diff --git a/CHANGELOG.md b/CHANGELOG.md index cc00fad2..00d916a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # @vladmandic/human -Version: **1.8.3** +Version: **1.8.4** Description: **Human: AI-powered 3D Face Detection & Rotation Tracking, Face Description & Recognition, Body Pose Tracking, 3D Hand & Finger Tracking, Iris Analysis, Age & Gender & Emotion Prediction, Gesture Recognition** Author: **Vladimir Mandic ** @@ -9,11 +9,15 @@ Repository: **** ## Changelog +### **1.8.4** 2021/05/11 mandic00@live.com + + +### **origin/main** 2021/05/05 mandic00@live.com + + ### **1.8.3** 2021/05/05 mandic00@live.com - -### **origin/main** 2021/05/04 mandic00@live.com - +- switch posenet weights ### **1.8.2** 2021/05/04 mandic00@live.com diff --git a/assets/tfjs-backend-wasm-simd.wasm b/assets/tfjs-backend-wasm-simd.wasm deleted file mode 100644 index 9bbd4b44..00000000 Binary files a/assets/tfjs-backend-wasm-simd.wasm and /dev/null differ diff --git a/assets/tfjs-backend-wasm-threaded-simd.wasm b/assets/tfjs-backend-wasm-threaded-simd.wasm deleted file mode 100644 index d285ff50..00000000 Binary files a/assets/tfjs-backend-wasm-threaded-simd.wasm and /dev/null differ diff --git a/assets/tfjs-backend-wasm.wasm b/assets/tfjs-backend-wasm.wasm deleted file mode 100644 index 1f70a712..00000000 Binary files a/assets/tfjs-backend-wasm.wasm and /dev/null differ diff --git a/demo/helpers/three.js b/demo/helpers/three.js index acd8b5b9..48c1bd32 100644 --- a/demo/helpers/three.js +++ b/demo/helpers/three.js @@ -1,12006 +1,8 @@ -// threejs.org/license -const REVISION = '126'; -const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 }; -const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }; -const CullFaceNone = 0; -const CullFaceBack = 1; -const CullFaceFront = 2; -const CullFaceFrontBack = 3; -const BasicShadowMap = 0; -const PCFShadowMap = 1; -const PCFSoftShadowMap = 2; -const VSMShadowMap = 3; -const FrontSide = 0; -const BackSide = 1; -const DoubleSide = 2; -const FlatShading = 1; -const SmoothShading = 2; -const NoBlending = 0; -const NormalBlending = 1; -const AdditiveBlending = 2; -const SubtractiveBlending = 3; -const MultiplyBlending = 4; -const CustomBlending = 5; -const AddEquation = 100; -const SubtractEquation = 101; -const ReverseSubtractEquation = 102; -const MinEquation = 103; -const MaxEquation = 104; -const ZeroFactor = 200; -const OneFactor = 201; -const SrcColorFactor = 202; -const OneMinusSrcColorFactor = 203; -const SrcAlphaFactor = 204; -const OneMinusSrcAlphaFactor = 205; -const DstAlphaFactor = 206; -const OneMinusDstAlphaFactor = 207; -const DstColorFactor = 208; -const OneMinusDstColorFactor = 209; -const SrcAlphaSaturateFactor = 210; -const NeverDepth = 0; -const AlwaysDepth = 1; -const LessDepth = 2; -const LessEqualDepth = 3; -const EqualDepth = 4; -const GreaterEqualDepth = 5; -const GreaterDepth = 6; -const NotEqualDepth = 7; -const MultiplyOperation = 0; -const MixOperation = 1; -const AddOperation = 2; -const NoToneMapping = 0; -const LinearToneMapping = 1; -const ReinhardToneMapping = 2; -const CineonToneMapping = 3; -const ACESFilmicToneMapping = 4; -const CustomToneMapping = 5; - -const UVMapping = 300; -const CubeReflectionMapping = 301; -const CubeRefractionMapping = 302; -const EquirectangularReflectionMapping = 303; -const EquirectangularRefractionMapping = 304; -const CubeUVReflectionMapping = 306; -const CubeUVRefractionMapping = 307; -const RepeatWrapping = 1000; -const ClampToEdgeWrapping = 1001; -const MirroredRepeatWrapping = 1002; -const NearestFilter = 1003; -const NearestMipmapNearestFilter = 1004; -const NearestMipMapNearestFilter = 1004; -const NearestMipmapLinearFilter = 1005; -const NearestMipMapLinearFilter = 1005; -const LinearFilter = 1006; -const LinearMipmapNearestFilter = 1007; -const LinearMipMapNearestFilter = 1007; -const LinearMipmapLinearFilter = 1008; -const LinearMipMapLinearFilter = 1008; -const UnsignedByteType = 1009; -const ByteType = 1010; -const ShortType = 1011; -const UnsignedShortType = 1012; -const IntType = 1013; -const UnsignedIntType = 1014; -const FloatType = 1015; -const HalfFloatType = 1016; -const UnsignedShort4444Type = 1017; -const UnsignedShort5551Type = 1018; -const UnsignedShort565Type = 1019; -const UnsignedInt248Type = 1020; -const AlphaFormat = 1021; -const RGBFormat = 1022; -const RGBAFormat = 1023; -const LuminanceFormat = 1024; -const LuminanceAlphaFormat = 1025; -const RGBEFormat = RGBAFormat; -const DepthFormat = 1026; -const DepthStencilFormat = 1027; -const RedFormat = 1028; -const RedIntegerFormat = 1029; -const RGFormat = 1030; -const RGIntegerFormat = 1031; -const RGBIntegerFormat = 1032; -const RGBAIntegerFormat = 1033; - -const RGB_S3TC_DXT1_Format = 33776; -const RGBA_S3TC_DXT1_Format = 33777; -const RGBA_S3TC_DXT3_Format = 33778; -const RGBA_S3TC_DXT5_Format = 33779; -const RGB_PVRTC_4BPPV1_Format = 35840; -const RGB_PVRTC_2BPPV1_Format = 35841; -const RGBA_PVRTC_4BPPV1_Format = 35842; -const RGBA_PVRTC_2BPPV1_Format = 35843; -const RGB_ETC1_Format = 36196; -const RGB_ETC2_Format = 37492; -const RGBA_ETC2_EAC_Format = 37496; -const RGBA_ASTC_4x4_Format = 37808; -const RGBA_ASTC_5x4_Format = 37809; -const RGBA_ASTC_5x5_Format = 37810; -const RGBA_ASTC_6x5_Format = 37811; -const RGBA_ASTC_6x6_Format = 37812; -const RGBA_ASTC_8x5_Format = 37813; -const RGBA_ASTC_8x6_Format = 37814; -const RGBA_ASTC_8x8_Format = 37815; -const RGBA_ASTC_10x5_Format = 37816; -const RGBA_ASTC_10x6_Format = 37817; -const RGBA_ASTC_10x8_Format = 37818; -const RGBA_ASTC_10x10_Format = 37819; -const RGBA_ASTC_12x10_Format = 37820; -const RGBA_ASTC_12x12_Format = 37821; -const RGBA_BPTC_Format = 36492; -const SRGB8_ALPHA8_ASTC_4x4_Format = 37840; -const SRGB8_ALPHA8_ASTC_5x4_Format = 37841; -const SRGB8_ALPHA8_ASTC_5x5_Format = 37842; -const SRGB8_ALPHA8_ASTC_6x5_Format = 37843; -const SRGB8_ALPHA8_ASTC_6x6_Format = 37844; -const SRGB8_ALPHA8_ASTC_8x5_Format = 37845; -const SRGB8_ALPHA8_ASTC_8x6_Format = 37846; -const SRGB8_ALPHA8_ASTC_8x8_Format = 37847; -const SRGB8_ALPHA8_ASTC_10x5_Format = 37848; -const SRGB8_ALPHA8_ASTC_10x6_Format = 37849; -const SRGB8_ALPHA8_ASTC_10x8_Format = 37850; -const SRGB8_ALPHA8_ASTC_10x10_Format = 37851; -const SRGB8_ALPHA8_ASTC_12x10_Format = 37852; -const SRGB8_ALPHA8_ASTC_12x12_Format = 37853; -const LoopOnce = 2200; -const LoopRepeat = 2201; -const LoopPingPong = 2202; -const InterpolateDiscrete = 2300; -const InterpolateLinear = 2301; -const InterpolateSmooth = 2302; -const ZeroCurvatureEnding = 2400; -const ZeroSlopeEnding = 2401; -const WrapAroundEnding = 2402; -const NormalAnimationBlendMode = 2500; -const AdditiveAnimationBlendMode = 2501; -const TrianglesDrawMode = 0; -const TriangleStripDrawMode = 1; -const TriangleFanDrawMode = 2; -const LinearEncoding = 3000; -const sRGBEncoding = 3001; -const GammaEncoding = 3007; -const RGBEEncoding = 3002; -const LogLuvEncoding = 3003; -const RGBM7Encoding = 3004; -const RGBM16Encoding = 3005; -const RGBDEncoding = 3006; -const BasicDepthPacking = 3200; -const RGBADepthPacking = 3201; -const TangentSpaceNormalMap = 0; -const ObjectSpaceNormalMap = 1; - -const ZeroStencilOp = 0; -const KeepStencilOp = 7680; -const ReplaceStencilOp = 7681; -const IncrementStencilOp = 7682; -const DecrementStencilOp = 7683; -const IncrementWrapStencilOp = 34055; -const DecrementWrapStencilOp = 34056; -const InvertStencilOp = 5386; - -const NeverStencilFunc = 512; -const LessStencilFunc = 513; -const EqualStencilFunc = 514; -const LessEqualStencilFunc = 515; -const GreaterStencilFunc = 516; -const NotEqualStencilFunc = 517; -const GreaterEqualStencilFunc = 518; -const AlwaysStencilFunc = 519; - -const StaticDrawUsage = 35044; -const DynamicDrawUsage = 35048; -const StreamDrawUsage = 35040; -const StaticReadUsage = 35045; -const DynamicReadUsage = 35049; -const StreamReadUsage = 35041; -const StaticCopyUsage = 35046; -const DynamicCopyUsage = 35050; -const StreamCopyUsage = 35042; - -const GLSL1 = '100'; -const GLSL3 = '300 es'; - -/** - * https://github.com/mrdoob/eventdispatcher.js/ - */ - -function EventDispatcher() {} - -Object.assign( EventDispatcher.prototype, { - - addEventListener: function ( type, listener ) { - - if ( this._listeners === undefined ) this._listeners = {}; - - const listeners = this._listeners; - - if ( listeners[ type ] === undefined ) { - - listeners[ type ] = []; - - } - - if ( listeners[ type ].indexOf( listener ) === - 1 ) { - - listeners[ type ].push( listener ); - - } - - }, - - hasEventListener: function ( type, listener ) { - - if ( this._listeners === undefined ) return false; - - const listeners = this._listeners; - - return listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1; - - }, - - removeEventListener: function ( type, listener ) { - - if ( this._listeners === undefined ) return; - - const listeners = this._listeners; - const listenerArray = listeners[ type ]; - - if ( listenerArray !== undefined ) { - - const index = listenerArray.indexOf( listener ); - - if ( index !== - 1 ) { - - listenerArray.splice( index, 1 ); - - } - - } - - }, - - dispatchEvent: function ( event ) { - - if ( this._listeners === undefined ) return; - - const listeners = this._listeners; - const listenerArray = listeners[ event.type ]; - - if ( listenerArray !== undefined ) { - - event.target = this; - - // Make a copy, in case listeners are removed while iterating. - const array = listenerArray.slice( 0 ); - - for ( let i = 0, l = array.length; i < l; i ++ ) { - - array[ i ].call( this, event ); - - } - - } - - } - -} ); - -const _lut = []; - -for ( let i = 0; i < 256; i ++ ) { - - _lut[ i ] = ( i < 16 ? '0' : '' ) + ( i ).toString( 16 ); - -} - -let _seed = 1234567; - -const MathUtils = { - - DEG2RAD: Math.PI / 180, - RAD2DEG: 180 / Math.PI, - - generateUUID: function () { - - // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136 - - const d0 = Math.random() * 0xffffffff | 0; - const d1 = Math.random() * 0xffffffff | 0; - const d2 = Math.random() * 0xffffffff | 0; - const d3 = Math.random() * 0xffffffff | 0; - const uuid = _lut[ d0 & 0xff ] + _lut[ d0 >> 8 & 0xff ] + _lut[ d0 >> 16 & 0xff ] + _lut[ d0 >> 24 & 0xff ] + '-' + - _lut[ d1 & 0xff ] + _lut[ d1 >> 8 & 0xff ] + '-' + _lut[ d1 >> 16 & 0x0f | 0x40 ] + _lut[ d1 >> 24 & 0xff ] + '-' + - _lut[ d2 & 0x3f | 0x80 ] + _lut[ d2 >> 8 & 0xff ] + '-' + _lut[ d2 >> 16 & 0xff ] + _lut[ d2 >> 24 & 0xff ] + - _lut[ d3 & 0xff ] + _lut[ d3 >> 8 & 0xff ] + _lut[ d3 >> 16 & 0xff ] + _lut[ d3 >> 24 & 0xff ]; - - // .toUpperCase() here flattens concatenated strings to save heap memory space. - return uuid.toUpperCase(); - - }, - - clamp: function ( value, min, max ) { - - return Math.max( min, Math.min( max, value ) ); - - }, - - // compute euclidian modulo of m % n - // https://en.wikipedia.org/wiki/Modulo_operation - - euclideanModulo: function ( n, m ) { - - return ( ( n % m ) + m ) % m; - - }, - - // Linear mapping from range to range - - mapLinear: function ( x, a1, a2, b1, b2 ) { - - return b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 ); - - }, - - // https://en.wikipedia.org/wiki/Linear_interpolation - - lerp: function ( x, y, t ) { - - return ( 1 - t ) * x + t * y; - - }, - - // http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/ - - damp: function ( x, y, lambda, dt ) { - - return MathUtils.lerp( x, y, 1 - Math.exp( - lambda * dt ) ); - - }, - - // https://www.desmos.com/calculator/vcsjnyz7x4 - - pingpong: function ( x, length = 1 ) { - - return length - Math.abs( MathUtils.euclideanModulo( x, length * 2 ) - length ); - - }, - - // http://en.wikipedia.org/wiki/Smoothstep - - smoothstep: function ( x, min, max ) { - - if ( x <= min ) return 0; - if ( x >= max ) return 1; - - x = ( x - min ) / ( max - min ); - - return x * x * ( 3 - 2 * x ); - - }, - - smootherstep: function ( x, min, max ) { - - if ( x <= min ) return 0; - if ( x >= max ) return 1; - - x = ( x - min ) / ( max - min ); - - return x * x * x * ( x * ( x * 6 - 15 ) + 10 ); - - }, - - // Random integer from interval - - randInt: function ( low, high ) { - - return low + Math.floor( Math.random() * ( high - low + 1 ) ); - - }, - - // Random float from interval - - randFloat: function ( low, high ) { - - return low + Math.random() * ( high - low ); - - }, - - // Random float from <-range/2, range/2> interval - - randFloatSpread: function ( range ) { - - return range * ( 0.5 - Math.random() ); - - }, - - // Deterministic pseudo-random float in the interval [ 0, 1 ] - - seededRandom: function ( s ) { - - if ( s !== undefined ) _seed = s % 2147483647; - - // Park-Miller algorithm - - _seed = _seed * 16807 % 2147483647; - - return ( _seed - 1 ) / 2147483646; - - }, - - degToRad: function ( degrees ) { - - return degrees * MathUtils.DEG2RAD; - - }, - - radToDeg: function ( radians ) { - - return radians * MathUtils.RAD2DEG; - - }, - - isPowerOfTwo: function ( value ) { - - return ( value & ( value - 1 ) ) === 0 && value !== 0; - - }, - - ceilPowerOfTwo: function ( value ) { - - return Math.pow( 2, Math.ceil( Math.log( value ) / Math.LN2 ) ); - - }, - - floorPowerOfTwo: function ( value ) { - - return Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) ); - - }, - - setQuaternionFromProperEuler: function ( q, a, b, c, order ) { - - // Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles - - // rotations are applied to the axes in the order specified by 'order' - // rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c' - // angles are in radians - - const cos = Math.cos; - const sin = Math.sin; - - const c2 = cos( b / 2 ); - const s2 = sin( b / 2 ); - - const c13 = cos( ( a + c ) / 2 ); - const s13 = sin( ( a + c ) / 2 ); - - const c1_3 = cos( ( a - c ) / 2 ); - const s1_3 = sin( ( a - c ) / 2 ); - - const c3_1 = cos( ( c - a ) / 2 ); - const s3_1 = sin( ( c - a ) / 2 ); - - switch ( order ) { - - case 'XYX': - q.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 ); - break; - - case 'YZY': - q.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 ); - break; - - case 'ZXZ': - q.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 ); - break; - - case 'XZX': - q.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 ); - break; - - case 'YXY': - q.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 ); - break; - - case 'ZYZ': - q.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 ); - break; - - default: - console.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order ); - - } - - } - -}; - -class Vector2 { - - constructor( x = 0, y = 0 ) { - - this.x = x; - this.y = y; - - } - - get width() { - - return this.x; - - } - - set width( value ) { - - this.x = value; - - } - - get height() { - - return this.y; - - } - - set height( value ) { - - this.y = value; - - } - - set( x, y ) { - - this.x = x; - this.y = y; - - return this; - - } - - setScalar( scalar ) { - - this.x = scalar; - this.y = scalar; - - return this; - - } - - setX( x ) { - - this.x = x; - - return this; - - } - - setY( y ) { - - this.y = y; - - return this; - - } - - setComponent( index, value ) { - - switch ( index ) { - - case 0: this.x = value; break; - case 1: this.y = value; break; - default: throw new Error( 'index is out of range: ' + index ); - - } - - return this; - - } - - getComponent( index ) { - - switch ( index ) { - - case 0: return this.x; - case 1: return this.y; - default: throw new Error( 'index is out of range: ' + index ); - - } - - } - - clone() { - - return new this.constructor( this.x, this.y ); - - } - - copy( v ) { - - this.x = v.x; - this.y = v.y; - - return this; - - } - - add( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' ); - return this.addVectors( v, w ); - - } - - this.x += v.x; - this.y += v.y; - - return this; - - } - - addScalar( s ) { - - this.x += s; - this.y += s; - - return this; - - } - - addVectors( a, b ) { - - this.x = a.x + b.x; - this.y = a.y + b.y; - - return this; - - } - - addScaledVector( v, s ) { - - this.x += v.x * s; - this.y += v.y * s; - - return this; - - } - - sub( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' ); - return this.subVectors( v, w ); - - } - - this.x -= v.x; - this.y -= v.y; - - return this; - - } - - subScalar( s ) { - - this.x -= s; - this.y -= s; - - return this; - - } - - subVectors( a, b ) { - - this.x = a.x - b.x; - this.y = a.y - b.y; - - return this; - - } - - multiply( v ) { - - this.x *= v.x; - this.y *= v.y; - - return this; - - } - - multiplyScalar( scalar ) { - - this.x *= scalar; - this.y *= scalar; - - return this; - - } - - divide( v ) { - - this.x /= v.x; - this.y /= v.y; - - return this; - - } - - divideScalar( scalar ) { - - return this.multiplyScalar( 1 / scalar ); - - } - - applyMatrix3( m ) { - - const x = this.x, y = this.y; - const e = m.elements; - - this.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ]; - this.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ]; - - return this; - - } - - min( v ) { - - this.x = Math.min( this.x, v.x ); - this.y = Math.min( this.y, v.y ); - - return this; - - } - - max( v ) { - - this.x = Math.max( this.x, v.x ); - this.y = Math.max( this.y, v.y ); - - return this; - - } - - clamp( min, max ) { - - // assumes min < max, componentwise - - this.x = Math.max( min.x, Math.min( max.x, this.x ) ); - this.y = Math.max( min.y, Math.min( max.y, this.y ) ); - - return this; - - } - - clampScalar( minVal, maxVal ) { - - this.x = Math.max( minVal, Math.min( maxVal, this.x ) ); - this.y = Math.max( minVal, Math.min( maxVal, this.y ) ); - - return this; - - } - - clampLength( min, max ) { - - const length = this.length(); - - return this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) ); - - } - - floor() { - - this.x = Math.floor( this.x ); - this.y = Math.floor( this.y ); - - return this; - - } - - ceil() { - - this.x = Math.ceil( this.x ); - this.y = Math.ceil( this.y ); - - return this; - - } - - round() { - - this.x = Math.round( this.x ); - this.y = Math.round( this.y ); - - return this; - - } - - roundToZero() { - - this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x ); - this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y ); - - return this; - - } - - negate() { - - this.x = - this.x; - this.y = - this.y; - - return this; - - } - - dot( v ) { - - return this.x * v.x + this.y * v.y; - - } - - cross( v ) { - - return this.x * v.y - this.y * v.x; - - } - - lengthSq() { - - return this.x * this.x + this.y * this.y; - - } - - length() { - - return Math.sqrt( this.x * this.x + this.y * this.y ); - - } - - manhattanLength() { - - return Math.abs( this.x ) + Math.abs( this.y ); - - } - - normalize() { - - return this.divideScalar( this.length() || 1 ); - - } - - angle() { - - // computes the angle in radians with respect to the positive x-axis - - const angle = Math.atan2( - this.y, - this.x ) + Math.PI; - - return angle; - - } - - distanceTo( v ) { - - return Math.sqrt( this.distanceToSquared( v ) ); - - } - - distanceToSquared( v ) { - - const dx = this.x - v.x, dy = this.y - v.y; - return dx * dx + dy * dy; - - } - - manhattanDistanceTo( v ) { - - return Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ); - - } - - setLength( length ) { - - return this.normalize().multiplyScalar( length ); - - } - - lerp( v, alpha ) { - - this.x += ( v.x - this.x ) * alpha; - this.y += ( v.y - this.y ) * alpha; - - return this; - - } - - lerpVectors( v1, v2, alpha ) { - - this.x = v1.x + ( v2.x - v1.x ) * alpha; - this.y = v1.y + ( v2.y - v1.y ) * alpha; - - return this; - - } - - equals( v ) { - - return ( ( v.x === this.x ) && ( v.y === this.y ) ); - - } - - fromArray( array, offset = 0 ) { - - this.x = array[ offset ]; - this.y = array[ offset + 1 ]; - - return this; - - } - - toArray( array = [], offset = 0 ) { - - array[ offset ] = this.x; - array[ offset + 1 ] = this.y; - - return array; - - } - - fromBufferAttribute( attribute, index, offset ) { - - if ( offset !== undefined ) { - - console.warn( 'THREE.Vector2: offset has been removed from .fromBufferAttribute().' ); - - } - - this.x = attribute.getX( index ); - this.y = attribute.getY( index ); - - return this; - - } - - rotateAround( center, angle ) { - - const c = Math.cos( angle ), s = Math.sin( angle ); - - const x = this.x - center.x; - const y = this.y - center.y; - - this.x = x * c - y * s + center.x; - this.y = x * s + y * c + center.y; - - return this; - - } - - random() { - - this.x = Math.random(); - this.y = Math.random(); - - return this; - - } - -} - -Vector2.prototype.isVector2 = true; - -class Matrix3 { - - constructor() { - - this.elements = [ - - 1, 0, 0, - 0, 1, 0, - 0, 0, 1 - - ]; - - if ( arguments.length > 0 ) { - - console.error( 'THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.' ); - - } - - } - - set( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) { - - const te = this.elements; - - te[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31; - te[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32; - te[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33; - - return this; - - } - - identity() { - - this.set( - - 1, 0, 0, - 0, 1, 0, - 0, 0, 1 - - ); - - return this; - - } - - copy( m ) { - - const te = this.elements; - const me = m.elements; - - te[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; - te[ 3 ] = me[ 3 ]; te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; - te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ]; te[ 8 ] = me[ 8 ]; - - return this; - - } - - extractBasis( xAxis, yAxis, zAxis ) { - - xAxis.setFromMatrix3Column( this, 0 ); - yAxis.setFromMatrix3Column( this, 1 ); - zAxis.setFromMatrix3Column( this, 2 ); - - return this; - - } - - setFromMatrix4( m ) { - - const me = m.elements; - - this.set( - - me[ 0 ], me[ 4 ], me[ 8 ], - me[ 1 ], me[ 5 ], me[ 9 ], - me[ 2 ], me[ 6 ], me[ 10 ] - - ); - - return this; - - } - - multiply( m ) { - - return this.multiplyMatrices( this, m ); - - } - - premultiply( m ) { - - return this.multiplyMatrices( m, this ); - - } - - multiplyMatrices( a, b ) { - - const ae = a.elements; - const be = b.elements; - const te = this.elements; - - const a11 = ae[ 0 ], a12 = ae[ 3 ], a13 = ae[ 6 ]; - const a21 = ae[ 1 ], a22 = ae[ 4 ], a23 = ae[ 7 ]; - const a31 = ae[ 2 ], a32 = ae[ 5 ], a33 = ae[ 8 ]; - - const b11 = be[ 0 ], b12 = be[ 3 ], b13 = be[ 6 ]; - const b21 = be[ 1 ], b22 = be[ 4 ], b23 = be[ 7 ]; - const b31 = be[ 2 ], b32 = be[ 5 ], b33 = be[ 8 ]; - - te[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31; - te[ 3 ] = a11 * b12 + a12 * b22 + a13 * b32; - te[ 6 ] = a11 * b13 + a12 * b23 + a13 * b33; - - te[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31; - te[ 4 ] = a21 * b12 + a22 * b22 + a23 * b32; - te[ 7 ] = a21 * b13 + a22 * b23 + a23 * b33; - - te[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31; - te[ 5 ] = a31 * b12 + a32 * b22 + a33 * b32; - te[ 8 ] = a31 * b13 + a32 * b23 + a33 * b33; - - return this; - - } - - multiplyScalar( s ) { - - const te = this.elements; - - te[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s; - te[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s; - te[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s; - - return this; - - } - - determinant() { - - const te = this.elements; - - const a = te[ 0 ], b = te[ 1 ], c = te[ 2 ], - d = te[ 3 ], e = te[ 4 ], f = te[ 5 ], - g = te[ 6 ], h = te[ 7 ], i = te[ 8 ]; - - return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g; - - } - - invert() { - - const te = this.elements, - - n11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], - n12 = te[ 3 ], n22 = te[ 4 ], n32 = te[ 5 ], - n13 = te[ 6 ], n23 = te[ 7 ], n33 = te[ 8 ], - - t11 = n33 * n22 - n32 * n23, - t12 = n32 * n13 - n33 * n12, - t13 = n23 * n12 - n22 * n13, - - det = n11 * t11 + n21 * t12 + n31 * t13; - - if ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 ); - - const detInv = 1 / det; - - te[ 0 ] = t11 * detInv; - te[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv; - te[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv; - - te[ 3 ] = t12 * detInv; - te[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv; - te[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv; - - te[ 6 ] = t13 * detInv; - te[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv; - te[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv; - - return this; - - } - - transpose() { - - let tmp; - const m = this.elements; - - tmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp; - tmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp; - tmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp; - - return this; - - } - - getNormalMatrix( matrix4 ) { - - return this.setFromMatrix4( matrix4 ).invert().transpose(); - - } - - transposeIntoArray( r ) { - - const m = this.elements; - - r[ 0 ] = m[ 0 ]; - r[ 1 ] = m[ 3 ]; - r[ 2 ] = m[ 6 ]; - r[ 3 ] = m[ 1 ]; - r[ 4 ] = m[ 4 ]; - r[ 5 ] = m[ 7 ]; - r[ 6 ] = m[ 2 ]; - r[ 7 ] = m[ 5 ]; - r[ 8 ] = m[ 8 ]; - - return this; - - } - - setUvTransform( tx, ty, sx, sy, rotation, cx, cy ) { - - const c = Math.cos( rotation ); - const s = Math.sin( rotation ); - - this.set( - sx * c, sx * s, - sx * ( c * cx + s * cy ) + cx + tx, - - sy * s, sy * c, - sy * ( - s * cx + c * cy ) + cy + ty, - 0, 0, 1 - ); - - return this; - - } - - scale( sx, sy ) { - - const te = this.elements; - - te[ 0 ] *= sx; te[ 3 ] *= sx; te[ 6 ] *= sx; - te[ 1 ] *= sy; te[ 4 ] *= sy; te[ 7 ] *= sy; - - return this; - - } - - rotate( theta ) { - - const c = Math.cos( theta ); - const s = Math.sin( theta ); - - const te = this.elements; - - const a11 = te[ 0 ], a12 = te[ 3 ], a13 = te[ 6 ]; - const a21 = te[ 1 ], a22 = te[ 4 ], a23 = te[ 7 ]; - - te[ 0 ] = c * a11 + s * a21; - te[ 3 ] = c * a12 + s * a22; - te[ 6 ] = c * a13 + s * a23; - - te[ 1 ] = - s * a11 + c * a21; - te[ 4 ] = - s * a12 + c * a22; - te[ 7 ] = - s * a13 + c * a23; - - return this; - - } - - translate( tx, ty ) { - - const te = this.elements; - - te[ 0 ] += tx * te[ 2 ]; te[ 3 ] += tx * te[ 5 ]; te[ 6 ] += tx * te[ 8 ]; - te[ 1 ] += ty * te[ 2 ]; te[ 4 ] += ty * te[ 5 ]; te[ 7 ] += ty * te[ 8 ]; - - return this; - - } - - equals( matrix ) { - - const te = this.elements; - const me = matrix.elements; - - for ( let i = 0; i < 9; i ++ ) { - - if ( te[ i ] !== me[ i ] ) return false; - - } - - return true; - - } - - fromArray( array, offset = 0 ) { - - for ( let i = 0; i < 9; i ++ ) { - - this.elements[ i ] = array[ i + offset ]; - - } - - return this; - - } - - toArray( array = [], offset = 0 ) { - - const te = this.elements; - - array[ offset ] = te[ 0 ]; - array[ offset + 1 ] = te[ 1 ]; - array[ offset + 2 ] = te[ 2 ]; - - array[ offset + 3 ] = te[ 3 ]; - array[ offset + 4 ] = te[ 4 ]; - array[ offset + 5 ] = te[ 5 ]; - - array[ offset + 6 ] = te[ 6 ]; - array[ offset + 7 ] = te[ 7 ]; - array[ offset + 8 ] = te[ 8 ]; - - return array; - - } - - clone() { - - return new this.constructor().fromArray( this.elements ); - - } - -} - -Matrix3.prototype.isMatrix3 = true; - -let _canvas; - -const ImageUtils = { - - getDataURL: function ( image ) { - - if ( /^data:/i.test( image.src ) ) { - - return image.src; - - } - - if ( typeof HTMLCanvasElement == 'undefined' ) { - - return image.src; - - } - - let canvas; - - if ( image instanceof HTMLCanvasElement ) { - - canvas = image; - - } else { - - if ( _canvas === undefined ) _canvas = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ); - - _canvas.width = image.width; - _canvas.height = image.height; - - const context = _canvas.getContext( '2d' ); - - if ( image instanceof ImageData ) { - - context.putImageData( image, 0, 0 ); - - } else { - - context.drawImage( image, 0, 0, image.width, image.height ); - - } - - canvas = _canvas; - - } - - if ( canvas.width > 2048 || canvas.height > 2048 ) { - - return canvas.toDataURL( 'image/jpeg', 0.6 ); - - } else { - - return canvas.toDataURL( 'image/png' ); - - } - - } - -}; - -let textureId = 0; - -class Texture extends EventDispatcher { - - constructor( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = 1, encoding = LinearEncoding ) { - - super(); - - Object.defineProperty( this, 'id', { value: textureId ++ } ); - - this.uuid = MathUtils.generateUUID(); - - this.name = ''; - - this.image = image; - this.mipmaps = []; - - this.mapping = mapping; - - this.wrapS = wrapS; - this.wrapT = wrapT; - - this.magFilter = magFilter; - this.minFilter = minFilter; - - this.anisotropy = anisotropy; - - this.format = format; - this.internalFormat = null; - this.type = type; - - this.offset = new Vector2( 0, 0 ); - this.repeat = new Vector2( 1, 1 ); - this.center = new Vector2( 0, 0 ); - this.rotation = 0; - - this.matrixAutoUpdate = true; - this.matrix = new Matrix3(); - - this.generateMipmaps = true; - this.premultiplyAlpha = false; - this.flipY = true; - this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml) - - // Values of encoding !== THREE.LinearEncoding only supported on map, envMap and emissiveMap. - // - // Also changing the encoding after already used by a Material will not automatically make the Material - // update. You need to explicitly call Material.needsUpdate to trigger it to recompile. - this.encoding = encoding; - - this.version = 0; - this.onUpdate = null; - - } - - updateMatrix() { - - this.matrix.setUvTransform( this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y ); - - } - - clone() { - - return new this.constructor().copy( this ); - - } - - copy( source ) { - - this.name = source.name; - - this.image = source.image; - this.mipmaps = source.mipmaps.slice( 0 ); - - this.mapping = source.mapping; - - this.wrapS = source.wrapS; - this.wrapT = source.wrapT; - - this.magFilter = source.magFilter; - this.minFilter = source.minFilter; - - this.anisotropy = source.anisotropy; - - this.format = source.format; - this.internalFormat = source.internalFormat; - this.type = source.type; - - this.offset.copy( source.offset ); - this.repeat.copy( source.repeat ); - this.center.copy( source.center ); - this.rotation = source.rotation; - - this.matrixAutoUpdate = source.matrixAutoUpdate; - this.matrix.copy( source.matrix ); - - this.generateMipmaps = source.generateMipmaps; - this.premultiplyAlpha = source.premultiplyAlpha; - this.flipY = source.flipY; - this.unpackAlignment = source.unpackAlignment; - this.encoding = source.encoding; - - return this; - - } - - toJSON( meta ) { - - const isRootObject = ( meta === undefined || typeof meta === 'string' ); - - if ( ! isRootObject && meta.textures[ this.uuid ] !== undefined ) { - - return meta.textures[ this.uuid ]; - - } - - const output = { - - metadata: { - version: 4.5, - type: 'Texture', - generator: 'Texture.toJSON' - }, - - uuid: this.uuid, - name: this.name, - - mapping: this.mapping, - - repeat: [ this.repeat.x, this.repeat.y ], - offset: [ this.offset.x, this.offset.y ], - center: [ this.center.x, this.center.y ], - rotation: this.rotation, - - wrap: [ this.wrapS, this.wrapT ], - - format: this.format, - type: this.type, - encoding: this.encoding, - - minFilter: this.minFilter, - magFilter: this.magFilter, - anisotropy: this.anisotropy, - - flipY: this.flipY, - - premultiplyAlpha: this.premultiplyAlpha, - unpackAlignment: this.unpackAlignment - - }; - - if ( this.image !== undefined ) { - - // TODO: Move to THREE.Image - - const image = this.image; - - if ( image.uuid === undefined ) { - - image.uuid = MathUtils.generateUUID(); // UGH - - } - - if ( ! isRootObject && meta.images[ image.uuid ] === undefined ) { - - let url; - - if ( Array.isArray( image ) ) { - - // process array of images e.g. CubeTexture - - url = []; - - for ( let i = 0, l = image.length; i < l; i ++ ) { - - // check cube texture with data textures - - if ( image[ i ].isDataTexture ) { - - url.push( serializeImage( image[ i ].image ) ); - - } else { - - url.push( serializeImage( image[ i ] ) ); - - } - - } - - } else { - - // process single image - - url = serializeImage( image ); - - } - - meta.images[ image.uuid ] = { - uuid: image.uuid, - url: url - }; - - } - - output.image = image.uuid; - - } - - if ( ! isRootObject ) { - - meta.textures[ this.uuid ] = output; - - } - - return output; - - } - - dispose() { - - this.dispatchEvent( { type: 'dispose' } ); - - } - - transformUv( uv ) { - - if ( this.mapping !== UVMapping ) return uv; - - uv.applyMatrix3( this.matrix ); - - if ( uv.x < 0 || uv.x > 1 ) { - - switch ( this.wrapS ) { - - case RepeatWrapping: - - uv.x = uv.x - Math.floor( uv.x ); - break; - - case ClampToEdgeWrapping: - - uv.x = uv.x < 0 ? 0 : 1; - break; - - case MirroredRepeatWrapping: - - if ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) { - - uv.x = Math.ceil( uv.x ) - uv.x; - - } else { - - uv.x = uv.x - Math.floor( uv.x ); - - } - - break; - - } - - } - - if ( uv.y < 0 || uv.y > 1 ) { - - switch ( this.wrapT ) { - - case RepeatWrapping: - - uv.y = uv.y - Math.floor( uv.y ); - break; - - case ClampToEdgeWrapping: - - uv.y = uv.y < 0 ? 0 : 1; - break; - - case MirroredRepeatWrapping: - - if ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) { - - uv.y = Math.ceil( uv.y ) - uv.y; - - } else { - - uv.y = uv.y - Math.floor( uv.y ); - - } - - break; - - } - - } - - if ( this.flipY ) { - - uv.y = 1 - uv.y; - - } - - return uv; - - } - - set needsUpdate( value ) { - - if ( value === true ) this.version ++; - - } - -} - -Texture.DEFAULT_IMAGE = undefined; -Texture.DEFAULT_MAPPING = UVMapping; - -Texture.prototype.isTexture = true; - -function serializeImage( image ) { - - if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) || - ( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) || - ( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) { - - // default images - - return ImageUtils.getDataURL( image ); - - } else { - - if ( image.data ) { - - // images of DataTexture - - return { - data: Array.prototype.slice.call( image.data ), - width: image.width, - height: image.height, - type: image.data.constructor.name - }; - - } else { - - console.warn( 'THREE.Texture: Unable to serialize Texture.' ); - return {}; - - } - - } - -} - -class Vector4 { - - constructor( x = 0, y = 0, z = 0, w = 1 ) { - - this.x = x; - this.y = y; - this.z = z; - this.w = w; - - } - - get width() { - - return this.z; - - } - - set width( value ) { - - this.z = value; - - } - - get height() { - - return this.w; - - } - - set height( value ) { - - this.w = value; - - } - - set( x, y, z, w ) { - - this.x = x; - this.y = y; - this.z = z; - this.w = w; - - return this; - - } - - setScalar( scalar ) { - - this.x = scalar; - this.y = scalar; - this.z = scalar; - this.w = scalar; - - return this; - - } - - setX( x ) { - - this.x = x; - - return this; - - } - - setY( y ) { - - this.y = y; - - return this; - - } - - setZ( z ) { - - this.z = z; - - return this; - - } - - setW( w ) { - - this.w = w; - - return this; - - } - - setComponent( index, value ) { - - switch ( index ) { - - case 0: this.x = value; break; - case 1: this.y = value; break; - case 2: this.z = value; break; - case 3: this.w = value; break; - default: throw new Error( 'index is out of range: ' + index ); - - } - - return this; - - } - - getComponent( index ) { - - switch ( index ) { - - case 0: return this.x; - case 1: return this.y; - case 2: return this.z; - case 3: return this.w; - default: throw new Error( 'index is out of range: ' + index ); - - } - - } - - clone() { - - return new this.constructor( this.x, this.y, this.z, this.w ); - - } - - copy( v ) { - - this.x = v.x; - this.y = v.y; - this.z = v.z; - this.w = ( v.w !== undefined ) ? v.w : 1; - - return this; - - } - - add( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' ); - return this.addVectors( v, w ); - - } - - this.x += v.x; - this.y += v.y; - this.z += v.z; - this.w += v.w; - - return this; - - } - - addScalar( s ) { - - this.x += s; - this.y += s; - this.z += s; - this.w += s; - - return this; - - } - - addVectors( a, b ) { - - this.x = a.x + b.x; - this.y = a.y + b.y; - this.z = a.z + b.z; - this.w = a.w + b.w; - - return this; - - } - - addScaledVector( v, s ) { - - this.x += v.x * s; - this.y += v.y * s; - this.z += v.z * s; - this.w += v.w * s; - - return this; - - } - - sub( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' ); - return this.subVectors( v, w ); - - } - - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - this.w -= v.w; - - return this; - - } - - subScalar( s ) { - - this.x -= s; - this.y -= s; - this.z -= s; - this.w -= s; - - return this; - - } - - subVectors( a, b ) { - - this.x = a.x - b.x; - this.y = a.y - b.y; - this.z = a.z - b.z; - this.w = a.w - b.w; - - return this; - - } - - multiply( v ) { - - this.x *= v.x; - this.y *= v.y; - this.z *= v.z; - this.w *= v.w; - - return this; - - } - - multiplyScalar( scalar ) { - - this.x *= scalar; - this.y *= scalar; - this.z *= scalar; - this.w *= scalar; - - return this; - - } - - applyMatrix4( m ) { - - const x = this.x, y = this.y, z = this.z, w = this.w; - const e = m.elements; - - this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w; - this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w; - this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w; - this.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w; - - return this; - - } - - divideScalar( scalar ) { - - return this.multiplyScalar( 1 / scalar ); - - } - - setAxisAngleFromQuaternion( q ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm - - // q is assumed to be normalized - - this.w = 2 * Math.acos( q.w ); - - const s = Math.sqrt( 1 - q.w * q.w ); - - if ( s < 0.0001 ) { - - this.x = 1; - this.y = 0; - this.z = 0; - - } else { - - this.x = q.x / s; - this.y = q.y / s; - this.z = q.z / s; - - } - - return this; - - } - - setAxisAngleFromRotationMatrix( m ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - let angle, x, y, z; // variables for result - const epsilon = 0.01, // margin to allow for rounding errors - epsilon2 = 0.1, // margin to distinguish between 0 and 180 degrees - - te = m.elements, - - m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ], - m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ], - m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ]; - - if ( ( Math.abs( m12 - m21 ) < epsilon ) && - ( Math.abs( m13 - m31 ) < epsilon ) && - ( Math.abs( m23 - m32 ) < epsilon ) ) { - - // singularity found - // first check for identity matrix which must have +1 for all terms - // in leading diagonal and zero in other terms - - if ( ( Math.abs( m12 + m21 ) < epsilon2 ) && - ( Math.abs( m13 + m31 ) < epsilon2 ) && - ( Math.abs( m23 + m32 ) < epsilon2 ) && - ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) { - - // this singularity is identity matrix so angle = 0 - - this.set( 1, 0, 0, 0 ); - - return this; // zero angle, arbitrary axis - - } - - // otherwise this singularity is angle = 180 - - angle = Math.PI; - - const xx = ( m11 + 1 ) / 2; - const yy = ( m22 + 1 ) / 2; - const zz = ( m33 + 1 ) / 2; - const xy = ( m12 + m21 ) / 4; - const xz = ( m13 + m31 ) / 4; - const yz = ( m23 + m32 ) / 4; - - if ( ( xx > yy ) && ( xx > zz ) ) { - - // m11 is the largest diagonal term - - if ( xx < epsilon ) { - - x = 0; - y = 0.707106781; - z = 0.707106781; - - } else { - - x = Math.sqrt( xx ); - y = xy / x; - z = xz / x; - - } - - } else if ( yy > zz ) { - - // m22 is the largest diagonal term - - if ( yy < epsilon ) { - - x = 0.707106781; - y = 0; - z = 0.707106781; - - } else { - - y = Math.sqrt( yy ); - x = xy / y; - z = yz / y; - - } - - } else { - - // m33 is the largest diagonal term so base result on this - - if ( zz < epsilon ) { - - x = 0.707106781; - y = 0.707106781; - z = 0; - - } else { - - z = Math.sqrt( zz ); - x = xz / z; - y = yz / z; - - } - - } - - this.set( x, y, z, angle ); - - return this; // return 180 deg rotation - - } - - // as we have reached here there are no singularities so we can handle normally - - let s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) + - ( m13 - m31 ) * ( m13 - m31 ) + - ( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize - - if ( Math.abs( s ) < 0.001 ) s = 1; - - // prevent divide by zero, should not happen if matrix is orthogonal and should be - // caught by singularity test above, but I've left it in just in case - - this.x = ( m32 - m23 ) / s; - this.y = ( m13 - m31 ) / s; - this.z = ( m21 - m12 ) / s; - this.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 ); - - return this; - - } - - min( v ) { - - this.x = Math.min( this.x, v.x ); - this.y = Math.min( this.y, v.y ); - this.z = Math.min( this.z, v.z ); - this.w = Math.min( this.w, v.w ); - - return this; - - } - - max( v ) { - - this.x = Math.max( this.x, v.x ); - this.y = Math.max( this.y, v.y ); - this.z = Math.max( this.z, v.z ); - this.w = Math.max( this.w, v.w ); - - return this; - - } - - clamp( min, max ) { - - // assumes min < max, componentwise - - this.x = Math.max( min.x, Math.min( max.x, this.x ) ); - this.y = Math.max( min.y, Math.min( max.y, this.y ) ); - this.z = Math.max( min.z, Math.min( max.z, this.z ) ); - this.w = Math.max( min.w, Math.min( max.w, this.w ) ); - - return this; - - } - - clampScalar( minVal, maxVal ) { - - this.x = Math.max( minVal, Math.min( maxVal, this.x ) ); - this.y = Math.max( minVal, Math.min( maxVal, this.y ) ); - this.z = Math.max( minVal, Math.min( maxVal, this.z ) ); - this.w = Math.max( minVal, Math.min( maxVal, this.w ) ); - - return this; - - } - - clampLength( min, max ) { - - const length = this.length(); - - return this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) ); - - } - - floor() { - - this.x = Math.floor( this.x ); - this.y = Math.floor( this.y ); - this.z = Math.floor( this.z ); - this.w = Math.floor( this.w ); - - return this; - - } - - ceil() { - - this.x = Math.ceil( this.x ); - this.y = Math.ceil( this.y ); - this.z = Math.ceil( this.z ); - this.w = Math.ceil( this.w ); - - return this; - - } - - round() { - - this.x = Math.round( this.x ); - this.y = Math.round( this.y ); - this.z = Math.round( this.z ); - this.w = Math.round( this.w ); - - return this; - - } - - roundToZero() { - - this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x ); - this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y ); - this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z ); - this.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w ); - - return this; - - } - - negate() { - - this.x = - this.x; - this.y = - this.y; - this.z = - this.z; - this.w = - this.w; - - return this; - - } - - dot( v ) { - - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - - } - - lengthSq() { - - return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; - - } - - length() { - - return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w ); - - } - - manhattanLength() { - - return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w ); - - } - - normalize() { - - return this.divideScalar( this.length() || 1 ); - - } - - setLength( length ) { - - return this.normalize().multiplyScalar( length ); - - } - - lerp( v, alpha ) { - - this.x += ( v.x - this.x ) * alpha; - this.y += ( v.y - this.y ) * alpha; - this.z += ( v.z - this.z ) * alpha; - this.w += ( v.w - this.w ) * alpha; - - return this; - - } - - lerpVectors( v1, v2, alpha ) { - - this.x = v1.x + ( v2.x - v1.x ) * alpha; - this.y = v1.y + ( v2.y - v1.y ) * alpha; - this.z = v1.z + ( v2.z - v1.z ) * alpha; - this.w = v1.w + ( v2.w - v1.w ) * alpha; - - return this; - - } - - equals( v ) { - - return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) ); - - } - - fromArray( array, offset = 0 ) { - - this.x = array[ offset ]; - this.y = array[ offset + 1 ]; - this.z = array[ offset + 2 ]; - this.w = array[ offset + 3 ]; - - return this; - - } - - toArray( array = [], offset = 0 ) { - - array[ offset ] = this.x; - array[ offset + 1 ] = this.y; - array[ offset + 2 ] = this.z; - array[ offset + 3 ] = this.w; - - return array; - - } - - fromBufferAttribute( attribute, index, offset ) { - - if ( offset !== undefined ) { - - console.warn( 'THREE.Vector4: offset has been removed from .fromBufferAttribute().' ); - - } - - this.x = attribute.getX( index ); - this.y = attribute.getY( index ); - this.z = attribute.getZ( index ); - this.w = attribute.getW( index ); - - return this; - - } - - random() { - - this.x = Math.random(); - this.y = Math.random(); - this.z = Math.random(); - this.w = Math.random(); - - return this; - - } - -} - -Vector4.prototype.isVector4 = true; - -/* - In options, we can specify: - * Texture parameters for an auto-generated target texture - * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers -*/ -class WebGLRenderTarget extends EventDispatcher { - - constructor( width, height, options ) { - - super(); - - this.width = width; - this.height = height; - this.depth = 1; - - this.scissor = new Vector4( 0, 0, width, height ); - this.scissorTest = false; - - this.viewport = new Vector4( 0, 0, width, height ); - - options = options || {}; - - this.texture = new Texture( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding ); - - this.texture.image = {}; - this.texture.image.width = width; - this.texture.image.height = height; - this.texture.image.depth = 1; - - this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false; - this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter; - - this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true; - this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false; - this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null; - - } - - setTexture( texture ) { - - texture.image = { - width: this.width, - height: this.height, - depth: this.depth - }; - - this.texture = texture; - - } - - setSize( width, height, depth = 1 ) { - - if ( this.width !== width || this.height !== height || this.depth !== depth ) { - - this.width = width; - this.height = height; - this.depth = depth; - - this.texture.image.width = width; - this.texture.image.height = height; - this.texture.image.depth = depth; - - this.dispose(); - - } - - this.viewport.set( 0, 0, width, height ); - this.scissor.set( 0, 0, width, height ); - - } - - clone() { - - return new this.constructor().copy( this ); - - } - - copy( source ) { - - this.width = source.width; - this.height = source.height; - this.depth = source.depth; - - this.viewport.copy( source.viewport ); - - this.texture = source.texture.clone(); - - this.depthBuffer = source.depthBuffer; - this.stencilBuffer = source.stencilBuffer; - this.depthTexture = source.depthTexture; - - return this; - - } - - dispose() { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -} - -WebGLRenderTarget.prototype.isWebGLRenderTarget = true; - -class WebGLMultisampleRenderTarget extends WebGLRenderTarget { - - constructor( width, height, options ) { - - super( width, height, options ); - - this.samples = 4; - - } - - copy( source ) { - - super.copy.call( this, source ); - - this.samples = source.samples; - - return this; - - } - -} - -WebGLMultisampleRenderTarget.prototype.isWebGLMultisampleRenderTarget = true; - -class Quaternion { - - constructor( x = 0, y = 0, z = 0, w = 1 ) { - - this._x = x; - this._y = y; - this._z = z; - this._w = w; - - } - - static slerp( qa, qb, qm, t ) { - - return qm.copy( qa ).slerp( qb, t ); - - } - - static slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) { - - // fuzz-free, array-based Quaternion SLERP operation - - let x0 = src0[ srcOffset0 + 0 ], - y0 = src0[ srcOffset0 + 1 ], - z0 = src0[ srcOffset0 + 2 ], - w0 = src0[ srcOffset0 + 3 ]; - - const x1 = src1[ srcOffset1 + 0 ], - y1 = src1[ srcOffset1 + 1 ], - z1 = src1[ srcOffset1 + 2 ], - w1 = src1[ srcOffset1 + 3 ]; - - if ( t === 0 ) { - - dst[ dstOffset + 0 ] = x0; - dst[ dstOffset + 1 ] = y0; - dst[ dstOffset + 2 ] = z0; - dst[ dstOffset + 3 ] = w0; - return; - - } - - if ( t === 1 ) { - - dst[ dstOffset + 0 ] = x1; - dst[ dstOffset + 1 ] = y1; - dst[ dstOffset + 2 ] = z1; - dst[ dstOffset + 3 ] = w1; - return; - - } - - if ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) { - - let s = 1 - t; - const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1, - dir = ( cos >= 0 ? 1 : - 1 ), - sqrSin = 1 - cos * cos; - - // Skip the Slerp for tiny steps to avoid numeric problems: - if ( sqrSin > Number.EPSILON ) { - - const sin = Math.sqrt( sqrSin ), - len = Math.atan2( sin, cos * dir ); - - s = Math.sin( s * len ) / sin; - t = Math.sin( t * len ) / sin; - - } - - const tDir = t * dir; - - x0 = x0 * s + x1 * tDir; - y0 = y0 * s + y1 * tDir; - z0 = z0 * s + z1 * tDir; - w0 = w0 * s + w1 * tDir; - - // Normalize in case we just did a lerp: - if ( s === 1 - t ) { - - const f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 ); - - x0 *= f; - y0 *= f; - z0 *= f; - w0 *= f; - - } - - } - - dst[ dstOffset ] = x0; - dst[ dstOffset + 1 ] = y0; - dst[ dstOffset + 2 ] = z0; - dst[ dstOffset + 3 ] = w0; - - } - - static multiplyQuaternionsFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1 ) { - - const x0 = src0[ srcOffset0 ]; - const y0 = src0[ srcOffset0 + 1 ]; - const z0 = src0[ srcOffset0 + 2 ]; - const w0 = src0[ srcOffset0 + 3 ]; - - const x1 = src1[ srcOffset1 ]; - const y1 = src1[ srcOffset1 + 1 ]; - const z1 = src1[ srcOffset1 + 2 ]; - const w1 = src1[ srcOffset1 + 3 ]; - - dst[ dstOffset ] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1; - dst[ dstOffset + 1 ] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1; - dst[ dstOffset + 2 ] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1; - dst[ dstOffset + 3 ] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1; - - return dst; - - } - - get x() { - - return this._x; - - } - - set x( value ) { - - this._x = value; - this._onChangeCallback(); - - } - - get y() { - - return this._y; - - } - - set y( value ) { - - this._y = value; - this._onChangeCallback(); - - } - - get z() { - - return this._z; - - } - - set z( value ) { - - this._z = value; - this._onChangeCallback(); - - } - - get w() { - - return this._w; - - } - - set w( value ) { - - this._w = value; - this._onChangeCallback(); - - } - - set( x, y, z, w ) { - - this._x = x; - this._y = y; - this._z = z; - this._w = w; - - this._onChangeCallback(); - - return this; - - } - - clone() { - - return new this.constructor( this._x, this._y, this._z, this._w ); - - } - - copy( quaternion ) { - - this._x = quaternion.x; - this._y = quaternion.y; - this._z = quaternion.z; - this._w = quaternion.w; - - this._onChangeCallback(); - - return this; - - } - - setFromEuler( euler, update ) { - - if ( ! ( euler && euler.isEuler ) ) { - - throw new Error( 'THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.' ); - - } - - const x = euler._x, y = euler._y, z = euler._z, order = euler._order; - - // http://www.mathworks.com/matlabcentral/fileexchange/ - // 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/ - // content/SpinCalc.m - - const cos = Math.cos; - const sin = Math.sin; - - const c1 = cos( x / 2 ); - const c2 = cos( y / 2 ); - const c3 = cos( z / 2 ); - - const s1 = sin( x / 2 ); - const s2 = sin( y / 2 ); - const s3 = sin( z / 2 ); - - switch ( order ) { - - case 'XYZ': - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - break; - - case 'YXZ': - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - break; - - case 'ZXY': - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - break; - - case 'ZYX': - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - break; - - case 'YZX': - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - break; - - case 'XZY': - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - break; - - default: - console.warn( 'THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order ); - - } - - if ( update !== false ) this._onChangeCallback(); - - return this; - - } - - setFromAxisAngle( axis, angle ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm - - // assumes axis is normalized - - const halfAngle = angle / 2, s = Math.sin( halfAngle ); - - this._x = axis.x * s; - this._y = axis.y * s; - this._z = axis.z * s; - this._w = Math.cos( halfAngle ); - - this._onChangeCallback(); - - return this; - - } - - setFromRotationMatrix( m ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - const te = m.elements, - - m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ], - m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ], - m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ], - - trace = m11 + m22 + m33; - - if ( trace > 0 ) { - - const s = 0.5 / Math.sqrt( trace + 1.0 ); - - this._w = 0.25 / s; - this._x = ( m32 - m23 ) * s; - this._y = ( m13 - m31 ) * s; - this._z = ( m21 - m12 ) * s; - - } else if ( m11 > m22 && m11 > m33 ) { - - const s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 ); - - this._w = ( m32 - m23 ) / s; - this._x = 0.25 * s; - this._y = ( m12 + m21 ) / s; - this._z = ( m13 + m31 ) / s; - - } else if ( m22 > m33 ) { - - const s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 ); - - this._w = ( m13 - m31 ) / s; - this._x = ( m12 + m21 ) / s; - this._y = 0.25 * s; - this._z = ( m23 + m32 ) / s; - - } else { - - const s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 ); - - this._w = ( m21 - m12 ) / s; - this._x = ( m13 + m31 ) / s; - this._y = ( m23 + m32 ) / s; - this._z = 0.25 * s; - - } - - this._onChangeCallback(); - - return this; - - } - - setFromUnitVectors( vFrom, vTo ) { - - // assumes direction vectors vFrom and vTo are normalized - - const EPS = 0.000001; - - let r = vFrom.dot( vTo ) + 1; - - if ( r < EPS ) { - - r = 0; - - if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) { - - this._x = - vFrom.y; - this._y = vFrom.x; - this._z = 0; - this._w = r; - - } else { - - this._x = 0; - this._y = - vFrom.z; - this._z = vFrom.y; - this._w = r; - - } - - } else { - - // crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3 - - this._x = vFrom.y * vTo.z - vFrom.z * vTo.y; - this._y = vFrom.z * vTo.x - vFrom.x * vTo.z; - this._z = vFrom.x * vTo.y - vFrom.y * vTo.x; - this._w = r; - - } - - return this.normalize(); - - } - - angleTo( q ) { - - return 2 * Math.acos( Math.abs( MathUtils.clamp( this.dot( q ), - 1, 1 ) ) ); - - } - - rotateTowards( q, step ) { - - const angle = this.angleTo( q ); - - if ( angle === 0 ) return this; - - const t = Math.min( 1, step / angle ); - - this.slerp( q, t ); - - return this; - - } - - identity() { - - return this.set( 0, 0, 0, 1 ); - - } - - invert() { - - // quaternion is assumed to have unit length - - return this.conjugate(); - - } - - conjugate() { - - this._x *= - 1; - this._y *= - 1; - this._z *= - 1; - - this._onChangeCallback(); - - return this; - - } - - dot( v ) { - - return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w; - - } - - lengthSq() { - - return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w; - - } - - length() { - - return Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w ); - - } - - normalize() { - - let l = this.length(); - - if ( l === 0 ) { - - this._x = 0; - this._y = 0; - this._z = 0; - this._w = 1; - - } else { - - l = 1 / l; - - this._x = this._x * l; - this._y = this._y * l; - this._z = this._z * l; - this._w = this._w * l; - - } - - this._onChangeCallback(); - - return this; - - } - - multiply( q, p ) { - - if ( p !== undefined ) { - - console.warn( 'THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.' ); - return this.multiplyQuaternions( q, p ); - - } - - return this.multiplyQuaternions( this, q ); - - } - - premultiply( q ) { - - return this.multiplyQuaternions( q, this ); - - } - - multiplyQuaternions( a, b ) { - - // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm - - const qax = a._x, qay = a._y, qaz = a._z, qaw = a._w; - const qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w; - - this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; - this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; - this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; - this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; - - this._onChangeCallback(); - - return this; - - } - - slerp( qb, t ) { - - if ( t === 0 ) return this; - if ( t === 1 ) return this.copy( qb ); - - const x = this._x, y = this._y, z = this._z, w = this._w; - - // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ - - let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z; - - if ( cosHalfTheta < 0 ) { - - this._w = - qb._w; - this._x = - qb._x; - this._y = - qb._y; - this._z = - qb._z; - - cosHalfTheta = - cosHalfTheta; - - } else { - - this.copy( qb ); - - } - - if ( cosHalfTheta >= 1.0 ) { - - this._w = w; - this._x = x; - this._y = y; - this._z = z; - - return this; - - } - - const sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta; - - if ( sqrSinHalfTheta <= Number.EPSILON ) { - - const s = 1 - t; - this._w = s * w + t * this._w; - this._x = s * x + t * this._x; - this._y = s * y + t * this._y; - this._z = s * z + t * this._z; - - this.normalize(); - this._onChangeCallback(); - - return this; - - } - - const sinHalfTheta = Math.sqrt( sqrSinHalfTheta ); - const halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta ); - const ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta, - ratioB = Math.sin( t * halfTheta ) / sinHalfTheta; - - this._w = ( w * ratioA + this._w * ratioB ); - this._x = ( x * ratioA + this._x * ratioB ); - this._y = ( y * ratioA + this._y * ratioB ); - this._z = ( z * ratioA + this._z * ratioB ); - - this._onChangeCallback(); - - return this; - - } - - equals( quaternion ) { - - return ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w ); - - } - - fromArray( array, offset = 0 ) { - - this._x = array[ offset ]; - this._y = array[ offset + 1 ]; - this._z = array[ offset + 2 ]; - this._w = array[ offset + 3 ]; - - this._onChangeCallback(); - - return this; - - } - - toArray( array = [], offset = 0 ) { - - array[ offset ] = this._x; - array[ offset + 1 ] = this._y; - array[ offset + 2 ] = this._z; - array[ offset + 3 ] = this._w; - - return array; - - } - - fromBufferAttribute( attribute, index ) { - - this._x = attribute.getX( index ); - this._y = attribute.getY( index ); - this._z = attribute.getZ( index ); - this._w = attribute.getW( index ); - - return this; - - } - - _onChange( callback ) { - - this._onChangeCallback = callback; - - return this; - - } - - _onChangeCallback() {} - -} - -Quaternion.prototype.isQuaternion = true; - -class Vector3 { - - constructor( x = 0, y = 0, z = 0 ) { - - this.x = x; - this.y = y; - this.z = z; - - } - - set( x, y, z ) { - - if ( z === undefined ) z = this.z; // sprite.scale.set(x,y) - - this.x = x; - this.y = y; - this.z = z; - - return this; - - } - - setScalar( scalar ) { - - this.x = scalar; - this.y = scalar; - this.z = scalar; - - return this; - - } - - setX( x ) { - - this.x = x; - - return this; - - } - - setY( y ) { - - this.y = y; - - return this; - - } - - setZ( z ) { - - this.z = z; - - return this; - - } - - setComponent( index, value ) { - - switch ( index ) { - - case 0: this.x = value; break; - case 1: this.y = value; break; - case 2: this.z = value; break; - default: throw new Error( 'index is out of range: ' + index ); - - } - - return this; - - } - - getComponent( index ) { - - switch ( index ) { - - case 0: return this.x; - case 1: return this.y; - case 2: return this.z; - default: throw new Error( 'index is out of range: ' + index ); - - } - - } - - clone() { - - return new this.constructor( this.x, this.y, this.z ); - - } - - copy( v ) { - - this.x = v.x; - this.y = v.y; - this.z = v.z; - - return this; - - } - - add( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' ); - return this.addVectors( v, w ); - - } - - this.x += v.x; - this.y += v.y; - this.z += v.z; - - return this; - - } - - addScalar( s ) { - - this.x += s; - this.y += s; - this.z += s; - - return this; - - } - - addVectors( a, b ) { - - this.x = a.x + b.x; - this.y = a.y + b.y; - this.z = a.z + b.z; - - return this; - - } - - addScaledVector( v, s ) { - - this.x += v.x * s; - this.y += v.y * s; - this.z += v.z * s; - - return this; - - } - - sub( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' ); - return this.subVectors( v, w ); - - } - - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - - return this; - - } - - subScalar( s ) { - - this.x -= s; - this.y -= s; - this.z -= s; - - return this; - - } - - subVectors( a, b ) { - - this.x = a.x - b.x; - this.y = a.y - b.y; - this.z = a.z - b.z; - - return this; - - } - - multiply( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.' ); - return this.multiplyVectors( v, w ); - - } - - this.x *= v.x; - this.y *= v.y; - this.z *= v.z; - - return this; - - } - - multiplyScalar( scalar ) { - - this.x *= scalar; - this.y *= scalar; - this.z *= scalar; - - return this; - - } - - multiplyVectors( a, b ) { - - this.x = a.x * b.x; - this.y = a.y * b.y; - this.z = a.z * b.z; - - return this; - - } - - applyEuler( euler ) { - - if ( ! ( euler && euler.isEuler ) ) { - - console.error( 'THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.' ); - - } - - return this.applyQuaternion( _quaternion.setFromEuler( euler ) ); - - } - - applyAxisAngle( axis, angle ) { - - return this.applyQuaternion( _quaternion.setFromAxisAngle( axis, angle ) ); - - } - - applyMatrix3( m ) { - - const x = this.x, y = this.y, z = this.z; - const e = m.elements; - - this.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z; - this.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z; - this.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z; - - return this; - - } - - applyNormalMatrix( m ) { - - return this.applyMatrix3( m ).normalize(); - - } - - applyMatrix4( m ) { - - const x = this.x, y = this.y, z = this.z; - const e = m.elements; - - const w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] ); - - this.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w; - this.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w; - this.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w; - - return this; - - } - - applyQuaternion( q ) { - - const x = this.x, y = this.y, z = this.z; - const qx = q.x, qy = q.y, qz = q.z, qw = q.w; - - // calculate quat * vector - - const ix = qw * x + qy * z - qz * y; - const iy = qw * y + qz * x - qx * z; - const iz = qw * z + qx * y - qy * x; - const iw = - qx * x - qy * y - qz * z; - - // calculate result * inverse quat - - this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy; - this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz; - this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx; - - return this; - - } - - project( camera ) { - - return this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix ); - - } - - unproject( camera ) { - - return this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld ); - - } - - transformDirection( m ) { - - // input: THREE.Matrix4 affine matrix - // vector interpreted as a direction - - const x = this.x, y = this.y, z = this.z; - const e = m.elements; - - this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z; - this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z; - this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z; - - return this.normalize(); - - } - - divide( v ) { - - this.x /= v.x; - this.y /= v.y; - this.z /= v.z; - - return this; - - } - - divideScalar( scalar ) { - - return this.multiplyScalar( 1 / scalar ); - - } - - min( v ) { - - this.x = Math.min( this.x, v.x ); - this.y = Math.min( this.y, v.y ); - this.z = Math.min( this.z, v.z ); - - return this; - - } - - max( v ) { - - this.x = Math.max( this.x, v.x ); - this.y = Math.max( this.y, v.y ); - this.z = Math.max( this.z, v.z ); - - return this; - - } - - clamp( min, max ) { - - // assumes min < max, componentwise - - this.x = Math.max( min.x, Math.min( max.x, this.x ) ); - this.y = Math.max( min.y, Math.min( max.y, this.y ) ); - this.z = Math.max( min.z, Math.min( max.z, this.z ) ); - - return this; - - } - - clampScalar( minVal, maxVal ) { - - this.x = Math.max( minVal, Math.min( maxVal, this.x ) ); - this.y = Math.max( minVal, Math.min( maxVal, this.y ) ); - this.z = Math.max( minVal, Math.min( maxVal, this.z ) ); - - return this; - - } - - clampLength( min, max ) { - - const length = this.length(); - - return this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) ); - - } - - floor() { - - this.x = Math.floor( this.x ); - this.y = Math.floor( this.y ); - this.z = Math.floor( this.z ); - - return this; - - } - - ceil() { - - this.x = Math.ceil( this.x ); - this.y = Math.ceil( this.y ); - this.z = Math.ceil( this.z ); - - return this; - - } - - round() { - - this.x = Math.round( this.x ); - this.y = Math.round( this.y ); - this.z = Math.round( this.z ); - - return this; - - } - - roundToZero() { - - this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x ); - this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y ); - this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z ); - - return this; - - } - - negate() { - - this.x = - this.x; - this.y = - this.y; - this.z = - this.z; - - return this; - - } - - dot( v ) { - - return this.x * v.x + this.y * v.y + this.z * v.z; - - } - - // TODO lengthSquared? - - lengthSq() { - - return this.x * this.x + this.y * this.y + this.z * this.z; - - } - - length() { - - return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z ); - - } - - manhattanLength() { - - return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ); - - } - - normalize() { - - return this.divideScalar( this.length() || 1 ); - - } - - setLength( length ) { - - return this.normalize().multiplyScalar( length ); - - } - - lerp( v, alpha ) { - - this.x += ( v.x - this.x ) * alpha; - this.y += ( v.y - this.y ) * alpha; - this.z += ( v.z - this.z ) * alpha; - - return this; - - } - - lerpVectors( v1, v2, alpha ) { - - this.x = v1.x + ( v2.x - v1.x ) * alpha; - this.y = v1.y + ( v2.y - v1.y ) * alpha; - this.z = v1.z + ( v2.z - v1.z ) * alpha; - - return this; - - } - - cross( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.' ); - return this.crossVectors( v, w ); - - } - - return this.crossVectors( this, v ); - - } - - crossVectors( a, b ) { - - const ax = a.x, ay = a.y, az = a.z; - const bx = b.x, by = b.y, bz = b.z; - - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - - return this; - - } - - projectOnVector( v ) { - - const denominator = v.lengthSq(); - - if ( denominator === 0 ) return this.set( 0, 0, 0 ); - - const scalar = v.dot( this ) / denominator; - - return this.copy( v ).multiplyScalar( scalar ); - - } - - projectOnPlane( planeNormal ) { - - _vector.copy( this ).projectOnVector( planeNormal ); - - return this.sub( _vector ); - - } - - reflect( normal ) { - - // reflect incident vector off plane orthogonal to normal - // normal is assumed to have unit length - - return this.sub( _vector.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) ); - - } - - angleTo( v ) { - - const denominator = Math.sqrt( this.lengthSq() * v.lengthSq() ); - - if ( denominator === 0 ) return Math.PI / 2; - - const theta = this.dot( v ) / denominator; - - // clamp, to handle numerical problems - - return Math.acos( MathUtils.clamp( theta, - 1, 1 ) ); - - } - - distanceTo( v ) { - - return Math.sqrt( this.distanceToSquared( v ) ); - - } - - distanceToSquared( v ) { - - const dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z; - - return dx * dx + dy * dy + dz * dz; - - } - - manhattanDistanceTo( v ) { - - return Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z ); - - } - - setFromSpherical( s ) { - - return this.setFromSphericalCoords( s.radius, s.phi, s.theta ); - - } - - setFromSphericalCoords( radius, phi, theta ) { - - const sinPhiRadius = Math.sin( phi ) * radius; - - this.x = sinPhiRadius * Math.sin( theta ); - this.y = Math.cos( phi ) * radius; - this.z = sinPhiRadius * Math.cos( theta ); - - return this; - - } - - setFromCylindrical( c ) { - - return this.setFromCylindricalCoords( c.radius, c.theta, c.y ); - - } - - setFromCylindricalCoords( radius, theta, y ) { - - this.x = radius * Math.sin( theta ); - this.y = y; - this.z = radius * Math.cos( theta ); - - return this; - - } - - setFromMatrixPosition( m ) { - - const e = m.elements; - - this.x = e[ 12 ]; - this.y = e[ 13 ]; - this.z = e[ 14 ]; - - return this; - - } - - setFromMatrixScale( m ) { - - const sx = this.setFromMatrixColumn( m, 0 ).length(); - const sy = this.setFromMatrixColumn( m, 1 ).length(); - const sz = this.setFromMatrixColumn( m, 2 ).length(); - - this.x = sx; - this.y = sy; - this.z = sz; - - return this; - - } - - setFromMatrixColumn( m, index ) { - - return this.fromArray( m.elements, index * 4 ); - - } - - setFromMatrix3Column( m, index ) { - - return this.fromArray( m.elements, index * 3 ); - - } - - equals( v ) { - - return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) ); - - } - - fromArray( array, offset = 0 ) { - - this.x = array[ offset ]; - this.y = array[ offset + 1 ]; - this.z = array[ offset + 2 ]; - - return this; - - } - - toArray( array = [], offset = 0 ) { - - array[ offset ] = this.x; - array[ offset + 1 ] = this.y; - array[ offset + 2 ] = this.z; - - return array; - - } - - fromBufferAttribute( attribute, index, offset ) { - - if ( offset !== undefined ) { - - console.warn( 'THREE.Vector3: offset has been removed from .fromBufferAttribute().' ); - - } - - this.x = attribute.getX( index ); - this.y = attribute.getY( index ); - this.z = attribute.getZ( index ); - - return this; - - } - - random() { - - this.x = Math.random(); - this.y = Math.random(); - this.z = Math.random(); - - return this; - - } - -} - -Vector3.prototype.isVector3 = true; - -const _vector = /*@__PURE__*/ new Vector3(); -const _quaternion = /*@__PURE__*/ new Quaternion(); - -class Box3 { - - constructor( min = new Vector3( + Infinity, + Infinity, + Infinity ), max = new Vector3( - Infinity, - Infinity, - Infinity ) ) { - - this.min = min; - this.max = max; - - } - - set( min, max ) { - - this.min.copy( min ); - this.max.copy( max ); - - return this; - - } - - setFromArray( array ) { - - let minX = + Infinity; - let minY = + Infinity; - let minZ = + Infinity; - - let maxX = - Infinity; - let maxY = - Infinity; - let maxZ = - Infinity; - - for ( let i = 0, l = array.length; i < l; i += 3 ) { - - const x = array[ i ]; - const y = array[ i + 1 ]; - const z = array[ i + 2 ]; - - if ( x < minX ) minX = x; - if ( y < minY ) minY = y; - if ( z < minZ ) minZ = z; - - if ( x > maxX ) maxX = x; - if ( y > maxY ) maxY = y; - if ( z > maxZ ) maxZ = z; - - } - - this.min.set( minX, minY, minZ ); - this.max.set( maxX, maxY, maxZ ); - - return this; - - } - - setFromBufferAttribute( attribute ) { - - let minX = + Infinity; - let minY = + Infinity; - let minZ = + Infinity; - - let maxX = - Infinity; - let maxY = - Infinity; - let maxZ = - Infinity; - - for ( let i = 0, l = attribute.count; i < l; i ++ ) { - - const x = attribute.getX( i ); - const y = attribute.getY( i ); - const z = attribute.getZ( i ); - - if ( x < minX ) minX = x; - if ( y < minY ) minY = y; - if ( z < minZ ) minZ = z; - - if ( x > maxX ) maxX = x; - if ( y > maxY ) maxY = y; - if ( z > maxZ ) maxZ = z; - - } - - this.min.set( minX, minY, minZ ); - this.max.set( maxX, maxY, maxZ ); - - return this; - - } - - setFromPoints( points ) { - - this.makeEmpty(); - - for ( let i = 0, il = points.length; i < il; i ++ ) { - - this.expandByPoint( points[ i ] ); - - } - - return this; - - } - - setFromCenterAndSize( center, size ) { - - const halfSize = _vector$1.copy( size ).multiplyScalar( 0.5 ); - - this.min.copy( center ).sub( halfSize ); - this.max.copy( center ).add( halfSize ); - - return this; - - } - - setFromObject( object ) { - - this.makeEmpty(); - - return this.expandByObject( object ); - - } - - clone() { - - return new this.constructor().copy( this ); - - } - - copy( box ) { - - this.min.copy( box.min ); - this.max.copy( box.max ); - - return this; - - } - - makeEmpty() { - - this.min.x = this.min.y = this.min.z = + Infinity; - this.max.x = this.max.y = this.max.z = - Infinity; - - return this; - - } - - isEmpty() { - - // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes - - return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z ); - - } - - getCenter( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Box3: .getCenter() target is now required' ); - target = new Vector3(); - - } - - return this.isEmpty() ? target.set( 0, 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 ); - - } - - getSize( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Box3: .getSize() target is now required' ); - target = new Vector3(); - - } - - return this.isEmpty() ? target.set( 0, 0, 0 ) : target.subVectors( this.max, this.min ); - - } - - expandByPoint( point ) { - - this.min.min( point ); - this.max.max( point ); - - return this; - - } - - expandByVector( vector ) { - - this.min.sub( vector ); - this.max.add( vector ); - - return this; - - } - - expandByScalar( scalar ) { - - this.min.addScalar( - scalar ); - this.max.addScalar( scalar ); - - return this; - - } - - expandByObject( object ) { - - // Computes the world-axis-aligned bounding box of an object (including its children), - // accounting for both the object's, and children's, world transforms - - object.updateWorldMatrix( false, false ); - - const geometry = object.geometry; - - if ( geometry !== undefined ) { - - if ( geometry.boundingBox === null ) { - - geometry.computeBoundingBox(); - - } - - _box.copy( geometry.boundingBox ); - _box.applyMatrix4( object.matrixWorld ); - - this.union( _box ); - - } - - const children = object.children; - - for ( let i = 0, l = children.length; i < l; i ++ ) { - - this.expandByObject( children[ i ] ); - - } - - return this; - - } - - containsPoint( point ) { - - return point.x < this.min.x || point.x > this.max.x || - point.y < this.min.y || point.y > this.max.y || - point.z < this.min.z || point.z > this.max.z ? false : true; - - } - - containsBox( box ) { - - return this.min.x <= box.min.x && box.max.x <= this.max.x && - this.min.y <= box.min.y && box.max.y <= this.max.y && - this.min.z <= box.min.z && box.max.z <= this.max.z; - - } - - getParameter( point, target ) { - - // This can potentially have a divide by zero if the box - // has a size dimension of 0. - - if ( target === undefined ) { - - console.warn( 'THREE.Box3: .getParameter() target is now required' ); - target = new Vector3(); - - } - - return target.set( - ( point.x - this.min.x ) / ( this.max.x - this.min.x ), - ( point.y - this.min.y ) / ( this.max.y - this.min.y ), - ( point.z - this.min.z ) / ( this.max.z - this.min.z ) - ); - - } - - intersectsBox( box ) { - - // using 6 splitting planes to rule out intersections. - return box.max.x < this.min.x || box.min.x > this.max.x || - box.max.y < this.min.y || box.min.y > this.max.y || - box.max.z < this.min.z || box.min.z > this.max.z ? false : true; - - } - - intersectsSphere( sphere ) { - - // Find the point on the AABB closest to the sphere center. - this.clampPoint( sphere.center, _vector$1 ); - - // If that point is inside the sphere, the AABB and sphere intersect. - return _vector$1.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius ); - - } - - intersectsPlane( plane ) { - - // We compute the minimum and maximum dot product values. If those values - // are on the same side (back or front) of the plane, then there is no intersection. - - let min, max; - - if ( plane.normal.x > 0 ) { - - min = plane.normal.x * this.min.x; - max = plane.normal.x * this.max.x; - - } else { - - min = plane.normal.x * this.max.x; - max = plane.normal.x * this.min.x; - - } - - if ( plane.normal.y > 0 ) { - - min += plane.normal.y * this.min.y; - max += plane.normal.y * this.max.y; - - } else { - - min += plane.normal.y * this.max.y; - max += plane.normal.y * this.min.y; - - } - - if ( plane.normal.z > 0 ) { - - min += plane.normal.z * this.min.z; - max += plane.normal.z * this.max.z; - - } else { - - min += plane.normal.z * this.max.z; - max += plane.normal.z * this.min.z; - - } - - return ( min <= - plane.constant && max >= - plane.constant ); - - } - - intersectsTriangle( triangle ) { - - if ( this.isEmpty() ) { - - return false; - - } - - // compute box center and extents - this.getCenter( _center ); - _extents.subVectors( this.max, _center ); - - // translate triangle to aabb origin - _v0.subVectors( triangle.a, _center ); - _v1.subVectors( triangle.b, _center ); - _v2.subVectors( triangle.c, _center ); - - // compute edge vectors for triangle - _f0.subVectors( _v1, _v0 ); - _f1.subVectors( _v2, _v1 ); - _f2.subVectors( _v0, _v2 ); - - // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb - // make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation - // axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned) - let axes = [ - 0, - _f0.z, _f0.y, 0, - _f1.z, _f1.y, 0, - _f2.z, _f2.y, - _f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x, - - _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0 - ]; - if ( ! satForAxes( axes, _v0, _v1, _v2, _extents ) ) { - - return false; - - } - - // test 3 face normals from the aabb - axes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ]; - if ( ! satForAxes( axes, _v0, _v1, _v2, _extents ) ) { - - return false; - - } - - // finally testing the face normal of the triangle - // use already existing triangle edge vectors here - _triangleNormal.crossVectors( _f0, _f1 ); - axes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ]; - - return satForAxes( axes, _v0, _v1, _v2, _extents ); - - } - - clampPoint( point, target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Box3: .clampPoint() target is now required' ); - target = new Vector3(); - - } - - return target.copy( point ).clamp( this.min, this.max ); - - } - - distanceToPoint( point ) { - - const clampedPoint = _vector$1.copy( point ).clamp( this.min, this.max ); - - return clampedPoint.sub( point ).length(); - - } - - getBoundingSphere( target ) { - - if ( target === undefined ) { - - console.error( 'THREE.Box3: .getBoundingSphere() target is now required' ); - //target = new Sphere(); // removed to avoid cyclic dependency - - } - - this.getCenter( target.center ); - - target.radius = this.getSize( _vector$1 ).length() * 0.5; - - return target; - - } - - intersect( box ) { - - this.min.max( box.min ); - this.max.min( box.max ); - - // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values. - if ( this.isEmpty() ) this.makeEmpty(); - - return this; - - } - - union( box ) { - - this.min.min( box.min ); - this.max.max( box.max ); - - return this; - - } - - applyMatrix4( matrix ) { - - // transform of empty box is an empty box. - if ( this.isEmpty() ) return this; - - // NOTE: I am using a binary pattern to specify all 2^3 combinations below - _points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000 - _points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001 - _points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010 - _points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011 - _points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100 - _points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101 - _points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110 - _points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111 - - this.setFromPoints( _points ); - - return this; - - } - - translate( offset ) { - - this.min.add( offset ); - this.max.add( offset ); - - return this; - - } - - equals( box ) { - - return box.min.equals( this.min ) && box.max.equals( this.max ); - - } - -} - -Box3.prototype.isBox3 = true; - -const _points = [ - /*@__PURE__*/ new Vector3(), - /*@__PURE__*/ new Vector3(), - /*@__PURE__*/ new Vector3(), - /*@__PURE__*/ new Vector3(), - /*@__PURE__*/ new Vector3(), - /*@__PURE__*/ new Vector3(), - /*@__PURE__*/ new Vector3(), - /*@__PURE__*/ new Vector3() -]; - -const _vector$1 = /*@__PURE__*/ new Vector3(); - -const _box = /*@__PURE__*/ new Box3(); - -// triangle centered vertices - -const _v0 = /*@__PURE__*/ new Vector3(); -const _v1 = /*@__PURE__*/ new Vector3(); -const _v2 = /*@__PURE__*/ new Vector3(); - -// triangle edge vectors - -const _f0 = /*@__PURE__*/ new Vector3(); -const _f1 = /*@__PURE__*/ new Vector3(); -const _f2 = /*@__PURE__*/ new Vector3(); - -const _center = /*@__PURE__*/ new Vector3(); -const _extents = /*@__PURE__*/ new Vector3(); -const _triangleNormal = /*@__PURE__*/ new Vector3(); -const _testAxis = /*@__PURE__*/ new Vector3(); - -function satForAxes( axes, v0, v1, v2, extents ) { - - for ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) { - - _testAxis.fromArray( axes, i ); - // project the aabb onto the seperating axis - const r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z ); - // project all 3 vertices of the triangle onto the seperating axis - const p0 = v0.dot( _testAxis ); - const p1 = v1.dot( _testAxis ); - const p2 = v2.dot( _testAxis ); - // actual test, basically see if either of the most extreme of the triangle points intersects r - if ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) { - - // points of the projected triangle are outside the projected half-length of the aabb - // the axis is seperating and we can exit - return false; - - } - - } - - return true; - -} - -const _box$1 = /*@__PURE__*/ new Box3(); - -class Sphere { - - constructor( center = new Vector3(), radius = - 1 ) { - - this.center = center; - this.radius = radius; - - } - - set( center, radius ) { - - this.center.copy( center ); - this.radius = radius; - - return this; - - } - - setFromPoints( points, optionalCenter ) { - - const center = this.center; - - if ( optionalCenter !== undefined ) { - - center.copy( optionalCenter ); - - } else { - - _box$1.setFromPoints( points ).getCenter( center ); - - } - - let maxRadiusSq = 0; - - for ( let i = 0, il = points.length; i < il; i ++ ) { - - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) ); - - } - - this.radius = Math.sqrt( maxRadiusSq ); - - return this; - - } - - copy( sphere ) { - - this.center.copy( sphere.center ); - this.radius = sphere.radius; - - return this; - - } - - isEmpty() { - - return ( this.radius < 0 ); - - } - - makeEmpty() { - - this.center.set( 0, 0, 0 ); - this.radius = - 1; - - return this; - - } - - containsPoint( point ) { - - return ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) ); - - } - - distanceToPoint( point ) { - - return ( point.distanceTo( this.center ) - this.radius ); - - } - - intersectsSphere( sphere ) { - - const radiusSum = this.radius + sphere.radius; - - return sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum ); - - } - - intersectsBox( box ) { - - return box.intersectsSphere( this ); - - } - - intersectsPlane( plane ) { - - return Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius; - - } - - clampPoint( point, target ) { - - const deltaLengthSq = this.center.distanceToSquared( point ); - - if ( target === undefined ) { - - console.warn( 'THREE.Sphere: .clampPoint() target is now required' ); - target = new Vector3(); - - } - - target.copy( point ); - - if ( deltaLengthSq > ( this.radius * this.radius ) ) { - - target.sub( this.center ).normalize(); - target.multiplyScalar( this.radius ).add( this.center ); - - } - - return target; - - } - - getBoundingBox( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Sphere: .getBoundingBox() target is now required' ); - target = new Box3(); - - } - - if ( this.isEmpty() ) { - - // Empty sphere produces empty bounding box - target.makeEmpty(); - return target; - - } - - target.set( this.center, this.center ); - target.expandByScalar( this.radius ); - - return target; - - } - - applyMatrix4( matrix ) { - - this.center.applyMatrix4( matrix ); - this.radius = this.radius * matrix.getMaxScaleOnAxis(); - - return this; - - } - - translate( offset ) { - - this.center.add( offset ); - - return this; - - } - - equals( sphere ) { - - return sphere.center.equals( this.center ) && ( sphere.radius === this.radius ); - - } - - clone() { - - return new this.constructor().copy( this ); - - } - -} - -const _vector$2 = /*@__PURE__*/ new Vector3(); -const _segCenter = /*@__PURE__*/ new Vector3(); -const _segDir = /*@__PURE__*/ new Vector3(); -const _diff = /*@__PURE__*/ new Vector3(); - -const _edge1 = /*@__PURE__*/ new Vector3(); -const _edge2 = /*@__PURE__*/ new Vector3(); -const _normal = /*@__PURE__*/ new Vector3(); - -class Ray { - - constructor( origin = new Vector3(), direction = new Vector3( 0, 0, - 1 ) ) { - - this.origin = origin; - this.direction = direction; - - } - - set( origin, direction ) { - - this.origin.copy( origin ); - this.direction.copy( direction ); - - return this; - - } - - copy( ray ) { - - this.origin.copy( ray.origin ); - this.direction.copy( ray.direction ); - - return this; - - } - - at( t, target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Ray: .at() target is now required' ); - target = new Vector3(); - - } - - return target.copy( this.direction ).multiplyScalar( t ).add( this.origin ); - - } - - lookAt( v ) { - - this.direction.copy( v ).sub( this.origin ).normalize(); - - return this; - - } - - recast( t ) { - - this.origin.copy( this.at( t, _vector$2 ) ); - - return this; - - } - - closestPointToPoint( point, target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Ray: .closestPointToPoint() target is now required' ); - target = new Vector3(); - - } - - target.subVectors( point, this.origin ); - - const directionDistance = target.dot( this.direction ); - - if ( directionDistance < 0 ) { - - return target.copy( this.origin ); - - } - - return target.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin ); - - } - - distanceToPoint( point ) { - - return Math.sqrt( this.distanceSqToPoint( point ) ); - - } - - distanceSqToPoint( point ) { - - const directionDistance = _vector$2.subVectors( point, this.origin ).dot( this.direction ); - - // point behind the ray - - if ( directionDistance < 0 ) { - - return this.origin.distanceToSquared( point ); - - } - - _vector$2.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin ); - - return _vector$2.distanceToSquared( point ); - - } - - distanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) { - - // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteDistRaySegment.h - // It returns the min distance between the ray and the segment - // defined by v0 and v1 - // It can also set two optional targets : - // - The closest point on the ray - // - The closest point on the segment - - _segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 ); - _segDir.copy( v1 ).sub( v0 ).normalize(); - _diff.copy( this.origin ).sub( _segCenter ); - - const segExtent = v0.distanceTo( v1 ) * 0.5; - const a01 = - this.direction.dot( _segDir ); - const b0 = _diff.dot( this.direction ); - const b1 = - _diff.dot( _segDir ); - const c = _diff.lengthSq(); - const det = Math.abs( 1 - a01 * a01 ); - let s0, s1, sqrDist, extDet; - - if ( det > 0 ) { - - // The ray and segment are not parallel. - - s0 = a01 * b1 - b0; - s1 = a01 * b0 - b1; - extDet = segExtent * det; - - if ( s0 >= 0 ) { - - if ( s1 >= - extDet ) { - - if ( s1 <= extDet ) { - - // region 0 - // Minimum at interior points of ray and segment. - - const invDet = 1 / det; - s0 *= invDet; - s1 *= invDet; - sqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c; - - } else { - - // region 1 - - s1 = segExtent; - s0 = Math.max( 0, - ( a01 * s1 + b0 ) ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - } else { - - // region 5 - - s1 = - segExtent; - s0 = Math.max( 0, - ( a01 * s1 + b0 ) ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - } else { - - if ( s1 <= - extDet ) { - - // region 4 - - s0 = Math.max( 0, - ( - a01 * segExtent + b0 ) ); - s1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } else if ( s1 <= extDet ) { - - // region 3 - - s0 = 0; - s1 = Math.min( Math.max( - segExtent, - b1 ), segExtent ); - sqrDist = s1 * ( s1 + 2 * b1 ) + c; - - } else { - - // region 2 - - s0 = Math.max( 0, - ( a01 * segExtent + b0 ) ); - s1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - } - - } else { - - // Ray and segment are parallel. - - s1 = ( a01 > 0 ) ? - segExtent : segExtent; - s0 = Math.max( 0, - ( a01 * s1 + b0 ) ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - if ( optionalPointOnRay ) { - - optionalPointOnRay.copy( this.direction ).multiplyScalar( s0 ).add( this.origin ); - - } - - if ( optionalPointOnSegment ) { - - optionalPointOnSegment.copy( _segDir ).multiplyScalar( s1 ).add( _segCenter ); - - } - - return sqrDist; - - } - - intersectSphere( sphere, target ) { - - _vector$2.subVectors( sphere.center, this.origin ); - const tca = _vector$2.dot( this.direction ); - const d2 = _vector$2.dot( _vector$2 ) - tca * tca; - const radius2 = sphere.radius * sphere.radius; - - if ( d2 > radius2 ) return null; - - const thc = Math.sqrt( radius2 - d2 ); - - // t0 = first intersect point - entrance on front of sphere - const t0 = tca - thc; - - // t1 = second intersect point - exit point on back of sphere - const t1 = tca + thc; - - // test to see if both t0 and t1 are behind the ray - if so, return null - if ( t0 < 0 && t1 < 0 ) return null; - - // test to see if t0 is behind the ray: - // if it is, the ray is inside the sphere, so return the second exit point scaled by t1, - // in order to always return an intersect point that is in front of the ray. - if ( t0 < 0 ) return this.at( t1, target ); - - // else t0 is in front of the ray, so return the first collision point scaled by t0 - return this.at( t0, target ); - - } - - intersectsSphere( sphere ) { - - return this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius ); - - } - - distanceToPlane( plane ) { - - const denominator = plane.normal.dot( this.direction ); - - if ( denominator === 0 ) { - - // line is coplanar, return origin - if ( plane.distanceToPoint( this.origin ) === 0 ) { - - return 0; - - } - - // Null is preferable to undefined since undefined means.... it is undefined - - return null; - - } - - const t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator; - - // Return if the ray never intersects the plane - - return t >= 0 ? t : null; - - } - - intersectPlane( plane, target ) { - - const t = this.distanceToPlane( plane ); - - if ( t === null ) { - - return null; - - } - - return this.at( t, target ); - - } - - intersectsPlane( plane ) { - - // check if the ray lies on the plane first - - const distToPoint = plane.distanceToPoint( this.origin ); - - if ( distToPoint === 0 ) { - - return true; - - } - - const denominator = plane.normal.dot( this.direction ); - - if ( denominator * distToPoint < 0 ) { - - return true; - - } - - // ray origin is behind the plane (and is pointing behind it) - - return false; - - } - - intersectBox( box, target ) { - - let tmin, tmax, tymin, tymax, tzmin, tzmax; - - const invdirx = 1 / this.direction.x, - invdiry = 1 / this.direction.y, - invdirz = 1 / this.direction.z; - - const origin = this.origin; - - if ( invdirx >= 0 ) { - - tmin = ( box.min.x - origin.x ) * invdirx; - tmax = ( box.max.x - origin.x ) * invdirx; - - } else { - - tmin = ( box.max.x - origin.x ) * invdirx; - tmax = ( box.min.x - origin.x ) * invdirx; - - } - - if ( invdiry >= 0 ) { - - tymin = ( box.min.y - origin.y ) * invdiry; - tymax = ( box.max.y - origin.y ) * invdiry; - - } else { - - tymin = ( box.max.y - origin.y ) * invdiry; - tymax = ( box.min.y - origin.y ) * invdiry; - - } - - if ( ( tmin > tymax ) || ( tymin > tmax ) ) return null; - - // These lines also handle the case where tmin or tmax is NaN - // (result of 0 * Infinity). x !== x returns true if x is NaN - - if ( tymin > tmin || tmin !== tmin ) tmin = tymin; - - if ( tymax < tmax || tmax !== tmax ) tmax = tymax; - - if ( invdirz >= 0 ) { - - tzmin = ( box.min.z - origin.z ) * invdirz; - tzmax = ( box.max.z - origin.z ) * invdirz; - - } else { - - tzmin = ( box.max.z - origin.z ) * invdirz; - tzmax = ( box.min.z - origin.z ) * invdirz; - - } - - if ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null; - - if ( tzmin > tmin || tmin !== tmin ) tmin = tzmin; - - if ( tzmax < tmax || tmax !== tmax ) tmax = tzmax; - - //return point closest to the ray (positive side) - - if ( tmax < 0 ) return null; - - return this.at( tmin >= 0 ? tmin : tmax, target ); - - } - - intersectsBox( box ) { - - return this.intersectBox( box, _vector$2 ) !== null; - - } - - intersectTriangle( a, b, c, backfaceCulling, target ) { - - // Compute the offset origin, edges, and normal. - - // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h - - _edge1.subVectors( b, a ); - _edge2.subVectors( c, a ); - _normal.crossVectors( _edge1, _edge2 ); - - // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction, - // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by - // |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2)) - // |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q)) - // |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N) - let DdN = this.direction.dot( _normal ); - let sign; - - if ( DdN > 0 ) { - - if ( backfaceCulling ) return null; - sign = 1; - - } else if ( DdN < 0 ) { - - sign = - 1; - DdN = - DdN; - - } else { - - return null; - - } - - _diff.subVectors( this.origin, a ); - const DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) ); - - // b1 < 0, no intersection - if ( DdQxE2 < 0 ) { - - return null; - - } - - const DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) ); - - // b2 < 0, no intersection - if ( DdE1xQ < 0 ) { - - return null; - - } - - // b1+b2 > 1, no intersection - if ( DdQxE2 + DdE1xQ > DdN ) { - - return null; - - } - - // Line intersects triangle, check if ray does. - const QdN = - sign * _diff.dot( _normal ); - - // t < 0, no intersection - if ( QdN < 0 ) { - - return null; - - } - - // Ray intersects triangle. - return this.at( QdN / DdN, target ); - - } - - applyMatrix4( matrix4 ) { - - this.origin.applyMatrix4( matrix4 ); - this.direction.transformDirection( matrix4 ); - - return this; - - } - - equals( ray ) { - - return ray.origin.equals( this.origin ) && ray.direction.equals( this.direction ); - - } - - clone() { - - return new this.constructor().copy( this ); - - } - -} - -class Matrix4 { - - constructor() { - - this.elements = [ - - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - - ]; - - if ( arguments.length > 0 ) { - - console.error( 'THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.' ); - - } - - } - - set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) { - - const te = this.elements; - - te[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14; - te[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24; - te[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34; - te[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44; - - return this; - - } - - identity() { - - this.set( - - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - - ); - - return this; - - } - - clone() { - - return new Matrix4().fromArray( this.elements ); - - } - - copy( m ) { - - const te = this.elements; - const me = m.elements; - - te[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ]; - te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ]; - te[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ]; - te[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ]; - - return this; - - } - - copyPosition( m ) { - - const te = this.elements, me = m.elements; - - te[ 12 ] = me[ 12 ]; - te[ 13 ] = me[ 13 ]; - te[ 14 ] = me[ 14 ]; - - return this; - - } - - setFromMatrix3( m ) { - - const me = m.elements; - - this.set( - - me[ 0 ], me[ 3 ], me[ 6 ], 0, - me[ 1 ], me[ 4 ], me[ 7 ], 0, - me[ 2 ], me[ 5 ], me[ 8 ], 0, - 0, 0, 0, 1 - - ); - - return this; - - } - - extractBasis( xAxis, yAxis, zAxis ) { - - xAxis.setFromMatrixColumn( this, 0 ); - yAxis.setFromMatrixColumn( this, 1 ); - zAxis.setFromMatrixColumn( this, 2 ); - - return this; - - } - - makeBasis( xAxis, yAxis, zAxis ) { - - this.set( - xAxis.x, yAxis.x, zAxis.x, 0, - xAxis.y, yAxis.y, zAxis.y, 0, - xAxis.z, yAxis.z, zAxis.z, 0, - 0, 0, 0, 1 - ); - - return this; - - } - - extractRotation( m ) { - - // this method does not support reflection matrices - - const te = this.elements; - const me = m.elements; - - const scaleX = 1 / _v1$1.setFromMatrixColumn( m, 0 ).length(); - const scaleY = 1 / _v1$1.setFromMatrixColumn( m, 1 ).length(); - const scaleZ = 1 / _v1$1.setFromMatrixColumn( m, 2 ).length(); - - te[ 0 ] = me[ 0 ] * scaleX; - te[ 1 ] = me[ 1 ] * scaleX; - te[ 2 ] = me[ 2 ] * scaleX; - te[ 3 ] = 0; - - te[ 4 ] = me[ 4 ] * scaleY; - te[ 5 ] = me[ 5 ] * scaleY; - te[ 6 ] = me[ 6 ] * scaleY; - te[ 7 ] = 0; - - te[ 8 ] = me[ 8 ] * scaleZ; - te[ 9 ] = me[ 9 ] * scaleZ; - te[ 10 ] = me[ 10 ] * scaleZ; - te[ 11 ] = 0; - - te[ 12 ] = 0; - te[ 13 ] = 0; - te[ 14 ] = 0; - te[ 15 ] = 1; - - return this; - - } - - makeRotationFromEuler( euler ) { - - if ( ! ( euler && euler.isEuler ) ) { - - console.error( 'THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.' ); - - } - - const te = this.elements; - - const x = euler.x, y = euler.y, z = euler.z; - const a = Math.cos( x ), b = Math.sin( x ); - const c = Math.cos( y ), d = Math.sin( y ); - const e = Math.cos( z ), f = Math.sin( z ); - - if ( euler.order === 'XYZ' ) { - - const ae = a * e, af = a * f, be = b * e, bf = b * f; - - te[ 0 ] = c * e; - te[ 4 ] = - c * f; - te[ 8 ] = d; - - te[ 1 ] = af + be * d; - te[ 5 ] = ae - bf * d; - te[ 9 ] = - b * c; - - te[ 2 ] = bf - ae * d; - te[ 6 ] = be + af * d; - te[ 10 ] = a * c; - - } else if ( euler.order === 'YXZ' ) { - - const ce = c * e, cf = c * f, de = d * e, df = d * f; - - te[ 0 ] = ce + df * b; - te[ 4 ] = de * b - cf; - te[ 8 ] = a * d; - - te[ 1 ] = a * f; - te[ 5 ] = a * e; - te[ 9 ] = - b; - - te[ 2 ] = cf * b - de; - te[ 6 ] = df + ce * b; - te[ 10 ] = a * c; - - } else if ( euler.order === 'ZXY' ) { - - const ce = c * e, cf = c * f, de = d * e, df = d * f; - - te[ 0 ] = ce - df * b; - te[ 4 ] = - a * f; - te[ 8 ] = de + cf * b; - - te[ 1 ] = cf + de * b; - te[ 5 ] = a * e; - te[ 9 ] = df - ce * b; - - te[ 2 ] = - a * d; - te[ 6 ] = b; - te[ 10 ] = a * c; - - } else if ( euler.order === 'ZYX' ) { - - const ae = a * e, af = a * f, be = b * e, bf = b * f; - - te[ 0 ] = c * e; - te[ 4 ] = be * d - af; - te[ 8 ] = ae * d + bf; - - te[ 1 ] = c * f; - te[ 5 ] = bf * d + ae; - te[ 9 ] = af * d - be; - - te[ 2 ] = - d; - te[ 6 ] = b * c; - te[ 10 ] = a * c; - - } else if ( euler.order === 'YZX' ) { - - const ac = a * c, ad = a * d, bc = b * c, bd = b * d; - - te[ 0 ] = c * e; - te[ 4 ] = bd - ac * f; - te[ 8 ] = bc * f + ad; - - te[ 1 ] = f; - te[ 5 ] = a * e; - te[ 9 ] = - b * e; - - te[ 2 ] = - d * e; - te[ 6 ] = ad * f + bc; - te[ 10 ] = ac - bd * f; - - } else if ( euler.order === 'XZY' ) { - - const ac = a * c, ad = a * d, bc = b * c, bd = b * d; - - te[ 0 ] = c * e; - te[ 4 ] = - f; - te[ 8 ] = d * e; - - te[ 1 ] = ac * f + bd; - te[ 5 ] = a * e; - te[ 9 ] = ad * f - bc; - - te[ 2 ] = bc * f - ad; - te[ 6 ] = b * e; - te[ 10 ] = bd * f + ac; - - } - - // bottom row - te[ 3 ] = 0; - te[ 7 ] = 0; - te[ 11 ] = 0; - - // last column - te[ 12 ] = 0; - te[ 13 ] = 0; - te[ 14 ] = 0; - te[ 15 ] = 1; - - return this; - - } - - makeRotationFromQuaternion( q ) { - - return this.compose( _zero, q, _one ); - - } - - lookAt( eye, target, up ) { - - const te = this.elements; - - _z.subVectors( eye, target ); - - if ( _z.lengthSq() === 0 ) { - - // eye and target are in the same position - - _z.z = 1; - - } - - _z.normalize(); - _x.crossVectors( up, _z ); - - if ( _x.lengthSq() === 0 ) { - - // up and z are parallel - - if ( Math.abs( up.z ) === 1 ) { - - _z.x += 0.0001; - - } else { - - _z.z += 0.0001; - - } - - _z.normalize(); - _x.crossVectors( up, _z ); - - } - - _x.normalize(); - _y.crossVectors( _z, _x ); - - te[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x; - te[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y; - te[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z; - - return this; - - } - - multiply( m, n ) { - - if ( n !== undefined ) { - - console.warn( 'THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.' ); - return this.multiplyMatrices( m, n ); - - } - - return this.multiplyMatrices( this, m ); - - } - - premultiply( m ) { - - return this.multiplyMatrices( m, this ); - - } - - multiplyMatrices( a, b ) { - - const ae = a.elements; - const be = b.elements; - const te = this.elements; - - const a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ]; - const a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ]; - const a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ]; - const a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ]; - - const b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ]; - const b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ]; - const b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ]; - const b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ]; - - te[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41; - te[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42; - te[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43; - te[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44; - - te[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41; - te[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42; - te[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43; - te[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44; - - te[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41; - te[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42; - te[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43; - te[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44; - - te[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41; - te[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42; - te[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43; - te[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44; - - return this; - - } - - multiplyScalar( s ) { - - const te = this.elements; - - te[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s; - te[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s; - te[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s; - te[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s; - - return this; - - } - - determinant() { - - const te = this.elements; - - const n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ]; - const n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ]; - const n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ]; - const n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ]; - - //TODO: make this more efficient - //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm ) - - return ( - n41 * ( - + n14 * n23 * n32 - - n13 * n24 * n32 - - n14 * n22 * n33 - + n12 * n24 * n33 - + n13 * n22 * n34 - - n12 * n23 * n34 - ) + - n42 * ( - + n11 * n23 * n34 - - n11 * n24 * n33 - + n14 * n21 * n33 - - n13 * n21 * n34 - + n13 * n24 * n31 - - n14 * n23 * n31 - ) + - n43 * ( - + n11 * n24 * n32 - - n11 * n22 * n34 - - n14 * n21 * n32 - + n12 * n21 * n34 - + n14 * n22 * n31 - - n12 * n24 * n31 - ) + - n44 * ( - - n13 * n22 * n31 - - n11 * n23 * n32 - + n11 * n22 * n33 - + n13 * n21 * n32 - - n12 * n21 * n33 - + n12 * n23 * n31 - ) - - ); - - } - - transpose() { - - const te = this.elements; - let tmp; - - tmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp; - tmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp; - tmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp; - - tmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp; - tmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp; - tmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp; - - return this; - - } - - setPosition( x, y, z ) { - - const te = this.elements; - - if ( x.isVector3 ) { - - te[ 12 ] = x.x; - te[ 13 ] = x.y; - te[ 14 ] = x.z; - - } else { - - te[ 12 ] = x; - te[ 13 ] = y; - te[ 14 ] = z; - - } - - return this; - - } - - invert() { - - // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm - const te = this.elements, - - n11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ], - n12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ], - n13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ], - n14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ], - - t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44, - t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44, - t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44, - t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34; - - const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14; - - if ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); - - const detInv = 1 / det; - - te[ 0 ] = t11 * detInv; - te[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv; - te[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv; - te[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv; - - te[ 4 ] = t12 * detInv; - te[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv; - te[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv; - te[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv; - - te[ 8 ] = t13 * detInv; - te[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv; - te[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv; - te[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv; - - te[ 12 ] = t14 * detInv; - te[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv; - te[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv; - te[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv; - - return this; - - } - - scale( v ) { - - const te = this.elements; - const x = v.x, y = v.y, z = v.z; - - te[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z; - te[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z; - te[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z; - te[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z; - - return this; - - } - - getMaxScaleOnAxis() { - - const te = this.elements; - - const scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ]; - const scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ]; - const scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ]; - - return Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) ); - - } - - makeTranslation( x, y, z ) { - - this.set( - - 1, 0, 0, x, - 0, 1, 0, y, - 0, 0, 1, z, - 0, 0, 0, 1 - - ); - - return this; - - } - - makeRotationX( theta ) { - - const c = Math.cos( theta ), s = Math.sin( theta ); - - this.set( - - 1, 0, 0, 0, - 0, c, - s, 0, - 0, s, c, 0, - 0, 0, 0, 1 - - ); - - return this; - - } - - makeRotationY( theta ) { - - const c = Math.cos( theta ), s = Math.sin( theta ); - - this.set( - - c, 0, s, 0, - 0, 1, 0, 0, - - s, 0, c, 0, - 0, 0, 0, 1 - - ); - - return this; - - } - - makeRotationZ( theta ) { - - const c = Math.cos( theta ), s = Math.sin( theta ); - - this.set( - - c, - s, 0, 0, - s, c, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - - ); - - return this; - - } - - makeRotationAxis( axis, angle ) { - - // Based on http://www.gamedev.net/reference/articles/article1199.asp - - const c = Math.cos( angle ); - const s = Math.sin( angle ); - const t = 1 - c; - const x = axis.x, y = axis.y, z = axis.z; - const tx = t * x, ty = t * y; - - this.set( - - tx * x + c, tx * y - s * z, tx * z + s * y, 0, - tx * y + s * z, ty * y + c, ty * z - s * x, 0, - tx * z - s * y, ty * z + s * x, t * z * z + c, 0, - 0, 0, 0, 1 - - ); - - return this; - - } - - makeScale( x, y, z ) { - - this.set( - - x, 0, 0, 0, - 0, y, 0, 0, - 0, 0, z, 0, - 0, 0, 0, 1 - - ); - - return this; - - } - - makeShear( x, y, z ) { - - this.set( - - 1, y, z, 0, - x, 1, z, 0, - x, y, 1, 0, - 0, 0, 0, 1 - - ); - - return this; - - } - - compose( position, quaternion, scale ) { - - const te = this.elements; - - const x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w; - const x2 = x + x, y2 = y + y, z2 = z + z; - const xx = x * x2, xy = x * y2, xz = x * z2; - const yy = y * y2, yz = y * z2, zz = z * z2; - const wx = w * x2, wy = w * y2, wz = w * z2; - - const sx = scale.x, sy = scale.y, sz = scale.z; - - te[ 0 ] = ( 1 - ( yy + zz ) ) * sx; - te[ 1 ] = ( xy + wz ) * sx; - te[ 2 ] = ( xz - wy ) * sx; - te[ 3 ] = 0; - - te[ 4 ] = ( xy - wz ) * sy; - te[ 5 ] = ( 1 - ( xx + zz ) ) * sy; - te[ 6 ] = ( yz + wx ) * sy; - te[ 7 ] = 0; - - te[ 8 ] = ( xz + wy ) * sz; - te[ 9 ] = ( yz - wx ) * sz; - te[ 10 ] = ( 1 - ( xx + yy ) ) * sz; - te[ 11 ] = 0; - - te[ 12 ] = position.x; - te[ 13 ] = position.y; - te[ 14 ] = position.z; - te[ 15 ] = 1; - - return this; - - } - - decompose( position, quaternion, scale ) { - - const te = this.elements; - - let sx = _v1$1.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length(); - const sy = _v1$1.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length(); - const sz = _v1$1.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length(); - - // if determine is negative, we need to invert one scale - const det = this.determinant(); - if ( det < 0 ) sx = - sx; - - position.x = te[ 12 ]; - position.y = te[ 13 ]; - position.z = te[ 14 ]; - - // scale the rotation part - _m1.copy( this ); - - const invSX = 1 / sx; - const invSY = 1 / sy; - const invSZ = 1 / sz; - - _m1.elements[ 0 ] *= invSX; - _m1.elements[ 1 ] *= invSX; - _m1.elements[ 2 ] *= invSX; - - _m1.elements[ 4 ] *= invSY; - _m1.elements[ 5 ] *= invSY; - _m1.elements[ 6 ] *= invSY; - - _m1.elements[ 8 ] *= invSZ; - _m1.elements[ 9 ] *= invSZ; - _m1.elements[ 10 ] *= invSZ; - - quaternion.setFromRotationMatrix( _m1 ); - - scale.x = sx; - scale.y = sy; - scale.z = sz; - - return this; - - } - - makePerspective( left, right, top, bottom, near, far ) { - - if ( far === undefined ) { - - console.warn( 'THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.' ); - - } - - const te = this.elements; - const x = 2 * near / ( right - left ); - const y = 2 * near / ( top - bottom ); - - const a = ( right + left ) / ( right - left ); - const b = ( top + bottom ) / ( top - bottom ); - const c = - ( far + near ) / ( far - near ); - const d = - 2 * far * near / ( far - near ); - - te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0; - te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0; - te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d; - te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = - 1; te[ 15 ] = 0; - - return this; - - } - - makeOrthographic( left, right, top, bottom, near, far ) { - - const te = this.elements; - const w = 1.0 / ( right - left ); - const h = 1.0 / ( top - bottom ); - const p = 1.0 / ( far - near ); - - const x = ( right + left ) * w; - const y = ( top + bottom ) * h; - const z = ( far + near ) * p; - - te[ 0 ] = 2 * w; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = - x; - te[ 1 ] = 0; te[ 5 ] = 2 * h; te[ 9 ] = 0; te[ 13 ] = - y; - te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = - 2 * p; te[ 14 ] = - z; - te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1; - - return this; - - } - - equals( matrix ) { - - const te = this.elements; - const me = matrix.elements; - - for ( let i = 0; i < 16; i ++ ) { - - if ( te[ i ] !== me[ i ] ) return false; - - } - - return true; - - } - - fromArray( array, offset = 0 ) { - - for ( let i = 0; i < 16; i ++ ) { - - this.elements[ i ] = array[ i + offset ]; - - } - - return this; - - } - - toArray( array = [], offset = 0 ) { - - const te = this.elements; - - array[ offset ] = te[ 0 ]; - array[ offset + 1 ] = te[ 1 ]; - array[ offset + 2 ] = te[ 2 ]; - array[ offset + 3 ] = te[ 3 ]; - - array[ offset + 4 ] = te[ 4 ]; - array[ offset + 5 ] = te[ 5 ]; - array[ offset + 6 ] = te[ 6 ]; - array[ offset + 7 ] = te[ 7 ]; - - array[ offset + 8 ] = te[ 8 ]; - array[ offset + 9 ] = te[ 9 ]; - array[ offset + 10 ] = te[ 10 ]; - array[ offset + 11 ] = te[ 11 ]; - - array[ offset + 12 ] = te[ 12 ]; - array[ offset + 13 ] = te[ 13 ]; - array[ offset + 14 ] = te[ 14 ]; - array[ offset + 15 ] = te[ 15 ]; - - return array; - - } - -} - -Matrix4.prototype.isMatrix4 = true; - -const _v1$1 = /*@__PURE__*/ new Vector3(); -const _m1 = /*@__PURE__*/ new Matrix4(); -const _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 ); -const _one = /*@__PURE__*/ new Vector3( 1, 1, 1 ); -const _x = /*@__PURE__*/ new Vector3(); -const _y = /*@__PURE__*/ new Vector3(); -const _z = /*@__PURE__*/ new Vector3(); - -const _matrix = /*@__PURE__*/ new Matrix4(); -const _quaternion$1 = /*@__PURE__*/ new Quaternion(); - -class Euler { - - constructor( x = 0, y = 0, z = 0, order = Euler.DefaultOrder ) { - - this._x = x; - this._y = y; - this._z = z; - this._order = order; - - } - - get x() { - - return this._x; - - } - - set x( value ) { - - this._x = value; - this._onChangeCallback(); - - } - - get y() { - - return this._y; - - } - - set y( value ) { - - this._y = value; - this._onChangeCallback(); - - } - - get z() { - - return this._z; - - } - - set z( value ) { - - this._z = value; - this._onChangeCallback(); - - } - - get order() { - - return this._order; - - } - - set order( value ) { - - this._order = value; - this._onChangeCallback(); - - } - - set( x, y, z, order ) { - - this._x = x; - this._y = y; - this._z = z; - this._order = order || this._order; - - this._onChangeCallback(); - - return this; - - } - - clone() { - - return new this.constructor( this._x, this._y, this._z, this._order ); - - } - - copy( euler ) { - - this._x = euler._x; - this._y = euler._y; - this._z = euler._z; - this._order = euler._order; - - this._onChangeCallback(); - - return this; - - } - - setFromRotationMatrix( m, order, update ) { - - const clamp = MathUtils.clamp; - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - const te = m.elements; - const m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ]; - const m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ]; - const m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ]; - - order = order || this._order; - - switch ( order ) { - - case 'XYZ': - - this._y = Math.asin( clamp( m13, - 1, 1 ) ); - - if ( Math.abs( m13 ) < 0.9999999 ) { - - this._x = Math.atan2( - m23, m33 ); - this._z = Math.atan2( - m12, m11 ); - - } else { - - this._x = Math.atan2( m32, m22 ); - this._z = 0; - - } - - break; - - case 'YXZ': - - this._x = Math.asin( - clamp( m23, - 1, 1 ) ); - - if ( Math.abs( m23 ) < 0.9999999 ) { - - this._y = Math.atan2( m13, m33 ); - this._z = Math.atan2( m21, m22 ); - - } else { - - this._y = Math.atan2( - m31, m11 ); - this._z = 0; - - } - - break; - - case 'ZXY': - - this._x = Math.asin( clamp( m32, - 1, 1 ) ); - - if ( Math.abs( m32 ) < 0.9999999 ) { - - this._y = Math.atan2( - m31, m33 ); - this._z = Math.atan2( - m12, m22 ); - - } else { - - this._y = 0; - this._z = Math.atan2( m21, m11 ); - - } - - break; - - case 'ZYX': - - this._y = Math.asin( - clamp( m31, - 1, 1 ) ); - - if ( Math.abs( m31 ) < 0.9999999 ) { - - this._x = Math.atan2( m32, m33 ); - this._z = Math.atan2( m21, m11 ); - - } else { - - this._x = 0; - this._z = Math.atan2( - m12, m22 ); - - } - - break; - - case 'YZX': - - this._z = Math.asin( clamp( m21, - 1, 1 ) ); - - if ( Math.abs( m21 ) < 0.9999999 ) { - - this._x = Math.atan2( - m23, m22 ); - this._y = Math.atan2( - m31, m11 ); - - } else { - - this._x = 0; - this._y = Math.atan2( m13, m33 ); - - } - - break; - - case 'XZY': - - this._z = Math.asin( - clamp( m12, - 1, 1 ) ); - - if ( Math.abs( m12 ) < 0.9999999 ) { - - this._x = Math.atan2( m32, m22 ); - this._y = Math.atan2( m13, m11 ); - - } else { - - this._x = Math.atan2( - m23, m33 ); - this._y = 0; - - } - - break; - - default: - - console.warn( 'THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order ); - - } - - this._order = order; - - if ( update !== false ) this._onChangeCallback(); - - return this; - - } - - setFromQuaternion( q, order, update ) { - - _matrix.makeRotationFromQuaternion( q ); - - return this.setFromRotationMatrix( _matrix, order, update ); - - } - - setFromVector3( v, order ) { - - return this.set( v.x, v.y, v.z, order || this._order ); - - } - - reorder( newOrder ) { - - // WARNING: this discards revolution information -bhouston - - _quaternion$1.setFromEuler( this ); - - return this.setFromQuaternion( _quaternion$1, newOrder ); - - } - - equals( euler ) { - - return ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order ); - - } - - fromArray( array ) { - - this._x = array[ 0 ]; - this._y = array[ 1 ]; - this._z = array[ 2 ]; - if ( array[ 3 ] !== undefined ) this._order = array[ 3 ]; - - this._onChangeCallback(); - - return this; - - } - - toArray( array = [], offset = 0 ) { - - array[ offset ] = this._x; - array[ offset + 1 ] = this._y; - array[ offset + 2 ] = this._z; - array[ offset + 3 ] = this._order; - - return array; - - } - - toVector3( optionalResult ) { - - if ( optionalResult ) { - - return optionalResult.set( this._x, this._y, this._z ); - - } else { - - return new Vector3( this._x, this._y, this._z ); - - } - - } - - _onChange( callback ) { - - this._onChangeCallback = callback; - - return this; - - } - - _onChangeCallback() {} - -} - -Euler.prototype.isEuler = true; - -Euler.DefaultOrder = 'XYZ'; -Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ]; - -class Layers { - - constructor() { - - this.mask = 1 | 0; - - } - - set( channel ) { - - this.mask = 1 << channel | 0; - - } - - enable( channel ) { - - this.mask |= 1 << channel | 0; - - } - - enableAll() { - - this.mask = 0xffffffff | 0; - - } - - toggle( channel ) { - - this.mask ^= 1 << channel | 0; - - } - - disable( channel ) { - - this.mask &= ~ ( 1 << channel | 0 ); - - } - - disableAll() { - - this.mask = 0; - - } - - test( layers ) { - - return ( this.mask & layers.mask ) !== 0; - - } - -} - -let _object3DId = 0; - -const _v1$2 = new Vector3(); -const _q1 = new Quaternion(); -const _m1$1 = new Matrix4(); -const _target = new Vector3(); - -const _position = new Vector3(); -const _scale = new Vector3(); -const _quaternion$2 = new Quaternion(); - -const _xAxis = new Vector3( 1, 0, 0 ); -const _yAxis = new Vector3( 0, 1, 0 ); -const _zAxis = new Vector3( 0, 0, 1 ); - -const _addedEvent = { type: 'added' }; -const _removedEvent = { type: 'removed' }; - -function Object3D() { - - Object.defineProperty( this, 'id', { value: _object3DId ++ } ); - - this.uuid = MathUtils.generateUUID(); - - this.name = ''; - this.type = 'Object3D'; - - this.parent = null; - this.children = []; - - this.up = Object3D.DefaultUp.clone(); - - const position = new Vector3(); - const rotation = new Euler(); - const quaternion = new Quaternion(); - const scale = new Vector3( 1, 1, 1 ); - - function onRotationChange() { - - quaternion.setFromEuler( rotation, false ); - - } - - function onQuaternionChange() { - - rotation.setFromQuaternion( quaternion, undefined, false ); - - } - - rotation._onChange( onRotationChange ); - quaternion._onChange( onQuaternionChange ); - - Object.defineProperties( this, { - position: { - configurable: true, - enumerable: true, - value: position - }, - rotation: { - configurable: true, - enumerable: true, - value: rotation - }, - quaternion: { - configurable: true, - enumerable: true, - value: quaternion - }, - scale: { - configurable: true, - enumerable: true, - value: scale - }, - modelViewMatrix: { - value: new Matrix4() - }, - normalMatrix: { - value: new Matrix3() - } - } ); - - this.matrix = new Matrix4(); - this.matrixWorld = new Matrix4(); - - this.matrixAutoUpdate = Object3D.DefaultMatrixAutoUpdate; - this.matrixWorldNeedsUpdate = false; - - this.layers = new Layers(); - this.visible = true; - - this.castShadow = false; - this.receiveShadow = false; - - this.frustumCulled = true; - this.renderOrder = 0; - - this.animations = []; - - this.userData = {}; - -} - -Object3D.DefaultUp = new Vector3( 0, 1, 0 ); -Object3D.DefaultMatrixAutoUpdate = true; - -Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), { - - constructor: Object3D, - - isObject3D: true, - - onBeforeRender: function () {}, - onAfterRender: function () {}, - - applyMatrix4: function ( matrix ) { - - if ( this.matrixAutoUpdate ) this.updateMatrix(); - - this.matrix.premultiply( matrix ); - - this.matrix.decompose( this.position, this.quaternion, this.scale ); - - }, - - applyQuaternion: function ( q ) { - - this.quaternion.premultiply( q ); - - return this; - - }, - - setRotationFromAxisAngle: function ( axis, angle ) { - - // assumes axis is normalized - - this.quaternion.setFromAxisAngle( axis, angle ); - - }, - - setRotationFromEuler: function ( euler ) { - - this.quaternion.setFromEuler( euler, true ); - - }, - - setRotationFromMatrix: function ( m ) { - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - this.quaternion.setFromRotationMatrix( m ); - - }, - - setRotationFromQuaternion: function ( q ) { - - // assumes q is normalized - - this.quaternion.copy( q ); - - }, - - rotateOnAxis: function ( axis, angle ) { - - // rotate object on axis in object space - // axis is assumed to be normalized - - _q1.setFromAxisAngle( axis, angle ); - - this.quaternion.multiply( _q1 ); - - return this; - - }, - - rotateOnWorldAxis: function ( axis, angle ) { - - // rotate object on axis in world space - // axis is assumed to be normalized - // method assumes no rotated parent - - _q1.setFromAxisAngle( axis, angle ); - - this.quaternion.premultiply( _q1 ); - - return this; - - }, - - rotateX: function ( angle ) { - - return this.rotateOnAxis( _xAxis, angle ); - - }, - - rotateY: function ( angle ) { - - return this.rotateOnAxis( _yAxis, angle ); - - }, - - rotateZ: function ( angle ) { - - return this.rotateOnAxis( _zAxis, angle ); - - }, - - translateOnAxis: function ( axis, distance ) { - - // translate object by distance along axis in object space - // axis is assumed to be normalized - - _v1$2.copy( axis ).applyQuaternion( this.quaternion ); - - this.position.add( _v1$2.multiplyScalar( distance ) ); - - return this; - - }, - - translateX: function ( distance ) { - - return this.translateOnAxis( _xAxis, distance ); - - }, - - translateY: function ( distance ) { - - return this.translateOnAxis( _yAxis, distance ); - - }, - - translateZ: function ( distance ) { - - return this.translateOnAxis( _zAxis, distance ); - - }, - - localToWorld: function ( vector ) { - - return vector.applyMatrix4( this.matrixWorld ); - - }, - - worldToLocal: function ( vector ) { - - return vector.applyMatrix4( _m1$1.copy( this.matrixWorld ).invert() ); - - }, - - lookAt: function ( x, y, z ) { - - // This method does not support objects having non-uniformly-scaled parent(s) - - if ( x.isVector3 ) { - - _target.copy( x ); - - } else { - - _target.set( x, y, z ); - - } - - const parent = this.parent; - - this.updateWorldMatrix( true, false ); - - _position.setFromMatrixPosition( this.matrixWorld ); - - if ( this.isCamera || this.isLight ) { - - _m1$1.lookAt( _position, _target, this.up ); - - } else { - - _m1$1.lookAt( _target, _position, this.up ); - - } - - this.quaternion.setFromRotationMatrix( _m1$1 ); - - if ( parent ) { - - _m1$1.extractRotation( parent.matrixWorld ); - _q1.setFromRotationMatrix( _m1$1 ); - this.quaternion.premultiply( _q1.invert() ); - - } - - }, - - add: function ( object ) { - - if ( arguments.length > 1 ) { - - for ( let i = 0; i < arguments.length; i ++ ) { - - this.add( arguments[ i ] ); - - } - - return this; - - } - - if ( object === this ) { - - console.error( 'THREE.Object3D.add: object can\'t be added as a child of itself.', object ); - return this; - - } - - if ( object && object.isObject3D ) { - - if ( object.parent !== null ) { - - object.parent.remove( object ); - - } - - object.parent = this; - this.children.push( object ); - - object.dispatchEvent( _addedEvent ); - - } else { - - console.error( 'THREE.Object3D.add: object not an instance of THREE.Object3D.', object ); - - } - - return this; - - }, - - remove: function ( object ) { - - if ( arguments.length > 1 ) { - - for ( let i = 0; i < arguments.length; i ++ ) { - - this.remove( arguments[ i ] ); - - } - - return this; - - } - - const index = this.children.indexOf( object ); - - if ( index !== - 1 ) { - - object.parent = null; - this.children.splice( index, 1 ); - - object.dispatchEvent( _removedEvent ); - - } - - return this; - - }, - - clear: function () { - - for ( let i = 0; i < this.children.length; i ++ ) { - - const object = this.children[ i ]; - - object.parent = null; - - object.dispatchEvent( _removedEvent ); - - } - - this.children.length = 0; - - return this; - - - }, - - attach: function ( object ) { - - // adds object as a child of this, while maintaining the object's world transform - - this.updateWorldMatrix( true, false ); - - _m1$1.copy( this.matrixWorld ).invert(); - - if ( object.parent !== null ) { - - object.parent.updateWorldMatrix( true, false ); - - _m1$1.multiply( object.parent.matrixWorld ); - - } - - object.applyMatrix4( _m1$1 ); - - this.add( object ); - - object.updateWorldMatrix( false, true ); - - return this; - - }, - - getObjectById: function ( id ) { - - return this.getObjectByProperty( 'id', id ); - - }, - - getObjectByName: function ( name ) { - - return this.getObjectByProperty( 'name', name ); - - }, - - getObjectByProperty: function ( name, value ) { - - if ( this[ name ] === value ) return this; - - for ( let i = 0, l = this.children.length; i < l; i ++ ) { - - const child = this.children[ i ]; - const object = child.getObjectByProperty( name, value ); - - if ( object !== undefined ) { - - return object; - - } - - } - - return undefined; - - }, - - getWorldPosition: function ( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Object3D: .getWorldPosition() target is now required' ); - target = new Vector3(); - - } - - this.updateWorldMatrix( true, false ); - - return target.setFromMatrixPosition( this.matrixWorld ); - - }, - - getWorldQuaternion: function ( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Object3D: .getWorldQuaternion() target is now required' ); - target = new Quaternion(); - - } - - this.updateWorldMatrix( true, false ); - - this.matrixWorld.decompose( _position, target, _scale ); - - return target; - - }, - - getWorldScale: function ( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Object3D: .getWorldScale() target is now required' ); - target = new Vector3(); - - } - - this.updateWorldMatrix( true, false ); - - this.matrixWorld.decompose( _position, _quaternion$2, target ); - - return target; - - }, - - getWorldDirection: function ( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Object3D: .getWorldDirection() target is now required' ); - target = new Vector3(); - - } - - this.updateWorldMatrix( true, false ); - - const e = this.matrixWorld.elements; - - return target.set( e[ 8 ], e[ 9 ], e[ 10 ] ).normalize(); - - }, - - raycast: function () {}, - - traverse: function ( callback ) { - - callback( this ); - - const children = this.children; - - for ( let i = 0, l = children.length; i < l; i ++ ) { - - children[ i ].traverse( callback ); - - } - - }, - - traverseVisible: function ( callback ) { - - if ( this.visible === false ) return; - - callback( this ); - - const children = this.children; - - for ( let i = 0, l = children.length; i < l; i ++ ) { - - children[ i ].traverseVisible( callback ); - - } - - }, - - traverseAncestors: function ( callback ) { - - const parent = this.parent; - - if ( parent !== null ) { - - callback( parent ); - - parent.traverseAncestors( callback ); - - } - - }, - - updateMatrix: function () { - - this.matrix.compose( this.position, this.quaternion, this.scale ); - - this.matrixWorldNeedsUpdate = true; - - }, - - updateMatrixWorld: function ( force ) { - - if ( this.matrixAutoUpdate ) this.updateMatrix(); - - if ( this.matrixWorldNeedsUpdate || force ) { - - if ( this.parent === null ) { - - this.matrixWorld.copy( this.matrix ); - - } else { - - this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); - - } - - this.matrixWorldNeedsUpdate = false; - - force = true; - - } - - // update children - - const children = this.children; - - for ( let i = 0, l = children.length; i < l; i ++ ) { - - children[ i ].updateMatrixWorld( force ); - - } - - }, - - updateWorldMatrix: function ( updateParents, updateChildren ) { - - const parent = this.parent; - - if ( updateParents === true && parent !== null ) { - - parent.updateWorldMatrix( true, false ); - - } - - if ( this.matrixAutoUpdate ) this.updateMatrix(); - - if ( this.parent === null ) { - - this.matrixWorld.copy( this.matrix ); - - } else { - - this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); - - } - - // update children - - if ( updateChildren === true ) { - - const children = this.children; - - for ( let i = 0, l = children.length; i < l; i ++ ) { - - children[ i ].updateWorldMatrix( false, true ); - - } - - } - - }, - - toJSON: function ( meta ) { - - // meta is a string when called from JSON.stringify - const isRootObject = ( meta === undefined || typeof meta === 'string' ); - - const output = {}; - - // meta is a hash used to collect geometries, materials. - // not providing it implies that this is the root object - // being serialized. - if ( isRootObject ) { - - // initialize meta obj - meta = { - geometries: {}, - materials: {}, - textures: {}, - images: {}, - shapes: {}, - skeletons: {}, - animations: {} - }; - - output.metadata = { - version: 4.5, - type: 'Object', - generator: 'Object3D.toJSON' - }; - - } - - // standard Object3D serialization - - const object = {}; - - object.uuid = this.uuid; - object.type = this.type; - - if ( this.name !== '' ) object.name = this.name; - if ( this.castShadow === true ) object.castShadow = true; - if ( this.receiveShadow === true ) object.receiveShadow = true; - if ( this.visible === false ) object.visible = false; - if ( this.frustumCulled === false ) object.frustumCulled = false; - if ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder; - if ( JSON.stringify( this.userData ) !== '{}' ) object.userData = this.userData; - - object.layers = this.layers.mask; - object.matrix = this.matrix.toArray(); - - if ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false; - - // object specific properties - - if ( this.isInstancedMesh ) { - - object.type = 'InstancedMesh'; - object.count = this.count; - object.instanceMatrix = this.instanceMatrix.toJSON(); - - } - - // - - function serialize( library, element ) { - - if ( library[ element.uuid ] === undefined ) { - - library[ element.uuid ] = element.toJSON( meta ); - - } - - return element.uuid; - - } - - if ( this.isMesh || this.isLine || this.isPoints ) { - - object.geometry = serialize( meta.geometries, this.geometry ); - - const parameters = this.geometry.parameters; - - if ( parameters !== undefined && parameters.shapes !== undefined ) { - - const shapes = parameters.shapes; - - if ( Array.isArray( shapes ) ) { - - for ( let i = 0, l = shapes.length; i < l; i ++ ) { - - const shape = shapes[ i ]; - - serialize( meta.shapes, shape ); - - } - - } else { - - serialize( meta.shapes, shapes ); - - } - - } - - } - - if ( this.isSkinnedMesh ) { - - object.bindMode = this.bindMode; - object.bindMatrix = this.bindMatrix.toArray(); - - if ( this.skeleton !== undefined ) { - - serialize( meta.skeletons, this.skeleton ); - - object.skeleton = this.skeleton.uuid; - - } - - } - - if ( this.material !== undefined ) { - - if ( Array.isArray( this.material ) ) { - - const uuids = []; - - for ( let i = 0, l = this.material.length; i < l; i ++ ) { - - uuids.push( serialize( meta.materials, this.material[ i ] ) ); - - } - - object.material = uuids; - - } else { - - object.material = serialize( meta.materials, this.material ); - - } - - } - - // - - if ( this.children.length > 0 ) { - - object.children = []; - - for ( let i = 0; i < this.children.length; i ++ ) { - - object.children.push( this.children[ i ].toJSON( meta ).object ); - - } - - } - - // - - if ( this.animations.length > 0 ) { - - object.animations = []; - - for ( let i = 0; i < this.animations.length; i ++ ) { - - const animation = this.animations[ i ]; - - object.animations.push( serialize( meta.animations, animation ) ); - - } - - } - - if ( isRootObject ) { - - const geometries = extractFromCache( meta.geometries ); - const materials = extractFromCache( meta.materials ); - const textures = extractFromCache( meta.textures ); - const images = extractFromCache( meta.images ); - const shapes = extractFromCache( meta.shapes ); - const skeletons = extractFromCache( meta.skeletons ); - const animations = extractFromCache( meta.animations ); - - if ( geometries.length > 0 ) output.geometries = geometries; - if ( materials.length > 0 ) output.materials = materials; - if ( textures.length > 0 ) output.textures = textures; - if ( images.length > 0 ) output.images = images; - if ( shapes.length > 0 ) output.shapes = shapes; - if ( skeletons.length > 0 ) output.skeletons = skeletons; - if ( animations.length > 0 ) output.animations = animations; - - } - - output.object = object; - - return output; - - // extract data from the cache hash - // remove metadata on each item - // and return as array - function extractFromCache( cache ) { - - const values = []; - for ( const key in cache ) { - - const data = cache[ key ]; - delete data.metadata; - values.push( data ); - - } - - return values; - - } - - }, - - clone: function ( recursive ) { - - return new this.constructor().copy( this, recursive ); - - }, - - copy: function ( source, recursive = true ) { - - this.name = source.name; - - this.up.copy( source.up ); - - this.position.copy( source.position ); - this.rotation.order = source.rotation.order; - this.quaternion.copy( source.quaternion ); - this.scale.copy( source.scale ); - - this.matrix.copy( source.matrix ); - this.matrixWorld.copy( source.matrixWorld ); - - this.matrixAutoUpdate = source.matrixAutoUpdate; - this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate; - - this.layers.mask = source.layers.mask; - this.visible = source.visible; - - this.castShadow = source.castShadow; - this.receiveShadow = source.receiveShadow; - - this.frustumCulled = source.frustumCulled; - this.renderOrder = source.renderOrder; - - this.userData = JSON.parse( JSON.stringify( source.userData ) ); - - if ( recursive === true ) { - - for ( let i = 0; i < source.children.length; i ++ ) { - - const child = source.children[ i ]; - this.add( child.clone() ); - - } - - } - - return this; - - } - -} ); - -const _vector1 = /*@__PURE__*/ new Vector3(); -const _vector2 = /*@__PURE__*/ new Vector3(); -const _normalMatrix = /*@__PURE__*/ new Matrix3(); - -class Plane { - - constructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) { - - // normal is assumed to be normalized - - this.normal = normal; - this.constant = constant; - - } - - set( normal, constant ) { - - this.normal.copy( normal ); - this.constant = constant; - - return this; - - } - - setComponents( x, y, z, w ) { - - this.normal.set( x, y, z ); - this.constant = w; - - return this; - - } - - setFromNormalAndCoplanarPoint( normal, point ) { - - this.normal.copy( normal ); - this.constant = - point.dot( this.normal ); - - return this; - - } - - setFromCoplanarPoints( a, b, c ) { - - const normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize(); - - // Q: should an error be thrown if normal is zero (e.g. degenerate plane)? - - this.setFromNormalAndCoplanarPoint( normal, a ); - - return this; - - } - - copy( plane ) { - - this.normal.copy( plane.normal ); - this.constant = plane.constant; - - return this; - - } - - normalize() { - - // Note: will lead to a divide by zero if the plane is invalid. - - const inverseNormalLength = 1.0 / this.normal.length(); - this.normal.multiplyScalar( inverseNormalLength ); - this.constant *= inverseNormalLength; - - return this; - - } - - negate() { - - this.constant *= - 1; - this.normal.negate(); - - return this; - - } - - distanceToPoint( point ) { - - return this.normal.dot( point ) + this.constant; - - } - - distanceToSphere( sphere ) { - - return this.distanceToPoint( sphere.center ) - sphere.radius; - - } - - projectPoint( point, target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Plane: .projectPoint() target is now required' ); - target = new Vector3(); - - } - - return target.copy( this.normal ).multiplyScalar( - this.distanceToPoint( point ) ).add( point ); - - } - - intersectLine( line, target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Plane: .intersectLine() target is now required' ); - target = new Vector3(); - - } - - const direction = line.delta( _vector1 ); - - const denominator = this.normal.dot( direction ); - - if ( denominator === 0 ) { - - // line is coplanar, return origin - if ( this.distanceToPoint( line.start ) === 0 ) { - - return target.copy( line.start ); - - } - - // Unsure if this is the correct method to handle this case. - return undefined; - - } - - const t = - ( line.start.dot( this.normal ) + this.constant ) / denominator; - - if ( t < 0 || t > 1 ) { - - return undefined; - - } - - return target.copy( direction ).multiplyScalar( t ).add( line.start ); - - } - - intersectsLine( line ) { - - // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it. - - const startSign = this.distanceToPoint( line.start ); - const endSign = this.distanceToPoint( line.end ); - - return ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 ); - - } - - intersectsBox( box ) { - - return box.intersectsPlane( this ); - - } - - intersectsSphere( sphere ) { - - return sphere.intersectsPlane( this ); - - } - - coplanarPoint( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Plane: .coplanarPoint() target is now required' ); - target = new Vector3(); - - } - - return target.copy( this.normal ).multiplyScalar( - this.constant ); - - } - - applyMatrix4( matrix, optionalNormalMatrix ) { - - const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix ); - - const referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix ); - - const normal = this.normal.applyMatrix3( normalMatrix ).normalize(); - - this.constant = - referencePoint.dot( normal ); - - return this; - - } - - translate( offset ) { - - this.constant -= offset.dot( this.normal ); - - return this; - - } - - equals( plane ) { - - return plane.normal.equals( this.normal ) && ( plane.constant === this.constant ); - - } - - clone() { - - return new this.constructor().copy( this ); - - } - -} - -Plane.prototype.isPlane = true; - -const _v0$1 = /*@__PURE__*/ new Vector3(); -const _v1$3 = /*@__PURE__*/ new Vector3(); -const _v2$1 = /*@__PURE__*/ new Vector3(); -const _v3 = /*@__PURE__*/ new Vector3(); - -const _vab = /*@__PURE__*/ new Vector3(); -const _vac = /*@__PURE__*/ new Vector3(); -const _vbc = /*@__PURE__*/ new Vector3(); -const _vap = /*@__PURE__*/ new Vector3(); -const _vbp = /*@__PURE__*/ new Vector3(); -const _vcp = /*@__PURE__*/ new Vector3(); - -class Triangle { - - constructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) { - - this.a = a; - this.b = b; - this.c = c; - - } - - static getNormal( a, b, c, target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Triangle: .getNormal() target is now required' ); - target = new Vector3(); - - } - - target.subVectors( c, b ); - _v0$1.subVectors( a, b ); - target.cross( _v0$1 ); - - const targetLengthSq = target.lengthSq(); - if ( targetLengthSq > 0 ) { - - return target.multiplyScalar( 1 / Math.sqrt( targetLengthSq ) ); - - } - - return target.set( 0, 0, 0 ); - - } - - // static/instance method to calculate barycentric coordinates - // based on: http://www.blackpawn.com/texts/pointinpoly/default.html - static getBarycoord( point, a, b, c, target ) { - - _v0$1.subVectors( c, a ); - _v1$3.subVectors( b, a ); - _v2$1.subVectors( point, a ); - - const dot00 = _v0$1.dot( _v0$1 ); - const dot01 = _v0$1.dot( _v1$3 ); - const dot02 = _v0$1.dot( _v2$1 ); - const dot11 = _v1$3.dot( _v1$3 ); - const dot12 = _v1$3.dot( _v2$1 ); - - const denom = ( dot00 * dot11 - dot01 * dot01 ); - - if ( target === undefined ) { - - console.warn( 'THREE.Triangle: .getBarycoord() target is now required' ); - target = new Vector3(); - - } - - // collinear or singular triangle - if ( denom === 0 ) { - - // arbitrary location outside of triangle? - // not sure if this is the best idea, maybe should be returning undefined - return target.set( - 2, - 1, - 1 ); - - } - - const invDenom = 1 / denom; - const u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom; - const v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom; - - // barycentric coordinates must always sum to 1 - return target.set( 1 - u - v, v, u ); - - } - - static containsPoint( point, a, b, c ) { - - this.getBarycoord( point, a, b, c, _v3 ); - - return ( _v3.x >= 0 ) && ( _v3.y >= 0 ) && ( ( _v3.x + _v3.y ) <= 1 ); - - } - - static getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) { - - this.getBarycoord( point, p1, p2, p3, _v3 ); - - target.set( 0, 0 ); - target.addScaledVector( uv1, _v3.x ); - target.addScaledVector( uv2, _v3.y ); - target.addScaledVector( uv3, _v3.z ); - - return target; - - } - - static isFrontFacing( a, b, c, direction ) { - - _v0$1.subVectors( c, b ); - _v1$3.subVectors( a, b ); - - // strictly front facing - return ( _v0$1.cross( _v1$3 ).dot( direction ) < 0 ) ? true : false; - - } - - set( a, b, c ) { - - this.a.copy( a ); - this.b.copy( b ); - this.c.copy( c ); - - return this; - - } - - setFromPointsAndIndices( points, i0, i1, i2 ) { - - this.a.copy( points[ i0 ] ); - this.b.copy( points[ i1 ] ); - this.c.copy( points[ i2 ] ); - - return this; - - } - - clone() { - - return new this.constructor().copy( this ); - - } - - copy( triangle ) { - - this.a.copy( triangle.a ); - this.b.copy( triangle.b ); - this.c.copy( triangle.c ); - - return this; - - } - - getArea() { - - _v0$1.subVectors( this.c, this.b ); - _v1$3.subVectors( this.a, this.b ); - - return _v0$1.cross( _v1$3 ).length() * 0.5; - - } - - getMidpoint( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Triangle: .getMidpoint() target is now required' ); - target = new Vector3(); - - } - - return target.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 ); - - } - - getNormal( target ) { - - return Triangle.getNormal( this.a, this.b, this.c, target ); - - } - - getPlane( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Triangle: .getPlane() target is now required' ); - target = new Plane(); - - } - - return target.setFromCoplanarPoints( this.a, this.b, this.c ); - - } - - getBarycoord( point, target ) { - - return Triangle.getBarycoord( point, this.a, this.b, this.c, target ); - - } - - getUV( point, uv1, uv2, uv3, target ) { - - return Triangle.getUV( point, this.a, this.b, this.c, uv1, uv2, uv3, target ); - - } - - containsPoint( point ) { - - return Triangle.containsPoint( point, this.a, this.b, this.c ); - - } - - isFrontFacing( direction ) { - - return Triangle.isFrontFacing( this.a, this.b, this.c, direction ); - - } - - intersectsBox( box ) { - - return box.intersectsTriangle( this ); - - } - - closestPointToPoint( p, target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Triangle: .closestPointToPoint() target is now required' ); - target = new Vector3(); - - } - - const a = this.a, b = this.b, c = this.c; - let v, w; - - // algorithm thanks to Real-Time Collision Detection by Christer Ericson, - // published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc., - // under the accompanying license; see chapter 5.1.5 for detailed explanation. - // basically, we're distinguishing which of the voronoi regions of the triangle - // the point lies in with the minimum amount of redundant computation. - - _vab.subVectors( b, a ); - _vac.subVectors( c, a ); - _vap.subVectors( p, a ); - const d1 = _vab.dot( _vap ); - const d2 = _vac.dot( _vap ); - if ( d1 <= 0 && d2 <= 0 ) { - - // vertex region of A; barycentric coords (1, 0, 0) - return target.copy( a ); - - } - - _vbp.subVectors( p, b ); - const d3 = _vab.dot( _vbp ); - const d4 = _vac.dot( _vbp ); - if ( d3 >= 0 && d4 <= d3 ) { - - // vertex region of B; barycentric coords (0, 1, 0) - return target.copy( b ); - - } - - const vc = d1 * d4 - d3 * d2; - if ( vc <= 0 && d1 >= 0 && d3 <= 0 ) { - - v = d1 / ( d1 - d3 ); - // edge region of AB; barycentric coords (1-v, v, 0) - return target.copy( a ).addScaledVector( _vab, v ); - - } - - _vcp.subVectors( p, c ); - const d5 = _vab.dot( _vcp ); - const d6 = _vac.dot( _vcp ); - if ( d6 >= 0 && d5 <= d6 ) { - - // vertex region of C; barycentric coords (0, 0, 1) - return target.copy( c ); - - } - - const vb = d5 * d2 - d1 * d6; - if ( vb <= 0 && d2 >= 0 && d6 <= 0 ) { - - w = d2 / ( d2 - d6 ); - // edge region of AC; barycentric coords (1-w, 0, w) - return target.copy( a ).addScaledVector( _vac, w ); - - } - - const va = d3 * d6 - d5 * d4; - if ( va <= 0 && ( d4 - d3 ) >= 0 && ( d5 - d6 ) >= 0 ) { - - _vbc.subVectors( c, b ); - w = ( d4 - d3 ) / ( ( d4 - d3 ) + ( d5 - d6 ) ); - // edge region of BC; barycentric coords (0, 1-w, w) - return target.copy( b ).addScaledVector( _vbc, w ); // edge region of BC - - } - - // face region - const denom = 1 / ( va + vb + vc ); - // u = va * denom - v = vb * denom; - w = vc * denom; - - return target.copy( a ).addScaledVector( _vab, v ).addScaledVector( _vac, w ); - - } - - equals( triangle ) { - - return triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c ); - - } - -} - -let materialId = 0; - -function Material() { - - Object.defineProperty( this, 'id', { value: materialId ++ } ); - - this.uuid = MathUtils.generateUUID(); - - this.name = ''; - this.type = 'Material'; - - this.fog = true; - - this.blending = NormalBlending; - this.side = FrontSide; - this.vertexColors = false; - - this.opacity = 1; - this.transparent = false; - - this.blendSrc = SrcAlphaFactor; - this.blendDst = OneMinusSrcAlphaFactor; - this.blendEquation = AddEquation; - this.blendSrcAlpha = null; - this.blendDstAlpha = null; - this.blendEquationAlpha = null; - - this.depthFunc = LessEqualDepth; - this.depthTest = true; - this.depthWrite = true; - - this.stencilWriteMask = 0xff; - this.stencilFunc = AlwaysStencilFunc; - this.stencilRef = 0; - this.stencilFuncMask = 0xff; - this.stencilFail = KeepStencilOp; - this.stencilZFail = KeepStencilOp; - this.stencilZPass = KeepStencilOp; - this.stencilWrite = false; - - this.clippingPlanes = null; - this.clipIntersection = false; - this.clipShadows = false; - - this.shadowSide = null; - - this.colorWrite = true; - - this.precision = null; // override the renderer's default precision for this material - - this.polygonOffset = false; - this.polygonOffsetFactor = 0; - this.polygonOffsetUnits = 0; - - this.dithering = false; - - this.alphaTest = 0; - this.premultipliedAlpha = false; - - this.visible = true; - - this.toneMapped = true; - - this.userData = {}; - - this.version = 0; - -} - -Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ), { - - constructor: Material, - - isMaterial: true, - - onBeforeCompile: function ( /* shaderobject, renderer */ ) {}, - - customProgramCacheKey: function () { - - return this.onBeforeCompile.toString(); - - }, - - setValues: function ( values ) { - - if ( values === undefined ) return; - - for ( const key in values ) { - - const newValue = values[ key ]; - - if ( newValue === undefined ) { - - console.warn( 'THREE.Material: \'' + key + '\' parameter is undefined.' ); - continue; - - } - - // for backward compatability if shading is set in the constructor - if ( key === 'shading' ) { - - console.warn( 'THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.' ); - this.flatShading = ( newValue === FlatShading ) ? true : false; - continue; - - } - - const currentValue = this[ key ]; - - if ( currentValue === undefined ) { - - console.warn( 'THREE.' + this.type + ': \'' + key + '\' is not a property of this material.' ); - continue; - - } - - if ( currentValue && currentValue.isColor ) { - - currentValue.set( newValue ); - - } else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) { - - currentValue.copy( newValue ); - - } else { - - this[ key ] = newValue; - - } - - } - - }, - - toJSON: function ( meta ) { - - const isRoot = ( meta === undefined || typeof meta === 'string' ); - - if ( isRoot ) { - - meta = { - textures: {}, - images: {} - }; - - } - - const data = { - metadata: { - version: 4.5, - type: 'Material', - generator: 'Material.toJSON' - } - }; - - // standard Material serialization - data.uuid = this.uuid; - data.type = this.type; - - if ( this.name !== '' ) data.name = this.name; - - if ( this.color && this.color.isColor ) data.color = this.color.getHex(); - - if ( this.roughness !== undefined ) data.roughness = this.roughness; - if ( this.metalness !== undefined ) data.metalness = this.metalness; - - if ( this.sheen && this.sheen.isColor ) data.sheen = this.sheen.getHex(); - if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex(); - if ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity; - - if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex(); - if ( this.shininess !== undefined ) data.shininess = this.shininess; - if ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat; - if ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness; - - if ( this.clearcoatMap && this.clearcoatMap.isTexture ) { - - data.clearcoatMap = this.clearcoatMap.toJSON( meta ).uuid; - - } - - if ( this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture ) { - - data.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON( meta ).uuid; - - } - - if ( this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture ) { - - data.clearcoatNormalMap = this.clearcoatNormalMap.toJSON( meta ).uuid; - data.clearcoatNormalScale = this.clearcoatNormalScale.toArray(); - - } - - if ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid; - if ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid; - if ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid; - - if ( this.lightMap && this.lightMap.isTexture ) { - - data.lightMap = this.lightMap.toJSON( meta ).uuid; - data.lightMapIntensity = this.lightMapIntensity; - - } - - if ( this.aoMap && this.aoMap.isTexture ) { - - data.aoMap = this.aoMap.toJSON( meta ).uuid; - data.aoMapIntensity = this.aoMapIntensity; - - } - - if ( this.bumpMap && this.bumpMap.isTexture ) { - - data.bumpMap = this.bumpMap.toJSON( meta ).uuid; - data.bumpScale = this.bumpScale; - - } - - if ( this.normalMap && this.normalMap.isTexture ) { - - data.normalMap = this.normalMap.toJSON( meta ).uuid; - data.normalMapType = this.normalMapType; - data.normalScale = this.normalScale.toArray(); - - } - - if ( this.displacementMap && this.displacementMap.isTexture ) { - - data.displacementMap = this.displacementMap.toJSON( meta ).uuid; - data.displacementScale = this.displacementScale; - data.displacementBias = this.displacementBias; - - } - - if ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid; - if ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid; - - if ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid; - if ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid; - - if ( this.envMap && this.envMap.isTexture ) { - - data.envMap = this.envMap.toJSON( meta ).uuid; - data.reflectivity = this.reflectivity; // Scale behind envMap - data.refractionRatio = this.refractionRatio; - - if ( this.combine !== undefined ) data.combine = this.combine; - if ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity; - - } - - if ( this.gradientMap && this.gradientMap.isTexture ) { - - data.gradientMap = this.gradientMap.toJSON( meta ).uuid; - - } - - if ( this.size !== undefined ) data.size = this.size; - if ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation; - - if ( this.blending !== NormalBlending ) data.blending = this.blending; - if ( this.side !== FrontSide ) data.side = this.side; - if ( this.vertexColors ) data.vertexColors = true; - - if ( this.opacity < 1 ) data.opacity = this.opacity; - if ( this.transparent === true ) data.transparent = this.transparent; - - data.depthFunc = this.depthFunc; - data.depthTest = this.depthTest; - data.depthWrite = this.depthWrite; - - data.stencilWrite = this.stencilWrite; - data.stencilWriteMask = this.stencilWriteMask; - data.stencilFunc = this.stencilFunc; - data.stencilRef = this.stencilRef; - data.stencilFuncMask = this.stencilFuncMask; - data.stencilFail = this.stencilFail; - data.stencilZFail = this.stencilZFail; - data.stencilZPass = this.stencilZPass; - - // rotation (SpriteMaterial) - if ( this.rotation && this.rotation !== 0 ) data.rotation = this.rotation; - - if ( this.polygonOffset === true ) data.polygonOffset = true; - if ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor; - if ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits; - - if ( this.linewidth && this.linewidth !== 1 ) data.linewidth = this.linewidth; - if ( this.dashSize !== undefined ) data.dashSize = this.dashSize; - if ( this.gapSize !== undefined ) data.gapSize = this.gapSize; - if ( this.scale !== undefined ) data.scale = this.scale; - - if ( this.dithering === true ) data.dithering = true; - - if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest; - if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = this.premultipliedAlpha; - - if ( this.wireframe === true ) data.wireframe = this.wireframe; - if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth; - if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap; - if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin; - - if ( this.morphTargets === true ) data.morphTargets = true; - if ( this.morphNormals === true ) data.morphNormals = true; - if ( this.skinning === true ) data.skinning = true; - - if ( this.flatShading === true ) data.flatShading = this.flatShading; - - if ( this.visible === false ) data.visible = false; - - if ( this.toneMapped === false ) data.toneMapped = false; - - if ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData; - - // TODO: Copied from Object3D.toJSON - - function extractFromCache( cache ) { - - const values = []; - - for ( const key in cache ) { - - const data = cache[ key ]; - delete data.metadata; - values.push( data ); - - } - - return values; - - } - - if ( isRoot ) { - - const textures = extractFromCache( meta.textures ); - const images = extractFromCache( meta.images ); - - if ( textures.length > 0 ) data.textures = textures; - if ( images.length > 0 ) data.images = images; - - } - - return data; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( source ) { - - this.name = source.name; - - this.fog = source.fog; - - this.blending = source.blending; - this.side = source.side; - this.vertexColors = source.vertexColors; - - this.opacity = source.opacity; - this.transparent = source.transparent; - - this.blendSrc = source.blendSrc; - this.blendDst = source.blendDst; - this.blendEquation = source.blendEquation; - this.blendSrcAlpha = source.blendSrcAlpha; - this.blendDstAlpha = source.blendDstAlpha; - this.blendEquationAlpha = source.blendEquationAlpha; - - this.depthFunc = source.depthFunc; - this.depthTest = source.depthTest; - this.depthWrite = source.depthWrite; - - this.stencilWriteMask = source.stencilWriteMask; - this.stencilFunc = source.stencilFunc; - this.stencilRef = source.stencilRef; - this.stencilFuncMask = source.stencilFuncMask; - this.stencilFail = source.stencilFail; - this.stencilZFail = source.stencilZFail; - this.stencilZPass = source.stencilZPass; - this.stencilWrite = source.stencilWrite; - - const srcPlanes = source.clippingPlanes; - let dstPlanes = null; - - if ( srcPlanes !== null ) { - - const n = srcPlanes.length; - dstPlanes = new Array( n ); - - for ( let i = 0; i !== n; ++ i ) { - - dstPlanes[ i ] = srcPlanes[ i ].clone(); - - } - - } - - this.clippingPlanes = dstPlanes; - this.clipIntersection = source.clipIntersection; - this.clipShadows = source.clipShadows; - - this.shadowSide = source.shadowSide; - - this.colorWrite = source.colorWrite; - - this.precision = source.precision; - - this.polygonOffset = source.polygonOffset; - this.polygonOffsetFactor = source.polygonOffsetFactor; - this.polygonOffsetUnits = source.polygonOffsetUnits; - - this.dithering = source.dithering; - - this.alphaTest = source.alphaTest; - this.premultipliedAlpha = source.premultipliedAlpha; - - this.visible = source.visible; - - this.toneMapped = source.toneMapped; - - this.userData = JSON.parse( JSON.stringify( source.userData ) ); - - return this; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -} ); - -Object.defineProperty( Material.prototype, 'needsUpdate', { - - set: function ( value ) { - - if ( value === true ) this.version ++; - - } - -} ); - -const _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF, - 'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2, - 'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50, - 'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B, - 'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B, - 'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F, - 'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3, - 'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222, - 'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700, - 'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4, - 'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00, - 'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3, - 'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA, - 'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32, - 'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3, - 'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC, - 'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD, - 'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6, - 'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9, - 'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F, - 'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE, - 'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA, - 'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0, - 'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 }; - -const _hslA = { h: 0, s: 0, l: 0 }; -const _hslB = { h: 0, s: 0, l: 0 }; - -function hue2rgb( p, q, t ) { - - if ( t < 0 ) t += 1; - if ( t > 1 ) t -= 1; - if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t; - if ( t < 1 / 2 ) return q; - if ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t ); - return p; - -} - -function SRGBToLinear( c ) { - - return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 ); - -} - -function LinearToSRGB( c ) { - - return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055; - -} - -class Color { - - constructor( r, g, b ) { - - if ( g === undefined && b === undefined ) { - - // r is THREE.Color, hex or string - return this.set( r ); - - } - - return this.setRGB( r, g, b ); - - } - - set( value ) { - - if ( value && value.isColor ) { - - this.copy( value ); - - } else if ( typeof value === 'number' ) { - - this.setHex( value ); - - } else if ( typeof value === 'string' ) { - - this.setStyle( value ); - - } - - return this; - - } - - setScalar( scalar ) { - - this.r = scalar; - this.g = scalar; - this.b = scalar; - - return this; - - } - - setHex( hex ) { - - hex = Math.floor( hex ); - - this.r = ( hex >> 16 & 255 ) / 255; - this.g = ( hex >> 8 & 255 ) / 255; - this.b = ( hex & 255 ) / 255; - - return this; - - } - - setRGB( r, g, b ) { - - this.r = r; - this.g = g; - this.b = b; - - return this; - - } - - setHSL( h, s, l ) { - - // h,s,l ranges are in 0.0 - 1.0 - h = MathUtils.euclideanModulo( h, 1 ); - s = MathUtils.clamp( s, 0, 1 ); - l = MathUtils.clamp( l, 0, 1 ); - - if ( s === 0 ) { - - this.r = this.g = this.b = l; - - } else { - - const p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s ); - const q = ( 2 * l ) - p; - - this.r = hue2rgb( q, p, h + 1 / 3 ); - this.g = hue2rgb( q, p, h ); - this.b = hue2rgb( q, p, h - 1 / 3 ); - - } - - return this; - - } - - setStyle( style ) { - - function handleAlpha( string ) { - - if ( string === undefined ) return; - - if ( parseFloat( string ) < 1 ) { - - console.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' ); - - } - - } - - - let m; - - if ( m = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec( style ) ) { - - // rgb / hsl - - let color; - const name = m[ 1 ]; - const components = m[ 2 ]; - - switch ( name ) { - - case 'rgb': - case 'rgba': - - if ( color = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( components ) ) { - - // rgb(255,0,0) rgba(255,0,0,0.5) - this.r = Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255; - this.g = Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255; - this.b = Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255; - - handleAlpha( color[ 4 ] ); - - return this; - - } - - if ( color = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( components ) ) { - - // rgb(100%,0%,0%) rgba(100%,0%,0%,0.5) - this.r = Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100; - this.g = Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100; - this.b = Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100; - - handleAlpha( color[ 4 ] ); - - return this; - - } - - break; - - case 'hsl': - case 'hsla': - - if ( color = /^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( components ) ) { - - // hsl(120,50%,50%) hsla(120,50%,50%,0.5) - const h = parseFloat( color[ 1 ] ) / 360; - const s = parseInt( color[ 2 ], 10 ) / 100; - const l = parseInt( color[ 3 ], 10 ) / 100; - - handleAlpha( color[ 4 ] ); - - return this.setHSL( h, s, l ); - - } - - break; - - } - - } else if ( m = /^\#([A-Fa-f\d]+)$/.exec( style ) ) { - - // hex color - - const hex = m[ 1 ]; - const size = hex.length; - - if ( size === 3 ) { - - // #ff0 - this.r = parseInt( hex.charAt( 0 ) + hex.charAt( 0 ), 16 ) / 255; - this.g = parseInt( hex.charAt( 1 ) + hex.charAt( 1 ), 16 ) / 255; - this.b = parseInt( hex.charAt( 2 ) + hex.charAt( 2 ), 16 ) / 255; - - return this; - - } else if ( size === 6 ) { - - // #ff0000 - this.r = parseInt( hex.charAt( 0 ) + hex.charAt( 1 ), 16 ) / 255; - this.g = parseInt( hex.charAt( 2 ) + hex.charAt( 3 ), 16 ) / 255; - this.b = parseInt( hex.charAt( 4 ) + hex.charAt( 5 ), 16 ) / 255; - - return this; - - } - - } - - if ( style && style.length > 0 ) { - - return this.setColorName( style ); - - } - - return this; - - } - - setColorName( style ) { - - // color keywords - const hex = _colorKeywords[ style ]; - - if ( hex !== undefined ) { - - // red - this.setHex( hex ); - - } else { - - // unknown color - console.warn( 'THREE.Color: Unknown color ' + style ); - - } - - return this; - - } - - clone() { - - return new this.constructor( this.r, this.g, this.b ); - - } - - copy( color ) { - - this.r = color.r; - this.g = color.g; - this.b = color.b; - - return this; - - } - - copyGammaToLinear( color, gammaFactor = 2.0 ) { - - this.r = Math.pow( color.r, gammaFactor ); - this.g = Math.pow( color.g, gammaFactor ); - this.b = Math.pow( color.b, gammaFactor ); - - return this; - - } - - copyLinearToGamma( color, gammaFactor = 2.0 ) { - - const safeInverse = ( gammaFactor > 0 ) ? ( 1.0 / gammaFactor ) : 1.0; - - this.r = Math.pow( color.r, safeInverse ); - this.g = Math.pow( color.g, safeInverse ); - this.b = Math.pow( color.b, safeInverse ); - - return this; - - } - - convertGammaToLinear( gammaFactor ) { - - this.copyGammaToLinear( this, gammaFactor ); - - return this; - - } - - convertLinearToGamma( gammaFactor ) { - - this.copyLinearToGamma( this, gammaFactor ); - - return this; - - } - - copySRGBToLinear( color ) { - - this.r = SRGBToLinear( color.r ); - this.g = SRGBToLinear( color.g ); - this.b = SRGBToLinear( color.b ); - - return this; - - } - - copyLinearToSRGB( color ) { - - this.r = LinearToSRGB( color.r ); - this.g = LinearToSRGB( color.g ); - this.b = LinearToSRGB( color.b ); - - return this; - - } - - convertSRGBToLinear() { - - this.copySRGBToLinear( this ); - - return this; - - } - - convertLinearToSRGB() { - - this.copyLinearToSRGB( this ); - - return this; - - } - - getHex() { - - return ( this.r * 255 ) << 16 ^ ( this.g * 255 ) << 8 ^ ( this.b * 255 ) << 0; - - } - - getHexString() { - - return ( '000000' + this.getHex().toString( 16 ) ).slice( - 6 ); - - } - - getHSL( target ) { - - // h,s,l ranges are in 0.0 - 1.0 - - if ( target === undefined ) { - - console.warn( 'THREE.Color: .getHSL() target is now required' ); - target = { h: 0, s: 0, l: 0 }; - - } - - const r = this.r, g = this.g, b = this.b; - - const max = Math.max( r, g, b ); - const min = Math.min( r, g, b ); - - let hue, saturation; - const lightness = ( min + max ) / 2.0; - - if ( min === max ) { - - hue = 0; - saturation = 0; - - } else { - - const delta = max - min; - - saturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min ); - - switch ( max ) { - - case r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break; - case g: hue = ( b - r ) / delta + 2; break; - case b: hue = ( r - g ) / delta + 4; break; - - } - - hue /= 6; - - } - - target.h = hue; - target.s = saturation; - target.l = lightness; - - return target; - - } - - getStyle() { - - return 'rgb(' + ( ( this.r * 255 ) | 0 ) + ',' + ( ( this.g * 255 ) | 0 ) + ',' + ( ( this.b * 255 ) | 0 ) + ')'; - - } - - offsetHSL( h, s, l ) { - - this.getHSL( _hslA ); - - _hslA.h += h; _hslA.s += s; _hslA.l += l; - - this.setHSL( _hslA.h, _hslA.s, _hslA.l ); - - return this; - - } - - add( color ) { - - this.r += color.r; - this.g += color.g; - this.b += color.b; - - return this; - - } - - addColors( color1, color2 ) { - - this.r = color1.r + color2.r; - this.g = color1.g + color2.g; - this.b = color1.b + color2.b; - - return this; - - } - - addScalar( s ) { - - this.r += s; - this.g += s; - this.b += s; - - return this; - - } - - sub( color ) { - - this.r = Math.max( 0, this.r - color.r ); - this.g = Math.max( 0, this.g - color.g ); - this.b = Math.max( 0, this.b - color.b ); - - return this; - - } - - multiply( color ) { - - this.r *= color.r; - this.g *= color.g; - this.b *= color.b; - - return this; - - } - - multiplyScalar( s ) { - - this.r *= s; - this.g *= s; - this.b *= s; - - return this; - - } - - lerp( color, alpha ) { - - this.r += ( color.r - this.r ) * alpha; - this.g += ( color.g - this.g ) * alpha; - this.b += ( color.b - this.b ) * alpha; - - return this; - - } - - lerpColors( color1, color2, alpha ) { - - this.r = color1.r + ( color2.r - color1.r ) * alpha; - this.g = color1.g + ( color2.g - color1.g ) * alpha; - this.b = color1.b + ( color2.b - color1.b ) * alpha; - - return this; - - } - - lerpHSL( color, alpha ) { - - this.getHSL( _hslA ); - color.getHSL( _hslB ); - - const h = MathUtils.lerp( _hslA.h, _hslB.h, alpha ); - const s = MathUtils.lerp( _hslA.s, _hslB.s, alpha ); - const l = MathUtils.lerp( _hslA.l, _hslB.l, alpha ); - - this.setHSL( h, s, l ); - - return this; - - } - - equals( c ) { - - return ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b ); - - } - - fromArray( array, offset = 0 ) { - - this.r = array[ offset ]; - this.g = array[ offset + 1 ]; - this.b = array[ offset + 2 ]; - - return this; - - } - - toArray( array = [], offset = 0 ) { - - array[ offset ] = this.r; - array[ offset + 1 ] = this.g; - array[ offset + 2 ] = this.b; - - return array; - - } - - fromBufferAttribute( attribute, index ) { - - this.r = attribute.getX( index ); - this.g = attribute.getY( index ); - this.b = attribute.getZ( index ); - - if ( attribute.normalized === true ) { - - // assuming Uint8Array - - this.r /= 255; - this.g /= 255; - this.b /= 255; - - } - - return this; - - } - - toJSON() { - - return this.getHex(); - - } - -} - -Color.NAMES = _colorKeywords; - -Color.prototype.isColor = true; -Color.prototype.r = 1; -Color.prototype.g = 1; -Color.prototype.b = 1; - -/** - * parameters = { - * color: , - * opacity: , - * map: new THREE.Texture( ), - * - * lightMap: new THREE.Texture( ), - * lightMapIntensity: - * - * aoMap: new THREE.Texture( ), - * aoMapIntensity: - * - * specularMap: new THREE.Texture( ), - * - * alphaMap: new THREE.Texture( ), - * - * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: , - * refractionRatio: , - * - * depthTest: , - * depthWrite: , - * - * wireframe: , - * wireframeLinewidth: , - * - * skinning: , - * morphTargets: - * } - */ - -class MeshBasicMaterial extends Material { - - constructor( parameters ) { - - super(); - - this.type = 'MeshBasicMaterial'; - - this.color = new Color( 0xffffff ); // emissive - - this.map = null; - - this.lightMap = null; - this.lightMapIntensity = 1.0; - - this.aoMap = null; - this.aoMapIntensity = 1.0; - - this.specularMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.skinning = false; - this.morphTargets = false; - - this.setValues( parameters ); - - } - - copy( source ) { - - super.copy( source ); - - this.color.copy( source.color ); - - this.map = source.map; - - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.specularMap = source.specularMap; - - this.alphaMap = source.alphaMap; - - this.envMap = source.envMap; - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - - return this; - - } - -} - -MeshBasicMaterial.prototype.isMeshBasicMaterial = true; - -const _vector$3 = new Vector3(); -const _vector2$1 = new Vector2(); - -function BufferAttribute( array, itemSize, normalized ) { - - if ( Array.isArray( array ) ) { - - throw new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' ); - - } - - this.name = ''; - - this.array = array; - this.itemSize = itemSize; - this.count = array !== undefined ? array.length / itemSize : 0; - this.normalized = normalized === true; - - this.usage = StaticDrawUsage; - this.updateRange = { offset: 0, count: - 1 }; - - this.version = 0; - -} - -Object.defineProperty( BufferAttribute.prototype, 'needsUpdate', { - - set: function ( value ) { - - if ( value === true ) this.version ++; - - } - -} ); - -Object.assign( BufferAttribute.prototype, { - - isBufferAttribute: true, - - onUploadCallback: function () {}, - - setUsage: function ( value ) { - - this.usage = value; - - return this; - - }, - - copy: function ( source ) { - - this.name = source.name; - this.array = new source.array.constructor( source.array ); - this.itemSize = source.itemSize; - this.count = source.count; - this.normalized = source.normalized; - - this.usage = source.usage; - - return this; - - }, - - copyAt: function ( index1, attribute, index2 ) { - - index1 *= this.itemSize; - index2 *= attribute.itemSize; - - for ( let i = 0, l = this.itemSize; i < l; i ++ ) { - - this.array[ index1 + i ] = attribute.array[ index2 + i ]; - - } - - return this; - - }, - - copyArray: function ( array ) { - - this.array.set( array ); - - return this; - - }, - - copyColorsArray: function ( colors ) { - - const array = this.array; - let offset = 0; - - for ( let i = 0, l = colors.length; i < l; i ++ ) { - - let color = colors[ i ]; - - if ( color === undefined ) { - - console.warn( 'THREE.BufferAttribute.copyColorsArray(): color is undefined', i ); - color = new Color(); - - } - - array[ offset ++ ] = color.r; - array[ offset ++ ] = color.g; - array[ offset ++ ] = color.b; - - } - - return this; - - }, - - copyVector2sArray: function ( vectors ) { - - const array = this.array; - let offset = 0; - - for ( let i = 0, l = vectors.length; i < l; i ++ ) { - - let vector = vectors[ i ]; - - if ( vector === undefined ) { - - console.warn( 'THREE.BufferAttribute.copyVector2sArray(): vector is undefined', i ); - vector = new Vector2(); - - } - - array[ offset ++ ] = vector.x; - array[ offset ++ ] = vector.y; - - } - - return this; - - }, - - copyVector3sArray: function ( vectors ) { - - const array = this.array; - let offset = 0; - - for ( let i = 0, l = vectors.length; i < l; i ++ ) { - - let vector = vectors[ i ]; - - if ( vector === undefined ) { - - console.warn( 'THREE.BufferAttribute.copyVector3sArray(): vector is undefined', i ); - vector = new Vector3(); - - } - - array[ offset ++ ] = vector.x; - array[ offset ++ ] = vector.y; - array[ offset ++ ] = vector.z; - - } - - return this; - - }, - - copyVector4sArray: function ( vectors ) { - - const array = this.array; - let offset = 0; - - for ( let i = 0, l = vectors.length; i < l; i ++ ) { - - let vector = vectors[ i ]; - - if ( vector === undefined ) { - - console.warn( 'THREE.BufferAttribute.copyVector4sArray(): vector is undefined', i ); - vector = new Vector4(); - - } - - array[ offset ++ ] = vector.x; - array[ offset ++ ] = vector.y; - array[ offset ++ ] = vector.z; - array[ offset ++ ] = vector.w; - - } - - return this; - - }, - - applyMatrix3: function ( m ) { - - if ( this.itemSize === 2 ) { - - for ( let i = 0, l = this.count; i < l; i ++ ) { - - _vector2$1.fromBufferAttribute( this, i ); - _vector2$1.applyMatrix3( m ); - - this.setXY( i, _vector2$1.x, _vector2$1.y ); - - } - - } else if ( this.itemSize === 3 ) { - - for ( let i = 0, l = this.count; i < l; i ++ ) { - - _vector$3.fromBufferAttribute( this, i ); - _vector$3.applyMatrix3( m ); - - this.setXYZ( i, _vector$3.x, _vector$3.y, _vector$3.z ); - - } - - } - - return this; - - }, - - applyMatrix4: function ( m ) { - - for ( let i = 0, l = this.count; i < l; i ++ ) { - - _vector$3.x = this.getX( i ); - _vector$3.y = this.getY( i ); - _vector$3.z = this.getZ( i ); - - _vector$3.applyMatrix4( m ); - - this.setXYZ( i, _vector$3.x, _vector$3.y, _vector$3.z ); - - } - - return this; - - }, - - applyNormalMatrix: function ( m ) { - - for ( let i = 0, l = this.count; i < l; i ++ ) { - - _vector$3.x = this.getX( i ); - _vector$3.y = this.getY( i ); - _vector$3.z = this.getZ( i ); - - _vector$3.applyNormalMatrix( m ); - - this.setXYZ( i, _vector$3.x, _vector$3.y, _vector$3.z ); - - } - - return this; - - }, - - transformDirection: function ( m ) { - - for ( let i = 0, l = this.count; i < l; i ++ ) { - - _vector$3.x = this.getX( i ); - _vector$3.y = this.getY( i ); - _vector$3.z = this.getZ( i ); - - _vector$3.transformDirection( m ); - - this.setXYZ( i, _vector$3.x, _vector$3.y, _vector$3.z ); - - } - - return this; - - }, - - set: function ( value, offset = 0 ) { - - this.array.set( value, offset ); - - return this; - - }, - - getX: function ( index ) { - - return this.array[ index * this.itemSize ]; - - }, - - setX: function ( index, x ) { - - this.array[ index * this.itemSize ] = x; - - return this; - - }, - - getY: function ( index ) { - - return this.array[ index * this.itemSize + 1 ]; - - }, - - setY: function ( index, y ) { - - this.array[ index * this.itemSize + 1 ] = y; - - return this; - - }, - - getZ: function ( index ) { - - return this.array[ index * this.itemSize + 2 ]; - - }, - - setZ: function ( index, z ) { - - this.array[ index * this.itemSize + 2 ] = z; - - return this; - - }, - - getW: function ( index ) { - - return this.array[ index * this.itemSize + 3 ]; - - }, - - setW: function ( index, w ) { - - this.array[ index * this.itemSize + 3 ] = w; - - return this; - - }, - - setXY: function ( index, x, y ) { - - index *= this.itemSize; - - this.array[ index + 0 ] = x; - this.array[ index + 1 ] = y; - - return this; - - }, - - setXYZ: function ( index, x, y, z ) { - - index *= this.itemSize; - - this.array[ index + 0 ] = x; - this.array[ index + 1 ] = y; - this.array[ index + 2 ] = z; - - return this; - - }, - - setXYZW: function ( index, x, y, z, w ) { - - index *= this.itemSize; - - this.array[ index + 0 ] = x; - this.array[ index + 1 ] = y; - this.array[ index + 2 ] = z; - this.array[ index + 3 ] = w; - - return this; - - }, - - onUpload: function ( callback ) { - - this.onUploadCallback = callback; - - return this; - - }, - - clone: function () { - - return new this.constructor( this.array, this.itemSize ).copy( this ); - - }, - - toJSON: function () { - - return { - itemSize: this.itemSize, - type: this.array.constructor.name, - array: Array.prototype.slice.call( this.array ), - normalized: this.normalized - }; - - } - -} ); - -// - -function Int8BufferAttribute( array, itemSize, normalized ) { - - BufferAttribute.call( this, new Int8Array( array ), itemSize, normalized ); - -} - -Int8BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Int8BufferAttribute.prototype.constructor = Int8BufferAttribute; - - -function Uint8BufferAttribute( array, itemSize, normalized ) { - - BufferAttribute.call( this, new Uint8Array( array ), itemSize, normalized ); - -} - -Uint8BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Uint8BufferAttribute.prototype.constructor = Uint8BufferAttribute; - - -function Uint8ClampedBufferAttribute( array, itemSize, normalized ) { - - BufferAttribute.call( this, new Uint8ClampedArray( array ), itemSize, normalized ); - -} - -Uint8ClampedBufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Uint8ClampedBufferAttribute.prototype.constructor = Uint8ClampedBufferAttribute; - - -function Int16BufferAttribute( array, itemSize, normalized ) { - - BufferAttribute.call( this, new Int16Array( array ), itemSize, normalized ); - -} - -Int16BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Int16BufferAttribute.prototype.constructor = Int16BufferAttribute; - - -function Uint16BufferAttribute( array, itemSize, normalized ) { - - BufferAttribute.call( this, new Uint16Array( array ), itemSize, normalized ); - -} - -Uint16BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Uint16BufferAttribute.prototype.constructor = Uint16BufferAttribute; - - -function Int32BufferAttribute( array, itemSize, normalized ) { - - BufferAttribute.call( this, new Int32Array( array ), itemSize, normalized ); - -} - -Int32BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Int32BufferAttribute.prototype.constructor = Int32BufferAttribute; - - -function Uint32BufferAttribute( array, itemSize, normalized ) { - - BufferAttribute.call( this, new Uint32Array( array ), itemSize, normalized ); - -} - -Uint32BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Uint32BufferAttribute.prototype.constructor = Uint32BufferAttribute; - -function Float16BufferAttribute( array, itemSize, normalized ) { - - BufferAttribute.call( this, new Uint16Array( array ), itemSize, normalized ); - -} - -Float16BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Float16BufferAttribute.prototype.constructor = Float16BufferAttribute; -Float16BufferAttribute.prototype.isFloat16BufferAttribute = true; - -function Float32BufferAttribute( array, itemSize, normalized ) { - - BufferAttribute.call( this, new Float32Array( array ), itemSize, normalized ); - -} - -Float32BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Float32BufferAttribute.prototype.constructor = Float32BufferAttribute; - - -function Float64BufferAttribute( array, itemSize, normalized ) { - - BufferAttribute.call( this, new Float64Array( array ), itemSize, normalized ); - -} - -Float64BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Float64BufferAttribute.prototype.constructor = Float64BufferAttribute; - -function arrayMax( array ) { - - if ( array.length === 0 ) return - Infinity; - - let max = array[ 0 ]; - - for ( let i = 1, l = array.length; i < l; ++ i ) { - - if ( array[ i ] > max ) max = array[ i ]; - - } - - return max; - -} - -const TYPED_ARRAYS = { - Int8Array: Int8Array, - Uint8Array: Uint8Array, - Uint8ClampedArray: Uint8ClampedArray, - Int16Array: Int16Array, - Uint16Array: Uint16Array, - Int32Array: Int32Array, - Uint32Array: Uint32Array, - Float32Array: Float32Array, - Float64Array: Float64Array -}; - -function getTypedArray( type, buffer ) { - - return new TYPED_ARRAYS[ type ]( buffer ); - -} - -let _id = 0; - -const _m1$2 = new Matrix4(); -const _obj = new Object3D(); -const _offset = new Vector3(); -const _box$2 = new Box3(); -const _boxMorphTargets = new Box3(); -const _vector$4 = new Vector3(); - -function BufferGeometry() { - - Object.defineProperty( this, 'id', { value: _id ++ } ); - - this.uuid = MathUtils.generateUUID(); - - this.name = ''; - this.type = 'BufferGeometry'; - - this.index = null; - this.attributes = {}; - - this.morphAttributes = {}; - this.morphTargetsRelative = false; - - this.groups = []; - - this.boundingBox = null; - this.boundingSphere = null; - - this.drawRange = { start: 0, count: Infinity }; - - this.userData = {}; - -} - -BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), { - - constructor: BufferGeometry, - - isBufferGeometry: true, - - getIndex: function () { - - return this.index; - - }, - - setIndex: function ( index ) { - - if ( Array.isArray( index ) ) { - - this.index = new ( arrayMax( index ) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 ); - - } else { - - this.index = index; - - } - - return this; - - }, - - getAttribute: function ( name ) { - - return this.attributes[ name ]; - - }, - - setAttribute: function ( name, attribute ) { - - this.attributes[ name ] = attribute; - - return this; - - }, - - deleteAttribute: function ( name ) { - - delete this.attributes[ name ]; - - return this; - - }, - - hasAttribute: function ( name ) { - - return this.attributes[ name ] !== undefined; - - }, - - addGroup: function ( start, count, materialIndex = 0 ) { - - this.groups.push( { - - start: start, - count: count, - materialIndex: materialIndex - - } ); - - }, - - clearGroups: function () { - - this.groups = []; - - }, - - setDrawRange: function ( start, count ) { - - this.drawRange.start = start; - this.drawRange.count = count; - - }, - - applyMatrix4: function ( matrix ) { - - const position = this.attributes.position; - - if ( position !== undefined ) { - - position.applyMatrix4( matrix ); - - position.needsUpdate = true; - - } - - const normal = this.attributes.normal; - - if ( normal !== undefined ) { - - const normalMatrix = new Matrix3().getNormalMatrix( matrix ); - - normal.applyNormalMatrix( normalMatrix ); - - normal.needsUpdate = true; - - } - - const tangent = this.attributes.tangent; - - if ( tangent !== undefined ) { - - tangent.transformDirection( matrix ); - - tangent.needsUpdate = true; - - } - - if ( this.boundingBox !== null ) { - - this.computeBoundingBox(); - - } - - if ( this.boundingSphere !== null ) { - - this.computeBoundingSphere(); - - } - - return this; - - }, - - rotateX: function ( angle ) { - - // rotate geometry around world x-axis - - _m1$2.makeRotationX( angle ); - - this.applyMatrix4( _m1$2 ); - - return this; - - }, - - rotateY: function ( angle ) { - - // rotate geometry around world y-axis - - _m1$2.makeRotationY( angle ); - - this.applyMatrix4( _m1$2 ); - - return this; - - }, - - rotateZ: function ( angle ) { - - // rotate geometry around world z-axis - - _m1$2.makeRotationZ( angle ); - - this.applyMatrix4( _m1$2 ); - - return this; - - }, - - translate: function ( x, y, z ) { - - // translate geometry - - _m1$2.makeTranslation( x, y, z ); - - this.applyMatrix4( _m1$2 ); - - return this; - - }, - - scale: function ( x, y, z ) { - - // scale geometry - - _m1$2.makeScale( x, y, z ); - - this.applyMatrix4( _m1$2 ); - - return this; - - }, - - lookAt: function ( vector ) { - - _obj.lookAt( vector ); - - _obj.updateMatrix(); - - this.applyMatrix4( _obj.matrix ); - - return this; - - }, - - center: function () { - - this.computeBoundingBox(); - - this.boundingBox.getCenter( _offset ).negate(); - - this.translate( _offset.x, _offset.y, _offset.z ); - - return this; - - }, - - setFromPoints: function ( points ) { - - const position = []; - - for ( let i = 0, l = points.length; i < l; i ++ ) { - - const point = points[ i ]; - position.push( point.x, point.y, point.z || 0 ); - - } - - this.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) ); - - return this; - - }, - - computeBoundingBox: function () { - - if ( this.boundingBox === null ) { - - this.boundingBox = new Box3(); - - } - - const position = this.attributes.position; - const morphAttributesPosition = this.morphAttributes.position; - - if ( position && position.isGLBufferAttribute ) { - - console.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this ); - - this.boundingBox.set( - new Vector3( - Infinity, - Infinity, - Infinity ), - new Vector3( + Infinity, + Infinity, + Infinity ) - ); - - return; - - } - - if ( position !== undefined ) { - - this.boundingBox.setFromBufferAttribute( position ); - - // process morph attributes if present - - if ( morphAttributesPosition ) { - - for ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) { - - const morphAttribute = morphAttributesPosition[ i ]; - _box$2.setFromBufferAttribute( morphAttribute ); - - if ( this.morphTargetsRelative ) { - - _vector$4.addVectors( this.boundingBox.min, _box$2.min ); - this.boundingBox.expandByPoint( _vector$4 ); - - _vector$4.addVectors( this.boundingBox.max, _box$2.max ); - this.boundingBox.expandByPoint( _vector$4 ); - - } else { - - this.boundingBox.expandByPoint( _box$2.min ); - this.boundingBox.expandByPoint( _box$2.max ); - - } - - } - - } - - } else { - - this.boundingBox.makeEmpty(); - - } - - if ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) { - - console.error( 'THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this ); - - } - - }, - - computeBoundingSphere: function () { - - if ( this.boundingSphere === null ) { - - this.boundingSphere = new Sphere(); - - } - - const position = this.attributes.position; - const morphAttributesPosition = this.morphAttributes.position; - - if ( position && position.isGLBufferAttribute ) { - - console.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this ); - - this.boundingSphere.set( new Vector3(), Infinity ); - - return; - - } - - if ( position ) { - - // first, find the center of the bounding sphere - - const center = this.boundingSphere.center; - - _box$2.setFromBufferAttribute( position ); - - // process morph attributes if present - - if ( morphAttributesPosition ) { - - for ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) { - - const morphAttribute = morphAttributesPosition[ i ]; - _boxMorphTargets.setFromBufferAttribute( morphAttribute ); - - if ( this.morphTargetsRelative ) { - - _vector$4.addVectors( _box$2.min, _boxMorphTargets.min ); - _box$2.expandByPoint( _vector$4 ); - - _vector$4.addVectors( _box$2.max, _boxMorphTargets.max ); - _box$2.expandByPoint( _vector$4 ); - - } else { - - _box$2.expandByPoint( _boxMorphTargets.min ); - _box$2.expandByPoint( _boxMorphTargets.max ); - - } - - } - - } - - _box$2.getCenter( center ); - - // second, try to find a boundingSphere with a radius smaller than the - // boundingSphere of the boundingBox: sqrt(3) smaller in the best case - - let maxRadiusSq = 0; - - for ( let i = 0, il = position.count; i < il; i ++ ) { - - _vector$4.fromBufferAttribute( position, i ); - - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$4 ) ); - - } - - // process morph attributes if present - - if ( morphAttributesPosition ) { - - for ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) { - - const morphAttribute = morphAttributesPosition[ i ]; - const morphTargetsRelative = this.morphTargetsRelative; - - for ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) { - - _vector$4.fromBufferAttribute( morphAttribute, j ); - - if ( morphTargetsRelative ) { - - _offset.fromBufferAttribute( position, j ); - _vector$4.add( _offset ); - - } - - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$4 ) ); - - } - - } - - } - - this.boundingSphere.radius = Math.sqrt( maxRadiusSq ); - - if ( isNaN( this.boundingSphere.radius ) ) { - - console.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this ); - - } - - } - - }, - - computeFaceNormals: function () { - - // backwards compatibility - - }, - - computeTangents: function () { - - const index = this.index; - const attributes = this.attributes; - - // based on http://www.terathon.com/code/tangent.html - // (per vertex tangents) - - if ( index === null || - attributes.position === undefined || - attributes.normal === undefined || - attributes.uv === undefined ) { - - console.error( 'THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)' ); - return; - - } - - const indices = index.array; - const positions = attributes.position.array; - const normals = attributes.normal.array; - const uvs = attributes.uv.array; - - const nVertices = positions.length / 3; - - if ( attributes.tangent === undefined ) { - - this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) ); - - } - - const tangents = attributes.tangent.array; - - const tan1 = [], tan2 = []; - - for ( let i = 0; i < nVertices; i ++ ) { - - tan1[ i ] = new Vector3(); - tan2[ i ] = new Vector3(); - - } - - const vA = new Vector3(), - vB = new Vector3(), - vC = new Vector3(), - - uvA = new Vector2(), - uvB = new Vector2(), - uvC = new Vector2(), - - sdir = new Vector3(), - tdir = new Vector3(); - - function handleTriangle( a, b, c ) { - - vA.fromArray( positions, a * 3 ); - vB.fromArray( positions, b * 3 ); - vC.fromArray( positions, c * 3 ); - - uvA.fromArray( uvs, a * 2 ); - uvB.fromArray( uvs, b * 2 ); - uvC.fromArray( uvs, c * 2 ); - - vB.sub( vA ); - vC.sub( vA ); - - uvB.sub( uvA ); - uvC.sub( uvA ); - - const r = 1.0 / ( uvB.x * uvC.y - uvC.x * uvB.y ); - - // silently ignore degenerate uv triangles having coincident or colinear vertices - - if ( ! isFinite( r ) ) return; - - sdir.copy( vB ).multiplyScalar( uvC.y ).addScaledVector( vC, - uvB.y ).multiplyScalar( r ); - tdir.copy( vC ).multiplyScalar( uvB.x ).addScaledVector( vB, - uvC.x ).multiplyScalar( r ); - - tan1[ a ].add( sdir ); - tan1[ b ].add( sdir ); - tan1[ c ].add( sdir ); - - tan2[ a ].add( tdir ); - tan2[ b ].add( tdir ); - tan2[ c ].add( tdir ); - - } - - let groups = this.groups; - - if ( groups.length === 0 ) { - - groups = [ { - start: 0, - count: indices.length - } ]; - - } - - for ( let i = 0, il = groups.length; i < il; ++ i ) { - - const group = groups[ i ]; - - const start = group.start; - const count = group.count; - - for ( let j = start, jl = start + count; j < jl; j += 3 ) { - - handleTriangle( - indices[ j + 0 ], - indices[ j + 1 ], - indices[ j + 2 ] - ); - - } - - } - - const tmp = new Vector3(), tmp2 = new Vector3(); - const n = new Vector3(), n2 = new Vector3(); - - function handleVertex( v ) { - - n.fromArray( normals, v * 3 ); - n2.copy( n ); - - const t = tan1[ v ]; - - // Gram-Schmidt orthogonalize - - tmp.copy( t ); - tmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize(); - - // Calculate handedness - - tmp2.crossVectors( n2, t ); - const test = tmp2.dot( tan2[ v ] ); - const w = ( test < 0.0 ) ? - 1.0 : 1.0; - - tangents[ v * 4 ] = tmp.x; - tangents[ v * 4 + 1 ] = tmp.y; - tangents[ v * 4 + 2 ] = tmp.z; - tangents[ v * 4 + 3 ] = w; - - } - - for ( let i = 0, il = groups.length; i < il; ++ i ) { - - const group = groups[ i ]; - - const start = group.start; - const count = group.count; - - for ( let j = start, jl = start + count; j < jl; j += 3 ) { - - handleVertex( indices[ j + 0 ] ); - handleVertex( indices[ j + 1 ] ); - handleVertex( indices[ j + 2 ] ); - - } - - } - - }, - - computeVertexNormals: function () { - - const index = this.index; - const positionAttribute = this.getAttribute( 'position' ); - - if ( positionAttribute !== undefined ) { - - let normalAttribute = this.getAttribute( 'normal' ); - - if ( normalAttribute === undefined ) { - - normalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 ); - this.setAttribute( 'normal', normalAttribute ); - - } else { - - // reset existing normals to zero - - for ( let i = 0, il = normalAttribute.count; i < il; i ++ ) { - - normalAttribute.setXYZ( i, 0, 0, 0 ); - - } - - } - - const pA = new Vector3(), pB = new Vector3(), pC = new Vector3(); - const nA = new Vector3(), nB = new Vector3(), nC = new Vector3(); - const cb = new Vector3(), ab = new Vector3(); - - // indexed elements - - if ( index ) { - - for ( let i = 0, il = index.count; i < il; i += 3 ) { - - const vA = index.getX( i + 0 ); - const vB = index.getX( i + 1 ); - const vC = index.getX( i + 2 ); - - pA.fromBufferAttribute( positionAttribute, vA ); - pB.fromBufferAttribute( positionAttribute, vB ); - pC.fromBufferAttribute( positionAttribute, vC ); - - cb.subVectors( pC, pB ); - ab.subVectors( pA, pB ); - cb.cross( ab ); - - nA.fromBufferAttribute( normalAttribute, vA ); - nB.fromBufferAttribute( normalAttribute, vB ); - nC.fromBufferAttribute( normalAttribute, vC ); - - nA.add( cb ); - nB.add( cb ); - nC.add( cb ); - - normalAttribute.setXYZ( vA, nA.x, nA.y, nA.z ); - normalAttribute.setXYZ( vB, nB.x, nB.y, nB.z ); - normalAttribute.setXYZ( vC, nC.x, nC.y, nC.z ); - - } - - } else { - - // non-indexed elements (unconnected triangle soup) - - for ( let i = 0, il = positionAttribute.count; i < il; i += 3 ) { - - pA.fromBufferAttribute( positionAttribute, i + 0 ); - pB.fromBufferAttribute( positionAttribute, i + 1 ); - pC.fromBufferAttribute( positionAttribute, i + 2 ); - - cb.subVectors( pC, pB ); - ab.subVectors( pA, pB ); - cb.cross( ab ); - - normalAttribute.setXYZ( i + 0, cb.x, cb.y, cb.z ); - normalAttribute.setXYZ( i + 1, cb.x, cb.y, cb.z ); - normalAttribute.setXYZ( i + 2, cb.x, cb.y, cb.z ); - - } - - } - - this.normalizeNormals(); - - normalAttribute.needsUpdate = true; - - } - - }, - - merge: function ( geometry, offset ) { - - if ( ! ( geometry && geometry.isBufferGeometry ) ) { - - console.error( 'THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry ); - return; - - } - - if ( offset === undefined ) { - - offset = 0; - - console.warn( - 'THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. ' - + 'Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.' - ); - - } - - const attributes = this.attributes; - - for ( const key in attributes ) { - - if ( geometry.attributes[ key ] === undefined ) continue; - - const attribute1 = attributes[ key ]; - const attributeArray1 = attribute1.array; - - const attribute2 = geometry.attributes[ key ]; - const attributeArray2 = attribute2.array; - - const attributeOffset = attribute2.itemSize * offset; - const length = Math.min( attributeArray2.length, attributeArray1.length - attributeOffset ); - - for ( let i = 0, j = attributeOffset; i < length; i ++, j ++ ) { - - attributeArray1[ j ] = attributeArray2[ i ]; - - } - - } - - return this; - - }, - - normalizeNormals: function () { - - const normals = this.attributes.normal; - - for ( let i = 0, il = normals.count; i < il; i ++ ) { - - _vector$4.fromBufferAttribute( normals, i ); - - _vector$4.normalize(); - - normals.setXYZ( i, _vector$4.x, _vector$4.y, _vector$4.z ); - - } - - }, - - toNonIndexed: function () { - - function convertBufferAttribute( attribute, indices ) { - - const array = attribute.array; - const itemSize = attribute.itemSize; - const normalized = attribute.normalized; - - const array2 = new array.constructor( indices.length * itemSize ); - - let index = 0, index2 = 0; - - for ( let i = 0, l = indices.length; i < l; i ++ ) { - - index = indices[ i ] * itemSize; - - for ( let j = 0; j < itemSize; j ++ ) { - - array2[ index2 ++ ] = array[ index ++ ]; - - } - - } - - return new BufferAttribute( array2, itemSize, normalized ); - - } - - // - - if ( this.index === null ) { - - console.warn( 'THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.' ); - return this; - - } - - const geometry2 = new BufferGeometry(); - - const indices = this.index.array; - const attributes = this.attributes; - - // attributes - - for ( const name in attributes ) { - - const attribute = attributes[ name ]; - - const newAttribute = convertBufferAttribute( attribute, indices ); - - geometry2.setAttribute( name, newAttribute ); - - } - - // morph attributes - - const morphAttributes = this.morphAttributes; - - for ( const name in morphAttributes ) { - - const morphArray = []; - const morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes - - for ( let i = 0, il = morphAttribute.length; i < il; i ++ ) { - - const attribute = morphAttribute[ i ]; - - const newAttribute = convertBufferAttribute( attribute, indices ); - - morphArray.push( newAttribute ); - - } - - geometry2.morphAttributes[ name ] = morphArray; - - } - - geometry2.morphTargetsRelative = this.morphTargetsRelative; - - // groups - - const groups = this.groups; - - for ( let i = 0, l = groups.length; i < l; i ++ ) { - - const group = groups[ i ]; - geometry2.addGroup( group.start, group.count, group.materialIndex ); - - } - - return geometry2; - - }, - - toJSON: function () { - - const data = { - metadata: { - version: 4.5, - type: 'BufferGeometry', - generator: 'BufferGeometry.toJSON' - } - }; - - // standard BufferGeometry serialization - - data.uuid = this.uuid; - data.type = this.type; - if ( this.name !== '' ) data.name = this.name; - if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData; - - if ( this.parameters !== undefined ) { - - const parameters = this.parameters; - - for ( const key in parameters ) { - - if ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ]; - - } - - return data; - - } - - data.data = { attributes: {} }; - - const index = this.index; - - if ( index !== null ) { - - data.data.index = { - type: index.array.constructor.name, - array: Array.prototype.slice.call( index.array ) - }; - - } - - const attributes = this.attributes; - - for ( const key in attributes ) { - - const attribute = attributes[ key ]; - - const attributeData = attribute.toJSON( data.data ); - - if ( attribute.name !== '' ) attributeData.name = attribute.name; - - data.data.attributes[ key ] = attributeData; - - } - - const morphAttributes = {}; - let hasMorphAttributes = false; - - for ( const key in this.morphAttributes ) { - - const attributeArray = this.morphAttributes[ key ]; - - const array = []; - - for ( let i = 0, il = attributeArray.length; i < il; i ++ ) { - - const attribute = attributeArray[ i ]; - - const attributeData = attribute.toJSON( data.data ); - - if ( attribute.name !== '' ) attributeData.name = attribute.name; - - array.push( attributeData ); - - } - - if ( array.length > 0 ) { - - morphAttributes[ key ] = array; - - hasMorphAttributes = true; - - } - - } - - if ( hasMorphAttributes ) { - - data.data.morphAttributes = morphAttributes; - data.data.morphTargetsRelative = this.morphTargetsRelative; - - } - - const groups = this.groups; - - if ( groups.length > 0 ) { - - data.data.groups = JSON.parse( JSON.stringify( groups ) ); - - } - - const boundingSphere = this.boundingSphere; - - if ( boundingSphere !== null ) { - - data.data.boundingSphere = { - center: boundingSphere.center.toArray(), - radius: boundingSphere.radius - }; - - } - - return data; - - }, - - clone: function () { - - /* - // Handle primitives - - const parameters = this.parameters; - - if ( parameters !== undefined ) { - - const values = []; - - for ( const key in parameters ) { - - values.push( parameters[ key ] ); - - } - - const geometry = Object.create( this.constructor.prototype ); - this.constructor.apply( geometry, values ); - return geometry; - - } - - return new this.constructor().copy( this ); - */ - - return new BufferGeometry().copy( this ); - - }, - - copy: function ( source ) { - - // reset - - this.index = null; - this.attributes = {}; - this.morphAttributes = {}; - this.groups = []; - this.boundingBox = null; - this.boundingSphere = null; - - // used for storing cloned, shared data - - const data = {}; - - // name - - this.name = source.name; - - // index - - const index = source.index; - - if ( index !== null ) { - - this.setIndex( index.clone( data ) ); - - } - - // attributes - - const attributes = source.attributes; - - for ( const name in attributes ) { - - const attribute = attributes[ name ]; - this.setAttribute( name, attribute.clone( data ) ); - - } - - // morph attributes - - const morphAttributes = source.morphAttributes; - - for ( const name in morphAttributes ) { - - const array = []; - const morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes - - for ( let i = 0, l = morphAttribute.length; i < l; i ++ ) { - - array.push( morphAttribute[ i ].clone( data ) ); - - } - - this.morphAttributes[ name ] = array; - - } - - this.morphTargetsRelative = source.morphTargetsRelative; - - // groups - - const groups = source.groups; - - for ( let i = 0, l = groups.length; i < l; i ++ ) { - - const group = groups[ i ]; - this.addGroup( group.start, group.count, group.materialIndex ); - - } - - // bounding box - - const boundingBox = source.boundingBox; - - if ( boundingBox !== null ) { - - this.boundingBox = boundingBox.clone(); - - } - - // bounding sphere - - const boundingSphere = source.boundingSphere; - - if ( boundingSphere !== null ) { - - this.boundingSphere = boundingSphere.clone(); - - } - - // draw range - - this.drawRange.start = source.drawRange.start; - this.drawRange.count = source.drawRange.count; - - // user data - - this.userData = source.userData; - - return this; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -} ); - -const _inverseMatrix = new Matrix4(); -const _ray = new Ray(); -const _sphere = new Sphere(); - -const _vA = new Vector3(); -const _vB = new Vector3(); -const _vC = new Vector3(); - -const _tempA = new Vector3(); -const _tempB = new Vector3(); -const _tempC = new Vector3(); - -const _morphA = new Vector3(); -const _morphB = new Vector3(); -const _morphC = new Vector3(); - -const _uvA = new Vector2(); -const _uvB = new Vector2(); -const _uvC = new Vector2(); - -const _intersectionPoint = new Vector3(); -const _intersectionPointWorld = new Vector3(); - -function Mesh( geometry = new BufferGeometry(), material = new MeshBasicMaterial() ) { - - Object3D.call( this ); - - this.type = 'Mesh'; - - this.geometry = geometry; - this.material = material; - - this.updateMorphTargets(); - -} - -Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Mesh, - - isMesh: true, - - copy: function ( source ) { - - Object3D.prototype.copy.call( this, source ); - - if ( source.morphTargetInfluences !== undefined ) { - - this.morphTargetInfluences = source.morphTargetInfluences.slice(); - - } - - if ( source.morphTargetDictionary !== undefined ) { - - this.morphTargetDictionary = Object.assign( {}, source.morphTargetDictionary ); - - } - - this.material = source.material; - this.geometry = source.geometry; - - return this; - - }, - - updateMorphTargets: function () { - - const geometry = this.geometry; - - if ( geometry.isBufferGeometry ) { - - const morphAttributes = geometry.morphAttributes; - const keys = Object.keys( morphAttributes ); - - if ( keys.length > 0 ) { - - const morphAttribute = morphAttributes[ keys[ 0 ] ]; - - if ( morphAttribute !== undefined ) { - - this.morphTargetInfluences = []; - this.morphTargetDictionary = {}; - - for ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) { - - const name = morphAttribute[ m ].name || String( m ); - - this.morphTargetInfluences.push( 0 ); - this.morphTargetDictionary[ name ] = m; - - } - - } - - } - - } else { - - const morphTargets = geometry.morphTargets; - - if ( morphTargets !== undefined && morphTargets.length > 0 ) { - - console.error( 'THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' ); - - } - - } - - }, - - raycast: function ( raycaster, intersects ) { - - const geometry = this.geometry; - const material = this.material; - const matrixWorld = this.matrixWorld; - - if ( material === undefined ) return; - - // Checking boundingSphere distance to ray - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - _sphere.copy( geometry.boundingSphere ); - _sphere.applyMatrix4( matrixWorld ); - - if ( raycaster.ray.intersectsSphere( _sphere ) === false ) return; - - // - - _inverseMatrix.copy( matrixWorld ).invert(); - _ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix ); - - // Check boundingBox before continuing - - if ( geometry.boundingBox !== null ) { - - if ( _ray.intersectsBox( geometry.boundingBox ) === false ) return; - - } - - let intersection; - - if ( geometry.isBufferGeometry ) { - - const index = geometry.index; - const position = geometry.attributes.position; - const morphPosition = geometry.morphAttributes.position; - const morphTargetsRelative = geometry.morphTargetsRelative; - const uv = geometry.attributes.uv; - const uv2 = geometry.attributes.uv2; - const groups = geometry.groups; - const drawRange = geometry.drawRange; - - if ( index !== null ) { - - // indexed buffer geometry - - if ( Array.isArray( material ) ) { - - for ( let i = 0, il = groups.length; i < il; i ++ ) { - - const group = groups[ i ]; - const groupMaterial = material[ group.materialIndex ]; - - const start = Math.max( group.start, drawRange.start ); - const end = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ); - - for ( let j = start, jl = end; j < jl; j += 3 ) { - - const a = index.getX( j ); - const b = index.getX( j + 1 ); - const c = index.getX( j + 2 ); - - intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ); - - if ( intersection ) { - - intersection.faceIndex = Math.floor( j / 3 ); // triangle number in indexed buffer semantics - intersection.face.materialIndex = group.materialIndex; - intersects.push( intersection ); - - } - - } - - } - - } else { - - const start = Math.max( 0, drawRange.start ); - const end = Math.min( index.count, ( drawRange.start + drawRange.count ) ); - - for ( let i = start, il = end; i < il; i += 3 ) { - - const a = index.getX( i ); - const b = index.getX( i + 1 ); - const c = index.getX( i + 2 ); - - intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ); - - if ( intersection ) { - - intersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics - intersects.push( intersection ); - - } - - } - - } - - } else if ( position !== undefined ) { - - // non-indexed buffer geometry - - if ( Array.isArray( material ) ) { - - for ( let i = 0, il = groups.length; i < il; i ++ ) { - - const group = groups[ i ]; - const groupMaterial = material[ group.materialIndex ]; - - const start = Math.max( group.start, drawRange.start ); - const end = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ); - - for ( let j = start, jl = end; j < jl; j += 3 ) { - - const a = j; - const b = j + 1; - const c = j + 2; - - intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ); - - if ( intersection ) { - - intersection.faceIndex = Math.floor( j / 3 ); // triangle number in non-indexed buffer semantics - intersection.face.materialIndex = group.materialIndex; - intersects.push( intersection ); - - } - - } - - } - - } else { - - const start = Math.max( 0, drawRange.start ); - const end = Math.min( position.count, ( drawRange.start + drawRange.count ) ); - - for ( let i = start, il = end; i < il; i += 3 ) { - - const a = i; - const b = i + 1; - const c = i + 2; - - intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ); - - if ( intersection ) { - - intersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics - intersects.push( intersection ); - - } - - } - - } - - } - - } else if ( geometry.isGeometry ) { - - console.error( 'THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' ); - - } - - } - -} ); - -function checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) { - - let intersect; - - if ( material.side === BackSide ) { - - intersect = ray.intersectTriangle( pC, pB, pA, true, point ); - - } else { - - intersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point ); - - } - - if ( intersect === null ) return null; - - _intersectionPointWorld.copy( point ); - _intersectionPointWorld.applyMatrix4( object.matrixWorld ); - - const distance = raycaster.ray.origin.distanceTo( _intersectionPointWorld ); - - if ( distance < raycaster.near || distance > raycaster.far ) return null; - - return { - distance: distance, - point: _intersectionPointWorld.clone(), - object: object - }; - -} - -function checkBufferGeometryIntersection( object, material, raycaster, ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ) { - - _vA.fromBufferAttribute( position, a ); - _vB.fromBufferAttribute( position, b ); - _vC.fromBufferAttribute( position, c ); - - const morphInfluences = object.morphTargetInfluences; - - if ( material.morphTargets && morphPosition && morphInfluences ) { - - _morphA.set( 0, 0, 0 ); - _morphB.set( 0, 0, 0 ); - _morphC.set( 0, 0, 0 ); - - for ( let i = 0, il = morphPosition.length; i < il; i ++ ) { - - const influence = morphInfluences[ i ]; - const morphAttribute = morphPosition[ i ]; - - if ( influence === 0 ) continue; - - _tempA.fromBufferAttribute( morphAttribute, a ); - _tempB.fromBufferAttribute( morphAttribute, b ); - _tempC.fromBufferAttribute( morphAttribute, c ); - - if ( morphTargetsRelative ) { - - _morphA.addScaledVector( _tempA, influence ); - _morphB.addScaledVector( _tempB, influence ); - _morphC.addScaledVector( _tempC, influence ); - - } else { - - _morphA.addScaledVector( _tempA.sub( _vA ), influence ); - _morphB.addScaledVector( _tempB.sub( _vB ), influence ); - _morphC.addScaledVector( _tempC.sub( _vC ), influence ); - - } - - } - - _vA.add( _morphA ); - _vB.add( _morphB ); - _vC.add( _morphC ); - - } - - if ( object.isSkinnedMesh && material.skinning ) { - - object.boneTransform( a, _vA ); - object.boneTransform( b, _vB ); - object.boneTransform( c, _vC ); - - } - - const intersection = checkIntersection( object, material, raycaster, ray, _vA, _vB, _vC, _intersectionPoint ); - - if ( intersection ) { - - if ( uv ) { - - _uvA.fromBufferAttribute( uv, a ); - _uvB.fromBufferAttribute( uv, b ); - _uvC.fromBufferAttribute( uv, c ); - - intersection.uv = Triangle.getUV( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() ); - - } - - if ( uv2 ) { - - _uvA.fromBufferAttribute( uv2, a ); - _uvB.fromBufferAttribute( uv2, b ); - _uvC.fromBufferAttribute( uv2, c ); - - intersection.uv2 = Triangle.getUV( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() ); - - } - - const face = { - a: a, - b: b, - c: c, - normal: new Vector3(), - materialIndex: 0 - }; - - Triangle.getNormal( _vA, _vB, _vC, face.normal ); - - intersection.face = face; - - } - - return intersection; - -} - -class BoxGeometry extends BufferGeometry { - - constructor( width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1 ) { - - super(); - - this.type = 'BoxGeometry'; - - this.parameters = { - width: width, - height: height, - depth: depth, - widthSegments: widthSegments, - heightSegments: heightSegments, - depthSegments: depthSegments - }; - - const scope = this; - - // segments - - widthSegments = Math.floor( widthSegments ); - heightSegments = Math.floor( heightSegments ); - depthSegments = Math.floor( depthSegments ); - - // buffers - - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - - // helper variables - - let numberOfVertices = 0; - let groupStart = 0; - - // build each side of the box geometry - - buildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px - buildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx - buildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py - buildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny - buildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz - buildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz - - // build geometry - - this.setIndex( indices ); - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - function buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) { - - const segmentWidth = width / gridX; - const segmentHeight = height / gridY; - - const widthHalf = width / 2; - const heightHalf = height / 2; - const depthHalf = depth / 2; - - const gridX1 = gridX + 1; - const gridY1 = gridY + 1; - - let vertexCounter = 0; - let groupCount = 0; - - const vector = new Vector3(); - - // generate vertices, normals and uvs - - for ( let iy = 0; iy < gridY1; iy ++ ) { - - const y = iy * segmentHeight - heightHalf; - - for ( let ix = 0; ix < gridX1; ix ++ ) { - - const x = ix * segmentWidth - widthHalf; - - // set values to correct vector component - - vector[ u ] = x * udir; - vector[ v ] = y * vdir; - vector[ w ] = depthHalf; - - // now apply vector to vertex buffer - - vertices.push( vector.x, vector.y, vector.z ); - - // set values to correct vector component - - vector[ u ] = 0; - vector[ v ] = 0; - vector[ w ] = depth > 0 ? 1 : - 1; - - // now apply vector to normal buffer - - normals.push( vector.x, vector.y, vector.z ); - - // uvs - - uvs.push( ix / gridX ); - uvs.push( 1 - ( iy / gridY ) ); - - // counters - - vertexCounter += 1; - - } - - } - - // indices - - // 1. you need three indices to draw a single face - // 2. a single segment consists of two faces - // 3. so we need to generate six (2*3) indices per segment - - for ( let iy = 0; iy < gridY; iy ++ ) { - - for ( let ix = 0; ix < gridX; ix ++ ) { - - const a = numberOfVertices + ix + gridX1 * iy; - const b = numberOfVertices + ix + gridX1 * ( iy + 1 ); - const c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 ); - const d = numberOfVertices + ( ix + 1 ) + gridX1 * iy; - - // faces - - indices.push( a, b, d ); - indices.push( b, c, d ); - - // increase counter - - groupCount += 6; - - } - - } - - // add a group to the geometry. this will ensure multi material support - - scope.addGroup( groupStart, groupCount, materialIndex ); - - // calculate new start value for groups - - groupStart += groupCount; - - // update total number of vertices - - numberOfVertices += vertexCounter; - - } - - } - -} - -/** - * Uniform Utilities - */ - -function cloneUniforms( src ) { - - const dst = {}; - - for ( const u in src ) { - - dst[ u ] = {}; - - for ( const p in src[ u ] ) { - - const property = src[ u ][ p ]; - - if ( property && ( property.isColor || - property.isMatrix3 || property.isMatrix4 || - property.isVector2 || property.isVector3 || property.isVector4 || - property.isTexture || property.isQuaternion ) ) { - - dst[ u ][ p ] = property.clone(); - - } else if ( Array.isArray( property ) ) { - - dst[ u ][ p ] = property.slice(); - - } else { - - dst[ u ][ p ] = property; - - } - - } - - } - - return dst; - -} - -function mergeUniforms( uniforms ) { - - const merged = {}; - - for ( let u = 0; u < uniforms.length; u ++ ) { - - const tmp = cloneUniforms( uniforms[ u ] ); - - for ( const p in tmp ) { - - merged[ p ] = tmp[ p ]; - - } - - } - - return merged; - -} - -// Legacy - -const UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms }; - -var default_vertex = "void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"; - -var default_fragment = "void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}"; - -/** - * parameters = { - * defines: { "label" : "value" }, - * uniforms: { "parameter1": { value: 1.0 }, "parameter2": { value2: 2 } }, - * - * fragmentShader: , - * vertexShader: , - * - * wireframe: , - * wireframeLinewidth: , - * - * lights: , - * - * skinning: , - * morphTargets: , - * morphNormals: - * } - */ - -function ShaderMaterial( parameters ) { - - Material.call( this ); - - this.type = 'ShaderMaterial'; - - this.defines = {}; - this.uniforms = {}; - - this.vertexShader = default_vertex; - this.fragmentShader = default_fragment; - - this.linewidth = 1; - - this.wireframe = false; - this.wireframeLinewidth = 1; - - this.fog = false; // set to use scene fog - this.lights = false; // set to use scene lights - this.clipping = false; // set to use user-defined clipping planes - - this.skinning = false; // set to use skinning attribute streams - this.morphTargets = false; // set to use morph targets - this.morphNormals = false; // set to use morph normals - - this.extensions = { - derivatives: false, // set to use derivatives - fragDepth: false, // set to use fragment depth values - drawBuffers: false, // set to use draw buffers - shaderTextureLOD: false // set to use shader texture LOD - }; - - // When rendered geometry doesn't include these attributes but the material does, - // use these default values in WebGL. This avoids errors when buffer data is missing. - this.defaultAttributeValues = { - 'color': [ 1, 1, 1 ], - 'uv': [ 0, 0 ], - 'uv2': [ 0, 0 ] - }; - - this.index0AttributeName = undefined; - this.uniformsNeedUpdate = false; - - this.glslVersion = null; - - if ( parameters !== undefined ) { - - if ( parameters.attributes !== undefined ) { - - console.error( 'THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.' ); - - } - - this.setValues( parameters ); - - } - -} - -ShaderMaterial.prototype = Object.create( Material.prototype ); -ShaderMaterial.prototype.constructor = ShaderMaterial; - -ShaderMaterial.prototype.isShaderMaterial = true; - -ShaderMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.fragmentShader = source.fragmentShader; - this.vertexShader = source.vertexShader; - - this.uniforms = cloneUniforms( source.uniforms ); - - this.defines = Object.assign( {}, source.defines ); - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - - this.lights = source.lights; - this.clipping = source.clipping; - - this.skinning = source.skinning; - - this.morphTargets = source.morphTargets; - this.morphNormals = source.morphNormals; - - this.extensions = Object.assign( {}, source.extensions ); - - this.glslVersion = source.glslVersion; - - return this; - -}; - -ShaderMaterial.prototype.toJSON = function ( meta ) { - - const data = Material.prototype.toJSON.call( this, meta ); - - data.glslVersion = this.glslVersion; - data.uniforms = {}; - - for ( const name in this.uniforms ) { - - const uniform = this.uniforms[ name ]; - const value = uniform.value; - - if ( value && value.isTexture ) { - - data.uniforms[ name ] = { - type: 't', - value: value.toJSON( meta ).uuid - }; - - } else if ( value && value.isColor ) { - - data.uniforms[ name ] = { - type: 'c', - value: value.getHex() - }; - - } else if ( value && value.isVector2 ) { - - data.uniforms[ name ] = { - type: 'v2', - value: value.toArray() - }; - - } else if ( value && value.isVector3 ) { - - data.uniforms[ name ] = { - type: 'v3', - value: value.toArray() - }; - - } else if ( value && value.isVector4 ) { - - data.uniforms[ name ] = { - type: 'v4', - value: value.toArray() - }; - - } else if ( value && value.isMatrix3 ) { - - data.uniforms[ name ] = { - type: 'm3', - value: value.toArray() - }; - - } else if ( value && value.isMatrix4 ) { - - data.uniforms[ name ] = { - type: 'm4', - value: value.toArray() - }; - - } else { - - data.uniforms[ name ] = { - value: value - }; - - // note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far - - } - - } - - if ( Object.keys( this.defines ).length > 0 ) data.defines = this.defines; - - data.vertexShader = this.vertexShader; - data.fragmentShader = this.fragmentShader; - - const extensions = {}; - - for ( const key in this.extensions ) { - - if ( this.extensions[ key ] === true ) extensions[ key ] = true; - - } - - if ( Object.keys( extensions ).length > 0 ) data.extensions = extensions; - - return data; - -}; - -function Camera() { - - Object3D.call( this ); - - this.type = 'Camera'; - - this.matrixWorldInverse = new Matrix4(); - - this.projectionMatrix = new Matrix4(); - this.projectionMatrixInverse = new Matrix4(); - -} - -Camera.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Camera, - - isCamera: true, - - copy: function ( source, recursive ) { - - Object3D.prototype.copy.call( this, source, recursive ); - - this.matrixWorldInverse.copy( source.matrixWorldInverse ); - - this.projectionMatrix.copy( source.projectionMatrix ); - this.projectionMatrixInverse.copy( source.projectionMatrixInverse ); - - return this; - - }, - - getWorldDirection: function ( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Camera: .getWorldDirection() target is now required' ); - target = new Vector3(); - - } - - this.updateWorldMatrix( true, false ); - - const e = this.matrixWorld.elements; - - return target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize(); - - }, - - updateMatrixWorld: function ( force ) { - - Object3D.prototype.updateMatrixWorld.call( this, force ); - - this.matrixWorldInverse.copy( this.matrixWorld ).invert(); - - }, - - updateWorldMatrix: function ( updateParents, updateChildren ) { - - Object3D.prototype.updateWorldMatrix.call( this, updateParents, updateChildren ); - - this.matrixWorldInverse.copy( this.matrixWorld ).invert(); - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - } - -} ); - -function PerspectiveCamera( fov = 50, aspect = 1, near = 0.1, far = 2000 ) { - - Camera.call( this ); - - this.type = 'PerspectiveCamera'; - - this.fov = fov; - this.zoom = 1; - - this.near = near; - this.far = far; - this.focus = 10; - - this.aspect = aspect; - this.view = null; - - this.filmGauge = 35; // width of the film (default in millimeters) - this.filmOffset = 0; // horizontal film offset (same unit as gauge) - - this.updateProjectionMatrix(); - -} - -PerspectiveCamera.prototype = Object.assign( Object.create( Camera.prototype ), { - - constructor: PerspectiveCamera, - - isPerspectiveCamera: true, - - copy: function ( source, recursive ) { - - Camera.prototype.copy.call( this, source, recursive ); - - this.fov = source.fov; - this.zoom = source.zoom; - - this.near = source.near; - this.far = source.far; - this.focus = source.focus; - - this.aspect = source.aspect; - this.view = source.view === null ? null : Object.assign( {}, source.view ); - - this.filmGauge = source.filmGauge; - this.filmOffset = source.filmOffset; - - return this; - - }, - - /** - * Sets the FOV by focal length in respect to the current .filmGauge. - * - * The default film gauge is 35, so that the focal length can be specified for - * a 35mm (full frame) camera. - * - * Values for focal length and film gauge must have the same unit. - */ - setFocalLength: function ( focalLength ) { - - /** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */ - const vExtentSlope = 0.5 * this.getFilmHeight() / focalLength; - - this.fov = MathUtils.RAD2DEG * 2 * Math.atan( vExtentSlope ); - this.updateProjectionMatrix(); - - }, - - /** - * Calculates the focal length from the current .fov and .filmGauge. - */ - getFocalLength: function () { - - const vExtentSlope = Math.tan( MathUtils.DEG2RAD * 0.5 * this.fov ); - - return 0.5 * this.getFilmHeight() / vExtentSlope; - - }, - - getEffectiveFOV: function () { - - return MathUtils.RAD2DEG * 2 * Math.atan( - Math.tan( MathUtils.DEG2RAD * 0.5 * this.fov ) / this.zoom ); - - }, - - getFilmWidth: function () { - - // film not completely covered in portrait format (aspect < 1) - return this.filmGauge * Math.min( this.aspect, 1 ); - - }, - - getFilmHeight: function () { - - // film not completely covered in landscape format (aspect > 1) - return this.filmGauge / Math.max( this.aspect, 1 ); - - }, - - /** - * Sets an offset in a larger frustum. This is useful for multi-window or - * multi-monitor/multi-machine setups. - * - * For example, if you have 3x2 monitors and each monitor is 1920x1080 and - * the monitors are in grid like this - * - * +---+---+---+ - * | A | B | C | - * +---+---+---+ - * | D | E | F | - * +---+---+---+ - * - * then for each monitor you would call it like this - * - * const w = 1920; - * const h = 1080; - * const fullWidth = w * 3; - * const fullHeight = h * 2; - * - * --A-- - * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); - * --B-- - * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); - * --C-- - * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); - * --D-- - * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); - * --E-- - * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); - * --F-- - * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); - * - * Note there is no reason monitors have to be the same size or in a grid. - */ - setViewOffset: function ( fullWidth, fullHeight, x, y, width, height ) { - - this.aspect = fullWidth / fullHeight; - - if ( this.view === null ) { - - this.view = { - enabled: true, - fullWidth: 1, - fullHeight: 1, - offsetX: 0, - offsetY: 0, - width: 1, - height: 1 - }; - - } - - this.view.enabled = true; - this.view.fullWidth = fullWidth; - this.view.fullHeight = fullHeight; - this.view.offsetX = x; - this.view.offsetY = y; - this.view.width = width; - this.view.height = height; - - this.updateProjectionMatrix(); - - }, - - clearViewOffset: function () { - - if ( this.view !== null ) { - - this.view.enabled = false; - - } - - this.updateProjectionMatrix(); - - }, - - updateProjectionMatrix: function () { - - const near = this.near; - let top = near * Math.tan( MathUtils.DEG2RAD * 0.5 * this.fov ) / this.zoom; - let height = 2 * top; - let width = this.aspect * height; - let left = - 0.5 * width; - const view = this.view; - - if ( this.view !== null && this.view.enabled ) { - - const fullWidth = view.fullWidth, - fullHeight = view.fullHeight; - - left += view.offsetX * width / fullWidth; - top -= view.offsetY * height / fullHeight; - width *= view.width / fullWidth; - height *= view.height / fullHeight; - - } - - const skew = this.filmOffset; - if ( skew !== 0 ) left += near * skew / this.getFilmWidth(); - - this.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far ); - - this.projectionMatrixInverse.copy( this.projectionMatrix ).invert(); - - }, - - toJSON: function ( meta ) { - - const data = Object3D.prototype.toJSON.call( this, meta ); - - data.object.fov = this.fov; - data.object.zoom = this.zoom; - - data.object.near = this.near; - data.object.far = this.far; - data.object.focus = this.focus; - - data.object.aspect = this.aspect; - - if ( this.view !== null ) data.object.view = Object.assign( {}, this.view ); - - data.object.filmGauge = this.filmGauge; - data.object.filmOffset = this.filmOffset; - - return data; - - } - -} ); - -const fov = 90, aspect = 1; - -class CubeCamera extends Object3D { - - constructor( near, far, renderTarget ) { - - super(); - - this.type = 'CubeCamera'; - - if ( renderTarget.isWebGLCubeRenderTarget !== true ) { - - console.error( 'THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.' ); - return; - - } - - this.renderTarget = renderTarget; - - const cameraPX = new PerspectiveCamera( fov, aspect, near, far ); - cameraPX.layers = this.layers; - cameraPX.up.set( 0, - 1, 0 ); - cameraPX.lookAt( new Vector3( 1, 0, 0 ) ); - this.add( cameraPX ); - - const cameraNX = new PerspectiveCamera( fov, aspect, near, far ); - cameraNX.layers = this.layers; - cameraNX.up.set( 0, - 1, 0 ); - cameraNX.lookAt( new Vector3( - 1, 0, 0 ) ); - this.add( cameraNX ); - - const cameraPY = new PerspectiveCamera( fov, aspect, near, far ); - cameraPY.layers = this.layers; - cameraPY.up.set( 0, 0, 1 ); - cameraPY.lookAt( new Vector3( 0, 1, 0 ) ); - this.add( cameraPY ); - - const cameraNY = new PerspectiveCamera( fov, aspect, near, far ); - cameraNY.layers = this.layers; - cameraNY.up.set( 0, 0, - 1 ); - cameraNY.lookAt( new Vector3( 0, - 1, 0 ) ); - this.add( cameraNY ); - - const cameraPZ = new PerspectiveCamera( fov, aspect, near, far ); - cameraPZ.layers = this.layers; - cameraPZ.up.set( 0, - 1, 0 ); - cameraPZ.lookAt( new Vector3( 0, 0, 1 ) ); - this.add( cameraPZ ); - - const cameraNZ = new PerspectiveCamera( fov, aspect, near, far ); - cameraNZ.layers = this.layers; - cameraNZ.up.set( 0, - 1, 0 ); - cameraNZ.lookAt( new Vector3( 0, 0, - 1 ) ); - this.add( cameraNZ ); - - } - - update( renderer, scene ) { - - if ( this.parent === null ) this.updateMatrixWorld(); - - const renderTarget = this.renderTarget; - - const [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children; - - const currentXrEnabled = renderer.xr.enabled; - const currentRenderTarget = renderer.getRenderTarget(); - - renderer.xr.enabled = false; - - const generateMipmaps = renderTarget.texture.generateMipmaps; - - renderTarget.texture.generateMipmaps = false; - - renderer.setRenderTarget( renderTarget, 0 ); - renderer.render( scene, cameraPX ); - - renderer.setRenderTarget( renderTarget, 1 ); - renderer.render( scene, cameraNX ); - - renderer.setRenderTarget( renderTarget, 2 ); - renderer.render( scene, cameraPY ); - - renderer.setRenderTarget( renderTarget, 3 ); - renderer.render( scene, cameraNY ); - - renderer.setRenderTarget( renderTarget, 4 ); - renderer.render( scene, cameraPZ ); - - renderTarget.texture.generateMipmaps = generateMipmaps; - - renderer.setRenderTarget( renderTarget, 5 ); - renderer.render( scene, cameraNZ ); - - renderer.setRenderTarget( currentRenderTarget ); - - renderer.xr.enabled = currentXrEnabled; - - } - -} - -class CubeTexture extends Texture { - - constructor( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ) { - - images = images !== undefined ? images : []; - mapping = mapping !== undefined ? mapping : CubeReflectionMapping; - format = format !== undefined ? format : RGBFormat; - - super( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ); - - // Why CubeTexture._needsFlipEnvMap is necessary: - // - // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js) - // in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words, - // in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly. - - // three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped - // and the flag _needsFlipEnvMap controls this conversion. The flip is not required (and thus _needsFlipEnvMap is set to false) - // when using WebGLCubeRenderTarget.texture as a cube texture. - - this._needsFlipEnvMap = true; - - this.flipY = false; - - } - - get images() { - - return this.image; - - } - - set images( value ) { - - this.image = value; - - } - -} - -CubeTexture.prototype.isCubeTexture = true; - -class WebGLCubeRenderTarget extends WebGLRenderTarget { - - constructor( size, options, dummy ) { - - if ( Number.isInteger( options ) ) { - - console.warn( 'THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )' ); - - options = dummy; - - } - - super( size, size, options ); - - options = options || {}; - - this.texture = new CubeTexture( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding ); - - this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false; - this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter; - - this.texture._needsFlipEnvMap = false; - - } - - fromEquirectangularTexture( renderer, texture ) { - - this.texture.type = texture.type; - this.texture.format = RGBAFormat; // see #18859 - this.texture.encoding = texture.encoding; - - this.texture.generateMipmaps = texture.generateMipmaps; - this.texture.minFilter = texture.minFilter; - this.texture.magFilter = texture.magFilter; - - const shader = { - - uniforms: { - tEquirect: { value: null }, - }, - - vertexShader: /* glsl */` +var $a="128",Oy={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Uy={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},su=0,Qa=1,ou=2,Hy=3,Gy=0,Ka=1,au=2,Mi=3,Si=0,Qe=1,fr=2,el=1,ky=2,en=0,Ti=1,tl=2,nl=3,il=4,lu=5,Gn=100,cu=101,hu=102,rl=103,sl=104,uu=200,du=201,fu=202,pu=203,ol=204,al=205,mu=206,gu=207,xu=208,yu=209,vu=210,_u=0,wu=1,bu=2,Gs=3,Mu=4,Su=5,Tu=6,Eu=7,pr=0,Au=1,Lu=2,kn=0,Ru=1,Cu=2,Pu=3,Iu=4,Du=5,ks=300,mr=301,gr=302,Vs=303,Ws=304,Ei=306,xr=307,yr=1e3,xt=1001,vr=1002,nt=1003,qs=1004,Vy=1004,Xs=1005,Wy=1005,it=1006,ll=1007,qy=1007,Ai=1008,Xy=1008,Li=1009,Fu=1010,Nu=1011,_r=1012,Bu=1013,wr=1014,tn=1015,br=1016,zu=1017,Ou=1018,Uu=1019,Ri=1020,Hu=1021,Sn=1022,Tt=1023,Gu=1024,ku=1025,Vu=Tt,Vn=1026,Ci=1027,Wu=1028,qu=1029,Xu=1030,Yu=1031,Zu=1032,Ju=1033,cl=33776,hl=33777,ul=33778,dl=33779,fl=35840,pl=35841,ml=35842,gl=35843,ju=36196,xl=37492,yl=37496,$u=37808,Qu=37809,Ku=37810,ed=37811,td=37812,nd=37813,id=37814,rd=37815,sd=37816,od=37817,ad=37818,ld=37819,cd=37820,hd=37821,ud=36492,dd=37840,fd=37841,pd=37842,md=37843,gd=37844,xd=37845,yd=37846,vd=37847,_d=37848,wd=37849,bd=37850,Md=37851,Sd=37852,Td=37853,Ed=2200,Ad=2201,Ld=2202,Mr=2300,Sr=2301,Ys=2302,Wn=2400,qn=2401,Tr=2402,Zs=2500,vl=2501,Rd=0,Yy=1,Zy=2,yt=3e3,Er=3001,Js=3007,js=3002,Cd=3003,_l=3004,wl=3005,bl=3006,Pd=3200,Id=3201,Xn=0,Dd=1,Jy=0,$s=7680,jy=7681,$y=7682,Qy=7683,Ky=34055,ev=34056,tv=5386,nv=512,iv=513,rv=514,sv=515,ov=516,av=517,lv=518,Fd=519,Pi=35044,Ii=35048,cv=35040,hv=35045,uv=35049,dv=35041,fv=35046,pv=35050,mv=35042,gv="100",Ml="300 es",nn=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let i=this._listeners[e];if(i!==void 0){let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let n=this._listeners[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let r=0,o=i.length;r>8&255]+lt[s>>16&255]+lt[s>>24&255]+"-"+lt[e&255]+lt[e>>8&255]+"-"+lt[e>>16&15|64]+lt[e>>24&255]+"-"+lt[t&63|128]+lt[t>>8&255]+"-"+lt[t>>16&255]+lt[t>>24&255]+lt[n&255]+lt[n>>8&255]+lt[n>>16&255]+lt[n>>24&255]).toUpperCase()}function ct(s,e,t){return Math.max(e,Math.min(t,s))}function Qs(s,e){return(s%e+e)%e}function Nd(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function Bd(s,e,t){return s!==e?(t-s)/(e-s):0}function Fi(s,e,t){return(1-t)*s+t*e}function zd(s,e,t,n){return Fi(s,e,1-Math.exp(-t*n))}function Od(s,e=1){return e-Math.abs(Qs(s,e*2)-e)}function Ud(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function Hd(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function Gd(s,e){return s+Math.floor(Math.random()*(e-s+1))}function kd(s,e){return s+Math.random()*(e-s)}function Vd(s){return s*(.5-Math.random())}function Wd(s){return s!==void 0&&(Ar=s%2147483647),Ar=Ar*16807%2147483647,(Ar-1)/2147483646}function qd(s){return s*Tn}function Xd(s){return s*Di}function Ks(s){return(s&s-1)==0&&s!==0}function Sl(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function Tl(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function Yd(s,e,t,n,i){let r=Math.cos,o=Math.sin,a=r(t/2),c=o(t/2),l=r((e+n)/2),h=o((e+n)/2),u=r((e-n)/2),d=o((e-n)/2),f=r((n-e)/2),m=o((n-e)/2);switch(i){case"XYX":s.set(a*h,c*u,c*d,a*l);break;case"YZY":s.set(c*d,a*h,c*u,a*l);break;case"ZXZ":s.set(c*u,c*d,a*h,a*l);break;case"XZX":s.set(a*h,c*m,c*f,a*l);break;case"YXY":s.set(c*f,a*h,c*m,a*l);break;case"ZYZ":s.set(c*m,c*f,a*h,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}var xv=Object.freeze({__proto__:null,DEG2RAD:Tn,RAD2DEG:Di,generateUUID:wt,clamp:ct,euclideanModulo:Qs,mapLinear:Nd,inverseLerp:Bd,lerp:Fi,damp:zd,pingpong:Od,smoothstep:Ud,smootherstep:Hd,randInt:Gd,randFloat:kd,randFloatSpread:Vd,seededRandom:Wd,degToRad:qd,radToDeg:Xd,isPowerOfTwo:Ks,ceilPowerOfTwo:Sl,floorPowerOfTwo:Tl,setQuaternionFromProperEuler:Yd}),W=class{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,n){return n!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*n-o*i+e.x,this.y=r*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}};W.prototype.isVector2=!0;var Ke=class{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,o,a,c,l){let h=this.elements;return h[0]=e,h[1]=i,h[2]=a,h[3]=t,h[4]=r,h[5]=c,h[6]=n,h[7]=o,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[3],c=n[6],l=n[1],h=n[4],u=n[7],d=n[2],f=n[5],m=n[8],x=i[0],y=i[3],g=i[6],p=i[1],w=i[4],b=i[7],T=i[2],v=i[5],A=i[8];return r[0]=o*x+a*p+c*T,r[3]=o*y+a*w+c*v,r[6]=o*g+a*b+c*A,r[1]=l*x+h*p+u*T,r[4]=l*y+h*w+u*v,r[7]=l*g+h*b+u*A,r[2]=d*x+f*p+m*T,r[5]=d*y+f*w+m*v,r[8]=d*g+f*b+m*A,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8];return t*o*h-t*a*l-n*r*h+n*a*c+i*r*l-i*o*c}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8],u=h*o-a*l,d=a*c-h*r,f=l*r-o*c,m=t*u+n*d+i*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);let x=1/m;return e[0]=u*x,e[1]=(i*l-h*n)*x,e[2]=(a*n-i*o)*x,e[3]=d*x,e[4]=(h*t-i*c)*x,e[5]=(i*r-a*t)*x,e[6]=f*x,e[7]=(n*c-l*t)*x,e[8]=(o*t-n*r)*x,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,o,a){let c=Math.cos(r),l=Math.sin(r);return this.set(n*c,n*l,-n*(c*o+l*a)+o+e,-i*l,i*c,-i*(-l*o+c*a)+a+t,0,0,1),this}scale(e,t){let n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){let t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],o=i[3],a=i[6],c=i[1],l=i[4],h=i[7];return i[0]=t*r+n*c,i[3]=t*o+n*l,i[6]=t*a+n*h,i[1]=-n*r+t*c,i[4]=-n*o+t*l,i[7]=-n*a+t*h,this}translate(e,t){let n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Ke.prototype.isMatrix3=!0;var Yn,En=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Yn===void 0&&(Yn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Yn.width=e.width,Yn.height=e.height;let n=Yn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Yn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}},Zd=0,et=class extends nn{constructor(e=et.DEFAULT_IMAGE,t=et.DEFAULT_MAPPING,n=xt,i=xt,r=it,o=Ai,a=Tt,c=Li,l=1,h=yt){super();Object.defineProperty(this,"id",{value:Zd++}),this.uuid=wt(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=c,this.offset=new W(0,0),this.repeat=new W(1,1),this.center=new W(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ke,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){let i=this.image;if(i.uuid===void 0&&(i.uuid=wt()),!t&&e.images[i.uuid]===void 0){let r;if(Array.isArray(i)){r=[];for(let o=0,a=i.length;o1)switch(this.wrapS){case yr:e.x=e.x-Math.floor(e.x);break;case xt:e.x=e.x<0?0:1;break;case vr:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case yr:e.y=e.y-Math.floor(e.y);break;case xt:e.y=e.y<0?0:1;break;case vr:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&this.version++}};et.DEFAULT_IMAGE=void 0;et.DEFAULT_MAPPING=ks;et.prototype.isTexture=!0;function eo(s){return typeof HTMLImageElement!="undefined"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&s instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&s instanceof ImageBitmap?En.getDataURL(s):s.data?{data:Array.prototype.slice.call(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var Fe=class{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r,o=.01,a=.1,c=e.elements,l=c[0],h=c[4],u=c[8],d=c[1],f=c[5],m=c[9],x=c[2],y=c[6],g=c[10];if(Math.abs(h-d)b&&w>T?wT?b=0?1:-1,w=1-g*g;if(w>Number.EPSILON){let T=Math.sqrt(w),v=Math.atan2(T,g*p);y=Math.sin(y*v)/T,a=Math.sin(a*v)/T}let b=a*p;if(c=c*y+d*b,l=l*y+f*b,h=h*y+m*b,u=u*y+x*b,y===1-a){let T=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=T,l*=T,h*=T,u*=T}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,o){let a=n[i],c=n[i+1],l=n[i+2],h=n[i+3],u=r[o],d=r[o+1],f=r[o+2],m=r[o+3];return e[t]=a*m+h*u+c*f-l*d,e[t+1]=c*m+h*d+l*u-a*f,e[t+2]=l*m+h*f+a*d-c*u,e[t+3]=h*m-a*u-c*d-l*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");let n=e._x,i=e._y,r=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(n/2),h=a(i/2),u=a(r/2),d=c(n/2),f=c(i/2),m=c(r/2);switch(o){case"XYZ":this._x=d*h*u+l*f*m,this._y=l*f*u-d*h*m,this._z=l*h*m+d*f*u,this._w=l*h*u-d*f*m;break;case"YXZ":this._x=d*h*u+l*f*m,this._y=l*f*u-d*h*m,this._z=l*h*m-d*f*u,this._w=l*h*u+d*f*m;break;case"ZXY":this._x=d*h*u-l*f*m,this._y=l*f*u+d*h*m,this._z=l*h*m+d*f*u,this._w=l*h*u-d*f*m;break;case"ZYX":this._x=d*h*u-l*f*m,this._y=l*f*u+d*h*m,this._z=l*h*m-d*f*u,this._w=l*h*u+d*f*m;break;case"YZX":this._x=d*h*u+l*f*m,this._y=l*f*u+d*h*m,this._z=l*h*m-d*f*u,this._w=l*h*u-d*f*m;break;case"XZY":this._x=d*h*u-l*f*m,this._y=l*f*u-d*h*m,this._z=l*h*m+d*f*u,this._w=l*h*u+d*f*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],r=t[8],o=t[1],a=t[5],c=t[9],l=t[2],h=t[6],u=t[10],d=n+a+u;if(d>0){let f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-c)*f,this._y=(r-l)*f,this._z=(o-i)*f}else if(n>a&&n>u){let f=2*Math.sqrt(1+n-a-u);this._w=(h-c)/f,this._x=.25*f,this._y=(i+o)/f,this._z=(r+l)/f}else if(a>u){let f=2*Math.sqrt(1+a-n-u);this._w=(r-l)/f,this._x=(i+o)/f,this._y=.25*f,this._z=(c+h)/f}else{let f=2*Math.sqrt(1+u-n-a);this._w=(o-i)/f,this._x=(r+l)/f,this._y=(c+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ct(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,i=e._y,r=e._z,o=e._w,a=t._x,c=t._y,l=t._z,h=t._w;return this._x=n*h+o*a+i*l-r*c,this._y=i*h+o*c+r*a-n*l,this._z=r*h+o*l+n*c-i*a,this._w=o*h-n*a-i*c-r*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let n=this._x,i=this._y,r=this._z,o=this._w,a=o*e._w+n*e._x+i*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;let c=1-a*a;if(c<=Number.EPSILON){let f=1-t;return this._w=f*o+t*this._w,this._x=f*n+t*this._x,this._y=f*i+t*this._y,this._z=f*r+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(c),h=Math.atan2(l,a),u=Math.sin((1-t)*h)/l,d=Math.sin(t*h)/l;return this._w=o*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=r*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){this.copy(e).slerp(t,n)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};rt.prototype.isQuaternion=!0;var _=class{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Al.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Al.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,o=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,r=e.x,o=e.y,a=e.z,c=e.w,l=c*t+o*i-a*n,h=c*n+a*t-r*i,u=c*i+r*n-o*t,d=-r*t-o*n-a*i;return this.x=l*c+d*-r+h*-a-u*-o,this.y=h*c+d*-o+u*-r-l*-a,this.z=u*c+d*-a+l*-o-h*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,r=e.z,o=t.x,a=t.y,c=t.z;return this.x=i*c-r*a,this.y=r*o-n*c,this.z=n*a-i*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return to.copy(this).projectOnVector(e),this.sub(to)}reflect(e){return this.sub(to.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(ct(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return n!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}};_.prototype.isVector3=!0;var to=new _,Al=new rt,vt=class{constructor(e=new _(Infinity,Infinity,Infinity),t=new _(-Infinity,-Infinity,-Infinity)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=Infinity,n=Infinity,i=Infinity,r=-Infinity,o=-Infinity,a=-Infinity;for(let c=0,l=e.length;cr&&(r=h),u>o&&(o=u),d>a&&(a=d)}return this.min.set(t,n,i),this.max.set(r,o,a),this}setFromBufferAttribute(e){let t=Infinity,n=Infinity,i=Infinity,r=-Infinity,o=-Infinity,a=-Infinity;for(let c=0,l=e.count;cr&&(r=h),u>o&&(o=u),d>a&&(a=d)}return this.min.set(t,n,i),this.max.set(r,o,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t===void 0&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new _),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Ni),Ni.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Bi),Lr.subVectors(this.max,Bi),Zn.subVectors(e.a,Bi),Jn.subVectors(e.b,Bi),jn.subVectors(e.c,Bi),rn.subVectors(Jn,Zn),sn.subVectors(jn,Jn),An.subVectors(Zn,jn);let t=[0,-rn.z,rn.y,0,-sn.z,sn.y,0,-An.z,An.y,rn.z,0,-rn.x,sn.z,0,-sn.x,An.z,0,-An.x,-rn.y,rn.x,0,-sn.y,sn.x,0,-An.y,An.x,0];return!io(t,Zn,Jn,jn,Lr)||(t=[1,0,0,0,1,0,0,0,1],!io(t,Zn,Jn,jn,Lr))?!1:(Rr.crossVectors(rn,sn),t=[Rr.x,Rr.y,Rr.z],io(t,Zn,Jn,jn,Lr))}clampPoint(e,t){return t===void 0&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new _),t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Ni.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return e===void 0&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=this.getSize(Ni).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Wt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Wt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Wt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Wt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Wt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Wt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Wt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Wt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Wt),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};vt.prototype.isBox3=!0;var Wt=[new _,new _,new _,new _,new _,new _,new _,new _],Ni=new _,no=new vt,Zn=new _,Jn=new _,jn=new _,rn=new _,sn=new _,An=new _,Bi=new _,Lr=new _,Rr=new _,Ln=new _;function io(s,e,t,n,i){for(let r=0,o=s.length-3;r<=o;r+=3){Ln.fromArray(s,r);let a=i.x*Math.abs(Ln.x)+i.y*Math.abs(Ln.y)+i.z*Math.abs(Ln.z),c=e.dot(Ln),l=t.dot(Ln),h=n.dot(Ln);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>a)return!1}return!0}var Jd=new vt,Ll=new _,ro=new _,so=new _,on=class{constructor(e=new _,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):Jd.setFromPoints(e).getCenter(n);let i=0;for(let r=0,o=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return e===void 0&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new vt),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){so.subVectors(e,this.center);let t=so.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.add(so.multiplyScalar(i/n)),this.radius+=i}return this}union(e){return ro.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Ll.copy(e.center).add(ro)),this.expandByPoint(Ll.copy(e.center).sub(ro)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},qt=new _,oo=new _,Cr=new _,an=new _,ao=new _,Pr=new _,lo=new _,ln=class{constructor(e=new _,t=new _(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t===void 0&&(console.warn("THREE.Ray: .at() target is now required"),t=new _),t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,qt)),this}closestPointToPoint(e,t){t===void 0&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new _),t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=qt.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(qt.copy(this.direction).multiplyScalar(t).add(this.origin),qt.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){oo.copy(e).add(t).multiplyScalar(.5),Cr.copy(t).sub(e).normalize(),an.copy(this.origin).sub(oo);let r=e.distanceTo(t)*.5,o=-this.direction.dot(Cr),a=an.dot(this.direction),c=-an.dot(Cr),l=an.lengthSq(),h=Math.abs(1-o*o),u,d,f,m;if(h>0)if(u=o*c-a,d=o*a-c,m=r*h,u>=0)if(d>=-m)if(d<=m){let x=1/h;u*=x,d*=x,f=u*(u+o*d+2*a)+d*(o*u+d+2*c)+l}else d=r,u=Math.max(0,-(o*d+a)),f=-u*u+d*(d+2*c)+l;else d=-r,u=Math.max(0,-(o*d+a)),f=-u*u+d*(d+2*c)+l;else d<=-m?(u=Math.max(0,-(-o*r+a)),d=u>0?-r:Math.min(Math.max(-r,-c),r),f=-u*u+d*(d+2*c)+l):d<=m?(u=0,d=Math.min(Math.max(-r,-c),r),f=d*(d+2*c)+l):(u=Math.max(0,-(o*r+a)),d=u>0?r:Math.min(Math.max(-r,-c),r),f=-u*u+d*(d+2*c)+l);else d=o>0?-r:r,u=Math.max(0,-(o*d+a)),f=-u*u+d*(d+2*c)+l;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),i&&i.copy(Cr).multiplyScalar(d).add(oo),f}intersectSphere(e,t){qt.subVectors(e.center,this.origin);let n=qt.dot(this.direction),i=qt.dot(qt)-n*n,r=e.radius*e.radius;if(i>r)return null;let o=Math.sqrt(r-i),a=n-o,c=n+o;return a<0&&c<0?null:a<0?this.at(c,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,o,a,c,l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),h>=0?(r=(e.min.y-d.y)*h,o=(e.max.y-d.y)*h):(r=(e.max.y-d.y)*h,o=(e.min.y-d.y)*h),n>o||r>i||((r>n||n!==n)&&(n=r),(o=0?(a=(e.min.z-d.z)*u,c=(e.max.z-d.z)*u):(a=(e.max.z-d.z)*u,c=(e.min.z-d.z)*u),n>c||a>i)||((a>n||n!==n)&&(n=a),(c=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,qt)!==null}intersectTriangle(e,t,n,i,r){ao.subVectors(t,e),Pr.subVectors(n,e),lo.crossVectors(ao,Pr);let o=this.direction.dot(lo),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;an.subVectors(this.origin,e);let c=a*this.direction.dot(Pr.crossVectors(an,Pr));if(c<0)return null;let l=a*this.direction.dot(ao.cross(an));if(l<0||c+l>o)return null;let h=-a*an.dot(lo);return h<0?null:this.at(h/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},le=class{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,o,a,c,l,h,u,d,f,m,x,y){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=a,g[13]=c,g[2]=l,g[6]=h,g[10]=u,g[14]=d,g[3]=f,g[7]=m,g[11]=x,g[15]=y,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new le().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,i=1/$n.setFromMatrixColumn(e,0).length(),r=1/$n.setFromMatrixColumn(e,1).length(),o=1/$n.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");let t=this.elements,n=e.x,i=e.y,r=e.z,o=Math.cos(n),a=Math.sin(n),c=Math.cos(i),l=Math.sin(i),h=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){let d=o*h,f=o*u,m=a*h,x=a*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=f+m*l,t[5]=d-x*l,t[9]=-a*c,t[2]=x-d*l,t[6]=m+f*l,t[10]=o*c}else if(e.order==="YXZ"){let d=c*h,f=c*u,m=l*h,x=l*u;t[0]=d+x*a,t[4]=m*a-f,t[8]=o*l,t[1]=o*u,t[5]=o*h,t[9]=-a,t[2]=f*a-m,t[6]=x+d*a,t[10]=o*c}else if(e.order==="ZXY"){let d=c*h,f=c*u,m=l*h,x=l*u;t[0]=d-x*a,t[4]=-o*u,t[8]=m+f*a,t[1]=f+m*a,t[5]=o*h,t[9]=x-d*a,t[2]=-o*l,t[6]=a,t[10]=o*c}else if(e.order==="ZYX"){let d=o*h,f=o*u,m=a*h,x=a*u;t[0]=c*h,t[4]=m*l-f,t[8]=d*l+x,t[1]=c*u,t[5]=x*l+d,t[9]=f*l-m,t[2]=-l,t[6]=a*c,t[10]=o*c}else if(e.order==="YZX"){let d=o*c,f=o*l,m=a*c,x=a*l;t[0]=c*h,t[4]=x-d*u,t[8]=m*u+f,t[1]=u,t[5]=o*h,t[9]=-a*h,t[2]=-l*h,t[6]=f*u+m,t[10]=d-x*u}else if(e.order==="XZY"){let d=o*c,f=o*l,m=a*c,x=a*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=d*u+x,t[5]=o*h,t[9]=f*u-m,t[2]=m*u-f,t[6]=a*h,t[10]=x*u+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(jd,e,$d)}lookAt(e,t,n){let i=this.elements;return bt.subVectors(e,t),bt.lengthSq()===0&&(bt.z=1),bt.normalize(),cn.crossVectors(n,bt),cn.lengthSq()===0&&(Math.abs(n.z)===1?bt.x+=1e-4:bt.z+=1e-4,bt.normalize(),cn.crossVectors(n,bt)),cn.normalize(),Ir.crossVectors(bt,cn),i[0]=cn.x,i[4]=Ir.x,i[8]=bt.x,i[1]=cn.y,i[5]=Ir.y,i[9]=bt.y,i[2]=cn.z,i[6]=Ir.z,i[10]=bt.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[4],c=n[8],l=n[12],h=n[1],u=n[5],d=n[9],f=n[13],m=n[2],x=n[6],y=n[10],g=n[14],p=n[3],w=n[7],b=n[11],T=n[15],v=i[0],A=i[4],L=i[8],I=i[12],N=i[1],U=i[5],z=i[9],R=i[13],D=i[2],F=i[6],P=i[10],X=i[14],$=i[3],Z=i[7],oe=i[11],re=i[15];return r[0]=o*v+a*N+c*D+l*$,r[4]=o*A+a*U+c*F+l*Z,r[8]=o*L+a*z+c*P+l*oe,r[12]=o*I+a*R+c*X+l*re,r[1]=h*v+u*N+d*D+f*$,r[5]=h*A+u*U+d*F+f*Z,r[9]=h*L+u*z+d*P+f*oe,r[13]=h*I+u*R+d*X+f*re,r[2]=m*v+x*N+y*D+g*$,r[6]=m*A+x*U+y*F+g*Z,r[10]=m*L+x*z+y*P+g*oe,r[14]=m*I+x*R+y*X+g*re,r[3]=p*v+w*N+b*D+T*$,r[7]=p*A+w*U+b*F+T*Z,r[11]=p*L+w*z+b*P+T*oe,r[15]=p*I+w*R+b*X+T*re,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],o=e[1],a=e[5],c=e[9],l=e[13],h=e[2],u=e[6],d=e[10],f=e[14],m=e[3],x=e[7],y=e[11],g=e[15];return m*(+r*c*u-i*l*u-r*a*d+n*l*d+i*a*f-n*c*f)+x*(+t*c*f-t*l*d+r*o*d-i*o*f+i*l*h-r*c*h)+y*(+t*l*u-t*a*f-r*o*u+n*o*f+r*a*h-n*l*h)+g*(-i*a*h-t*c*u+t*a*d+i*o*u-n*o*d+n*c*h)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8],u=e[9],d=e[10],f=e[11],m=e[12],x=e[13],y=e[14],g=e[15],p=u*y*l-x*d*l+x*c*f-a*y*f-u*c*g+a*d*g,w=m*d*l-h*y*l-m*c*f+o*y*f+h*c*g-o*d*g,b=h*x*l-m*u*l+m*a*f-o*x*f-h*a*g+o*u*g,T=m*u*c-h*x*c-m*a*d+o*x*d+h*a*y-o*u*y,v=t*p+n*w+i*b+r*T;if(v===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/v;return e[0]=p*A,e[1]=(x*d*r-u*y*r-x*i*f+n*y*f+u*i*g-n*d*g)*A,e[2]=(a*y*r-x*c*r+x*i*l-n*y*l-a*i*g+n*c*g)*A,e[3]=(u*c*r-a*d*r-u*i*l+n*d*l+a*i*f-n*c*f)*A,e[4]=w*A,e[5]=(h*y*r-m*d*r+m*i*f-t*y*f-h*i*g+t*d*g)*A,e[6]=(m*c*r-o*y*r-m*i*l+t*y*l+o*i*g-t*c*g)*A,e[7]=(o*d*r-h*c*r+h*i*l-t*d*l-o*i*f+t*c*f)*A,e[8]=b*A,e[9]=(m*u*r-h*x*r-m*n*f+t*x*f+h*n*g-t*u*g)*A,e[10]=(o*x*r-m*a*r+m*n*l-t*x*l-o*n*g+t*a*g)*A,e[11]=(h*a*r-o*u*r-h*n*l+t*u*l+o*n*f-t*a*f)*A,e[12]=T*A,e[13]=(h*x*i-m*u*i+m*n*d-t*x*d-h*n*y+t*u*y)*A,e[14]=(m*a*i-o*x*i-m*n*c+t*x*c+o*n*y-t*a*y)*A,e[15]=(o*u*i-h*a*i+h*n*c-t*u*c-o*n*d+t*a*d)*A,this}scale(e){let t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),r=1-n,o=e.x,a=e.y,c=e.z,l=r*o,h=r*a;return this.set(l*o+n,l*a-i*c,l*c+i*a,0,l*a+i*c,h*a+n,h*c-i*o,0,l*c-i*a,h*c+i*o,r*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,r=t._x,o=t._y,a=t._z,c=t._w,l=r+r,h=o+o,u=a+a,d=r*l,f=r*h,m=r*u,x=o*h,y=o*u,g=a*u,p=c*l,w=c*h,b=c*u,T=n.x,v=n.y,A=n.z;return i[0]=(1-(x+g))*T,i[1]=(f+b)*T,i[2]=(m-w)*T,i[3]=0,i[4]=(f-b)*v,i[5]=(1-(d+g))*v,i[6]=(y+p)*v,i[7]=0,i[8]=(m+w)*A,i[9]=(y-p)*A,i[10]=(1-(d+x))*A,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements,r=$n.set(i[0],i[1],i[2]).length(),o=$n.set(i[4],i[5],i[6]).length(),a=$n.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],At.copy(this);let l=1/r,h=1/o,u=1/a;return At.elements[0]*=l,At.elements[1]*=l,At.elements[2]*=l,At.elements[4]*=h,At.elements[5]*=h,At.elements[6]*=h,At.elements[8]*=u,At.elements[9]*=u,At.elements[10]*=u,t.setFromRotationMatrix(At),n.x=r,n.y=o,n.z=a,this}makePerspective(e,t,n,i,r,o){o===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");let a=this.elements,c=2*r/(t-e),l=2*r/(n-i),h=(t+e)/(t-e),u=(n+i)/(n-i),d=-(o+r)/(o-r),f=-2*o*r/(o-r);return a[0]=c,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=l,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=f,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,r,o){let a=this.elements,c=1/(t-e),l=1/(n-i),h=1/(o-r),u=(t+e)*c,d=(n+i)*l,f=(o+r)*h;return a[0]=2*c,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=-2*h,a[14]=-f,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};le.prototype.isMatrix4=!0;var $n=new _,At=new le,jd=new _(0,0,0),$d=new _(1,1,1),cn=new _,Ir=new _,bt=new _,Rl=new le,Cl=new rt,Rn=class{constructor(e=0,t=0,n=0,i=Rn.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._order=i||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t,n){let i=e.elements,r=i[0],o=i[4],a=i[8],c=i[1],l=i[5],h=i[9],u=i[2],d=i[6],f=i[10];switch(t=t||this._order,t){case"XYZ":this._y=Math.asin(ct(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-ct(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,f),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(ct(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-ct(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(ct(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,f));break;case"XZY":this._z=Math.asin(-ct(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-h,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n!==!1&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Rl.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Rl,t,n)}setFromVector3(e,t){return this.set(e.x,e.y,e.z,t||this._order)}reorder(e){return Cl.setFromEuler(this),this.setFromQuaternion(Cl,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new _(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};Rn.prototype.isEuler=!0;Rn.DefaultOrder="XYZ";Rn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var co=class{constructor(){this.mask=1|0}set(e){this.mask=1<1){for(let t=0;t1){for(let n=0;n0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(n.geometries=a),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f)}return n.object=i,n;function o(a){let c=[];for(let l in a){let h=a[l];delete h.metadata,c.push(h)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n1?null:t.copy(n).multiplyScalar(r).add(e.start)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e===void 0&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new _),e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||rf.getNormalMatrix(e),i=this.coplanarPoint(ho).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}};Lt.prototype.isPlane=!0;var Rt=new _,Yt=new _,uo=new _,Zt=new _,Kn=new _,ei=new _,Bl=new _,fo=new _,po=new _,mo=new _,qe=class{constructor(e=new _,t=new _,n=new _){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i===void 0&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new _),i.subVectors(n,t),Rt.subVectors(e,t),i.cross(Rt);let r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Rt.subVectors(i,t),Yt.subVectors(n,t),uo.subVectors(e,t);let o=Rt.dot(Rt),a=Rt.dot(Yt),c=Rt.dot(uo),l=Yt.dot(Yt),h=Yt.dot(uo),u=o*l-a*a;if(r===void 0&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new _),u===0)return r.set(-2,-1,-1);let d=1/u,f=(l*c-a*h)*d,m=(o*h-a*c)*d;return r.set(1-f-m,m,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Zt),Zt.x>=0&&Zt.y>=0&&Zt.x+Zt.y<=1}static getUV(e,t,n,i,r,o,a,c){return this.getBarycoord(e,t,n,i,Zt),c.set(0,0),c.addScaledVector(r,Zt.x),c.addScaledVector(o,Zt.y),c.addScaledVector(a,Zt.z),c}static isFrontFacing(e,t,n,i){return Rt.subVectors(n,t),Yt.subVectors(e,t),Rt.cross(Yt).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Rt.subVectors(this.c,this.b),Yt.subVectors(this.a,this.b),Rt.cross(Yt).length()*.5}getMidpoint(e){return e===void 0&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new _),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return qe.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e===void 0&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new Lt),e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return qe.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,r){return qe.getUV(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return qe.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return qe.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){t===void 0&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new _);let n=this.a,i=this.b,r=this.c,o,a;Kn.subVectors(i,n),ei.subVectors(r,n),fo.subVectors(e,n);let c=Kn.dot(fo),l=ei.dot(fo);if(c<=0&&l<=0)return t.copy(n);po.subVectors(e,i);let h=Kn.dot(po),u=ei.dot(po);if(h>=0&&u<=h)return t.copy(i);let d=c*u-h*l;if(d<=0&&c>=0&&h<=0)return o=c/(c-h),t.copy(n).addScaledVector(Kn,o);mo.subVectors(e,r);let f=Kn.dot(mo),m=ei.dot(mo);if(m>=0&&f<=m)return t.copy(r);let x=f*l-c*m;if(x<=0&&l>=0&&m<=0)return a=l/(l-m),t.copy(n).addScaledVector(ei,a);let y=h*m-f*u;if(y<=0&&u-h>=0&&f-m>=0)return Bl.subVectors(r,i),a=(u-h)/(u-h+(f-m)),t.copy(i).addScaledVector(Bl,a);let g=1/(y+x+d);return o=x*g,a=d*g,t.copy(n).addScaledVector(Kn,o).addScaledVector(ei,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},sf=0;function tt(){Object.defineProperty(this,"id",{value:sf++}),this.uuid=wt(),this.name="",this.type="Material",this.fog=!0,this.blending=Ti,this.side=Si,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=ol,this.blendDst=al,this.blendEquation=Gn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Gs,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Fd,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=$s,this.stencilZFail=$s,this.stencilZPass=$s,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}tt.prototype=Object.assign(Object.create(nn.prototype),{constructor:tt,isMaterial:!0,onBuild:function(){},onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(s){if(s!==void 0)for(let e in s){let t=s[e];if(t===void 0){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if(e==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=t===el;continue}let n=this[e];if(n===void 0){console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.");continue}n&&n.isColor?n.set(t):n&&n.isVector3&&t&&t.isVector3?n.copy(t):this[e]=t}},toJSON:function(s){let e=s===void 0||typeof s=="string";e&&(s={textures:{},images:{}});let t={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),this.color&&this.color.isColor&&(t.color=this.color.getHex()),this.roughness!==void 0&&(t.roughness=this.roughness),this.metalness!==void 0&&(t.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(t.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(t.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(t.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(t.specular=this.specular.getHex()),this.shininess!==void 0&&(t.shininess=this.shininess),this.clearcoat!==void 0&&(t.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(t.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(t.clearcoatMap=this.clearcoatMap.toJSON(s).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(t.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(s).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(t.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(s).uuid,t.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(t.map=this.map.toJSON(s).uuid),this.matcap&&this.matcap.isTexture&&(t.matcap=this.matcap.toJSON(s).uuid),this.alphaMap&&this.alphaMap.isTexture&&(t.alphaMap=this.alphaMap.toJSON(s).uuid),this.lightMap&&this.lightMap.isTexture&&(t.lightMap=this.lightMap.toJSON(s).uuid,t.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(t.aoMap=this.aoMap.toJSON(s).uuid,t.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(t.bumpMap=this.bumpMap.toJSON(s).uuid,t.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(t.normalMap=this.normalMap.toJSON(s).uuid,t.normalMapType=this.normalMapType,t.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(t.displacementMap=this.displacementMap.toJSON(s).uuid,t.displacementScale=this.displacementScale,t.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(t.roughnessMap=this.roughnessMap.toJSON(s).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(t.metalnessMap=this.metalnessMap.toJSON(s).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(t.emissiveMap=this.emissiveMap.toJSON(s).uuid),this.specularMap&&this.specularMap.isTexture&&(t.specularMap=this.specularMap.toJSON(s).uuid),this.envMap&&this.envMap.isTexture&&(t.envMap=this.envMap.toJSON(s).uuid,this.combine!==void 0&&(t.combine=this.combine)),this.envMapIntensity!==void 0&&(t.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(t.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(t.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(t.gradientMap=this.gradientMap.toJSON(s).uuid),this.size!==void 0&&(t.size=this.size),this.shadowSide!==null&&(t.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(t.sizeAttenuation=this.sizeAttenuation),this.blending!==Ti&&(t.blending=this.blending),this.side!==Si&&(t.side=this.side),this.vertexColors&&(t.vertexColors=!0),this.opacity<1&&(t.opacity=this.opacity),this.transparent===!0&&(t.transparent=this.transparent),t.depthFunc=this.depthFunc,t.depthTest=this.depthTest,t.depthWrite=this.depthWrite,t.colorWrite=this.colorWrite,t.stencilWrite=this.stencilWrite,t.stencilWriteMask=this.stencilWriteMask,t.stencilFunc=this.stencilFunc,t.stencilRef=this.stencilRef,t.stencilFuncMask=this.stencilFuncMask,t.stencilFail=this.stencilFail,t.stencilZFail=this.stencilZFail,t.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(t.rotation=this.rotation),this.polygonOffset===!0&&(t.polygonOffset=!0),this.polygonOffsetFactor!==0&&(t.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(t.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(t.linewidth=this.linewidth),this.dashSize!==void 0&&(t.dashSize=this.dashSize),this.gapSize!==void 0&&(t.gapSize=this.gapSize),this.scale!==void 0&&(t.scale=this.scale),this.dithering===!0&&(t.dithering=!0),this.alphaTest>0&&(t.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(t.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(t.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(t.wireframe=this.wireframe),this.wireframeLinewidth>1&&(t.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(t.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(t.wireframeLinejoin=this.wireframeLinejoin),this.morphTargets===!0&&(t.morphTargets=!0),this.morphNormals===!0&&(t.morphNormals=!0),this.skinning===!0&&(t.skinning=!0),this.flatShading===!0&&(t.flatShading=this.flatShading),this.visible===!1&&(t.visible=!1),this.toneMapped===!1&&(t.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(t.userData=this.userData);function n(i){let r=[];for(let o in i){let a=i[o];delete a.metadata,r.push(a)}return r}if(e){let i=n(s.textures),r=n(s.images);i.length>0&&(t.textures=i),r.length>0&&(t.images=r)}return t},clone:function(){return new this.constructor().copy(this)},copy:function(s){this.name=s.name,this.fog=s.fog,this.blending=s.blending,this.side=s.side,this.vertexColors=s.vertexColors,this.opacity=s.opacity,this.transparent=s.transparent,this.blendSrc=s.blendSrc,this.blendDst=s.blendDst,this.blendEquation=s.blendEquation,this.blendSrcAlpha=s.blendSrcAlpha,this.blendDstAlpha=s.blendDstAlpha,this.blendEquationAlpha=s.blendEquationAlpha,this.depthFunc=s.depthFunc,this.depthTest=s.depthTest,this.depthWrite=s.depthWrite,this.stencilWriteMask=s.stencilWriteMask,this.stencilFunc=s.stencilFunc,this.stencilRef=s.stencilRef,this.stencilFuncMask=s.stencilFuncMask,this.stencilFail=s.stencilFail,this.stencilZFail=s.stencilZFail,this.stencilZPass=s.stencilZPass,this.stencilWrite=s.stencilWrite;let e=s.clippingPlanes,t=null;if(e!==null){let n=e.length;t=new Array(n);for(let i=0;i!==n;++i)t[i]=e[i].clone()}return this.clippingPlanes=t,this.clipIntersection=s.clipIntersection,this.clipShadows=s.clipShadows,this.shadowSide=s.shadowSide,this.colorWrite=s.colorWrite,this.precision=s.precision,this.polygonOffset=s.polygonOffset,this.polygonOffsetFactor=s.polygonOffsetFactor,this.polygonOffsetUnits=s.polygonOffsetUnits,this.dithering=s.dithering,this.alphaTest=s.alphaTest,this.alphaToCoverage=s.alphaToCoverage,this.premultipliedAlpha=s.premultipliedAlpha,this.visible=s.visible,this.toneMapped=s.toneMapped,this.userData=JSON.parse(JSON.stringify(s.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Object.defineProperty(tt.prototype,"needsUpdate",{set:function(s){s===!0&&this.version++}});var zl={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ct={h:0,s:0,l:0},Fr={h:0,s:0,l:0};function go(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}function xo(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function yo(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}var se=class{constructor(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=Qs(e,1),t=ct(t,0,1),n=ct(n,0,1),t===0)this.r=this.g=this.b=n;else{let i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=go(r,i,e+1/3),this.g=go(r,i,e),this.b=go(r,i,e-1/3)}return this}setStyle(e){function t(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let i,r=n[1],o=n[2];switch(r){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){let a=parseFloat(i[1])/360,c=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return t(i[4]),this.setHSL(a,c,l)}break}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let i=n[1],r=i.length;if(r===3)return this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,this;if(r===6)return this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){let t=zl[e.toLowerCase()];return t!==void 0?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copyGammaToLinear(e,t=2){return this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this}copyLinearToGamma(e,t=2){let n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.r=xo(e.r),this.g=xo(e.g),this.b=xo(e.b),this}copyLinearToSRGB(e){return this.r=yo(e.r),this.g=yo(e.g),this.b=yo(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return this.r*255<<16^this.g*255<<8^this.b*255<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){e===void 0&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});let t=this.r,n=this.g,i=this.b,r=Math.max(t,n,i),o=Math.min(t,n,i),a,c,l=(o+r)/2;if(o===r)a=0,c=0;else{let h=r-o;switch(c=l<=.5?h/(r+o):h/(2-r-o),r){case t:a=(n-i)/h+(ne&&(e=s[t]);return e}var of={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Oi(s,e){return new of[s](e)}var af=0,Nt=new le,vo=new Se,ti=new _,Mt=new vt,Ui=new vt,st=new _,ue=class extends nn{constructor(){super();Object.defineProperty(this,"id",{value:af++}),this.uuid=wt(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:Infinity},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(ql(e)>65535?zr:Br)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let r=new Ke().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}rotateX(e){return Nt.makeRotationX(e),this.applyMatrix4(Nt),this}rotateY(e){return Nt.makeRotationY(e),this.applyMatrix4(Nt),this}rotateZ(e){return Nt.makeRotationZ(e),this.applyMatrix4(Nt),this}translate(e,t,n){return Nt.makeTranslation(e,t,n),this.applyMatrix4(Nt),this}scale(e,t,n){return Nt.makeScale(e,t,n),this.applyMatrix4(Nt),this}lookAt(e){return vo.lookAt(e),vo.updateMatrix(),this.applyMatrix4(vo.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ti).negate(),this.translate(ti.x,ti.y,ti.z),this}setFromPoints(e){let t=[];for(let n=0,i=e.length;n0&&(e.userData=this.userData),this.parameters!==void 0){let c=this.parameters;for(let l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let c in n){let l=n[c];e.data.attributes[c]=l.toJSON(e.data)}let i={},r=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],h=[];for(let u=0,d=l.length;u0&&(i[c]=h,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new ue().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone(t));let i=e.attributes;for(let l in i){let h=i[l];this.setAttribute(l,h.clone(t))}let r=e.morphAttributes;for(let l in r){let h=[],u=r[l];for(let d=0,f=u.length;d0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){let n=this.geometry,i=this.material,r=this.matrixWorld;if(i===void 0||(n.boundingSphere===null&&n.computeBoundingSphere(),_o.copy(n.boundingSphere),_o.applyMatrix4(r),e.ray.intersectsSphere(_o)===!1)||(Xl.copy(r).invert(),ni.copy(e.ray).applyMatrix4(Xl),n.boundingBox!==null&&ni.intersectsBox(n.boundingBox)===!1))return;let o;if(n.isBufferGeometry){let a=n.index,c=n.attributes.position,l=n.morphAttributes.position,h=n.morphTargetsRelative,u=n.attributes.uv,d=n.attributes.uv2,f=n.groups,m=n.drawRange;if(a!==null)if(Array.isArray(i))for(let x=0,y=f.length;xt.far?null:{distance:l,point:Wr.clone(),object:s}}function qr(s,e,t,n,i,r,o,a,c,l,h,u){hn.fromBufferAttribute(i,l),un.fromBufferAttribute(i,h),dn.fromBufferAttribute(i,u);let d=s.morphTargetInfluences;if(e.morphTargets&&r&&d){Or.set(0,0,0),Ur.set(0,0,0),Hr.set(0,0,0);for(let m=0,x=r.length;m0?1:-1,h.push(Z.x,Z.y,Z.z),u.push(fe/A),u.push(1-oe/L),X+=1}}for(let oe=0;oe0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let n={};for(let i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}};jt.prototype.isShaderMaterial=!0;var Hi=class extends Se{constructor(){super();this.type="Camera",this.matrixWorldInverse=new le,this.projectionMatrix=new le,this.projectionMatrixInverse=new le}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){e===void 0&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new _),this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}};Hi.prototype.isCamera=!0;var ot=class extends Hi{constructor(e=50,t=1,n=.1,i=2e3){super();this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Di*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Tn*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Di*2*Math.atan(Math.tan(Tn*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,r,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Tn*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,o=this.view;if(this.view!==null&&this.view.enabled){let c=o.fullWidth,l=o.fullHeight;r+=o.offsetX*i/c,t-=o.offsetY*n/l,i*=o.width/c,n*=o.height/l}let a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}};ot.prototype.isPerspectiveCamera=!0;var si=90,oi=1,Xr=class extends Se{constructor(e,t,n){super();if(this.type="CubeCamera",n.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=n;let i=new ot(si,oi,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new _(1,0,0)),this.add(i);let r=new ot(si,oi,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new _(-1,0,0)),this.add(r);let o=new ot(si,oi,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new _(0,1,0)),this.add(o);let a=new ot(si,oi,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new _(0,-1,0)),this.add(a);let c=new ot(si,oi,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new _(0,0,1)),this.add(c);let l=new ot(si,oi,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new _(0,0,-1)),this.add(l)}update(e,t){this.parent===null&&this.updateMatrixWorld();let n=this.renderTarget,[i,r,o,a,c,l]=this.children,h=e.xr.enabled,u=e.getRenderTarget();e.xr.enabled=!1;let d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,r),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,c),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(u),e.xr.enabled=h}},ai=class extends et{constructor(e,t,n,i,r,o,a,c,l,h){e=e!==void 0?e:[],t=t!==void 0?t:mr,a=a!==void 0?a:Sn,super(e,t,n,i,r,o,a,c,l,h),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};ai.prototype.isCubeTexture=!0;var Yr=class extends Vt{constructor(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),super(e,e,t),t=t||{},this.texture=new ai(void 0,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:it,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.format=Tt,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -12018,9 +20,7 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget { #include } - `, - - fragmentShader: /* glsl */` + `,fragmentShader:` uniform sampler2D tEquirect; @@ -12037,34513 +37,2795 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget { gl_FragColor = texture2D( tEquirect, sampleUV ); } - ` + `},i=new ii(5,5,5),r=new jt({name:"CubemapFromEquirect",uniforms:ri(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Qe,blending:en});r.uniforms.tEquirect.value=t;let o=new je(i,r),a=t.minFilter;return t.minFilter===Ai&&(t.minFilter=it),new Xr(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){let r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(r)}};Yr.prototype.isWebGLCubeRenderTarget=!0;var li=class extends et{constructor(e,t,n,i,r,o,a,c,l,h,u,d){super(null,o,a,c,l,h,i,r,u,d);this.image={data:e||null,width:t||1,height:n||1},this.magFilter=l!==void 0?l:nt,this.minFilter=h!==void 0?h:nt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}};li.prototype.isDataTexture=!0;var ci=new on,Zr=new _,Gi=class{constructor(e=new Lt,t=new Lt,n=new Lt,i=new Lt,r=new Lt,o=new Lt){this.planes=[e,t,n,i,r,o]}set(e,t,n,i,r,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){let t=this.planes,n=e.elements,i=n[0],r=n[1],o=n[2],a=n[3],c=n[4],l=n[5],h=n[6],u=n[7],d=n[8],f=n[9],m=n[10],x=n[11],y=n[12],g=n[13],p=n[14],w=n[15];return t[0].setComponents(a-i,u-c,x-d,w-y).normalize(),t[1].setComponents(a+i,u+c,x+d,w+y).normalize(),t[2].setComponents(a+r,u+l,x+f,w+g).normalize(),t[3].setComponents(a-r,u-l,x-f,w-g).normalize(),t[4].setComponents(a-o,u-h,x-m,w-p).normalize(),t[5].setComponents(a+o,u+h,x+m,w+p).normalize(),this}intersectsObject(e){let t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),ci.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(ci)}intersectsSprite(e){return ci.center.set(0,0,0),ci.radius=.7071067811865476,ci.applyMatrix4(e.matrixWorld),this.intersectsSphere(ci)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)0?e.max.x:e.min.x,Zr.y=i.normal.y>0?e.max.y:e.min.y,Zr.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Zr)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function Yl(){let s=null,e=!1,t=null,n=null;function i(r,o){t(r,o),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){s=r}}}function df(s,e){let t=e.isWebGL2,n=new WeakMap;function i(l,h){let u=l.array,d=l.usage,f=s.createBuffer();s.bindBuffer(h,f),s.bufferData(h,u,d),l.onUploadCallback();let m=5126;return u instanceof Float32Array?m=5126:u instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):u instanceof Uint16Array?l.isFloat16BufferAttribute?t?m=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):m=5123:u instanceof Int16Array?m=5122:u instanceof Uint32Array?m=5125:u instanceof Int32Array?m=5124:u instanceof Int8Array?m=5120:u instanceof Uint8Array&&(m=5121),{buffer:f,type:m,bytesPerElement:u.BYTES_PER_ELEMENT,version:l.version}}function r(l,h,u){let d=h.array,f=h.updateRange;s.bindBuffer(u,l),f.count===-1?s.bufferSubData(u,0,d):(t?s.bufferSubData(u,f.offset*d.BYTES_PER_ELEMENT,d,f.offset,f.count):s.bufferSubData(u,f.offset*d.BYTES_PER_ELEMENT,d.subarray(f.offset,f.offset+f.count)),f.count=-1)}function o(l){return l.isInterleavedBufferAttribute&&(l=l.data),n.get(l)}function a(l){l.isInterleavedBufferAttribute&&(l=l.data);let h=n.get(l);h&&(s.deleteBuffer(h.buffer),n.delete(l))}function c(l,h){if(l.isGLBufferAttribute){let d=n.get(l);(!d||d.version 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +#else + if( cutoffDistance > 0.0 && decayExponent > 0.0 ) { + return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent ); + } + return 1.0; +#endif +} +vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) { + float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH ); + return ( 1.0 - specularColor ) * fresnel + specularColor; +} +vec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) { + float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV ); + vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0; + return Fr * fresnel + F0; +} +float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + return 1.0 / ( gl * gv ); +} +float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) { + float alpha = pow2( roughness ); + vec3 halfDir = normalize( incidentLight.direction + viewDir ); + float dotNL = saturate( dot( normal, incidentLight.direction ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotLH = saturate( dot( incidentLight.direction, halfDir ) ); + vec3 F = F_Schlick( specularColor, dotLH ); + float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( G * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +vec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 brdf = integrateSpecularBRDF( dotNV, roughness ); + return specularColor * brdf.x + brdf.y; +} +void BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { + float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); + vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness ); + vec2 brdf = integrateSpecularBRDF( dotNV, roughness ); + vec3 FssEss = F * brdf.x + brdf.y; + float Ess = brdf.x + brdf.y; + float Ems = 1.0 - Ess; + vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +float G_BlinnPhong_Implicit( ) { + return 0.25; +} +float D_BlinnPhong( const in float shininess, const in float dotNH ) { + return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); +} +vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) { + vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir ); + float dotNH = saturate( dot( geometry.normal, halfDir ) ); + float dotLH = saturate( dot( incidentLight.direction, halfDir ) ); + vec3 F = F_Schlick( specularColor, dotLH ); + float G = G_BlinnPhong_Implicit( ); + float D = D_BlinnPhong( shininess, dotNH ); + return F * ( G * D ); +} +float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) { + return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 ); +} +float BlinnExponentToGGXRoughness( const in float blinnExponent ) { + return sqrt( 2.0 / ( blinnExponent + 2.0 ) ); +} +#if defined( USE_SHEEN ) +float D_Charlie(float roughness, float NoH) { + float invAlpha = 1.0 / roughness; + float cos2h = NoH * NoH; + float sin2h = max(1.0 - cos2h, 0.0078125); return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI); +} +float V_Neubelt(float NoV, float NoL) { + return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV))); +} +vec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) { + vec3 N = geometry.normal; + vec3 V = geometry.viewDir; + vec3 H = normalize( V + L ); + float dotNH = saturate( dot( N, H ) ); + return specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) ); +} +#endif`,wf=`#ifdef USE_BUMPMAP + uniform sampler2D bumpMap; + uniform float bumpScale; + vec2 dHdxy_fwd() { + vec2 dSTdx = dFdx( vUv ); + vec2 dSTdy = dFdy( vUv ); + float Hll = bumpScale * texture2D( bumpMap, vUv ).x; + float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll; + float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll; + return vec2( dBx, dBy ); + } + vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { + vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) ); + vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) ); + vec3 vN = surf_norm; + vec3 R1 = cross( vSigmaY, vN ); + vec3 R2 = cross( vN, vSigmaX ); + float fDet = dot( vSigmaX, R1 ) * faceDirection; + vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); + return normalize( abs( fDet ) * surf_norm - vGrad ); + } +#endif`,bf=`#if NUM_CLIPPING_PLANES > 0 + vec4 plane; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif +#endif`,Mf=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,Sf=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,Tf=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,Ef=`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,Af=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,Lf=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) + varying vec3 vColor; +#endif`,Rf=`#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif`,Cf=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate(a) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement(a) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract(sin(sn) * c); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); } + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +struct GeometricContext { + vec3 position; + vec3 normal; + vec3 viewDir; +#ifdef CLEARCOAT + vec3 clearcoatNormal; +#endif +}; +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) { + float distance = dot( planeNormal, point - pointOnPlane ); + return - distance * planeNormal + point; +} +float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) { + return sign( dot( point - pointOnPlane, planeNormal ) ); +} +vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) { + return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine; +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +float linearToRelativeLuminance( const in vec3 color ) { + vec3 weights = vec3( 0.2126, 0.7152, 0.0722 ); + return dot( weights, color.rgb ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +}`,Pf=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_maxMipLevel 8.0 + #define cubeUV_minMipLevel 4.0 + #define cubeUV_maxTileSize 256.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + float texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize ); + vec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ); + vec2 f = fract( uv ); + uv += 0.5 - f; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + if ( mipInt < cubeUV_maxMipLevel ) { + uv.y += 2.0 * cubeUV_maxTileSize; + } + uv.y += filterInt * 2.0 * cubeUV_minTileSize; + uv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize ); + uv *= texelSize; + vec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb; + uv.x += texelSize; + vec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb; + uv.y += texelSize; + vec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb; + uv.x -= texelSize; + vec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb; + vec3 tm = mix( tl, tr, f.x ); + vec3 bm = mix( bl, br, f.x ); + return mix( tm, bm, f.y ); + } + #define r0 1.0 + #define v0 0.339 + #define m0 - 2.0 + #define r1 0.8 + #define v1 0.276 + #define m1 - 1.0 + #define r4 0.4 + #define v4 0.046 + #define m4 2.0 + #define r5 0.305 + #define v5 0.016 + #define m5 3.0 + #define r6 0.21 + #define v6 0.0038 + #define m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= r1 ) { + mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0; + } else if ( roughness >= r4 ) { + mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1; + } else if ( roughness >= r5 ) { + mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4; + } else if ( roughness >= r6 ) { + mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,If=`vec3 transformedNormal = objectNormal; +#ifdef USE_INSTANCING + mat3 m = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); + transformedNormal = m * transformedNormal; +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,Df=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,Ff=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias ); +#endif`,Nf=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vUv ); + emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb; + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,Bf=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,zf="gl_FragColor = linearToOutputTexel( gl_FragColor );",Of=` +vec4 LinearToLinear( in vec4 value ) { + return value; +} +vec4 GammaToLinear( in vec4 value, in float gammaFactor ) { + return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a ); +} +vec4 LinearToGamma( in vec4 value, in float gammaFactor ) { + return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a ); +} +vec4 sRGBToLinear( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 LinearTosRGB( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +} +vec4 RGBEToLinear( in vec4 value ) { + return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 ); +} +vec4 LinearToRGBE( in vec4 value ) { + float maxComponent = max( max( value.r, value.g ), value.b ); + float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 ); + return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 ); +} +vec4 RGBMToLinear( in vec4 value, in float maxRange ) { + return vec4( value.rgb * value.a * maxRange, 1.0 ); +} +vec4 LinearToRGBM( in vec4 value, in float maxRange ) { + float maxRGB = max( value.r, max( value.g, value.b ) ); + float M = clamp( maxRGB / maxRange, 0.0, 1.0 ); + M = ceil( M * 255.0 ) / 255.0; + return vec4( value.rgb / ( M * maxRange ), M ); +} +vec4 RGBDToLinear( in vec4 value, in float maxRange ) { + return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 ); +} +vec4 LinearToRGBD( in vec4 value, in float maxRange ) { + float maxRGB = max( value.r, max( value.g, value.b ) ); + float D = max( maxRange / maxRGB, 1.0 ); + D = clamp( floor( D ) / 255.0, 0.0, 1.0 ); + return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D ); +} +const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 ); +vec4 LinearToLogLuv( in vec4 value ) { + vec3 Xp_Y_XYZp = cLogLuvM * value.rgb; + Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) ); + vec4 vResult; + vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z; + float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0; + vResult.w = fract( Le ); + vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0; + return vResult; +} +const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 ); +vec4 LogLuvToLinear( in vec4 value ) { + float Le = value.z * 255.0 + value.w; + vec3 Xp_Y_XYZp; + Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 ); + Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y; + Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z; + vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb; + return vec4( max( vRGB, 0.0 ), 1.0 ); +}`,Uf=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifndef ENVMAP_TYPE_CUBE_UV + envColor = envMapTexelToLinear( envColor ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`,Hf=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform int maxMipLevel; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,Gf=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,kf=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,Vf=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,Wf=`#ifdef USE_FOG + fogDepth = - mvPosition.z; +#endif`,qf=`#ifdef USE_FOG + varying float fogDepth; +#endif`,Xf=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, fogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,Yf=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float fogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,Zf=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return texture2D( gradientMap, coord ).rgb; + #else + return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 ); + #endif +}`,Jf=`#ifdef USE_LIGHTMAP + vec4 lightMapTexel= texture2D( lightMap, vUv2 ); + reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity; +#endif`,jf=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,$f=`vec3 diffuse = vec3( 1.0 ); +GeometricContext geometry; +geometry.position = mvPosition.xyz; +geometry.normal = normalize( transformedNormal ); +geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz ); +GeometricContext backGeometry; +backGeometry.position = geometry.position; +backGeometry.normal = -geometry.normal; +backGeometry.viewDir = geometry.viewDir; +vLightFront = vec3( 0.0 ); +vIndirectFront = vec3( 0.0 ); +#ifdef DOUBLE_SIDED + vLightBack = vec3( 0.0 ); + vIndirectBack = vec3( 0.0 ); +#endif +IncidentLight directLight; +float dotNL; +vec3 directLightColor_Diffuse; +vIndirectFront += getAmbientLightIrradiance( ambientLightColor ); +vIndirectFront += getLightProbeIrradiance( lightProbe, geometry ); +#ifdef DOUBLE_SIDED + vIndirectBack += getAmbientLightIrradiance( ambientLightColor ); + vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry ); +#endif +#if NUM_POINT_LIGHTS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight ); + dotNL = dot( geometry.normal, directLight.direction ); + directLightColor_Diffuse = PI * directLight.color; + vLightFront += saturate( dotNL ) * directLightColor_Diffuse; + #ifdef DOUBLE_SIDED + vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; + #endif + } + #pragma unroll_loop_end +#endif +#if NUM_SPOT_LIGHTS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight ); + dotNL = dot( geometry.normal, directLight.direction ); + directLightColor_Diffuse = PI * directLight.color; + vLightFront += saturate( dotNL ) * directLightColor_Diffuse; + #ifdef DOUBLE_SIDED + vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; + #endif + } + #pragma unroll_loop_end +#endif +#if NUM_DIR_LIGHTS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight ); + dotNL = dot( geometry.normal, directLight.direction ); + directLightColor_Diffuse = PI * directLight.color; + vLightFront += saturate( dotNL ) * directLightColor_Diffuse; + #ifdef DOUBLE_SIDED + vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; + #endif + } + #pragma unroll_loop_end +#endif +#if NUM_HEMI_LIGHTS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry ); + #ifdef DOUBLE_SIDED + vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry ); + #endif + } + #pragma unroll_loop_end +#endif`,Qf=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +uniform vec3 lightProbe[ 9 ]; +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) { + vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + #ifndef PHYSICALLY_CORRECT_LIGHTS + irradiance *= PI; + #endif + return irradiance; +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) { + directLight.color = directionalLight.color; + directLight.direction = directionalLight.direction; + directLight.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) { + vec3 lVector = pointLight.position - geometry.position; + directLight.direction = normalize( lVector ); + float lightDistance = length( lVector ); + directLight.color = pointLight.color; + directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay ); + directLight.visible = ( directLight.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) { + vec3 lVector = spotLight.position - geometry.position; + directLight.direction = normalize( lVector ); + float lightDistance = length( lVector ); + float angleCos = dot( directLight.direction, spotLight.direction ); + if ( angleCos > spotLight.coneCos ) { + float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + directLight.color = spotLight.color; + directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay ); + directLight.visible = true; + } else { + directLight.color = vec3( 0.0 ); + directLight.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) { + float dotNL = dot( geometry.normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + #ifndef PHYSICALLY_CORRECT_LIGHTS + irradiance *= PI; + #endif + return irradiance; + } +#endif`,Kf=`#if defined( USE_ENVMAP ) + #ifdef ENVMAP_MODE_REFRACTION + uniform float refractionRatio; + #endif + vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) { + vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix ); + #ifdef ENVMAP_TYPE_CUBE + vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz ); + #ifdef TEXTURE_LOD_EXT + vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) ); + #else + vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) ); + #endif + envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb; + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); + #else + vec4 envMapColor = vec4( 0.0 ); + #endif + return PI * envMapColor.rgb * envMapIntensity; + } + float getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) { + float maxMIPLevelScalar = float( maxMIPLevel ); + float sigma = PI * roughness * roughness / ( 1.0 + roughness ); + float desiredMIPLevel = maxMIPLevelScalar + log2( sigma ); + return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar ); + } + vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) { + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( -viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + #else + vec3 reflectVec = refract( -viewDir, normal, refractionRatio ); + #endif + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel ); + #ifdef ENVMAP_TYPE_CUBE + vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz ); + #ifdef TEXTURE_LOD_EXT + vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel ); + #else + vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel ); + #endif + envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb; + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); + #endif + return envMapColor.rgb * envMapIntensity; + } +#endif`,ep=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,tp=`varying vec3 vViewPosition; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; + #ifndef PHYSICALLY_CORRECT_LIGHTS + irradiance *= PI; + #endif + reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon +#define Material_LightProbeLOD( material ) (0)`,np=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,ip=`varying vec3 vViewPosition; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifndef PHYSICALLY_CORRECT_LIGHTS + irradiance *= PI; + #endif + reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong +#define Material_LightProbeLOD( material ) (0)`,rp=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness; +material.specularRoughness = min( material.specularRoughness, 1.0 ); +#ifdef REFLECTIVITY + material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor ); +#endif +#ifdef CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_SHEEN + material.sheenColor = sheen; +#endif`,sp=`struct PhysicalMaterial { + vec3 diffuseColor; + float specularRoughness; + vec3 specularColor; +#ifdef CLEARCOAT + float clearcoat; + float clearcoatRoughness; +#endif +#ifdef USE_SHEEN + vec3 sheenColor; +#endif +}; +#define MAXIMUM_SPECULAR_COEFFICIENT 0.16 +#define DEFAULT_SPECULAR_COEFFICIENT 0.04 +float clearcoatDHRApprox( const in float roughness, const in float dotNL ) { + return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) ); +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometry.normal; + vec3 viewDir = geometry.viewDir; + vec3 position = geometry.position; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.specularRoughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifndef PHYSICALLY_CORRECT_LIGHTS + irradiance *= PI; + #endif + #ifdef CLEARCOAT + float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = ccDotNL * directLight.color; + #ifndef PHYSICALLY_CORRECT_LIGHTS + ccIrradiance *= PI; + #endif + float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL ); + reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness ); + #else + float clearcoatDHR = 0.0; + #endif + #ifdef USE_SHEEN + reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen( + material.specularRoughness, + directLight.direction, + geometry, + material.sheenColor + ); + #else + reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness); + #endif + reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef CLEARCOAT + float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); + reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness ); + float ccDotNL = ccDotNV; + float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL ); + #else + float clearcoatDHR = 0.0; + #endif + float clearcoatInv = 1.0 - clearcoatDHR; + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering ); + vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) ); + reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,op=` +GeometricContext geometry; +geometry.position = - vViewPosition; +geometry.normal = normal; +geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +#ifdef CLEARCOAT + geometry.clearcoatNormal = clearcoatNormal; +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointDirectLightIrradiance( pointLight, geometry, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometry, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotDirectLightIrradiance( spotLight, geometry, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometry, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometry, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + irradiance += getLightProbeIrradiance( lightProbe, geometry ); + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,ap=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel= texture2D( lightMap, vUv2 ); + vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity; + #ifndef PHYSICALLY_CORRECT_LIGHTS + lightMapIrradiance *= PI; + #endif + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + iblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + radiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel ); + #ifdef CLEARCOAT + clearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel ); + #endif +#endif`,lp=`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); +#endif`,cp=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,hp=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,up=`#ifdef USE_LOGDEPTHBUF + #ifdef USE_LOGDEPTHBUF_EXT + varying float vFragDepth; + varying float vIsPerspective; + #else + uniform float logDepthBufFC; + #endif +#endif`,dp=`#ifdef USE_LOGDEPTHBUF + #ifdef USE_LOGDEPTHBUF_EXT + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); + #else + if ( isPerspectiveMatrix( projectionMatrix ) ) { + gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; + gl_Position.z *= gl_Position.w; + } + #endif +#endif`,fp=`#ifdef USE_MAP + vec4 texelColor = texture2D( map, vUv ); + texelColor = mapTexelToLinear( texelColor ); + diffuseColor *= texelColor; +#endif`,pp=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,mp=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; +#endif +#ifdef USE_MAP + vec4 mapTexel = texture2D( map, uv ); + diffuseColor *= mapTexelToLinear( mapTexel ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,gp=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,xp=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vUv ); + metalnessFactor *= texelMetalness.b; +#endif`,yp=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,vp=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; + objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; + objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; + objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; +#endif`,_p=`#ifdef USE_MORPHTARGETS + uniform float morphTargetBaseInfluence; + #ifndef USE_MORPHNORMALS + uniform float morphTargetInfluences[ 8 ]; + #else + uniform float morphTargetInfluences[ 4 ]; + #endif +#endif`,wp=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + transformed += morphTarget0 * morphTargetInfluences[ 0 ]; + transformed += morphTarget1 * morphTargetInfluences[ 1 ]; + transformed += morphTarget2 * morphTargetInfluences[ 2 ]; + transformed += morphTarget3 * morphTargetInfluences[ 3 ]; + #ifndef USE_MORPHNORMALS + transformed += morphTarget4 * morphTargetInfluences[ 4 ]; + transformed += morphTarget5 * morphTargetInfluences[ 5 ]; + transformed += morphTarget6 * morphTargetInfluences[ 6 ]; + transformed += morphTarget7 * morphTargetInfluences[ 7 ]; + #endif +#endif`,bp=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) ); + vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + #ifdef USE_TANGENT + vec3 tangent = normalize( vTangent ); + vec3 bitangent = normalize( vBitangent ); + #ifdef DOUBLE_SIDED + tangent = tangent * faceDirection; + bitangent = bitangent * faceDirection; + #endif + #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP ) + mat3 vTBN = mat3( tangent, bitangent, normal ); + #endif + #endif +#endif +vec3 geometryNormal = normal;`,Mp=`#ifdef OBJECTSPACE_NORMALMAP + normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( TANGENTSPACE_NORMALMAP ) + vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + #ifdef USE_TANGENT + normal = normalize( vTBN * mapN ); + #else + normal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection ); + #endif +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,Sp=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef OBJECTSPACE_NORMALMAP + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) ) + vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) { + vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) ); + vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) ); + vec2 st0 = dFdx( vUv.st ); + vec2 st1 = dFdy( vUv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det ); + return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z ); + } +#endif`,Tp=`#ifdef CLEARCOAT + vec3 clearcoatNormal = geometryNormal; +#endif`,Ep=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + #ifdef USE_TANGENT + clearcoatNormal = normalize( vTBN * clearcoatMapN ); + #else + clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection ); + #endif +#endif`,Ap=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif`,Lp=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; +const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); +const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); +const float ShiftRight8 = 1. / 256.; +vec4 packDepthToRGBA( const in float v ) { + vec4 r = vec4( fract( v * PackFactors ), v ); + r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors ); +} +vec4 pack2HalfToRGBA( vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 )); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w); +} +vec2 unpackRGBATo2Half( vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) { + return linearClipZ * ( near - far ) - near; +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return (( near + viewZ ) * far ) / (( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) { + return ( near * far ) / ( ( far - near ) * invClipZ - far ); +}`,Rp=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,Cp=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,Pp=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,Ip=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,Dp=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vUv ); + roughnessFactor *= texelRoughness.g; +#endif`,Fp=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,Np=`#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; }; - - const geometry = new BoxGeometry( 5, 5, 5 ); - - const material = new ShaderMaterial( { - - name: 'CubemapFromEquirect', - - uniforms: cloneUniforms( shader.uniforms ), - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader, - side: BackSide, - blending: NoBlending - - } ); - - material.uniforms.tEquirect.value = texture; - - const mesh = new Mesh( geometry, material ); - - const currentMinFilter = texture.minFilter; - - // Avoid blurred poles - if ( texture.minFilter === LinearMipmapLinearFilter ) texture.minFilter = LinearFilter; - - const camera = new CubeCamera( 1, 10, this ); - camera.update( renderer, mesh ); - - texture.minFilter = currentMinFilter; - - mesh.geometry.dispose(); - mesh.material.dispose(); - - return this; - - } - - clear( renderer, color, depth, stencil ) { - - const currentRenderTarget = renderer.getRenderTarget(); - - for ( let i = 0; i < 6; i ++ ) { - - renderer.setRenderTarget( this, i ); - - renderer.clear( color, depth, stencil ); - - } - - renderer.setRenderTarget( currentRenderTarget ); - - } - -} - -WebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = true; - -class DataTexture extends Texture { - - constructor( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) { - - super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ); - - this.image = { data: data || null, width: width || 1, height: height || 1 }; - - this.magFilter = magFilter !== undefined ? magFilter : NearestFilter; - this.minFilter = minFilter !== undefined ? minFilter : NearestFilter; - - this.generateMipmaps = false; - this.flipY = false; - this.unpackAlignment = 1; - - this.needsUpdate = true; - - } - -} - -DataTexture.prototype.isDataTexture = true; - -const _sphere$1 = /*@__PURE__*/ new Sphere(); -const _vector$5 = /*@__PURE__*/ new Vector3(); - -class Frustum { - - constructor( p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane() ) { - - this.planes = [ p0, p1, p2, p3, p4, p5 ]; - - } - - set( p0, p1, p2, p3, p4, p5 ) { - - const planes = this.planes; - - planes[ 0 ].copy( p0 ); - planes[ 1 ].copy( p1 ); - planes[ 2 ].copy( p2 ); - planes[ 3 ].copy( p3 ); - planes[ 4 ].copy( p4 ); - planes[ 5 ].copy( p5 ); - - return this; - - } - - copy( frustum ) { - - const planes = this.planes; - - for ( let i = 0; i < 6; i ++ ) { - - planes[ i ].copy( frustum.planes[ i ] ); - - } - - return this; - - } - - setFromProjectionMatrix( m ) { - - const planes = this.planes; - const me = m.elements; - const me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ]; - const me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ]; - const me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ]; - const me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ]; - - planes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize(); - planes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize(); - planes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize(); - planes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize(); - planes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize(); - planes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize(); - - return this; - - } - - intersectsObject( object ) { - - const geometry = object.geometry; - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - _sphere$1.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld ); - - return this.intersectsSphere( _sphere$1 ); - - } - - intersectsSprite( sprite ) { - - _sphere$1.center.set( 0, 0, 0 ); - _sphere$1.radius = 0.7071067811865476; - _sphere$1.applyMatrix4( sprite.matrixWorld ); - - return this.intersectsSphere( _sphere$1 ); - - } - - intersectsSphere( sphere ) { - - const planes = this.planes; - const center = sphere.center; - const negRadius = - sphere.radius; - - for ( let i = 0; i < 6; i ++ ) { - - const distance = planes[ i ].distanceToPoint( center ); - - if ( distance < negRadius ) { - - return false; - - } - - } - - return true; - - } - - intersectsBox( box ) { - - const planes = this.planes; - - for ( let i = 0; i < 6; i ++ ) { - - const plane = planes[ i ]; - - // corner at max distance - - _vector$5.x = plane.normal.x > 0 ? box.max.x : box.min.x; - _vector$5.y = plane.normal.y > 0 ? box.max.y : box.min.y; - _vector$5.z = plane.normal.z > 0 ? box.max.z : box.min.z; - - if ( plane.distanceToPoint( _vector$5 ) < 0 ) { - - return false; - - } - - } - - return true; - - } - - containsPoint( point ) { - - const planes = this.planes; - - for ( let i = 0; i < 6; i ++ ) { - - if ( planes[ i ].distanceToPoint( point ) < 0 ) { - - return false; - - } - - } - - return true; - - } - - clone() { - - return new this.constructor().copy( this ); - - } - -} - -function WebGLAnimation() { - - let context = null; - let isAnimating = false; - let animationLoop = null; - let requestId = null; - - function onAnimationFrame( time, frame ) { - - animationLoop( time, frame ); - - requestId = context.requestAnimationFrame( onAnimationFrame ); - - } - - return { - - start: function () { - - if ( isAnimating === true ) return; - if ( animationLoop === null ) return; - - requestId = context.requestAnimationFrame( onAnimationFrame ); - - isAnimating = true; - - }, - - stop: function () { - - context.cancelAnimationFrame( requestId ); - - isAnimating = false; - - }, - - setAnimationLoop: function ( callback ) { - - animationLoop = callback; - - }, - - setContext: function ( value ) { - - context = value; - - } - - }; - -} - -function WebGLAttributes( gl, capabilities ) { - - const isWebGL2 = capabilities.isWebGL2; - - const buffers = new WeakMap(); - - function createBuffer( attribute, bufferType ) { - - const array = attribute.array; - const usage = attribute.usage; - - const buffer = gl.createBuffer(); - - gl.bindBuffer( bufferType, buffer ); - gl.bufferData( bufferType, array, usage ); - - attribute.onUploadCallback(); - - let type = 5126; - - if ( array instanceof Float32Array ) { - - type = 5126; - - } else if ( array instanceof Float64Array ) { - - console.warn( 'THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.' ); - - } else if ( array instanceof Uint16Array ) { - - if ( attribute.isFloat16BufferAttribute ) { - - if ( isWebGL2 ) { - - type = 5131; - - } else { - - console.warn( 'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' ); - - } - - } else { - - type = 5123; - - } - - } else if ( array instanceof Int16Array ) { - - type = 5122; - - } else if ( array instanceof Uint32Array ) { - - type = 5125; - - } else if ( array instanceof Int32Array ) { - - type = 5124; - - } else if ( array instanceof Int8Array ) { - - type = 5120; - - } else if ( array instanceof Uint8Array ) { - - type = 5121; - - } - - return { - buffer: buffer, - type: type, - bytesPerElement: array.BYTES_PER_ELEMENT, - version: attribute.version + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; }; - - } - - function updateBuffer( buffer, attribute, bufferType ) { - - const array = attribute.array; - const updateRange = attribute.updateRange; - - gl.bindBuffer( bufferType, buffer ); - - if ( updateRange.count === - 1 ) { - - // Not using update ranges - - gl.bufferSubData( bufferType, 0, array ); - - } else { - - if ( isWebGL2 ) { - - gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT, - array, updateRange.offset, updateRange.count ); - - } else { - - gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT, - array.subarray( updateRange.offset, updateRange.offset + updateRange.count ) ); - - } - - updateRange.count = - 1; // reset range - - } - - } - - // - - function get( attribute ) { - - if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data; - - return buffers.get( attribute ); - - } - - function remove( attribute ) { - - if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data; - - const data = buffers.get( attribute ); - - if ( data ) { - - gl.deleteBuffer( data.buffer ); - - buffers.delete( attribute ); - - } - - } - - function update( attribute, bufferType ) { - - if ( attribute.isGLBufferAttribute ) { - - const cached = buffers.get( attribute ); - - if ( ! cached || cached.version < attribute.version ) { - - buffers.set( attribute, { - buffer: attribute.buffer, - type: attribute.type, - bytesPerElement: attribute.elementSize, - version: attribute.version - } ); - - } - - return; - - } - - if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data; - - const data = buffers.get( attribute ); - - if ( data === undefined ) { - - buffers.set( attribute, createBuffer( attribute, bufferType ) ); - - } else if ( data.version < attribute.version ) { - - updateBuffer( data.buffer, attribute, bufferType ); - - data.version = attribute.version; - - } - - } - - return { - - get: get, - remove: remove, - update: update - - }; - -} - -class PlaneGeometry extends BufferGeometry { - - constructor( width = 1, height = 1, widthSegments = 1, heightSegments = 1 ) { - - super(); - this.type = 'PlaneGeometry'; - - this.parameters = { - width: width, - height: height, - widthSegments: widthSegments, - heightSegments: heightSegments + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; }; - - const width_half = width / 2; - const height_half = height / 2; - - const gridX = Math.floor( widthSegments ); - const gridY = Math.floor( heightSegments ); - - const gridX1 = gridX + 1; - const gridY1 = gridY + 1; - - const segment_width = width / gridX; - const segment_height = height / gridY; - - // - - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - - for ( let iy = 0; iy < gridY1; iy ++ ) { - - const y = iy * segment_height - height_half; - - for ( let ix = 0; ix < gridX1; ix ++ ) { - - const x = ix * segment_width - width_half; - - vertices.push( x, - y, 0 ); - - normals.push( 0, 0, 1 ); - - uvs.push( ix / gridX ); - uvs.push( 1 - ( iy / gridY ) ); - - } - - } - - for ( let iy = 0; iy < gridY; iy ++ ) { - - for ( let ix = 0; ix < gridX; ix ++ ) { - - const a = ix + gridX1 * iy; - const b = ix + gridX1 * ( iy + 1 ); - const c = ( ix + 1 ) + gridX1 * ( iy + 1 ); - const d = ( ix + 1 ) + gridX1 * iy; - - indices.push( a, b, d ); - indices.push( b, c, d ); - - } - - } - - this.setIndex( indices ); - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); } - -} - -var alphamap_fragment = "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif"; - -var alphamap_pars_fragment = "#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif"; - -var alphatest_fragment = "#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif"; - -var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif"; - -var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif"; - -var begin_vertex = "vec3 transformed = vec3( position );"; - -var beginnormal_vertex = "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif"; - -var bsdfs = "vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif"; - -var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif"; - -var clipping_planes_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif"; - -var clipping_planes_pars_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif"; - -var clipping_planes_pars_vertex = "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif"; - -var clipping_planes_vertex = "#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif"; - -var color_fragment = "#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif"; - -var color_pars_fragment = "#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif"; - -var color_pars_vertex = "#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif"; - -var color_vertex = "#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif"; - -var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}"; - -var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif"; - -var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif"; - -var displacementmap_pars_vertex = "#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif"; - -var displacementmap_vertex = "#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif"; - -var emissivemap_fragment = "#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif"; - -var emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif"; - -var encodings_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );"; - -var encodings_pars_fragment = "\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}"; - -var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif"; - -var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif"; - -var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif"; - -var envmap_pars_vertex = "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif"; - -var envmap_vertex = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif"; - -var fog_vertex = "#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif"; - -var fog_pars_vertex = "#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif"; - -var fog_fragment = "#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif"; - -var fog_pars_fragment = "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif"; - -var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}"; - -var lightmap_fragment = "#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif"; - -var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif"; - -var lights_lambert_vertex = "vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif"; - -var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif"; - -var envmap_physical_pars_fragment = "#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif"; - -var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;"; - -var lights_toon_pars_fragment = "varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)"; - -var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;"; - -var lights_phong_pars_fragment = "varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)"; - -var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif"; - -var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}"; - -var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif"; - -var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif"; - -var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif"; - -var logdepthbuf_fragment = "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif"; - -var logdepthbuf_pars_fragment = "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif"; - -var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif"; - -var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif"; - -var map_fragment = "#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif"; - -var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif"; - -var map_particle_fragment = "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif"; - -var map_particle_pars_fragment = "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif"; - -var metalnessmap_fragment = "float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif"; - -var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif"; - -var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif"; - -var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif"; - -var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif"; - -var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;"; - -var normal_fragment_maps = "#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif"; - -var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif"; - -var clearcoat_normal_fragment_begin = "#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif"; - -var clearcoat_normal_fragment_maps = "#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif"; - -var clearcoat_pars_fragment = "#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif"; - -var packing = "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}"; - -var premultiplied_alpha_fragment = "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif"; - -var project_vertex = "vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;"; - -var dithering_fragment = "#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif"; - -var dithering_pars_fragment = "#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif"; - -var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif"; - -var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif"; - -var shadowmap_pars_fragment = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif"; - -var shadowmap_pars_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif"; - -var shadowmap_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif"; - -var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}"; - -var skinbase_vertex = "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif"; - -var skinning_pars_vertex = "#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif"; - -var skinning_vertex = "#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif"; - -var skinnormal_vertex = "#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif"; - -var specularmap_fragment = "float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif"; - -var specularmap_pars_fragment = "#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif"; - -var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif"; - -var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }"; - -var transmissionmap_fragment = "#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif"; - -var transmissionmap_pars_fragment = "#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\n#endif"; - -var uv_pars_fragment = "#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif"; - -var uv_pars_vertex = "#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif"; - -var uv_vertex = "#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif"; - -var uv2_pars_fragment = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif"; - -var uv2_pars_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif"; - -var uv2_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif"; - -var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif"; - -var background_frag = "uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}"; - -var background_vert = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}"; - -var cube_frag = "#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}"; - -var cube_vert = "varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}"; - -var depth_frag = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}"; - -var depth_vert = "#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}"; - -var distanceRGBA_frag = "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}"; - -var distanceRGBA_vert = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}"; - -var equirect_frag = "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}"; - -var equirect_vert = "varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}"; - -var linedashed_frag = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}"; - -var linedashed_vert = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; - -var meshbasic_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; - -var meshbasic_vert = "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; - -var meshlambert_frag = "uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; - -var meshlambert_vert = "#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; - -var meshmatcap_frag = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; - -var meshmatcap_vert = "#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}"; - -var meshtoon_frag = "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; - -var meshtoon_vert = "#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}"; - -var meshphong_frag = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; - -var meshphong_vert = "#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}"; - -var meshphysical_frag = "#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; - -var meshphysical_vert = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}"; - -var normal_frag = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}"; - -var normal_vert = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}"; - -var points_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}"; - -var points_vert = "uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}"; - -var shadow_frag = "uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}"; - -var shadow_vert = "#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; - -var sprite_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}"; - -var sprite_vert = "uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"; - -const ShaderChunk = { - alphamap_fragment: alphamap_fragment, - alphamap_pars_fragment: alphamap_pars_fragment, - alphatest_fragment: alphatest_fragment, - aomap_fragment: aomap_fragment, - aomap_pars_fragment: aomap_pars_fragment, - begin_vertex: begin_vertex, - beginnormal_vertex: beginnormal_vertex, - bsdfs: bsdfs, - bumpmap_pars_fragment: bumpmap_pars_fragment, - clipping_planes_fragment: clipping_planes_fragment, - clipping_planes_pars_fragment: clipping_planes_pars_fragment, - clipping_planes_pars_vertex: clipping_planes_pars_vertex, - clipping_planes_vertex: clipping_planes_vertex, - color_fragment: color_fragment, - color_pars_fragment: color_pars_fragment, - color_pars_vertex: color_pars_vertex, - color_vertex: color_vertex, - common: common, - cube_uv_reflection_fragment: cube_uv_reflection_fragment, - defaultnormal_vertex: defaultnormal_vertex, - displacementmap_pars_vertex: displacementmap_pars_vertex, - displacementmap_vertex: displacementmap_vertex, - emissivemap_fragment: emissivemap_fragment, - emissivemap_pars_fragment: emissivemap_pars_fragment, - encodings_fragment: encodings_fragment, - encodings_pars_fragment: encodings_pars_fragment, - envmap_fragment: envmap_fragment, - envmap_common_pars_fragment: envmap_common_pars_fragment, - envmap_pars_fragment: envmap_pars_fragment, - envmap_pars_vertex: envmap_pars_vertex, - envmap_physical_pars_fragment: envmap_physical_pars_fragment, - envmap_vertex: envmap_vertex, - fog_vertex: fog_vertex, - fog_pars_vertex: fog_pars_vertex, - fog_fragment: fog_fragment, - fog_pars_fragment: fog_pars_fragment, - gradientmap_pars_fragment: gradientmap_pars_fragment, - lightmap_fragment: lightmap_fragment, - lightmap_pars_fragment: lightmap_pars_fragment, - lights_lambert_vertex: lights_lambert_vertex, - lights_pars_begin: lights_pars_begin, - lights_toon_fragment: lights_toon_fragment, - lights_toon_pars_fragment: lights_toon_pars_fragment, - lights_phong_fragment: lights_phong_fragment, - lights_phong_pars_fragment: lights_phong_pars_fragment, - lights_physical_fragment: lights_physical_fragment, - lights_physical_pars_fragment: lights_physical_pars_fragment, - lights_fragment_begin: lights_fragment_begin, - lights_fragment_maps: lights_fragment_maps, - lights_fragment_end: lights_fragment_end, - logdepthbuf_fragment: logdepthbuf_fragment, - logdepthbuf_pars_fragment: logdepthbuf_pars_fragment, - logdepthbuf_pars_vertex: logdepthbuf_pars_vertex, - logdepthbuf_vertex: logdepthbuf_vertex, - map_fragment: map_fragment, - map_pars_fragment: map_pars_fragment, - map_particle_fragment: map_particle_fragment, - map_particle_pars_fragment: map_particle_pars_fragment, - metalnessmap_fragment: metalnessmap_fragment, - metalnessmap_pars_fragment: metalnessmap_pars_fragment, - morphnormal_vertex: morphnormal_vertex, - morphtarget_pars_vertex: morphtarget_pars_vertex, - morphtarget_vertex: morphtarget_vertex, - normal_fragment_begin: normal_fragment_begin, - normal_fragment_maps: normal_fragment_maps, - normalmap_pars_fragment: normalmap_pars_fragment, - clearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin, - clearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps, - clearcoat_pars_fragment: clearcoat_pars_fragment, - packing: packing, - premultiplied_alpha_fragment: premultiplied_alpha_fragment, - project_vertex: project_vertex, - dithering_fragment: dithering_fragment, - dithering_pars_fragment: dithering_pars_fragment, - roughnessmap_fragment: roughnessmap_fragment, - roughnessmap_pars_fragment: roughnessmap_pars_fragment, - shadowmap_pars_fragment: shadowmap_pars_fragment, - shadowmap_pars_vertex: shadowmap_pars_vertex, - shadowmap_vertex: shadowmap_vertex, - shadowmask_pars_fragment: shadowmask_pars_fragment, - skinbase_vertex: skinbase_vertex, - skinning_pars_vertex: skinning_pars_vertex, - skinning_vertex: skinning_vertex, - skinnormal_vertex: skinnormal_vertex, - specularmap_fragment: specularmap_fragment, - specularmap_pars_fragment: specularmap_pars_fragment, - tonemapping_fragment: tonemapping_fragment, - tonemapping_pars_fragment: tonemapping_pars_fragment, - transmissionmap_fragment: transmissionmap_fragment, - transmissionmap_pars_fragment: transmissionmap_pars_fragment, - uv_pars_fragment: uv_pars_fragment, - uv_pars_vertex: uv_pars_vertex, - uv_vertex: uv_vertex, - uv2_pars_fragment: uv2_pars_fragment, - uv2_pars_vertex: uv2_pars_vertex, - uv2_vertex: uv2_vertex, - worldpos_vertex: worldpos_vertex, - - background_frag: background_frag, - background_vert: background_vert, - cube_frag: cube_frag, - cube_vert: cube_vert, - depth_frag: depth_frag, - depth_vert: depth_vert, - distanceRGBA_frag: distanceRGBA_frag, - distanceRGBA_vert: distanceRGBA_vert, - equirect_frag: equirect_frag, - equirect_vert: equirect_vert, - linedashed_frag: linedashed_frag, - linedashed_vert: linedashed_vert, - meshbasic_frag: meshbasic_frag, - meshbasic_vert: meshbasic_vert, - meshlambert_frag: meshlambert_frag, - meshlambert_vert: meshlambert_vert, - meshmatcap_frag: meshmatcap_frag, - meshmatcap_vert: meshmatcap_vert, - meshtoon_frag: meshtoon_frag, - meshtoon_vert: meshtoon_vert, - meshphong_frag: meshphong_frag, - meshphong_vert: meshphong_vert, - meshphysical_frag: meshphysical_frag, - meshphysical_vert: meshphysical_vert, - normal_frag: normal_frag, - normal_vert: normal_vert, - points_frag: points_frag, - points_vert: points_vert, - shadow_frag: shadow_frag, - shadow_vert: shadow_vert, - sprite_frag: sprite_frag, - sprite_vert: sprite_vert -}; - -/** - * Uniforms library for shared webgl shaders - */ - -const UniformsLib = { - - common: { - - diffuse: { value: new Color( 0xeeeeee ) }, - opacity: { value: 1.0 }, - - map: { value: null }, - uvTransform: { value: new Matrix3() }, - uv2Transform: { value: new Matrix3() }, - - alphaMap: { value: null }, - - }, - - specularmap: { - - specularMap: { value: null }, - - }, - - envmap: { - - envMap: { value: null }, - flipEnvMap: { value: - 1 }, - reflectivity: { value: 1.0 }, - refractionRatio: { value: 0.98 }, - maxMipLevel: { value: 0 } - - }, - - aomap: { - - aoMap: { value: null }, - aoMapIntensity: { value: 1 } - - }, - - lightmap: { - - lightMap: { value: null }, - lightMapIntensity: { value: 1 } - - }, - - emissivemap: { - - emissiveMap: { value: null } - - }, - - bumpmap: { - - bumpMap: { value: null }, - bumpScale: { value: 1 } - - }, - - normalmap: { - - normalMap: { value: null }, - normalScale: { value: new Vector2( 1, 1 ) } - - }, - - displacementmap: { - - displacementMap: { value: null }, - displacementScale: { value: 1 }, - displacementBias: { value: 0 } - - }, - - roughnessmap: { - - roughnessMap: { value: null } - - }, - - metalnessmap: { - - metalnessMap: { value: null } - - }, - - gradientmap: { - - gradientMap: { value: null } - - }, - - fog: { - - fogDensity: { value: 0.00025 }, - fogNear: { value: 1 }, - fogFar: { value: 2000 }, - fogColor: { value: new Color( 0xffffff ) } - - }, - - lights: { - - ambientLightColor: { value: [] }, - - lightProbe: { value: [] }, - - directionalLights: { value: [], properties: { - direction: {}, - color: {} - } }, - - directionalLightShadows: { value: [], properties: { - shadowBias: {}, - shadowNormalBias: {}, - shadowRadius: {}, - shadowMapSize: {} - } }, - - directionalShadowMap: { value: [] }, - directionalShadowMatrix: { value: [] }, - - spotLights: { value: [], properties: { - color: {}, - position: {}, - direction: {}, - distance: {}, - coneCos: {}, - penumbraCos: {}, - decay: {} - } }, - - spotLightShadows: { value: [], properties: { - shadowBias: {}, - shadowNormalBias: {}, - shadowRadius: {}, - shadowMapSize: {} - } }, - - spotShadowMap: { value: [] }, - spotShadowMatrix: { value: [] }, - - pointLights: { value: [], properties: { - color: {}, - position: {}, - decay: {}, - distance: {} - } }, - - pointLightShadows: { value: [], properties: { - shadowBias: {}, - shadowNormalBias: {}, - shadowRadius: {}, - shadowMapSize: {}, - shadowCameraNear: {}, - shadowCameraFar: {} - } }, - - pointShadowMap: { value: [] }, - pointShadowMatrix: { value: [] }, - - hemisphereLights: { value: [], properties: { - direction: {}, - skyColor: {}, - groundColor: {} - } }, - - // TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src - rectAreaLights: { value: [], properties: { - color: {}, - position: {}, - width: {}, - height: {} - } }, - - ltc_1: { value: null }, - ltc_2: { value: null } - - }, - - points: { - - diffuse: { value: new Color( 0xeeeeee ) }, - opacity: { value: 1.0 }, - size: { value: 1.0 }, - scale: { value: 1.0 }, - map: { value: null }, - alphaMap: { value: null }, - uvTransform: { value: new Matrix3() } - - }, - - sprite: { - - diffuse: { value: new Color( 0xeeeeee ) }, - opacity: { value: 1.0 }, - center: { value: new Vector2( 0.5, 0.5 ) }, - rotation: { value: 0.0 }, - map: { value: null }, - alphaMap: { value: null }, - uvTransform: { value: new Matrix3() } - + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); } - -}; - -const ShaderLib = { - - basic: { - - uniforms: mergeUniforms( [ - UniformsLib.common, - UniformsLib.specularmap, - UniformsLib.envmap, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.fog - ] ), - - vertexShader: ShaderChunk.meshbasic_vert, - fragmentShader: ShaderChunk.meshbasic_frag - - }, - - lambert: { - - uniforms: mergeUniforms( [ - UniformsLib.common, - UniformsLib.specularmap, - UniformsLib.envmap, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive: { value: new Color( 0x000000 ) } - } - ] ), - - vertexShader: ShaderChunk.meshlambert_vert, - fragmentShader: ShaderChunk.meshlambert_frag - - }, - - phong: { - - uniforms: mergeUniforms( [ - UniformsLib.common, - UniformsLib.specularmap, - UniformsLib.envmap, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive: { value: new Color( 0x000000 ) }, - specular: { value: new Color( 0x111111 ) }, - shininess: { value: 30 } - } - ] ), - - vertexShader: ShaderChunk.meshphong_vert, - fragmentShader: ShaderChunk.meshphong_frag - - }, - - standard: { - - uniforms: mergeUniforms( [ - UniformsLib.common, - UniformsLib.envmap, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.roughnessmap, - UniformsLib.metalnessmap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive: { value: new Color( 0x000000 ) }, - roughness: { value: 1.0 }, - metalness: { value: 0.0 }, - envMapIntensity: { value: 1 } // temporary - } - ] ), - - vertexShader: ShaderChunk.meshphysical_vert, - fragmentShader: ShaderChunk.meshphysical_frag - - }, - - toon: { - - uniforms: mergeUniforms( [ - UniformsLib.common, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.gradientmap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive: { value: new Color( 0x000000 ) } - } - ] ), - - vertexShader: ShaderChunk.meshtoon_vert, - fragmentShader: ShaderChunk.meshtoon_frag - - }, - - matcap: { - - uniforms: mergeUniforms( [ - UniformsLib.common, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.fog, - { - matcap: { value: null } - } - ] ), - - vertexShader: ShaderChunk.meshmatcap_vert, - fragmentShader: ShaderChunk.meshmatcap_frag - - }, - - points: { - - uniforms: mergeUniforms( [ - UniformsLib.points, - UniformsLib.fog - ] ), - - vertexShader: ShaderChunk.points_vert, - fragmentShader: ShaderChunk.points_frag - - }, - - dashed: { - - uniforms: mergeUniforms( [ - UniformsLib.common, - UniformsLib.fog, - { - scale: { value: 1 }, - dashSize: { value: 1 }, - totalSize: { value: 2 } - } - ] ), - - vertexShader: ShaderChunk.linedashed_vert, - fragmentShader: ShaderChunk.linedashed_frag - - }, - - depth: { - - uniforms: mergeUniforms( [ - UniformsLib.common, - UniformsLib.displacementmap - ] ), - - vertexShader: ShaderChunk.depth_vert, - fragmentShader: ShaderChunk.depth_frag - - }, - - normal: { - - uniforms: mergeUniforms( [ - UniformsLib.common, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - { - opacity: { value: 1.0 } - } - ] ), - - vertexShader: ShaderChunk.normal_vert, - fragmentShader: ShaderChunk.normal_frag - - }, - - sprite: { - - uniforms: mergeUniforms( [ - UniformsLib.sprite, - UniformsLib.fog - ] ), - - vertexShader: ShaderChunk.sprite_vert, - fragmentShader: ShaderChunk.sprite_frag - - }, - - background: { - - uniforms: { - uvTransform: { value: new Matrix3() }, - t2D: { value: null }, - }, - - vertexShader: ShaderChunk.background_vert, - fragmentShader: ShaderChunk.background_frag - - }, - /* ------------------------------------------------------------------------- - // Cube map shader - ------------------------------------------------------------------------- */ - - cube: { - - uniforms: mergeUniforms( [ - UniformsLib.envmap, - { - opacity: { value: 1.0 } - } - ] ), - - vertexShader: ShaderChunk.cube_vert, - fragmentShader: ShaderChunk.cube_frag - - }, - - equirect: { - - uniforms: { - tEquirect: { value: null }, - }, - - vertexShader: ShaderChunk.equirect_vert, - fragmentShader: ShaderChunk.equirect_frag - - }, - - distanceRGBA: { - - uniforms: mergeUniforms( [ - UniformsLib.common, - UniformsLib.displacementmap, - { - referencePosition: { value: new Vector3() }, - nearDistance: { value: 1 }, - farDistance: { value: 1000 } - } - ] ), - - vertexShader: ShaderChunk.distanceRGBA_vert, - fragmentShader: ShaderChunk.distanceRGBA_frag - - }, - - shadow: { - - uniforms: mergeUniforms( [ - UniformsLib.lights, - UniformsLib.fog, - { - color: { value: new Color( 0x00000 ) }, - opacity: { value: 1.0 } - }, - ] ), - - vertexShader: ShaderChunk.shadow_vert, - fragmentShader: ShaderChunk.shadow_frag - + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + float hard_shadow = step( compare , distribution.x ); + if (hard_shadow != 1.0 ) { + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + } + return occlusion; } - -}; - -ShaderLib.physical = { - - uniforms: mergeUniforms( [ - ShaderLib.standard.uniforms, - { - clearcoat: { value: 0 }, - clearcoatMap: { value: null }, - clearcoatRoughness: { value: 0 }, - clearcoatRoughnessMap: { value: null }, - clearcoatNormalScale: { value: new Vector2( 1, 1 ) }, - clearcoatNormalMap: { value: null }, - sheen: { value: new Color( 0x000000 ) }, - transmission: { value: 0 }, - transmissionMap: { value: null }, + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 ); + bool inFrustum = all( inFrustumVec ); + bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 ); + bool frustumTest = all( frustumTestVec ); + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif } - ] ), - - vertexShader: ShaderChunk.meshphysical_vert, - fragmentShader: ShaderChunk.meshphysical_frag - -}; - -function WebGLBackground( renderer, cubemaps, state, objects, premultipliedAlpha ) { - - const clearColor = new Color( 0x000000 ); - let clearAlpha = 0; - - let planeMesh; - let boxMesh; - - let currentBackground = null; - let currentBackgroundVersion = 0; - let currentTonemapping = null; - - function render( renderList, scene, camera, forceClear ) { - - let background = scene.isScene === true ? scene.background : null; - - if ( background && background.isTexture ) { - - background = cubemaps.get( background ); - - } - - // Ignore background in AR - // TODO: Reconsider this. - - const xr = renderer.xr; - const session = xr.getSession && xr.getSession(); - - if ( session && session.environmentBlendMode === 'additive' ) { - - background = null; - - } - - if ( background === null ) { - - setClear( clearColor, clearAlpha ); - - } else if ( background && background.isColor ) { - - setClear( background, 1 ); - forceClear = true; - - } - - if ( renderer.autoClear || forceClear ) { - - renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil ); - - } - - if ( background && ( background.isCubeTexture || background.isWebGLCubeRenderTarget || background.mapping === CubeUVReflectionMapping ) ) { - - if ( boxMesh === undefined ) { - - boxMesh = new Mesh( - new BoxGeometry( 1, 1, 1 ), - new ShaderMaterial( { - name: 'BackgroundCubeMaterial', - uniforms: cloneUniforms( ShaderLib.cube.uniforms ), - vertexShader: ShaderLib.cube.vertexShader, - fragmentShader: ShaderLib.cube.fragmentShader, - side: BackSide, - depthTest: false, - depthWrite: false, - fog: false - } ) - ); - - boxMesh.geometry.deleteAttribute( 'normal' ); - boxMesh.geometry.deleteAttribute( 'uv' ); - - boxMesh.onBeforeRender = function ( renderer, scene, camera ) { - - this.matrixWorld.copyPosition( camera.matrixWorld ); - - }; - - // enable code injection for non-built-in material - Object.defineProperty( boxMesh.material, 'envMap', { - - get: function () { - - return this.uniforms.envMap.value; - - } - - } ); - - objects.update( boxMesh ); - - } - - if ( background.isWebGLCubeRenderTarget ) { - - // TODO Deprecate - - background = background.texture; - - } - - boxMesh.material.uniforms.envMap.value = background; - boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background._needsFlipEnvMap ) ? - 1 : 1; - - if ( currentBackground !== background || - currentBackgroundVersion !== background.version || - currentTonemapping !== renderer.toneMapping ) { - - boxMesh.material.needsUpdate = true; - - currentBackground = background; - currentBackgroundVersion = background.version; - currentTonemapping = renderer.toneMapping; - - } - - // push to the pre-sorted opaque render list - renderList.unshift( boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null ); - - } else if ( background && background.isTexture ) { - - if ( planeMesh === undefined ) { - - planeMesh = new Mesh( - new PlaneGeometry( 2, 2 ), - new ShaderMaterial( { - name: 'BackgroundMaterial', - uniforms: cloneUniforms( ShaderLib.background.uniforms ), - vertexShader: ShaderLib.background.vertexShader, - fragmentShader: ShaderLib.background.fragmentShader, - side: FrontSide, - depthTest: false, - depthWrite: false, - fog: false - } ) - ); - - planeMesh.geometry.deleteAttribute( 'normal' ); - - // enable code injection for non-built-in material - Object.defineProperty( planeMesh.material, 'map', { - - get: function () { - - return this.uniforms.t2D.value; - - } - - } ); - - objects.update( planeMesh ); - - } - - planeMesh.material.uniforms.t2D.value = background; - - if ( background.matrixAutoUpdate === true ) { - - background.updateMatrix(); - - } - - planeMesh.material.uniforms.uvTransform.value.copy( background.matrix ); - - if ( currentBackground !== background || - currentBackgroundVersion !== background.version || - currentTonemapping !== renderer.toneMapping ) { - - planeMesh.material.needsUpdate = true; - - currentBackground = background; - currentBackgroundVersion = background.version; - currentTonemapping = renderer.toneMapping; - - } - - - // push to the pre-sorted opaque render list - renderList.unshift( planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null ); - - } - + return shadow; } - - function setClear( color, alpha ) { - - state.buffers.color.setClear( color.r, color.g, color.b, alpha, premultipliedAlpha ); - + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); } - - return { - - getClearColor: function () { - - return clearColor; - - }, - setClearColor: function ( color, alpha = 1 ) { - - clearColor.set( color ); - clearAlpha = alpha; - setClear( clearColor, clearAlpha ); - - }, - getClearAlpha: function () { - - return clearAlpha; - - }, - setClearAlpha: function ( alpha ) { - - clearAlpha = alpha; - setClear( clearColor, clearAlpha ); - - }, - render: render - - }; - -} - -function WebGLBindingStates( gl, extensions, attributes, capabilities ) { - - const maxVertexAttributes = gl.getParameter( 34921 ); - - const extension = capabilities.isWebGL2 ? null : extensions.get( 'OES_vertex_array_object' ); - const vaoAvailable = capabilities.isWebGL2 || extension !== null; - - const bindingStates = {}; - - const defaultState = createBindingState( null ); - let currentState = defaultState; - - function setup( object, material, program, geometry, index ) { - - let updateBuffers = false; - - if ( vaoAvailable ) { - - const state = getBindingState( geometry, program, material ); - - if ( currentState !== state ) { - - currentState = state; - bindVertexArrayObject( currentState.object ); - - } - - updateBuffers = needsUpdate( geometry, index ); - - if ( updateBuffers ) saveCache( geometry, index ); - - } else { - - const wireframe = ( material.wireframe === true ); - - if ( currentState.geometry !== geometry.id || - currentState.program !== program.id || - currentState.wireframe !== wireframe ) { - - currentState.geometry = geometry.id; - currentState.program = program.id; - currentState.wireframe = wireframe; - - updateBuffers = true; - - } - - } - - if ( object.isInstancedMesh === true ) { - - updateBuffers = true; - - } - - if ( index !== null ) { - - attributes.update( index, 34963 ); - - } - - if ( updateBuffers ) { - - setupVertexAttributes( object, material, program, geometry ); - - if ( index !== null ) { - - gl.bindBuffer( 34963, attributes.get( index ).buffer ); - - } - - } - + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + vec3 lightToPosition = shadowCoord.xyz; + float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + return ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + #else + return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif } - - function createVertexArrayObject() { - - if ( capabilities.isWebGL2 ) return gl.createVertexArray(); - - return extension.createVertexArrayOES(); - - } - - function bindVertexArrayObject( vao ) { - - if ( capabilities.isWebGL2 ) return gl.bindVertexArray( vao ); - - return extension.bindVertexArrayOES( vao ); - - } - - function deleteVertexArrayObject( vao ) { - - if ( capabilities.isWebGL2 ) return gl.deleteVertexArray( vao ); - - return extension.deleteVertexArrayOES( vao ); - - } - - function getBindingState( geometry, program, material ) { - - const wireframe = ( material.wireframe === true ); - - let programMap = bindingStates[ geometry.id ]; - - if ( programMap === undefined ) { - - programMap = {}; - bindingStates[ geometry.id ] = programMap; - - } - - let stateMap = programMap[ program.id ]; - - if ( stateMap === undefined ) { - - stateMap = {}; - programMap[ program.id ] = stateMap; - - } - - let state = stateMap[ wireframe ]; - - if ( state === undefined ) { - - state = createBindingState( createVertexArrayObject() ); - stateMap[ wireframe ] = state; - - } - - return state; - - } - - function createBindingState( vao ) { - - const newAttributes = []; - const enabledAttributes = []; - const attributeDivisors = []; - - for ( let i = 0; i < maxVertexAttributes; i ++ ) { - - newAttributes[ i ] = 0; - enabledAttributes[ i ] = 0; - attributeDivisors[ i ] = 0; - - } - - return { - - // for backward compatibility on non-VAO support browser - geometry: null, - program: null, - wireframe: false, - - newAttributes: newAttributes, - enabledAttributes: enabledAttributes, - attributeDivisors: attributeDivisors, - object: vao, - attributes: {}, - index: null - +#endif`,Bp=`#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; }; - - } - - function needsUpdate( geometry, index ) { - - const cachedAttributes = currentState.attributes; - const geometryAttributes = geometry.attributes; - - let attributesNum = 0; - - for ( const key in geometryAttributes ) { - - const cachedAttribute = cachedAttributes[ key ]; - const geometryAttribute = geometryAttributes[ key ]; - - if ( cachedAttribute === undefined ) return true; - - if ( cachedAttribute.attribute !== geometryAttribute ) return true; - - if ( cachedAttribute.data !== geometryAttribute.data ) return true; - - attributesNum ++; - - } - - if ( currentState.attributesNum !== attributesNum ) return true; - - if ( currentState.index !== index ) return true; - - return false; - - } - - function saveCache( geometry, index ) { - - const cache = {}; - const attributes = geometry.attributes; - let attributesNum = 0; - - for ( const key in attributes ) { - - const attribute = attributes[ key ]; - - const data = {}; - data.attribute = attribute; - - if ( attribute.data ) { - - data.data = attribute.data; - - } - - cache[ key ] = data; - - attributesNum ++; - - } - - currentState.attributes = cache; - currentState.attributesNum = attributesNum; - - currentState.index = index; - - } - - function initAttributes() { - - const newAttributes = currentState.newAttributes; - - for ( let i = 0, il = newAttributes.length; i < il; i ++ ) { - - newAttributes[ i ] = 0; - - } - - } - - function enableAttribute( attribute ) { - - enableAttributeAndDivisor( attribute, 0 ); - - } - - function enableAttributeAndDivisor( attribute, meshPerAttribute ) { - - const newAttributes = currentState.newAttributes; - const enabledAttributes = currentState.enabledAttributes; - const attributeDivisors = currentState.attributeDivisors; - - newAttributes[ attribute ] = 1; - - if ( enabledAttributes[ attribute ] === 0 ) { - - gl.enableVertexAttribArray( attribute ); - enabledAttributes[ attribute ] = 1; - - } - - if ( attributeDivisors[ attribute ] !== meshPerAttribute ) { - - const extension = capabilities.isWebGL2 ? gl : extensions.get( 'ANGLE_instanced_arrays' ); - - extension[ capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE' ]( attribute, meshPerAttribute ); - attributeDivisors[ attribute ] = meshPerAttribute; - - } - - } - - function disableUnusedAttributes() { - - const newAttributes = currentState.newAttributes; - const enabledAttributes = currentState.enabledAttributes; - - for ( let i = 0, il = enabledAttributes.length; i < il; i ++ ) { - - if ( enabledAttributes[ i ] !== newAttributes[ i ] ) { - - gl.disableVertexAttribArray( i ); - enabledAttributes[ i ] = 0; - - } - - } - - } - - function vertexAttribPointer( index, size, type, normalized, stride, offset ) { - - if ( capabilities.isWebGL2 === true && ( type === 5124 || type === 5125 ) ) { - - gl.vertexAttribIPointer( index, size, type, stride, offset ); - - } else { - - gl.vertexAttribPointer( index, size, type, normalized, stride, offset ); - - } - - } - - function setupVertexAttributes( object, material, program, geometry ) { - - if ( capabilities.isWebGL2 === false && ( object.isInstancedMesh || geometry.isInstancedBufferGeometry ) ) { - - if ( extensions.get( 'ANGLE_instanced_arrays' ) === null ) return; - - } - - initAttributes(); - - const geometryAttributes = geometry.attributes; - - const programAttributes = program.getAttributes(); - - const materialDefaultAttributeValues = material.defaultAttributeValues; - - for ( const name in programAttributes ) { - - const programAttribute = programAttributes[ name ]; - - if ( programAttribute >= 0 ) { - - const geometryAttribute = geometryAttributes[ name ]; - - if ( geometryAttribute !== undefined ) { - - const normalized = geometryAttribute.normalized; - const size = geometryAttribute.itemSize; - - const attribute = attributes.get( geometryAttribute ); - - // TODO Attribute may not be available on context restore - - if ( attribute === undefined ) continue; - - const buffer = attribute.buffer; - const type = attribute.type; - const bytesPerElement = attribute.bytesPerElement; - - if ( geometryAttribute.isInterleavedBufferAttribute ) { - - const data = geometryAttribute.data; - const stride = data.stride; - const offset = geometryAttribute.offset; - - if ( data && data.isInstancedInterleavedBuffer ) { - - enableAttributeAndDivisor( programAttribute, data.meshPerAttribute ); - - if ( geometry._maxInstanceCount === undefined ) { - - geometry._maxInstanceCount = data.meshPerAttribute * data.count; - - } - - } else { - - enableAttribute( programAttribute ); - - } - - gl.bindBuffer( 34962, buffer ); - vertexAttribPointer( programAttribute, size, type, normalized, stride * bytesPerElement, offset * bytesPerElement ); - - } else { - - if ( geometryAttribute.isInstancedBufferAttribute ) { - - enableAttributeAndDivisor( programAttribute, geometryAttribute.meshPerAttribute ); - - if ( geometry._maxInstanceCount === undefined ) { - - geometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count; - - } - - } else { - - enableAttribute( programAttribute ); - - } - - gl.bindBuffer( 34962, buffer ); - vertexAttribPointer( programAttribute, size, type, normalized, 0, 0 ); - - } - - } else if ( name === 'instanceMatrix' ) { - - const attribute = attributes.get( object.instanceMatrix ); - - // TODO Attribute may not be available on context restore - - if ( attribute === undefined ) continue; - - const buffer = attribute.buffer; - const type = attribute.type; - - enableAttributeAndDivisor( programAttribute + 0, 1 ); - enableAttributeAndDivisor( programAttribute + 1, 1 ); - enableAttributeAndDivisor( programAttribute + 2, 1 ); - enableAttributeAndDivisor( programAttribute + 3, 1 ); - - gl.bindBuffer( 34962, buffer ); - - gl.vertexAttribPointer( programAttribute + 0, 4, type, false, 64, 0 ); - gl.vertexAttribPointer( programAttribute + 1, 4, type, false, 64, 16 ); - gl.vertexAttribPointer( programAttribute + 2, 4, type, false, 64, 32 ); - gl.vertexAttribPointer( programAttribute + 3, 4, type, false, 64, 48 ); - - } else if ( name === 'instanceColor' ) { - - const attribute = attributes.get( object.instanceColor ); - - // TODO Attribute may not be available on context restore - - if ( attribute === undefined ) continue; - - const buffer = attribute.buffer; - const type = attribute.type; - - enableAttributeAndDivisor( programAttribute, 1 ); - - gl.bindBuffer( 34962, buffer ); - - gl.vertexAttribPointer( programAttribute, 3, type, false, 12, 0 ); - - } else if ( materialDefaultAttributeValues !== undefined ) { - - const value = materialDefaultAttributeValues[ name ]; - - if ( value !== undefined ) { - - switch ( value.length ) { - - case 2: - gl.vertexAttrib2fv( programAttribute, value ); - break; - - case 3: - gl.vertexAttrib3fv( programAttribute, value ); - break; - - case 4: - gl.vertexAttrib4fv( programAttribute, value ); - break; - - default: - gl.vertexAttrib1fv( programAttribute, value ); - - } - - } - - } - - } - - } - - disableUnusedAttributes(); - - } - - function dispose() { - - reset(); - - for ( const geometryId in bindingStates ) { - - const programMap = bindingStates[ geometryId ]; - - for ( const programId in programMap ) { - - const stateMap = programMap[ programId ]; - - for ( const wireframe in stateMap ) { - - deleteVertexArrayObject( stateMap[ wireframe ].object ); - - delete stateMap[ wireframe ]; - - } - - delete programMap[ programId ]; - - } - - delete bindingStates[ geometryId ]; - - } - - } - - function releaseStatesOfGeometry( geometry ) { - - if ( bindingStates[ geometry.id ] === undefined ) return; - - const programMap = bindingStates[ geometry.id ]; - - for ( const programId in programMap ) { - - const stateMap = programMap[ programId ]; - - for ( const wireframe in stateMap ) { - - deleteVertexArrayObject( stateMap[ wireframe ].object ); - - delete stateMap[ wireframe ]; - - } - - delete programMap[ programId ]; - - } - - delete bindingStates[ geometry.id ]; - - } - - function releaseStatesOfProgram( program ) { - - for ( const geometryId in bindingStates ) { - - const programMap = bindingStates[ geometryId ]; - - if ( programMap[ program.id ] === undefined ) continue; - - const stateMap = programMap[ program.id ]; - - for ( const wireframe in stateMap ) { - - deleteVertexArrayObject( stateMap[ wireframe ].object ); - - delete stateMap[ wireframe ]; - - } - - delete programMap[ program.id ]; - - } - - } - - function reset() { - - resetDefaultState(); - - if ( currentState === defaultState ) return; - - currentState = defaultState; - bindVertexArrayObject( currentState.object ); - - } - - // for backward-compatilibity - - function resetDefaultState() { - - defaultState.geometry = null; - defaultState.program = null; - defaultState.wireframe = false; - - } - - return { - - setup: setup, - reset: reset, - resetDefaultState: resetDefaultState, - dispose: dispose, - releaseStatesOfGeometry: releaseStatesOfGeometry, - releaseStatesOfProgram: releaseStatesOfProgram, - - initAttributes: initAttributes, - enableAttribute: enableAttribute, - disableUnusedAttributes: disableUnusedAttributes - - }; - -} - -function WebGLBufferRenderer( gl, extensions, info, capabilities ) { - - const isWebGL2 = capabilities.isWebGL2; - - let mode; - - function setMode( value ) { - - mode = value; - - } - - function render( start, count ) { - - gl.drawArrays( mode, start, count ); - - info.update( count, mode, 1 ); - - } - - function renderInstances( start, count, primcount ) { - - if ( primcount === 0 ) return; - - let extension, methodName; - - if ( isWebGL2 ) { - - extension = gl; - methodName = 'drawArraysInstanced'; - - } else { - - extension = extensions.get( 'ANGLE_instanced_arrays' ); - methodName = 'drawArraysInstancedANGLE'; - - if ( extension === null ) { - - console.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' ); - return; - - } - - } - - extension[ methodName ]( mode, start, count, primcount ); - - info.update( count, mode, primcount ); - - } - - // - - this.setMode = setMode; - this.render = render; - this.renderInstances = renderInstances; - -} - -function WebGLCapabilities( gl, extensions, parameters ) { - - let maxAnisotropy; - - function getMaxAnisotropy() { - - if ( maxAnisotropy !== undefined ) return maxAnisotropy; - - if ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) { - - const extension = extensions.get( 'EXT_texture_filter_anisotropic' ); - - maxAnisotropy = gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT ); - - } else { - - maxAnisotropy = 0; - - } - - return maxAnisotropy; - - } - - function getMaxPrecision( precision ) { - - if ( precision === 'highp' ) { - - if ( gl.getShaderPrecisionFormat( 35633, 36338 ).precision > 0 && - gl.getShaderPrecisionFormat( 35632, 36338 ).precision > 0 ) { - - return 'highp'; - - } - - precision = 'mediump'; - - } - - if ( precision === 'mediump' ) { - - if ( gl.getShaderPrecisionFormat( 35633, 36337 ).precision > 0 && - gl.getShaderPrecisionFormat( 35632, 36337 ).precision > 0 ) { - - return 'mediump'; - - } - - } - - return 'lowp'; - - } - - /* eslint-disable no-undef */ - const isWebGL2 = ( typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext ) || - ( typeof WebGL2ComputeRenderingContext !== 'undefined' && gl instanceof WebGL2ComputeRenderingContext ); - /* eslint-enable no-undef */ - - let precision = parameters.precision !== undefined ? parameters.precision : 'highp'; - const maxPrecision = getMaxPrecision( precision ); - - if ( maxPrecision !== precision ) { - - console.warn( 'THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' ); - precision = maxPrecision; - - } - - const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true; - - const maxTextures = gl.getParameter( 34930 ); - const maxVertexTextures = gl.getParameter( 35660 ); - const maxTextureSize = gl.getParameter( 3379 ); - const maxCubemapSize = gl.getParameter( 34076 ); - - const maxAttributes = gl.getParameter( 34921 ); - const maxVertexUniforms = gl.getParameter( 36347 ); - const maxVaryings = gl.getParameter( 36348 ); - const maxFragmentUniforms = gl.getParameter( 36349 ); - - const vertexTextures = maxVertexTextures > 0; - const floatFragmentTextures = isWebGL2 || extensions.has( 'OES_texture_float' ); - const floatVertexTextures = vertexTextures && floatFragmentTextures; - - const maxSamples = isWebGL2 ? gl.getParameter( 36183 ) : 0; - - return { - - isWebGL2: isWebGL2, - - getMaxAnisotropy: getMaxAnisotropy, - getMaxPrecision: getMaxPrecision, - - precision: precision, - logarithmicDepthBuffer: logarithmicDepthBuffer, - - maxTextures: maxTextures, - maxVertexTextures: maxVertexTextures, - maxTextureSize: maxTextureSize, - maxCubemapSize: maxCubemapSize, - - maxAttributes: maxAttributes, - maxVertexUniforms: maxVertexUniforms, - maxVaryings: maxVaryings, - maxFragmentUniforms: maxFragmentUniforms, - - vertexTextures: vertexTextures, - floatFragmentTextures: floatFragmentTextures, - floatVertexTextures: floatVertexTextures, - - maxSamples: maxSamples - - }; - -} - -function WebGLClipping( properties ) { - - const scope = this; - - let globalState = null, - numGlobalPlanes = 0, - localClippingEnabled = false, - renderingShadows = false; - - const plane = new Plane(), - viewNormalMatrix = new Matrix3(), - - uniform = { value: null, needsUpdate: false }; - - this.uniform = uniform; - this.numPlanes = 0; - this.numIntersection = 0; - - this.init = function ( planes, enableLocalClipping, camera ) { - - const enabled = - planes.length !== 0 || - enableLocalClipping || - // enable state of previous frame - the clipping code has to - // run another frame in order to reset the state: - numGlobalPlanes !== 0 || - localClippingEnabled; - - localClippingEnabled = enableLocalClipping; - - globalState = projectPlanes( planes, camera, 0 ); - numGlobalPlanes = planes.length; - - return enabled; - - }; - - this.beginShadows = function () { - - renderingShadows = true; - projectPlanes( null ); - - }; - - this.endShadows = function () { - - renderingShadows = false; - resetGlobalState(); - - }; - - this.setState = function ( material, camera, useCache ) { - - const planes = material.clippingPlanes, - clipIntersection = material.clipIntersection, - clipShadows = material.clipShadows; - - const materialProperties = properties.get( material ); - - if ( ! localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && ! clipShadows ) { - - // there's no local clipping - - if ( renderingShadows ) { - - // there's no global clipping - - projectPlanes( null ); - - } else { - - resetGlobalState(); - - } - - } else { - - const nGlobal = renderingShadows ? 0 : numGlobalPlanes, - lGlobal = nGlobal * 4; - - let dstArray = materialProperties.clippingState || null; - - uniform.value = dstArray; // ensure unique state - - dstArray = projectPlanes( planes, camera, lGlobal, useCache ); - - for ( let i = 0; i !== lGlobal; ++ i ) { - - dstArray[ i ] = globalState[ i ]; - - } - - materialProperties.clippingState = dstArray; - this.numIntersection = clipIntersection ? this.numPlanes : 0; - this.numPlanes += nGlobal; - - } - - - }; - - function resetGlobalState() { - - if ( uniform.value !== globalState ) { - - uniform.value = globalState; - uniform.needsUpdate = numGlobalPlanes > 0; - - } - - scope.numPlanes = numGlobalPlanes; - scope.numIntersection = 0; - - } - - function projectPlanes( planes, camera, dstOffset, skipTransform ) { - - const nPlanes = planes !== null ? planes.length : 0; - let dstArray = null; - - if ( nPlanes !== 0 ) { - - dstArray = uniform.value; - - if ( skipTransform !== true || dstArray === null ) { - - const flatSize = dstOffset + nPlanes * 4, - viewMatrix = camera.matrixWorldInverse; - - viewNormalMatrix.getNormalMatrix( viewMatrix ); - - if ( dstArray === null || dstArray.length < flatSize ) { - - dstArray = new Float32Array( flatSize ); - - } - - for ( let i = 0, i4 = dstOffset; i !== nPlanes; ++ i, i4 += 4 ) { - - plane.copy( planes[ i ] ).applyMatrix4( viewMatrix, viewNormalMatrix ); - - plane.normal.toArray( dstArray, i4 ); - dstArray[ i4 + 3 ] = plane.constant; - - } - - } - - uniform.value = dstArray; - uniform.needsUpdate = true; - - } - - scope.numPlanes = nPlanes; - scope.numIntersection = 0; - - return dstArray; - - } - -} - -function WebGLCubeMaps( renderer ) { - - let cubemaps = new WeakMap(); - - function mapTextureMapping( texture, mapping ) { - - if ( mapping === EquirectangularReflectionMapping ) { - - texture.mapping = CubeReflectionMapping; - - } else if ( mapping === EquirectangularRefractionMapping ) { - - texture.mapping = CubeRefractionMapping; - - } - - return texture; - - } - - function get( texture ) { - - if ( texture && texture.isTexture ) { - - const mapping = texture.mapping; - - if ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping ) { - - if ( cubemaps.has( texture ) ) { - - const cubemap = cubemaps.get( texture ).texture; - return mapTextureMapping( cubemap, texture.mapping ); - - } else { - - const image = texture.image; - - if ( image && image.height > 0 ) { - - const currentRenderTarget = renderer.getRenderTarget(); - - const renderTarget = new WebGLCubeRenderTarget( image.height / 2 ); - renderTarget.fromEquirectangularTexture( renderer, texture ); - cubemaps.set( texture, renderTarget ); - - renderer.setRenderTarget( currentRenderTarget ); - - texture.addEventListener( 'dispose', onTextureDispose ); - - return mapTextureMapping( renderTarget.texture, texture.mapping ); - - } else { - - // image not yet ready. try the conversion next frame - - return null; - - } - - } - - } - - } - - return texture; - - } - - function onTextureDispose( event ) { - - const texture = event.target; - - texture.removeEventListener( 'dispose', onTextureDispose ); - - const cubemap = cubemaps.get( texture ); - - if ( cubemap !== undefined ) { - - cubemaps.delete( texture ); - cubemap.dispose(); - - } - - } - - function dispose() { - - cubemaps = new WeakMap(); - - } - - return { - get: get, - dispose: dispose - }; - -} - -function WebGLExtensions( gl ) { - - const extensions = {}; - - function getExtension( name ) { - - if ( extensions[ name ] !== undefined ) { - - return extensions[ name ]; - - } - - let extension; - - switch ( name ) { - - case 'WEBGL_depth_texture': - extension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' ); - break; - - case 'EXT_texture_filter_anisotropic': - extension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' ); - break; - - case 'WEBGL_compressed_texture_s3tc': - extension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' ); - break; - - case 'WEBGL_compressed_texture_pvrtc': - extension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' ); - break; - - default: - extension = gl.getExtension( name ); - - } - - extensions[ name ] = extension; - - return extension; - - } - - return { - - has: function ( name ) { - - return getExtension( name ) !== null; - - }, - - init: function ( capabilities ) { - - if ( capabilities.isWebGL2 ) { - - getExtension( 'EXT_color_buffer_float' ); - - } else { - - getExtension( 'WEBGL_depth_texture' ); - getExtension( 'OES_texture_float' ); - getExtension( 'OES_texture_half_float' ); - getExtension( 'OES_texture_half_float_linear' ); - getExtension( 'OES_standard_derivatives' ); - getExtension( 'OES_element_index_uint' ); - getExtension( 'OES_vertex_array_object' ); - getExtension( 'ANGLE_instanced_arrays' ); - - } - - getExtension( 'OES_texture_float_linear' ); - getExtension( 'EXT_color_buffer_half_float' ); - - }, - - get: function ( name ) { - - const extension = getExtension( name ); - - if ( extension === null ) { - - console.warn( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' ); - - } - - return extension; - - } - - }; - -} - -function WebGLGeometries( gl, attributes, info, bindingStates ) { - - const geometries = {}; - const wireframeAttributes = new WeakMap(); - - function onGeometryDispose( event ) { - - const geometry = event.target; - - if ( geometry.index !== null ) { - - attributes.remove( geometry.index ); - - } - - for ( const name in geometry.attributes ) { - - attributes.remove( geometry.attributes[ name ] ); - - } - - geometry.removeEventListener( 'dispose', onGeometryDispose ); - - delete geometries[ geometry.id ]; - - const attribute = wireframeAttributes.get( geometry ); - - if ( attribute ) { - - attributes.remove( attribute ); - wireframeAttributes.delete( geometry ); - - } - - bindingStates.releaseStatesOfGeometry( geometry ); - - if ( geometry.isInstancedBufferGeometry === true ) { - - delete geometry._maxInstanceCount; - - } - - // - - info.memory.geometries --; - - } - - function get( object, geometry ) { - - if ( geometries[ geometry.id ] === true ) return geometry; - - geometry.addEventListener( 'dispose', onGeometryDispose ); - - geometries[ geometry.id ] = true; - - info.memory.geometries ++; - - return geometry; - - } - - function update( geometry ) { - - const geometryAttributes = geometry.attributes; - - // Updating index buffer in VAO now. See WebGLBindingStates. - - for ( const name in geometryAttributes ) { - - attributes.update( geometryAttributes[ name ], 34962 ); - - } - - // morph targets - - const morphAttributes = geometry.morphAttributes; - - for ( const name in morphAttributes ) { - - const array = morphAttributes[ name ]; - - for ( let i = 0, l = array.length; i < l; i ++ ) { - - attributes.update( array[ i ], 34962 ); - - } - - } - - } - - function updateWireframeAttribute( geometry ) { - - const indices = []; - - const geometryIndex = geometry.index; - const geometryPosition = geometry.attributes.position; - let version = 0; - - if ( geometryIndex !== null ) { - - const array = geometryIndex.array; - version = geometryIndex.version; - - for ( let i = 0, l = array.length; i < l; i += 3 ) { - - const a = array[ i + 0 ]; - const b = array[ i + 1 ]; - const c = array[ i + 2 ]; - - indices.push( a, b, b, c, c, a ); - - } - - } else { - - const array = geometryPosition.array; - version = geometryPosition.version; - - for ( let i = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) { - - const a = i + 0; - const b = i + 1; - const c = i + 2; - - indices.push( a, b, b, c, c, a ); - - } - - } - - const attribute = new ( arrayMax( indices ) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 ); - attribute.version = version; - - // Updating index buffer in VAO now. See WebGLBindingStates - - // - - const previousAttribute = wireframeAttributes.get( geometry ); - - if ( previousAttribute ) attributes.remove( previousAttribute ); - - // - - wireframeAttributes.set( geometry, attribute ); - - } - - function getWireframeAttribute( geometry ) { - - const currentAttribute = wireframeAttributes.get( geometry ); - - if ( currentAttribute ) { - - const geometryIndex = geometry.index; - - if ( geometryIndex !== null ) { - - // if the attribute is obsolete, create a new one - - if ( currentAttribute.version < geometryIndex.version ) { - - updateWireframeAttribute( geometry ); - - } - - } - - } else { - - updateWireframeAttribute( geometry ); - - } - - return wireframeAttributes.get( geometry ); - - } - - return { - - get: get, - update: update, - - getWireframeAttribute: getWireframeAttribute - - }; - -} - -function WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) { - - const isWebGL2 = capabilities.isWebGL2; - - let mode; - - function setMode( value ) { - - mode = value; - - } - - let type, bytesPerElement; - - function setIndex( value ) { - - type = value.type; - bytesPerElement = value.bytesPerElement; - - } - - function render( start, count ) { - - gl.drawElements( mode, count, type, start * bytesPerElement ); - - info.update( count, mode, 1 ); - - } - - function renderInstances( start, count, primcount ) { - - if ( primcount === 0 ) return; - - let extension, methodName; - - if ( isWebGL2 ) { - - extension = gl; - methodName = 'drawElementsInstanced'; - - } else { - - extension = extensions.get( 'ANGLE_instanced_arrays' ); - methodName = 'drawElementsInstancedANGLE'; - - if ( extension === null ) { - - console.error( 'THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' ); - return; - - } - - } - - extension[ methodName ]( mode, count, type, start * bytesPerElement, primcount ); - - info.update( count, mode, primcount ); - - } - - // - - this.setMode = setMode; - this.setIndex = setIndex; - this.render = render; - this.renderInstances = renderInstances; - -} - -function WebGLInfo( gl ) { - - const memory = { - geometries: 0, - textures: 0 - }; - - const render = { - frame: 0, - calls: 0, - triangles: 0, - points: 0, - lines: 0 - }; - - function update( count, mode, instanceCount ) { - - render.calls ++; - - switch ( mode ) { - - case 4: - render.triangles += instanceCount * ( count / 3 ); - break; - - case 1: - render.lines += instanceCount * ( count / 2 ); - break; - - case 3: - render.lines += instanceCount * ( count - 1 ); - break; - - case 2: - render.lines += instanceCount * count; - break; - - case 0: - render.points += instanceCount * count; - break; - - default: - console.error( 'THREE.WebGLInfo: Unknown draw mode:', mode ); - break; - - } - - } - - function reset() { - - render.frame ++; - render.calls = 0; - render.triangles = 0; - render.points = 0; - render.lines = 0; - - } - - return { - memory: memory, - render: render, - programs: null, - autoReset: true, - reset: reset, - update: update - }; - -} - -function numericalSort( a, b ) { - - return a[ 0 ] - b[ 0 ]; - -} - -function absNumericalSort( a, b ) { - - return Math.abs( b[ 1 ] ) - Math.abs( a[ 1 ] ); - -} - -function WebGLMorphtargets( gl ) { - - const influencesList = {}; - const morphInfluences = new Float32Array( 8 ); - - const workInfluences = []; - - for ( let i = 0; i < 8; i ++ ) { - - workInfluences[ i ] = [ i, 0 ]; - - } - - function update( object, geometry, material, program ) { - - const objectInfluences = object.morphTargetInfluences; - - // When object doesn't have morph target influences defined, we treat it as a 0-length array - // This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences - - const length = objectInfluences === undefined ? 0 : objectInfluences.length; - - let influences = influencesList[ geometry.id ]; - - if ( influences === undefined ) { - - // initialise list - - influences = []; - - for ( let i = 0; i < length; i ++ ) { - - influences[ i ] = [ i, 0 ]; - - } - - influencesList[ geometry.id ] = influences; - - } - - // Collect influences - - for ( let i = 0; i < length; i ++ ) { - - const influence = influences[ i ]; - - influence[ 0 ] = i; - influence[ 1 ] = objectInfluences[ i ]; - - } - - influences.sort( absNumericalSort ); - - for ( let i = 0; i < 8; i ++ ) { - - if ( i < length && influences[ i ][ 1 ] ) { - - workInfluences[ i ][ 0 ] = influences[ i ][ 0 ]; - workInfluences[ i ][ 1 ] = influences[ i ][ 1 ]; - - } else { - - workInfluences[ i ][ 0 ] = Number.MAX_SAFE_INTEGER; - workInfluences[ i ][ 1 ] = 0; - - } - - } - - workInfluences.sort( numericalSort ); - - const morphTargets = material.morphTargets && geometry.morphAttributes.position; - const morphNormals = material.morphNormals && geometry.morphAttributes.normal; - - let morphInfluencesSum = 0; - - for ( let i = 0; i < 8; i ++ ) { - - const influence = workInfluences[ i ]; - const index = influence[ 0 ]; - const value = influence[ 1 ]; - - if ( index !== Number.MAX_SAFE_INTEGER && value ) { - - if ( morphTargets && geometry.getAttribute( 'morphTarget' + i ) !== morphTargets[ index ] ) { - - geometry.setAttribute( 'morphTarget' + i, morphTargets[ index ] ); - - } - - if ( morphNormals && geometry.getAttribute( 'morphNormal' + i ) !== morphNormals[ index ] ) { - - geometry.setAttribute( 'morphNormal' + i, morphNormals[ index ] ); - - } - - morphInfluences[ i ] = value; - morphInfluencesSum += value; - - } else { - - if ( morphTargets && geometry.hasAttribute( 'morphTarget' + i ) === true ) { - - geometry.deleteAttribute( 'morphTarget' + i ); - - } - - if ( morphNormals && geometry.hasAttribute( 'morphNormal' + i ) === true ) { - - geometry.deleteAttribute( 'morphNormal' + i ); - - } - - morphInfluences[ i ] = 0; - - } - - } - - // GLSL shader uses formula baseinfluence * base + sum(target * influence) - // This allows us to switch between absolute morphs and relative morphs without changing shader code - // When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence) - const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum; - - program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence ); - program.getUniforms().setValue( gl, 'morphTargetInfluences', morphInfluences ); - - } - - return { - - update: update - - }; - -} - -function WebGLObjects( gl, geometries, attributes, info ) { - - let updateMap = new WeakMap(); - - function update( object ) { - - const frame = info.render.frame; - - const geometry = object.geometry; - const buffergeometry = geometries.get( object, geometry ); - - // Update once per frame - - if ( updateMap.get( buffergeometry ) !== frame ) { - - geometries.update( buffergeometry ); - - updateMap.set( buffergeometry, frame ); - - } - - if ( object.isInstancedMesh ) { - - if ( object.hasEventListener( 'dispose', onInstancedMeshDispose ) === false ) { - - object.addEventListener( 'dispose', onInstancedMeshDispose ); - - } - - attributes.update( object.instanceMatrix, 34962 ); - - if ( object.instanceColor !== null ) { - - attributes.update( object.instanceColor, 34962 ); - - } - - } - - return buffergeometry; - - } - - function dispose() { - - updateMap = new WeakMap(); - - } - - function onInstancedMeshDispose( event ) { - - const instancedMesh = event.target; - - instancedMesh.removeEventListener( 'dispose', onInstancedMeshDispose ); - - attributes.remove( instancedMesh.instanceMatrix ); - - if ( instancedMesh.instanceColor !== null ) attributes.remove( instancedMesh.instanceColor ); - - } - - return { - - update: update, - dispose: dispose - - }; - -} - -class DataTexture2DArray extends Texture { - - constructor( data = null, width = 1, height = 1, depth = 1 ) { - - super( null ); - - this.image = { data, width, height, depth }; - - this.magFilter = NearestFilter; - this.minFilter = NearestFilter; - - this.wrapR = ClampToEdgeWrapping; - - this.generateMipmaps = false; - this.flipY = false; - - this.needsUpdate = true; - - } - -} - -DataTexture2DArray.prototype.isDataTexture2DArray = true; - -class DataTexture3D extends Texture { - - constructor( data = null, width = 1, height = 1, depth = 1 ) { - - // We're going to add .setXXX() methods for setting properties later. - // Users can still set in DataTexture3D directly. - // - // const texture = new THREE.DataTexture3D( data, width, height, depth ); - // texture.anisotropy = 16; - // - // See #14839 - - super( null ); - - this.image = { data, width, height, depth }; - - this.magFilter = NearestFilter; - this.minFilter = NearestFilter; - - this.wrapR = ClampToEdgeWrapping; - - this.generateMipmaps = false; - this.flipY = false; - - this.needsUpdate = true; - - } - -} - -DataTexture3D.prototype.isDataTexture3D = true; - -/** - * Uniforms of a program. - * Those form a tree structure with a special top-level container for the root, - * which you get by calling 'new WebGLUniforms( gl, program )'. - * - * - * Properties of inner nodes including the top-level container: - * - * .seq - array of nested uniforms - * .map - nested uniforms by name - * - * - * Methods of all nodes except the top-level container: - * - * .setValue( gl, value, [textures] ) - * - * uploads a uniform value(s) - * the 'textures' parameter is needed for sampler uniforms - * - * - * Static methods of the top-level container (textures factorizations): - * - * .upload( gl, seq, values, textures ) - * - * sets uniforms in 'seq' to 'values[id].value' - * - * .seqWithValue( seq, values ) : filteredSeq - * - * filters 'seq' entries with corresponding entry in values - * - * - * Methods of the top-level container (textures factorizations): - * - * .setValue( gl, name, value, textures ) - * - * sets uniform with name 'name' to 'value' - * - * .setOptional( gl, obj, prop ) - * - * like .set for an optional property of the object - * - */ - -const emptyTexture = new Texture(); -const emptyTexture2dArray = new DataTexture2DArray(); -const emptyTexture3d = new DataTexture3D(); -const emptyCubeTexture = new CubeTexture(); - -// --- Utilities --- - -// Array Caches (provide typed arrays for temporary by size) - -const arrayCacheF32 = []; -const arrayCacheI32 = []; - -// Float32Array caches used for uploading Matrix uniforms - -const mat4array = new Float32Array( 16 ); -const mat3array = new Float32Array( 9 ); -const mat2array = new Float32Array( 4 ); - -// Flattening for arrays of vectors and matrices - -function flatten( array, nBlocks, blockSize ) { - - const firstElem = array[ 0 ]; - - if ( firstElem <= 0 || firstElem > 0 ) return array; - // unoptimized: ! isNaN( firstElem ) - // see http://jacksondunstan.com/articles/983 - - const n = nBlocks * blockSize; - let r = arrayCacheF32[ n ]; - - if ( r === undefined ) { - - r = new Float32Array( n ); - arrayCacheF32[ n ] = r; - - } - - if ( nBlocks !== 0 ) { - - firstElem.toArray( r, 0 ); - - for ( let i = 1, offset = 0; i !== nBlocks; ++ i ) { - - offset += blockSize; - array[ i ].toArray( r, offset ); - - } - - } - - return r; - -} - -function arraysEqual( a, b ) { - - if ( a.length !== b.length ) return false; - - for ( let i = 0, l = a.length; i < l; i ++ ) { - - if ( a[ i ] !== b[ i ] ) return false; - - } - - return true; - -} - -function copyArray( a, b ) { - - for ( let i = 0, l = b.length; i < l; i ++ ) { - - a[ i ] = b[ i ]; - - } - -} - -// Texture unit allocation - -function allocTexUnits( textures, n ) { - - let r = arrayCacheI32[ n ]; - - if ( r === undefined ) { - - r = new Int32Array( n ); - arrayCacheI32[ n ] = r; - - } - - for ( let i = 0; i !== n; ++ i ) { - - r[ i ] = textures.allocateTextureUnit(); - - } - - return r; - -} - -// --- Setters --- - -// Note: Defining these methods externally, because they come in a bunch -// and this way their names minify. - -// Single scalar - -function setValueV1f( gl, v ) { - - const cache = this.cache; - - if ( cache[ 0 ] === v ) return; - - gl.uniform1f( this.addr, v ); - - cache[ 0 ] = v; - -} - -// Single float vector (from flat array or THREE.VectorN) - -function setValueV2f( gl, v ) { - - const cache = this.cache; - - if ( v.x !== undefined ) { - - if ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) { - - gl.uniform2f( this.addr, v.x, v.y ); - - cache[ 0 ] = v.x; - cache[ 1 ] = v.y; - - } - - } else { - - if ( arraysEqual( cache, v ) ) return; - - gl.uniform2fv( this.addr, v ); - - copyArray( cache, v ); - - } - -} - -function setValueV3f( gl, v ) { - - const cache = this.cache; - - if ( v.x !== undefined ) { - - if ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) { - - gl.uniform3f( this.addr, v.x, v.y, v.z ); - - cache[ 0 ] = v.x; - cache[ 1 ] = v.y; - cache[ 2 ] = v.z; - - } - - } else if ( v.r !== undefined ) { - - if ( cache[ 0 ] !== v.r || cache[ 1 ] !== v.g || cache[ 2 ] !== v.b ) { - - gl.uniform3f( this.addr, v.r, v.g, v.b ); - - cache[ 0 ] = v.r; - cache[ 1 ] = v.g; - cache[ 2 ] = v.b; - - } - - } else { - - if ( arraysEqual( cache, v ) ) return; - - gl.uniform3fv( this.addr, v ); - - copyArray( cache, v ); - - } - -} - -function setValueV4f( gl, v ) { - - const cache = this.cache; - - if ( v.x !== undefined ) { - - if ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) { - - gl.uniform4f( this.addr, v.x, v.y, v.z, v.w ); - - cache[ 0 ] = v.x; - cache[ 1 ] = v.y; - cache[ 2 ] = v.z; - cache[ 3 ] = v.w; - - } - - } else { - - if ( arraysEqual( cache, v ) ) return; - - gl.uniform4fv( this.addr, v ); - - copyArray( cache, v ); - - } - -} - -// Single matrix (from flat array or MatrixN) - -function setValueM2( gl, v ) { - - const cache = this.cache; - const elements = v.elements; - - if ( elements === undefined ) { - - if ( arraysEqual( cache, v ) ) return; - - gl.uniformMatrix2fv( this.addr, false, v ); - - copyArray( cache, v ); - - } else { - - if ( arraysEqual( cache, elements ) ) return; - - mat2array.set( elements ); - - gl.uniformMatrix2fv( this.addr, false, mat2array ); - - copyArray( cache, elements ); - - } - -} - -function setValueM3( gl, v ) { - - const cache = this.cache; - const elements = v.elements; - - if ( elements === undefined ) { - - if ( arraysEqual( cache, v ) ) return; - - gl.uniformMatrix3fv( this.addr, false, v ); - - copyArray( cache, v ); - - } else { - - if ( arraysEqual( cache, elements ) ) return; - - mat3array.set( elements ); - - gl.uniformMatrix3fv( this.addr, false, mat3array ); - - copyArray( cache, elements ); - - } - -} - -function setValueM4( gl, v ) { - - const cache = this.cache; - const elements = v.elements; - - if ( elements === undefined ) { - - if ( arraysEqual( cache, v ) ) return; - - gl.uniformMatrix4fv( this.addr, false, v ); - - copyArray( cache, v ); - - } else { - - if ( arraysEqual( cache, elements ) ) return; - - mat4array.set( elements ); - - gl.uniformMatrix4fv( this.addr, false, mat4array ); - - copyArray( cache, elements ); - - } - -} - -// Single texture (2D / Cube) - -function setValueT1( gl, v, textures ) { - - const cache = this.cache; - const unit = textures.allocateTextureUnit(); - - if ( cache[ 0 ] !== unit ) { - - gl.uniform1i( this.addr, unit ); - cache[ 0 ] = unit; - - } - - textures.safeSetTexture2D( v || emptyTexture, unit ); - -} - -function setValueT2DArray1( gl, v, textures ) { - - const cache = this.cache; - const unit = textures.allocateTextureUnit(); - - if ( cache[ 0 ] !== unit ) { - - gl.uniform1i( this.addr, unit ); - cache[ 0 ] = unit; - - } - - textures.setTexture2DArray( v || emptyTexture2dArray, unit ); - -} - -function setValueT3D1( gl, v, textures ) { - - const cache = this.cache; - const unit = textures.allocateTextureUnit(); - - if ( cache[ 0 ] !== unit ) { - - gl.uniform1i( this.addr, unit ); - cache[ 0 ] = unit; - - } - - textures.setTexture3D( v || emptyTexture3d, unit ); - -} - -function setValueT6( gl, v, textures ) { - - const cache = this.cache; - const unit = textures.allocateTextureUnit(); - - if ( cache[ 0 ] !== unit ) { - - gl.uniform1i( this.addr, unit ); - cache[ 0 ] = unit; - - } - - textures.safeSetTextureCube( v || emptyCubeTexture, unit ); - -} - -// Integer / Boolean vectors or arrays thereof (always flat arrays) - -function setValueV1i( gl, v ) { - - const cache = this.cache; - - if ( cache[ 0 ] === v ) return; - - gl.uniform1i( this.addr, v ); - - cache[ 0 ] = v; - -} - -function setValueV2i( gl, v ) { - - const cache = this.cache; - - if ( arraysEqual( cache, v ) ) return; - - gl.uniform2iv( this.addr, v ); - - copyArray( cache, v ); - -} - -function setValueV3i( gl, v ) { - - const cache = this.cache; - - if ( arraysEqual( cache, v ) ) return; - - gl.uniform3iv( this.addr, v ); - - copyArray( cache, v ); - -} - -function setValueV4i( gl, v ) { - - const cache = this.cache; - - if ( arraysEqual( cache, v ) ) return; - - gl.uniform4iv( this.addr, v ); - - copyArray( cache, v ); - -} - -// uint - -function setValueV1ui( gl, v ) { - - const cache = this.cache; - - if ( cache[ 0 ] === v ) return; - - gl.uniform1ui( this.addr, v ); - - cache[ 0 ] = v; - -} - -// Helper to pick the right setter for the singular case - -function getSingularSetter( type ) { - - switch ( type ) { - - case 0x1406: return setValueV1f; // FLOAT - case 0x8b50: return setValueV2f; // _VEC2 - case 0x8b51: return setValueV3f; // _VEC3 - case 0x8b52: return setValueV4f; // _VEC4 - - case 0x8b5a: return setValueM2; // _MAT2 - case 0x8b5b: return setValueM3; // _MAT3 - case 0x8b5c: return setValueM4; // _MAT4 - - case 0x1404: case 0x8b56: return setValueV1i; // INT, BOOL - case 0x8b53: case 0x8b57: return setValueV2i; // _VEC2 - case 0x8b54: case 0x8b58: return setValueV3i; // _VEC3 - case 0x8b55: case 0x8b59: return setValueV4i; // _VEC4 - - case 0x1405: return setValueV1ui; // UINT - - case 0x8b5e: // SAMPLER_2D - case 0x8d66: // SAMPLER_EXTERNAL_OES - case 0x8dca: // INT_SAMPLER_2D - case 0x8dd2: // UNSIGNED_INT_SAMPLER_2D - case 0x8b62: // SAMPLER_2D_SHADOW - return setValueT1; - - case 0x8b5f: // SAMPLER_3D - case 0x8dcb: // INT_SAMPLER_3D - case 0x8dd3: // UNSIGNED_INT_SAMPLER_3D - return setValueT3D1; - - case 0x8b60: // SAMPLER_CUBE - case 0x8dcc: // INT_SAMPLER_CUBE - case 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE - case 0x8dc5: // SAMPLER_CUBE_SHADOW - return setValueT6; - - case 0x8dc1: // SAMPLER_2D_ARRAY - case 0x8dcf: // INT_SAMPLER_2D_ARRAY - case 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY - case 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW - return setValueT2DArray1; - - } - -} - -// Array of scalars -function setValueV1fArray( gl, v ) { - - gl.uniform1fv( this.addr, v ); - -} - -// Integer / Boolean vectors or arrays thereof (always flat arrays) -function setValueV1iArray( gl, v ) { - - gl.uniform1iv( this.addr, v ); - -} - -function setValueV2iArray( gl, v ) { - - gl.uniform2iv( this.addr, v ); - -} - -function setValueV3iArray( gl, v ) { - - gl.uniform3iv( this.addr, v ); - -} - -function setValueV4iArray( gl, v ) { - - gl.uniform4iv( this.addr, v ); - -} - - -// Array of vectors (flat or from THREE classes) - -function setValueV2fArray( gl, v ) { - - const data = flatten( v, this.size, 2 ); - - gl.uniform2fv( this.addr, data ); - -} - -function setValueV3fArray( gl, v ) { - - const data = flatten( v, this.size, 3 ); - - gl.uniform3fv( this.addr, data ); - -} - -function setValueV4fArray( gl, v ) { - - const data = flatten( v, this.size, 4 ); - - gl.uniform4fv( this.addr, data ); - -} - -// Array of matrices (flat or from THREE clases) - -function setValueM2Array( gl, v ) { - - const data = flatten( v, this.size, 4 ); - - gl.uniformMatrix2fv( this.addr, false, data ); - -} - -function setValueM3Array( gl, v ) { - - const data = flatten( v, this.size, 9 ); - - gl.uniformMatrix3fv( this.addr, false, data ); - -} - -function setValueM4Array( gl, v ) { - - const data = flatten( v, this.size, 16 ); - - gl.uniformMatrix4fv( this.addr, false, data ); - -} - -// Array of textures (2D / Cube) - -function setValueT1Array( gl, v, textures ) { - - const n = v.length; - - const units = allocTexUnits( textures, n ); - - gl.uniform1iv( this.addr, units ); - - for ( let i = 0; i !== n; ++ i ) { - - textures.safeSetTexture2D( v[ i ] || emptyTexture, units[ i ] ); - - } - -} - -function setValueT6Array( gl, v, textures ) { - - const n = v.length; - - const units = allocTexUnits( textures, n ); - - gl.uniform1iv( this.addr, units ); - - for ( let i = 0; i !== n; ++ i ) { - - textures.safeSetTextureCube( v[ i ] || emptyCubeTexture, units[ i ] ); - - } - -} - -// Helper to pick the right setter for a pure (bottom-level) array - -function getPureArraySetter( type ) { - - switch ( type ) { - - case 0x1406: return setValueV1fArray; // FLOAT - case 0x8b50: return setValueV2fArray; // _VEC2 - case 0x8b51: return setValueV3fArray; // _VEC3 - case 0x8b52: return setValueV4fArray; // _VEC4 - - case 0x8b5a: return setValueM2Array; // _MAT2 - case 0x8b5b: return setValueM3Array; // _MAT3 - case 0x8b5c: return setValueM4Array; // _MAT4 - - case 0x1404: case 0x8b56: return setValueV1iArray; // INT, BOOL - case 0x8b53: case 0x8b57: return setValueV2iArray; // _VEC2 - case 0x8b54: case 0x8b58: return setValueV3iArray; // _VEC3 - case 0x8b55: case 0x8b59: return setValueV4iArray; // _VEC4 - - case 0x8b5e: // SAMPLER_2D - case 0x8d66: // SAMPLER_EXTERNAL_OES - case 0x8dca: // INT_SAMPLER_2D - case 0x8dd2: // UNSIGNED_INT_SAMPLER_2D - case 0x8b62: // SAMPLER_2D_SHADOW - return setValueT1Array; - - case 0x8b60: // SAMPLER_CUBE - case 0x8dcc: // INT_SAMPLER_CUBE - case 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE - case 0x8dc5: // SAMPLER_CUBE_SHADOW - return setValueT6Array; - - } - -} - -// --- Uniform Classes --- - -function SingleUniform( id, activeInfo, addr ) { - - this.id = id; - this.addr = addr; - this.cache = []; - this.setValue = getSingularSetter( activeInfo.type ); - - // this.path = activeInfo.name; // DEBUG - -} - -function PureArrayUniform( id, activeInfo, addr ) { - - this.id = id; - this.addr = addr; - this.cache = []; - this.size = activeInfo.size; - this.setValue = getPureArraySetter( activeInfo.type ); - - // this.path = activeInfo.name; // DEBUG - -} - -PureArrayUniform.prototype.updateCache = function ( data ) { - - const cache = this.cache; - - if ( data instanceof Float32Array && cache.length !== data.length ) { - - this.cache = new Float32Array( data.length ); - - } - - copyArray( cache, data ); - -}; - -function StructuredUniform( id ) { - - this.id = id; - - this.seq = []; - this.map = {}; - -} - -StructuredUniform.prototype.setValue = function ( gl, value, textures ) { - - const seq = this.seq; - - for ( let i = 0, n = seq.length; i !== n; ++ i ) { - - const u = seq[ i ]; - u.setValue( gl, value[ u.id ], textures ); - - } - -}; - -// --- Top-level --- - -// Parser - builds up the property tree from the path strings - -const RePathPart = /(\w+)(\])?(\[|\.)?/g; - -// extracts -// - the identifier (member name or array index) -// - followed by an optional right bracket (found when array index) -// - followed by an optional left bracket or dot (type of subscript) -// -// Note: These portions can be read in a non-overlapping fashion and -// allow straightforward parsing of the hierarchy that WebGL encodes -// in the uniform names. - -function addUniform( container, uniformObject ) { - - container.seq.push( uniformObject ); - container.map[ uniformObject.id ] = uniformObject; - -} - -function parseUniform( activeInfo, addr, container ) { - - const path = activeInfo.name, - pathLength = path.length; - - // reset RegExp object, because of the early exit of a previous run - RePathPart.lastIndex = 0; - - while ( true ) { - - const match = RePathPart.exec( path ), - matchEnd = RePathPart.lastIndex; - - let id = match[ 1 ]; - const idIsIndex = match[ 2 ] === ']', - subscript = match[ 3 ]; - - if ( idIsIndex ) id = id | 0; // convert to integer - - if ( subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength ) { - - // bare name or "pure" bottom-level array "[0]" suffix - - addUniform( container, subscript === undefined ? - new SingleUniform( id, activeInfo, addr ) : - new PureArrayUniform( id, activeInfo, addr ) ); - - break; - - } else { - - // step into inner node / create it in case it doesn't exist - - const map = container.map; - let next = map[ id ]; - - if ( next === undefined ) { - - next = new StructuredUniform( id ); - addUniform( container, next ); - - } - - container = next; - - } - - } - -} - -// Root Container - -function WebGLUniforms( gl, program ) { - - this.seq = []; - this.map = {}; - - const n = gl.getProgramParameter( program, 35718 ); - - for ( let i = 0; i < n; ++ i ) { - - const info = gl.getActiveUniform( program, i ), - addr = gl.getUniformLocation( program, info.name ); - - parseUniform( info, addr, this ); - - } - -} - -WebGLUniforms.prototype.setValue = function ( gl, name, value, textures ) { - - const u = this.map[ name ]; - - if ( u !== undefined ) u.setValue( gl, value, textures ); - -}; - -WebGLUniforms.prototype.setOptional = function ( gl, object, name ) { - - const v = object[ name ]; - - if ( v !== undefined ) this.setValue( gl, name, v ); - -}; - - -// Static interface - -WebGLUniforms.upload = function ( gl, seq, values, textures ) { - - for ( let i = 0, n = seq.length; i !== n; ++ i ) { - - const u = seq[ i ], - v = values[ u.id ]; - - if ( v.needsUpdate !== false ) { - - // note: always updating when .needsUpdate is undefined - u.setValue( gl, v.value, textures ); - - } - - } - -}; - -WebGLUniforms.seqWithValue = function ( seq, values ) { - - const r = []; - - for ( let i = 0, n = seq.length; i !== n; ++ i ) { - - const u = seq[ i ]; - if ( u.id in values ) r.push( u ); - - } - - return r; - -}; - -function WebGLShader( gl, type, string ) { - - const shader = gl.createShader( type ); - - gl.shaderSource( shader, string ); - gl.compileShader( shader ); - - return shader; - -} - -let programIdCount = 0; - -function addLineNumbers( string ) { - - const lines = string.split( '\n' ); - - for ( let i = 0; i < lines.length; i ++ ) { - - lines[ i ] = ( i + 1 ) + ': ' + lines[ i ]; - - } - - return lines.join( '\n' ); - -} - -function getEncodingComponents( encoding ) { - - switch ( encoding ) { - - case LinearEncoding: - return [ 'Linear', '( value )' ]; - case sRGBEncoding: - return [ 'sRGB', '( value )' ]; - case RGBEEncoding: - return [ 'RGBE', '( value )' ]; - case RGBM7Encoding: - return [ 'RGBM', '( value, 7.0 )' ]; - case RGBM16Encoding: - return [ 'RGBM', '( value, 16.0 )' ]; - case RGBDEncoding: - return [ 'RGBD', '( value, 256.0 )' ]; - case GammaEncoding: - return [ 'Gamma', '( value, float( GAMMA_FACTOR ) )' ]; - case LogLuvEncoding: - return [ 'LogLuv', '( value )' ]; - default: - console.warn( 'THREE.WebGLProgram: Unsupported encoding:', encoding ); - return [ 'Linear', '( value )' ]; - - } - -} - -function getShaderErrors( gl, shader, type ) { - - const status = gl.getShaderParameter( shader, 35713 ); - const log = gl.getShaderInfoLog( shader ).trim(); - - if ( status && log === '' ) return ''; - - // --enable-privileged-webgl-extension - // console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) ); - - const source = gl.getShaderSource( shader ); - - return 'THREE.WebGLShader: gl.getShaderInfoLog() ' + type + '\n' + log + addLineNumbers( source ); - -} - -function getTexelDecodingFunction( functionName, encoding ) { - - const components = getEncodingComponents( encoding ); - return 'vec4 ' + functionName + '( vec4 value ) { return ' + components[ 0 ] + 'ToLinear' + components[ 1 ] + '; }'; - -} - -function getTexelEncodingFunction( functionName, encoding ) { - - const components = getEncodingComponents( encoding ); - return 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[ 0 ] + components[ 1 ] + '; }'; - -} - -function getToneMappingFunction( functionName, toneMapping ) { - - let toneMappingName; - - switch ( toneMapping ) { - - case LinearToneMapping: - toneMappingName = 'Linear'; - break; - - case ReinhardToneMapping: - toneMappingName = 'Reinhard'; - break; - - case CineonToneMapping: - toneMappingName = 'OptimizedCineon'; - break; - - case ACESFilmicToneMapping: - toneMappingName = 'ACESFilmic'; - break; - - case CustomToneMapping: - toneMappingName = 'Custom'; - break; - - default: - console.warn( 'THREE.WebGLProgram: Unsupported toneMapping:', toneMapping ); - toneMappingName = 'Linear'; - - } - - return 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }'; - -} - -function generateExtensions( parameters ) { - - const chunks = [ - ( parameters.extensionDerivatives || parameters.envMapCubeUV || parameters.bumpMap || parameters.tangentSpaceNormalMap || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '', - ( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '', - ( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '', - ( parameters.extensionShaderTextureLOD || parameters.envMap ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : '' - ]; - - return chunks.filter( filterEmptyLine ).join( '\n' ); - -} - -function generateDefines( defines ) { - - const chunks = []; - - for ( const name in defines ) { - - const value = defines[ name ]; - - if ( value === false ) continue; - - chunks.push( '#define ' + name + ' ' + value ); - - } - - return chunks.join( '\n' ); - -} - -function fetchAttributeLocations( gl, program ) { - - const attributes = {}; - - const n = gl.getProgramParameter( program, 35721 ); - - for ( let i = 0; i < n; i ++ ) { - - const info = gl.getActiveAttrib( program, i ); - const name = info.name; - - // console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i ); - - attributes[ name ] = gl.getAttribLocation( program, name ); - - } - - return attributes; - -} - -function filterEmptyLine( string ) { - - return string !== ''; - -} - -function replaceLightNums( string, parameters ) { - - return string - .replace( /NUM_DIR_LIGHTS/g, parameters.numDirLights ) - .replace( /NUM_SPOT_LIGHTS/g, parameters.numSpotLights ) - .replace( /NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights ) - .replace( /NUM_POINT_LIGHTS/g, parameters.numPointLights ) - .replace( /NUM_HEMI_LIGHTS/g, parameters.numHemiLights ) - .replace( /NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows ) - .replace( /NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows ) - .replace( /NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows ); - -} - -function replaceClippingPlaneNums( string, parameters ) { - - return string - .replace( /NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes ) - .replace( /UNION_CLIPPING_PLANES/g, ( parameters.numClippingPlanes - parameters.numClipIntersection ) ); - -} - -// Resolve Includes - -const includePattern = /^[ \t]*#include +<([\w\d./]+)>/gm; - -function resolveIncludes( string ) { - - return string.replace( includePattern, includeReplacer ); - -} - -function includeReplacer( match, include ) { - - const string = ShaderChunk[ include ]; - - if ( string === undefined ) { - - throw new Error( 'Can not resolve #include <' + include + '>' ); - - } - - return resolveIncludes( string ); - -} - -// Unroll Loops - -const deprecatedUnrollLoopPattern = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g; -const unrollLoopPattern = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g; - -function unrollLoops( string ) { - - return string - .replace( unrollLoopPattern, loopReplacer ) - .replace( deprecatedUnrollLoopPattern, deprecatedLoopReplacer ); - -} - -function deprecatedLoopReplacer( match, start, end, snippet ) { - - console.warn( 'WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead.' ); - return loopReplacer( match, start, end, snippet ); - -} - -function loopReplacer( match, start, end, snippet ) { - - let string = ''; - - for ( let i = parseInt( start ); i < parseInt( end ); i ++ ) { - - string += snippet - .replace( /\[\s*i\s*\]/g, '[ ' + i + ' ]' ) - .replace( /UNROLLED_LOOP_INDEX/g, i ); - - } - - return string; - -} - -// - -function generatePrecision( parameters ) { - - let precisionstring = 'precision ' + parameters.precision + ' float;\nprecision ' + parameters.precision + ' int;'; - - if ( parameters.precision === 'highp' ) { - - precisionstring += '\n#define HIGH_PRECISION'; - - } else if ( parameters.precision === 'mediump' ) { - - precisionstring += '\n#define MEDIUM_PRECISION'; - - } else if ( parameters.precision === 'lowp' ) { - - precisionstring += '\n#define LOW_PRECISION'; - - } - - return precisionstring; - -} - -function generateShadowMapTypeDefine( parameters ) { - - let shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC'; - - if ( parameters.shadowMapType === PCFShadowMap ) { - - shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF'; - - } else if ( parameters.shadowMapType === PCFSoftShadowMap ) { - - shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT'; - - } else if ( parameters.shadowMapType === VSMShadowMap ) { - - shadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM'; - - } - - return shadowMapTypeDefine; - -} - -function generateEnvMapTypeDefine( parameters ) { - - let envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; - - if ( parameters.envMap ) { - - switch ( parameters.envMapMode ) { - - case CubeReflectionMapping: - case CubeRefractionMapping: - envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; - break; - - case CubeUVReflectionMapping: - case CubeUVRefractionMapping: - envMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV'; - break; - - } - - } - - return envMapTypeDefine; - -} - -function generateEnvMapModeDefine( parameters ) { - - let envMapModeDefine = 'ENVMAP_MODE_REFLECTION'; - - if ( parameters.envMap ) { - - switch ( parameters.envMapMode ) { - - case CubeRefractionMapping: - case CubeUVRefractionMapping: - - envMapModeDefine = 'ENVMAP_MODE_REFRACTION'; - break; - - } - - } - - return envMapModeDefine; - -} - -function generateEnvMapBlendingDefine( parameters ) { - - let envMapBlendingDefine = 'ENVMAP_BLENDING_NONE'; - - if ( parameters.envMap ) { - - switch ( parameters.combine ) { - - case MultiplyOperation: - envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY'; - break; - - case MixOperation: - envMapBlendingDefine = 'ENVMAP_BLENDING_MIX'; - break; - - case AddOperation: - envMapBlendingDefine = 'ENVMAP_BLENDING_ADD'; - break; - - } - - } - - return envMapBlendingDefine; - -} - -function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) { - - const gl = renderer.getContext(); - - const defines = parameters.defines; - - let vertexShader = parameters.vertexShader; - let fragmentShader = parameters.fragmentShader; - - const shadowMapTypeDefine = generateShadowMapTypeDefine( parameters ); - const envMapTypeDefine = generateEnvMapTypeDefine( parameters ); - const envMapModeDefine = generateEnvMapModeDefine( parameters ); - const envMapBlendingDefine = generateEnvMapBlendingDefine( parameters ); - - - const gammaFactorDefine = ( renderer.gammaFactor > 0 ) ? renderer.gammaFactor : 1.0; - - const customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters ); - - const customDefines = generateDefines( defines ); - - const program = gl.createProgram(); - - let prefixVertex, prefixFragment; - let versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\n' : ''; - - if ( parameters.isRawShaderMaterial ) { - - prefixVertex = [ - - customDefines - - ].filter( filterEmptyLine ).join( '\n' ); - - if ( prefixVertex.length > 0 ) { - - prefixVertex += '\n'; - - } - - prefixFragment = [ - - customExtensions, - customDefines - - ].filter( filterEmptyLine ).join( '\n' ); - - if ( prefixFragment.length > 0 ) { - - prefixFragment += '\n'; - - } - - } else { - - prefixVertex = [ - - generatePrecision( parameters ), - - '#define SHADER_NAME ' + parameters.shaderName, - - customDefines, - - parameters.instancing ? '#define USE_INSTANCING' : '', - parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '', - - parameters.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '', - - '#define GAMMA_FACTOR ' + gammaFactorDefine, - - '#define MAX_BONES ' + parameters.maxBones, - ( parameters.useFog && parameters.fog ) ? '#define USE_FOG' : '', - ( parameters.useFog && parameters.fogExp2 ) ? '#define FOG_EXP2' : '', - - parameters.map ? '#define USE_MAP' : '', - parameters.envMap ? '#define USE_ENVMAP' : '', - parameters.envMap ? '#define ' + envMapModeDefine : '', - parameters.lightMap ? '#define USE_LIGHTMAP' : '', - parameters.aoMap ? '#define USE_AOMAP' : '', - parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', - parameters.bumpMap ? '#define USE_BUMPMAP' : '', - parameters.normalMap ? '#define USE_NORMALMAP' : '', - ( parameters.normalMap && parameters.objectSpaceNormalMap ) ? '#define OBJECTSPACE_NORMALMAP' : '', - ( parameters.normalMap && parameters.tangentSpaceNormalMap ) ? '#define TANGENTSPACE_NORMALMAP' : '', - - parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '', - parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '', - parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', - parameters.displacementMap && parameters.supportsVertexTextures ? '#define USE_DISPLACEMENTMAP' : '', - parameters.specularMap ? '#define USE_SPECULARMAP' : '', - parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', - parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', - parameters.alphaMap ? '#define USE_ALPHAMAP' : '', - parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '', - - parameters.vertexTangents ? '#define USE_TANGENT' : '', - parameters.vertexColors ? '#define USE_COLOR' : '', - parameters.vertexUvs ? '#define USE_UV' : '', - parameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '', - - parameters.flatShading ? '#define FLAT_SHADED' : '', - - parameters.skinning ? '#define USE_SKINNING' : '', - parameters.useVertexTexture ? '#define BONE_TEXTURE' : '', - - parameters.morphTargets ? '#define USE_MORPHTARGETS' : '', - parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '', - parameters.doubleSided ? '#define DOUBLE_SIDED' : '', - parameters.flipSided ? '#define FLIP_SIDED' : '', - - parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', - parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', - - parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '', - - parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', - ( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '', - - 'uniform mat4 modelMatrix;', - 'uniform mat4 modelViewMatrix;', - 'uniform mat4 projectionMatrix;', - 'uniform mat4 viewMatrix;', - 'uniform mat3 normalMatrix;', - 'uniform vec3 cameraPosition;', - 'uniform bool isOrthographic;', - - '#ifdef USE_INSTANCING', - - ' attribute mat4 instanceMatrix;', - - '#endif', - - '#ifdef USE_INSTANCING_COLOR', - - ' attribute vec3 instanceColor;', - - '#endif', - - 'attribute vec3 position;', - 'attribute vec3 normal;', - 'attribute vec2 uv;', - - '#ifdef USE_TANGENT', - - ' attribute vec4 tangent;', - - '#endif', - - '#ifdef USE_COLOR', - - ' attribute vec3 color;', - - '#endif', - - '#ifdef USE_MORPHTARGETS', - - ' attribute vec3 morphTarget0;', - ' attribute vec3 morphTarget1;', - ' attribute vec3 morphTarget2;', - ' attribute vec3 morphTarget3;', - - ' #ifdef USE_MORPHNORMALS', - - ' attribute vec3 morphNormal0;', - ' attribute vec3 morphNormal1;', - ' attribute vec3 morphNormal2;', - ' attribute vec3 morphNormal3;', - - ' #else', - - ' attribute vec3 morphTarget4;', - ' attribute vec3 morphTarget5;', - ' attribute vec3 morphTarget6;', - ' attribute vec3 morphTarget7;', - - ' #endif', - - '#endif', - - '#ifdef USE_SKINNING', - - ' attribute vec4 skinIndex;', - ' attribute vec4 skinWeight;', - - '#endif', - - '\n' - - ].filter( filterEmptyLine ).join( '\n' ); - - prefixFragment = [ - - customExtensions, - - generatePrecision( parameters ), - - '#define SHADER_NAME ' + parameters.shaderName, - - customDefines, - - parameters.alphaTest ? '#define ALPHATEST ' + parameters.alphaTest + ( parameters.alphaTest % 1 ? '' : '.0' ) : '', // add '.0' if integer - - '#define GAMMA_FACTOR ' + gammaFactorDefine, - - ( parameters.useFog && parameters.fog ) ? '#define USE_FOG' : '', - ( parameters.useFog && parameters.fogExp2 ) ? '#define FOG_EXP2' : '', - - parameters.map ? '#define USE_MAP' : '', - parameters.matcap ? '#define USE_MATCAP' : '', - parameters.envMap ? '#define USE_ENVMAP' : '', - parameters.envMap ? '#define ' + envMapTypeDefine : '', - parameters.envMap ? '#define ' + envMapModeDefine : '', - parameters.envMap ? '#define ' + envMapBlendingDefine : '', - parameters.lightMap ? '#define USE_LIGHTMAP' : '', - parameters.aoMap ? '#define USE_AOMAP' : '', - parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', - parameters.bumpMap ? '#define USE_BUMPMAP' : '', - parameters.normalMap ? '#define USE_NORMALMAP' : '', - ( parameters.normalMap && parameters.objectSpaceNormalMap ) ? '#define OBJECTSPACE_NORMALMAP' : '', - ( parameters.normalMap && parameters.tangentSpaceNormalMap ) ? '#define TANGENTSPACE_NORMALMAP' : '', - parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '', - parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '', - parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', - parameters.specularMap ? '#define USE_SPECULARMAP' : '', - parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', - parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', - parameters.alphaMap ? '#define USE_ALPHAMAP' : '', - - parameters.sheen ? '#define USE_SHEEN' : '', - parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '', - - parameters.vertexTangents ? '#define USE_TANGENT' : '', - parameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '', - parameters.vertexUvs ? '#define USE_UV' : '', - parameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '', - - parameters.gradientMap ? '#define USE_GRADIENTMAP' : '', - - parameters.flatShading ? '#define FLAT_SHADED' : '', - - parameters.doubleSided ? '#define DOUBLE_SIDED' : '', - parameters.flipSided ? '#define FLIP_SIDED' : '', - - parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', - parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', - - parameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '', - - parameters.physicallyCorrectLights ? '#define PHYSICALLY_CORRECT_LIGHTS' : '', - - parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', - ( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '', - - ( ( parameters.extensionShaderTextureLOD || parameters.envMap ) && parameters.rendererExtensionShaderTextureLod ) ? '#define TEXTURE_LOD_EXT' : '', - - 'uniform mat4 viewMatrix;', - 'uniform vec3 cameraPosition;', - 'uniform bool isOrthographic;', - - ( parameters.toneMapping !== NoToneMapping ) ? '#define TONE_MAPPING' : '', - ( parameters.toneMapping !== NoToneMapping ) ? ShaderChunk[ 'tonemapping_pars_fragment' ] : '', // this code is required here because it is used by the toneMapping() function defined below - ( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '', - - parameters.dithering ? '#define DITHERING' : '', - - ShaderChunk[ 'encodings_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below - parameters.map ? getTexelDecodingFunction( 'mapTexelToLinear', parameters.mapEncoding ) : '', - parameters.matcap ? getTexelDecodingFunction( 'matcapTexelToLinear', parameters.matcapEncoding ) : '', - parameters.envMap ? getTexelDecodingFunction( 'envMapTexelToLinear', parameters.envMapEncoding ) : '', - parameters.emissiveMap ? getTexelDecodingFunction( 'emissiveMapTexelToLinear', parameters.emissiveMapEncoding ) : '', - parameters.lightMap ? getTexelDecodingFunction( 'lightMapTexelToLinear', parameters.lightMapEncoding ) : '', - getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputEncoding ), - - parameters.depthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '', - - '\n' - - ].filter( filterEmptyLine ).join( '\n' ); - - } - - vertexShader = resolveIncludes( vertexShader ); - vertexShader = replaceLightNums( vertexShader, parameters ); - vertexShader = replaceClippingPlaneNums( vertexShader, parameters ); - - fragmentShader = resolveIncludes( fragmentShader ); - fragmentShader = replaceLightNums( fragmentShader, parameters ); - fragmentShader = replaceClippingPlaneNums( fragmentShader, parameters ); - - vertexShader = unrollLoops( vertexShader ); - fragmentShader = unrollLoops( fragmentShader ); - - if ( parameters.isWebGL2 && parameters.isRawShaderMaterial !== true ) { - - // GLSL 3.0 conversion for built-in materials and ShaderMaterial - - versionString = '#version 300 es\n'; - - prefixVertex = [ - '#define attribute in', - '#define varying out', - '#define texture2D texture' - ].join( '\n' ) + '\n' + prefixVertex; - - prefixFragment = [ - '#define varying in', - ( parameters.glslVersion === GLSL3 ) ? '' : 'out highp vec4 pc_fragColor;', - ( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor', - '#define gl_FragDepthEXT gl_FragDepth', - '#define texture2D texture', - '#define textureCube texture', - '#define texture2DProj textureProj', - '#define texture2DLodEXT textureLod', - '#define texture2DProjLodEXT textureProjLod', - '#define textureCubeLodEXT textureLod', - '#define texture2DGradEXT textureGrad', - '#define texture2DProjGradEXT textureProjGrad', - '#define textureCubeGradEXT textureGrad' - ].join( '\n' ) + '\n' + prefixFragment; - - } - - const vertexGlsl = versionString + prefixVertex + vertexShader; - const fragmentGlsl = versionString + prefixFragment + fragmentShader; - - // console.log( '*VERTEX*', vertexGlsl ); - // console.log( '*FRAGMENT*', fragmentGlsl ); - - const glVertexShader = WebGLShader( gl, 35633, vertexGlsl ); - const glFragmentShader = WebGLShader( gl, 35632, fragmentGlsl ); - - gl.attachShader( program, glVertexShader ); - gl.attachShader( program, glFragmentShader ); - - // Force a particular attribute to index 0. - - if ( parameters.index0AttributeName !== undefined ) { - - gl.bindAttribLocation( program, 0, parameters.index0AttributeName ); - - } else if ( parameters.morphTargets === true ) { - - // programs with morphTargets displace position out of attribute 0 - gl.bindAttribLocation( program, 0, 'position' ); - - } - - gl.linkProgram( program ); - - // check for link errors - if ( renderer.debug.checkShaderErrors ) { - - const programLog = gl.getProgramInfoLog( program ).trim(); - const vertexLog = gl.getShaderInfoLog( glVertexShader ).trim(); - const fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim(); - - let runnable = true; - let haveDiagnostics = true; - - if ( gl.getProgramParameter( program, 35714 ) === false ) { - - runnable = false; - - const vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' ); - const fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' ); - - console.error( 'THREE.WebGLProgram: shader error: ', gl.getError(), '35715', gl.getProgramParameter( program, 35715 ), 'gl.getProgramInfoLog', programLog, vertexErrors, fragmentErrors ); - - } else if ( programLog !== '' ) { - - console.warn( 'THREE.WebGLProgram: gl.getProgramInfoLog()', programLog ); - - } else if ( vertexLog === '' || fragmentLog === '' ) { - - haveDiagnostics = false; - - } - - if ( haveDiagnostics ) { - - this.diagnostics = { - - runnable: runnable, - - programLog: programLog, - - vertexShader: { - - log: vertexLog, - prefix: prefixVertex - - }, - - fragmentShader: { - - log: fragmentLog, - prefix: prefixFragment - - } - - }; - - } - - } - - // Clean up - - // Crashes in iOS9 and iOS10. #18402 - // gl.detachShader( program, glVertexShader ); - // gl.detachShader( program, glFragmentShader ); - - gl.deleteShader( glVertexShader ); - gl.deleteShader( glFragmentShader ); - - // set up caching for uniform locations - - let cachedUniforms; - - this.getUniforms = function () { - - if ( cachedUniforms === undefined ) { - - cachedUniforms = new WebGLUniforms( gl, program ); - - } - - return cachedUniforms; - - }; - - // set up caching for attribute locations - - let cachedAttributes; - - this.getAttributes = function () { - - if ( cachedAttributes === undefined ) { - - cachedAttributes = fetchAttributeLocations( gl, program ); - - } - - return cachedAttributes; - - }; - - // free resource - - this.destroy = function () { - - bindingStates.releaseStatesOfProgram( this ); - - gl.deleteProgram( program ); - this.program = undefined; - - }; - - // - - this.name = parameters.shaderName; - this.id = programIdCount ++; - this.cacheKey = cacheKey; - this.usedTimes = 1; - this.program = program; - this.vertexShader = glVertexShader; - this.fragmentShader = glFragmentShader; - - return this; - -} - -function WebGLPrograms( renderer, cubemaps, extensions, capabilities, bindingStates, clipping ) { - - const programs = []; - - const isWebGL2 = capabilities.isWebGL2; - const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer; - const floatVertexTextures = capabilities.floatVertexTextures; - const maxVertexUniforms = capabilities.maxVertexUniforms; - const vertexTextures = capabilities.vertexTextures; - - let precision = capabilities.precision; - - const shaderIDs = { - MeshDepthMaterial: 'depth', - MeshDistanceMaterial: 'distanceRGBA', - MeshNormalMaterial: 'normal', - MeshBasicMaterial: 'basic', - MeshLambertMaterial: 'lambert', - MeshPhongMaterial: 'phong', - MeshToonMaterial: 'toon', - MeshStandardMaterial: 'physical', - MeshPhysicalMaterial: 'physical', - MeshMatcapMaterial: 'matcap', - LineBasicMaterial: 'basic', - LineDashedMaterial: 'dashed', - PointsMaterial: 'points', - ShadowMaterial: 'shadow', - SpriteMaterial: 'sprite' - }; - - const parameterNames = [ - 'precision', 'isWebGL2', 'supportsVertexTextures', 'outputEncoding', 'instancing', 'instancingColor', - 'map', 'mapEncoding', 'matcap', 'matcapEncoding', 'envMap', 'envMapMode', 'envMapEncoding', 'envMapCubeUV', - 'lightMap', 'lightMapEncoding', 'aoMap', 'emissiveMap', 'emissiveMapEncoding', 'bumpMap', 'normalMap', 'objectSpaceNormalMap', 'tangentSpaceNormalMap', 'clearcoatMap', 'clearcoatRoughnessMap', 'clearcoatNormalMap', 'displacementMap', 'specularMap', - 'roughnessMap', 'metalnessMap', 'gradientMap', - 'alphaMap', 'combine', 'vertexColors', 'vertexTangents', 'vertexUvs', 'uvsVertexOnly', 'fog', 'useFog', 'fogExp2', - 'flatShading', 'sizeAttenuation', 'logarithmicDepthBuffer', 'skinning', - 'maxBones', 'useVertexTexture', 'morphTargets', 'morphNormals', - 'maxMorphTargets', 'maxMorphNormals', 'premultipliedAlpha', - 'numDirLights', 'numPointLights', 'numSpotLights', 'numHemiLights', 'numRectAreaLights', - 'numDirLightShadows', 'numPointLightShadows', 'numSpotLightShadows', - 'shadowMapEnabled', 'shadowMapType', 'toneMapping', 'physicallyCorrectLights', - 'alphaTest', 'doubleSided', 'flipSided', 'numClippingPlanes', 'numClipIntersection', 'depthPacking', 'dithering', - 'sheen', 'transmissionMap' - ]; - - function getMaxBones( object ) { - - const skeleton = object.skeleton; - const bones = skeleton.bones; - - if ( floatVertexTextures ) { - - return 1024; - - } else { - - // default for when object is not specified - // ( for example when prebuilding shader to be used with multiple objects ) - // - // - leave some extra space for other uniforms - // - limit here is ANGLE's 254 max uniform vectors - // (up to 54 should be safe) - - const nVertexUniforms = maxVertexUniforms; - const nVertexMatrices = Math.floor( ( nVertexUniforms - 20 ) / 4 ); - - const maxBones = Math.min( nVertexMatrices, bones.length ); - - if ( maxBones < bones.length ) { - - console.warn( 'THREE.WebGLRenderer: Skeleton has ' + bones.length + ' bones. This GPU supports ' + maxBones + '.' ); - return 0; - - } - - return maxBones; - - } - - } - - function getTextureEncodingFromMap( map ) { - - let encoding; - - if ( map && map.isTexture ) { - - encoding = map.encoding; - - } else if ( map && map.isWebGLRenderTarget ) { - - console.warn( 'THREE.WebGLPrograms.getTextureEncodingFromMap: don\'t use render targets as textures. Use their .texture property instead.' ); - encoding = map.texture.encoding; - - } else { - - encoding = LinearEncoding; - - } - - return encoding; - - } - - function getParameters( material, lights, shadows, scene, object ) { - - const fog = scene.fog; - const environment = material.isMeshStandardMaterial ? scene.environment : null; - - const envMap = cubemaps.get( material.envMap || environment ); - - const shaderID = shaderIDs[ material.type ]; - - // heuristics to create shader parameters according to lights in the scene - // (not to blow over maxLights budget) - - const maxBones = object.isSkinnedMesh ? getMaxBones( object ) : 0; - - if ( material.precision !== null ) { - - precision = capabilities.getMaxPrecision( material.precision ); - - if ( precision !== material.precision ) { - - console.warn( 'THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' ); - - } - - } - - let vertexShader, fragmentShader; - - if ( shaderID ) { - - const shader = ShaderLib[ shaderID ]; - - vertexShader = shader.vertexShader; - fragmentShader = shader.fragmentShader; - - } else { - - vertexShader = material.vertexShader; - fragmentShader = material.fragmentShader; - - } - - const currentRenderTarget = renderer.getRenderTarget(); - - const parameters = { - - isWebGL2: isWebGL2, - - shaderID: shaderID, - shaderName: material.type, - - vertexShader: vertexShader, - fragmentShader: fragmentShader, - defines: material.defines, - - isRawShaderMaterial: material.isRawShaderMaterial === true, - glslVersion: material.glslVersion, - - precision: precision, - - instancing: object.isInstancedMesh === true, - instancingColor: object.isInstancedMesh === true && object.instanceColor !== null, - - supportsVertexTextures: vertexTextures, - outputEncoding: ( currentRenderTarget !== null ) ? getTextureEncodingFromMap( currentRenderTarget.texture ) : renderer.outputEncoding, - map: !! material.map, - mapEncoding: getTextureEncodingFromMap( material.map ), - matcap: !! material.matcap, - matcapEncoding: getTextureEncodingFromMap( material.matcap ), - envMap: !! envMap, - envMapMode: envMap && envMap.mapping, - envMapEncoding: getTextureEncodingFromMap( envMap ), - envMapCubeUV: ( !! envMap ) && ( ( envMap.mapping === CubeUVReflectionMapping ) || ( envMap.mapping === CubeUVRefractionMapping ) ), - lightMap: !! material.lightMap, - lightMapEncoding: getTextureEncodingFromMap( material.lightMap ), - aoMap: !! material.aoMap, - emissiveMap: !! material.emissiveMap, - emissiveMapEncoding: getTextureEncodingFromMap( material.emissiveMap ), - bumpMap: !! material.bumpMap, - normalMap: !! material.normalMap, - objectSpaceNormalMap: material.normalMapType === ObjectSpaceNormalMap, - tangentSpaceNormalMap: material.normalMapType === TangentSpaceNormalMap, - clearcoatMap: !! material.clearcoatMap, - clearcoatRoughnessMap: !! material.clearcoatRoughnessMap, - clearcoatNormalMap: !! material.clearcoatNormalMap, - displacementMap: !! material.displacementMap, - roughnessMap: !! material.roughnessMap, - metalnessMap: !! material.metalnessMap, - specularMap: !! material.specularMap, - alphaMap: !! material.alphaMap, - - gradientMap: !! material.gradientMap, - - sheen: !! material.sheen, - - transmissionMap: !! material.transmissionMap, - - combine: material.combine, - - vertexTangents: ( material.normalMap && material.vertexTangents ), - vertexColors: material.vertexColors, - vertexUvs: !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatMap || !! material.clearcoatRoughnessMap || !! material.clearcoatNormalMap || !! material.displacementMap || !! material.transmissionMap, - uvsVertexOnly: ! ( !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatNormalMap || !! material.transmissionMap ) && !! material.displacementMap, - - fog: !! fog, - useFog: material.fog, - fogExp2: ( fog && fog.isFogExp2 ), - - flatShading: !! material.flatShading, - - sizeAttenuation: material.sizeAttenuation, - logarithmicDepthBuffer: logarithmicDepthBuffer, - - skinning: material.skinning && maxBones > 0, - maxBones: maxBones, - useVertexTexture: floatVertexTextures, - - morphTargets: material.morphTargets, - morphNormals: material.morphNormals, - maxMorphTargets: renderer.maxMorphTargets, - maxMorphNormals: renderer.maxMorphNormals, - - numDirLights: lights.directional.length, - numPointLights: lights.point.length, - numSpotLights: lights.spot.length, - numRectAreaLights: lights.rectArea.length, - numHemiLights: lights.hemi.length, - - numDirLightShadows: lights.directionalShadowMap.length, - numPointLightShadows: lights.pointShadowMap.length, - numSpotLightShadows: lights.spotShadowMap.length, - - numClippingPlanes: clipping.numPlanes, - numClipIntersection: clipping.numIntersection, - - dithering: material.dithering, - - shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0, - shadowMapType: renderer.shadowMap.type, - - toneMapping: material.toneMapped ? renderer.toneMapping : NoToneMapping, - physicallyCorrectLights: renderer.physicallyCorrectLights, - - premultipliedAlpha: material.premultipliedAlpha, - - alphaTest: material.alphaTest, - doubleSided: material.side === DoubleSide, - flipSided: material.side === BackSide, - - depthPacking: ( material.depthPacking !== undefined ) ? material.depthPacking : false, - - index0AttributeName: material.index0AttributeName, - - extensionDerivatives: material.extensions && material.extensions.derivatives, - extensionFragDepth: material.extensions && material.extensions.fragDepth, - extensionDrawBuffers: material.extensions && material.extensions.drawBuffers, - extensionShaderTextureLOD: material.extensions && material.extensions.shaderTextureLOD, - - rendererExtensionFragDepth: isWebGL2 || extensions.has( 'EXT_frag_depth' ), - rendererExtensionDrawBuffers: isWebGL2 || extensions.has( 'WEBGL_draw_buffers' ), - rendererExtensionShaderTextureLod: isWebGL2 || extensions.has( 'EXT_shader_texture_lod' ), - - customProgramCacheKey: material.customProgramCacheKey() - + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ]; + varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; }; - - return parameters; - + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,zp=`#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; + #endif + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; } - - function getProgramCacheKey( parameters ) { - - const array = []; - - if ( parameters.shaderID ) { - - array.push( parameters.shaderID ); - - } else { - - array.push( parameters.fragmentShader ); - array.push( parameters.vertexShader ); - - } - - if ( parameters.defines !== undefined ) { - - for ( const name in parameters.defines ) { - - array.push( name ); - array.push( parameters.defines[ name ] ); - - } - - } - - if ( parameters.isRawShaderMaterial === false ) { - - for ( let i = 0; i < parameterNames.length; i ++ ) { - - array.push( parameters[ parameterNames[ i ] ] ); - - } - - array.push( renderer.outputEncoding ); - array.push( renderer.gammaFactor ); - - } - - array.push( parameters.customProgramCacheKey ); - - return array.join(); - + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 ); + vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition; } - - function getUniforms( material ) { - - const shaderID = shaderIDs[ material.type ]; - let uniforms; - - if ( shaderID ) { - - const shader = ShaderLib[ shaderID ]; - uniforms = UniformsUtils.clone( shader.uniforms ); - - } else { - - uniforms = material.uniforms; - - } - - return uniforms; - + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; } - - function acquireProgram( parameters, cacheKey ) { - - let program; - - // Check if code has been already compiled - for ( let p = 0, pl = programs.length; p < pl; p ++ ) { - - const preexistingProgram = programs[ p ]; - - if ( preexistingProgram.cacheKey === cacheKey ) { - - program = preexistingProgram; - ++ program.usedTimes; - - break; - - } - - } - - if ( program === undefined ) { - - program = new WebGLProgram( renderer, cacheKey, parameters, bindingStates ); - programs.push( program ); - - } - - return program; - + #pragma unroll_loop_end + #endif +#endif`,Op=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } - - function releaseProgram( program ) { - - if ( -- program.usedTimes === 0 ) { - - // Remove from unordered set - const i = programs.indexOf( program ); - programs[ i ] = programs[ programs.length - 1 ]; - programs.pop(); - - // Free WebGL resources - program.destroy(); - - } - + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; } - - return { - getParameters: getParameters, - getProgramCacheKey: getProgramCacheKey, - getUniforms: getUniforms, - acquireProgram: acquireProgram, - releaseProgram: releaseProgram, - // Exposed for resource monitoring & error feedback via renderer.info: - programs: programs - }; - + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,Up=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,Hp=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + #ifdef BONE_TEXTURE + uniform highp sampler2D boneTexture; + uniform int boneTextureSize; + mat4 getBoneMatrix( const in float i ) { + float j = i * 4.0; + float x = mod( j, float( boneTextureSize ) ); + float y = floor( j / float( boneTextureSize ) ); + float dx = 1.0 / float( boneTextureSize ); + float dy = 1.0 / float( boneTextureSize ); + y = dy * ( y + 0.5 ); + vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); + vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); + vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); + vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); + mat4 bone = mat4( v1, v2, v3, v4 ); + return bone; + } + #else + uniform mat4 boneMatrices[ MAX_BONES ]; + mat4 getBoneMatrix( const in float i ) { + mat4 bone = boneMatrices[ int(i) ]; + return bone; + } + #endif +#endif`,Gp=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,kp=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,Vp=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,Wp=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,qp=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,Xp=`#ifndef saturate +#define saturate(a) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return toneMappingExposure * color; } - -function WebGLProperties() { - - let properties = new WeakMap(); - - function get( object ) { - - let map = properties.get( object ); - - if ( map === undefined ) { - - map = {}; - properties.set( object, map ); - - } - - return map; - - } - - function remove( object ) { - - properties.delete( object ); - - } - - function update( object, key, value ) { - - properties.get( object )[ key ] = value; - - } - - function dispose() { - - properties = new WeakMap(); - - } - - return { - get: get, - remove: remove, - update: update, - dispose: dispose - }; - +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); } - -function painterSortStable( a, b ) { - - if ( a.groupOrder !== b.groupOrder ) { - - return a.groupOrder - b.groupOrder; - - } else if ( a.renderOrder !== b.renderOrder ) { - - return a.renderOrder - b.renderOrder; - - } else if ( a.program !== b.program ) { - - return a.program.id - b.program.id; - - } else if ( a.material.id !== b.material.id ) { - - return a.material.id - b.material.id; - - } else if ( a.z !== b.z ) { - - return a.z - b.z; - - } else { - - return a.id - b.id; - - } - +vec3 OptimizedCineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); } - -function reversePainterSortStable( a, b ) { - - if ( a.groupOrder !== b.groupOrder ) { - - return a.groupOrder - b.groupOrder; - - } else if ( a.renderOrder !== b.renderOrder ) { - - return a.renderOrder - b.renderOrder; - - } else if ( a.z !== b.z ) { - - return b.z - a.z; - - } else { - - return a.id - b.id; - - } - +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; } - - -function WebGLRenderList( properties ) { - - const renderItems = []; - let renderItemsIndex = 0; - - const opaque = []; - const transparent = []; - - const defaultProgram = { id: - 1 }; - - function init() { - - renderItemsIndex = 0; - - opaque.length = 0; - transparent.length = 0; - - } - - function getNextRenderItem( object, geometry, material, groupOrder, z, group ) { - - let renderItem = renderItems[ renderItemsIndex ]; - const materialProperties = properties.get( material ); - - if ( renderItem === undefined ) { - - renderItem = { - id: object.id, - object: object, - geometry: geometry, - material: material, - program: materialProperties.program || defaultProgram, - groupOrder: groupOrder, - renderOrder: object.renderOrder, - z: z, - group: group - }; - - renderItems[ renderItemsIndex ] = renderItem; - - } else { - - renderItem.id = object.id; - renderItem.object = object; - renderItem.geometry = geometry; - renderItem.material = material; - renderItem.program = materialProperties.program || defaultProgram; - renderItem.groupOrder = groupOrder; - renderItem.renderOrder = object.renderOrder; - renderItem.z = z; - renderItem.group = group; - - } - - renderItemsIndex ++; - - return renderItem; - - } - - function push( object, geometry, material, groupOrder, z, group ) { - - const renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group ); - - ( material.transparent === true ? transparent : opaque ).push( renderItem ); - - } - - function unshift( object, geometry, material, groupOrder, z, group ) { - - const renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group ); - - ( material.transparent === true ? transparent : opaque ).unshift( renderItem ); - - } - - function sort( customOpaqueSort, customTransparentSort ) { - - if ( opaque.length > 1 ) opaque.sort( customOpaqueSort || painterSortStable ); - if ( transparent.length > 1 ) transparent.sort( customTransparentSort || reversePainterSortStable ); - - } - - function finish() { - - // Clear references from inactive renderItems in the list - - for ( let i = renderItemsIndex, il = renderItems.length; i < il; i ++ ) { - - const renderItem = renderItems[ i ]; - - if ( renderItem.id === null ) break; - - renderItem.id = null; - renderItem.object = null; - renderItem.geometry = null; - renderItem.material = null; - renderItem.program = null; - renderItem.group = null; - - } - - } - - return { - - opaque: opaque, - transparent: transparent, - - init: init, - push: push, - unshift: unshift, - finish: finish, - - sort: sort - }; - -} - -function WebGLRenderLists( properties ) { - - let lists = new WeakMap(); - - function get( scene, renderCallDepth ) { - - let list; - - if ( lists.has( scene ) === false ) { - - list = new WebGLRenderList( properties ); - lists.set( scene, [ list ] ); - - } else { - - if ( renderCallDepth >= lists.get( scene ).length ) { - - list = new WebGLRenderList( properties ); - lists.get( scene ).push( list ); - - } else { - - list = lists.get( scene )[ renderCallDepth ]; - - } - - } - - return list; - - } - - function dispose() { - - lists = new WeakMap(); - - } - - return { - get: get, - dispose: dispose - }; - -} - -function UniformsCache() { - - const lights = {}; - - return { - - get: function ( light ) { - - if ( lights[ light.id ] !== undefined ) { - - return lights[ light.id ]; - - } - - let uniforms; - - switch ( light.type ) { - - case 'DirectionalLight': - uniforms = { - direction: new Vector3(), - color: new Color() - }; - break; - - case 'SpotLight': - uniforms = { - position: new Vector3(), - direction: new Vector3(), - color: new Color(), - distance: 0, - coneCos: 0, - penumbraCos: 0, - decay: 0 - }; - break; - - case 'PointLight': - uniforms = { - position: new Vector3(), - color: new Color(), - distance: 0, - decay: 0 - }; - break; - - case 'HemisphereLight': - uniforms = { - direction: new Vector3(), - skyColor: new Color(), - groundColor: new Color() - }; - break; - - case 'RectAreaLight': - uniforms = { - color: new Color(), - position: new Vector3(), - halfWidth: new Vector3(), - halfHeight: new Vector3() - }; - break; - - } - - lights[ light.id ] = uniforms; - - return uniforms; - - } - - }; - -} - -function ShadowUniformsCache() { - - const lights = {}; - - return { - - get: function ( light ) { - - if ( lights[ light.id ] !== undefined ) { - - return lights[ light.id ]; - - } - - let uniforms; - - switch ( light.type ) { - - case 'DirectionalLight': - uniforms = { - shadowBias: 0, - shadowNormalBias: 0, - shadowRadius: 1, - shadowMapSize: new Vector2() - }; - break; - - case 'SpotLight': - uniforms = { - shadowBias: 0, - shadowNormalBias: 0, - shadowRadius: 1, - shadowMapSize: new Vector2() - }; - break; - - case 'PointLight': - uniforms = { - shadowBias: 0, - shadowNormalBias: 0, - shadowRadius: 1, - shadowMapSize: new Vector2(), - shadowCameraNear: 1, - shadowCameraFar: 1000 - }; - break; - - // TODO (abelnation): set RectAreaLight shadow uniforms - - } - - lights[ light.id ] = uniforms; - - return uniforms; - - } - - }; - -} - - - -let nextVersion = 0; - -function shadowCastingLightsFirst( lightA, lightB ) { - - return ( lightB.castShadow ? 1 : 0 ) - ( lightA.castShadow ? 1 : 0 ); - -} - -function WebGLLights( extensions, capabilities ) { - - const cache = new UniformsCache(); - - const shadowCache = ShadowUniformsCache(); - - const state = { - - version: 0, - - hash: { - directionalLength: - 1, - pointLength: - 1, - spotLength: - 1, - rectAreaLength: - 1, - hemiLength: - 1, - - numDirectionalShadows: - 1, - numPointShadows: - 1, - numSpotShadows: - 1 - }, - - ambient: [ 0, 0, 0 ], - probe: [], - directional: [], - directionalShadow: [], - directionalShadowMap: [], - directionalShadowMatrix: [], - spot: [], - spotShadow: [], - spotShadowMap: [], - spotShadowMatrix: [], - rectArea: [], - rectAreaLTC1: null, - rectAreaLTC2: null, - point: [], - pointShadow: [], - pointShadowMap: [], - pointShadowMatrix: [], - hemi: [] - - }; - - for ( let i = 0; i < 9; i ++ ) state.probe.push( new Vector3() ); - - const vector3 = new Vector3(); - const matrix4 = new Matrix4(); - const matrix42 = new Matrix4(); - - function setup( lights ) { - - let r = 0, g = 0, b = 0; - - for ( let i = 0; i < 9; i ++ ) state.probe[ i ].set( 0, 0, 0 ); - - let directionalLength = 0; - let pointLength = 0; - let spotLength = 0; - let rectAreaLength = 0; - let hemiLength = 0; - - let numDirectionalShadows = 0; - let numPointShadows = 0; - let numSpotShadows = 0; - - lights.sort( shadowCastingLightsFirst ); - - for ( let i = 0, l = lights.length; i < l; i ++ ) { - - const light = lights[ i ]; - - const color = light.color; - const intensity = light.intensity; - const distance = light.distance; - - const shadowMap = ( light.shadow && light.shadow.map ) ? light.shadow.map.texture : null; - - if ( light.isAmbientLight ) { - - r += color.r * intensity; - g += color.g * intensity; - b += color.b * intensity; - - } else if ( light.isLightProbe ) { - - for ( let j = 0; j < 9; j ++ ) { - - state.probe[ j ].addScaledVector( light.sh.coefficients[ j ], intensity ); - - } - - } else if ( light.isDirectionalLight ) { - - const uniforms = cache.get( light ); - - uniforms.color.copy( light.color ).multiplyScalar( light.intensity ); - - if ( light.castShadow ) { - - const shadow = light.shadow; - - const shadowUniforms = shadowCache.get( light ); - - shadowUniforms.shadowBias = shadow.bias; - shadowUniforms.shadowNormalBias = shadow.normalBias; - shadowUniforms.shadowRadius = shadow.radius; - shadowUniforms.shadowMapSize = shadow.mapSize; - - state.directionalShadow[ directionalLength ] = shadowUniforms; - state.directionalShadowMap[ directionalLength ] = shadowMap; - state.directionalShadowMatrix[ directionalLength ] = light.shadow.matrix; - - numDirectionalShadows ++; - - } - - state.directional[ directionalLength ] = uniforms; - - directionalLength ++; - - } else if ( light.isSpotLight ) { - - const uniforms = cache.get( light ); - - uniforms.position.setFromMatrixPosition( light.matrixWorld ); - - uniforms.color.copy( color ).multiplyScalar( intensity ); - uniforms.distance = distance; - - uniforms.coneCos = Math.cos( light.angle ); - uniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) ); - uniforms.decay = light.decay; - - if ( light.castShadow ) { - - const shadow = light.shadow; - - const shadowUniforms = shadowCache.get( light ); - - shadowUniforms.shadowBias = shadow.bias; - shadowUniforms.shadowNormalBias = shadow.normalBias; - shadowUniforms.shadowRadius = shadow.radius; - shadowUniforms.shadowMapSize = shadow.mapSize; - - state.spotShadow[ spotLength ] = shadowUniforms; - state.spotShadowMap[ spotLength ] = shadowMap; - state.spotShadowMatrix[ spotLength ] = light.shadow.matrix; - - numSpotShadows ++; - - } - - state.spot[ spotLength ] = uniforms; - - spotLength ++; - - } else if ( light.isRectAreaLight ) { - - const uniforms = cache.get( light ); - - // (a) intensity is the total visible light emitted - //uniforms.color.copy( color ).multiplyScalar( intensity / ( light.width * light.height * Math.PI ) ); - - // (b) intensity is the brightness of the light - uniforms.color.copy( color ).multiplyScalar( intensity ); - - uniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 ); - uniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 ); - - state.rectArea[ rectAreaLength ] = uniforms; - - rectAreaLength ++; - - } else if ( light.isPointLight ) { - - const uniforms = cache.get( light ); - - uniforms.color.copy( light.color ).multiplyScalar( light.intensity ); - uniforms.distance = light.distance; - uniforms.decay = light.decay; - - if ( light.castShadow ) { - - const shadow = light.shadow; - - const shadowUniforms = shadowCache.get( light ); - - shadowUniforms.shadowBias = shadow.bias; - shadowUniforms.shadowNormalBias = shadow.normalBias; - shadowUniforms.shadowRadius = shadow.radius; - shadowUniforms.shadowMapSize = shadow.mapSize; - shadowUniforms.shadowCameraNear = shadow.camera.near; - shadowUniforms.shadowCameraFar = shadow.camera.far; - - state.pointShadow[ pointLength ] = shadowUniforms; - state.pointShadowMap[ pointLength ] = shadowMap; - state.pointShadowMatrix[ pointLength ] = light.shadow.matrix; - - numPointShadows ++; - - } - - state.point[ pointLength ] = uniforms; - - pointLength ++; - - } else if ( light.isHemisphereLight ) { - - const uniforms = cache.get( light ); - - uniforms.skyColor.copy( light.color ).multiplyScalar( intensity ); - uniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity ); - - state.hemi[ hemiLength ] = uniforms; - - hemiLength ++; - - } - - } - - if ( rectAreaLength > 0 ) { - - if ( capabilities.isWebGL2 ) { - - // WebGL 2 - - state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1; - state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2; - - } else { - - // WebGL 1 - - if ( extensions.has( 'OES_texture_float_linear' ) === true ) { - - state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1; - state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2; - - } else if ( extensions.has( 'OES_texture_half_float_linear' ) === true ) { - - state.rectAreaLTC1 = UniformsLib.LTC_HALF_1; - state.rectAreaLTC2 = UniformsLib.LTC_HALF_2; - - } else { - - console.error( 'THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.' ); - - } - - } - - } - - state.ambient[ 0 ] = r; - state.ambient[ 1 ] = g; - state.ambient[ 2 ] = b; - - const hash = state.hash; - - if ( hash.directionalLength !== directionalLength || - hash.pointLength !== pointLength || - hash.spotLength !== spotLength || - hash.rectAreaLength !== rectAreaLength || - hash.hemiLength !== hemiLength || - hash.numDirectionalShadows !== numDirectionalShadows || - hash.numPointShadows !== numPointShadows || - hash.numSpotShadows !== numSpotShadows ) { - - state.directional.length = directionalLength; - state.spot.length = spotLength; - state.rectArea.length = rectAreaLength; - state.point.length = pointLength; - state.hemi.length = hemiLength; - - state.directionalShadow.length = numDirectionalShadows; - state.directionalShadowMap.length = numDirectionalShadows; - state.pointShadow.length = numPointShadows; - state.pointShadowMap.length = numPointShadows; - state.spotShadow.length = numSpotShadows; - state.spotShadowMap.length = numSpotShadows; - state.directionalShadowMatrix.length = numDirectionalShadows; - state.pointShadowMatrix.length = numPointShadows; - state.spotShadowMatrix.length = numSpotShadows; - - hash.directionalLength = directionalLength; - hash.pointLength = pointLength; - hash.spotLength = spotLength; - hash.rectAreaLength = rectAreaLength; - hash.hemiLength = hemiLength; - - hash.numDirectionalShadows = numDirectionalShadows; - hash.numPointShadows = numPointShadows; - hash.numSpotShadows = numSpotShadows; - - state.version = nextVersion ++; - - } - - } - - function setupView( lights, camera ) { - - let directionalLength = 0; - let pointLength = 0; - let spotLength = 0; - let rectAreaLength = 0; - let hemiLength = 0; - - const viewMatrix = camera.matrixWorldInverse; - - for ( let i = 0, l = lights.length; i < l; i ++ ) { - - const light = lights[ i ]; - - if ( light.isDirectionalLight ) { - - const uniforms = state.directional[ directionalLength ]; - - uniforms.direction.setFromMatrixPosition( light.matrixWorld ); - vector3.setFromMatrixPosition( light.target.matrixWorld ); - uniforms.direction.sub( vector3 ); - uniforms.direction.transformDirection( viewMatrix ); - - directionalLength ++; - - } else if ( light.isSpotLight ) { - - const uniforms = state.spot[ spotLength ]; - - uniforms.position.setFromMatrixPosition( light.matrixWorld ); - uniforms.position.applyMatrix4( viewMatrix ); - - uniforms.direction.setFromMatrixPosition( light.matrixWorld ); - vector3.setFromMatrixPosition( light.target.matrixWorld ); - uniforms.direction.sub( vector3 ); - uniforms.direction.transformDirection( viewMatrix ); - - spotLength ++; - - } else if ( light.isRectAreaLight ) { - - const uniforms = state.rectArea[ rectAreaLength ]; - - uniforms.position.setFromMatrixPosition( light.matrixWorld ); - uniforms.position.applyMatrix4( viewMatrix ); - - // extract local rotation of light to derive width/height half vectors - matrix42.identity(); - matrix4.copy( light.matrixWorld ); - matrix4.premultiply( viewMatrix ); - matrix42.extractRotation( matrix4 ); - - uniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 ); - uniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 ); - - uniforms.halfWidth.applyMatrix4( matrix42 ); - uniforms.halfHeight.applyMatrix4( matrix42 ); - - rectAreaLength ++; - - } else if ( light.isPointLight ) { - - const uniforms = state.point[ pointLength ]; - - uniforms.position.setFromMatrixPosition( light.matrixWorld ); - uniforms.position.applyMatrix4( viewMatrix ); - - pointLength ++; - - } else if ( light.isHemisphereLight ) { - - const uniforms = state.hemi[ hemiLength ]; - - uniforms.direction.setFromMatrixPosition( light.matrixWorld ); - uniforms.direction.transformDirection( viewMatrix ); - uniforms.direction.normalize(); - - hemiLength ++; - - } - - } - - } - - return { - setup: setup, - setupView: setupView, - state: state - }; - -} - -function WebGLRenderState( extensions, capabilities ) { - - const lights = new WebGLLights( extensions, capabilities ); - - const lightsArray = []; - const shadowsArray = []; - - function init() { - - lightsArray.length = 0; - shadowsArray.length = 0; - - } - - function pushLight( light ) { - - lightsArray.push( light ); - - } - - function pushShadow( shadowLight ) { - - shadowsArray.push( shadowLight ); - - } - - function setupLights() { - - lights.setup( lightsArray ); - - } - - function setupLightsView( camera ) { - - lights.setupView( lightsArray, camera ); - - } - - const state = { - lightsArray: lightsArray, - shadowsArray: shadowsArray, - - lights: lights - }; - - return { - init: init, - state: state, - setupLights: setupLights, - setupLightsView: setupLightsView, - - pushLight: pushLight, - pushShadow: pushShadow - }; - -} - -function WebGLRenderStates( extensions, capabilities ) { - - let renderStates = new WeakMap(); - - function get( scene, renderCallDepth = 0 ) { - - let renderState; - - if ( renderStates.has( scene ) === false ) { - - renderState = new WebGLRenderState( extensions, capabilities ); - renderStates.set( scene, [ renderState ] ); - - } else { - - if ( renderCallDepth >= renderStates.get( scene ).length ) { - - renderState = new WebGLRenderState( extensions, capabilities ); - renderStates.get( scene ).push( renderState ); - - } else { - - renderState = renderStates.get( scene )[ renderCallDepth ]; - - } - - } - - return renderState; - - } - - function dispose() { - - renderStates = new WeakMap(); - - } - - return { - get: get, - dispose: dispose - }; - -} - -/** - * parameters = { - * - * opacity: , - * - * map: new THREE.Texture( ), - * - * alphaMap: new THREE.Texture( ), - * - * displacementMap: new THREE.Texture( ), - * displacementScale: , - * displacementBias: , - * - * wireframe: , - * wireframeLinewidth: - * } - */ - -class MeshDepthMaterial extends Material { - - constructor( parameters ) { - - super(); - - this.type = 'MeshDepthMaterial'; - - this.depthPacking = BasicDepthPacking; - - this.skinning = false; - this.morphTargets = false; - - this.map = null; - - this.alphaMap = null; - - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - - this.wireframe = false; - this.wireframeLinewidth = 1; - - this.fog = false; - - this.setValues( parameters ); - - } - - copy( source ) { - - super.copy( source ); - - this.depthPacking = source.depthPacking; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - - this.map = source.map; - - this.alphaMap = source.alphaMap; - - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - - return this; - - } - -} - -MeshDepthMaterial.prototype.isMeshDepthMaterial = true; - -/** - * parameters = { - * - * referencePosition: , - * nearDistance: , - * farDistance: , - * - * skinning: , - * morphTargets: , - * - * map: new THREE.Texture( ), - * - * alphaMap: new THREE.Texture( ), - * - * displacementMap: new THREE.Texture( ), - * displacementScale: , - * displacementBias: - * - * } - */ - -class MeshDistanceMaterial extends Material { - - constructor( parameters ) { - - super(); - - this.type = 'MeshDistanceMaterial'; - - this.referencePosition = new Vector3(); - this.nearDistance = 1; - this.farDistance = 1000; - - this.skinning = false; - this.morphTargets = false; - - this.map = null; - - this.alphaMap = null; - - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - - this.fog = false; - - this.setValues( parameters ); - - } - - copy( source ) { - - super.copy( source ); - - this.referencePosition.copy( source.referencePosition ); - this.nearDistance = source.nearDistance; - this.farDistance = source.farDistance; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - - this.map = source.map; - - this.alphaMap = source.alphaMap; - - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - - return this; - - } - -} - -MeshDistanceMaterial.prototype.isMeshDistanceMaterial = true; - -var vsm_frag = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"; - -var vsm_vert = "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}"; - -function WebGLShadowMap( _renderer, _objects, maxTextureSize ) { - - let _frustum = new Frustum(); - - const _shadowMapSize = new Vector2(), - _viewportSize = new Vector2(), - - _viewport = new Vector4(), - - _depthMaterials = [], - _distanceMaterials = [], - - _materialCache = {}; - - const shadowSide = { 0: BackSide, 1: FrontSide, 2: DoubleSide }; - - const shadowMaterialVertical = new ShaderMaterial( { - - defines: { - SAMPLE_RATE: 2.0 / 8.0, - HALF_SAMPLE_RATE: 1.0 / 8.0 - }, - - uniforms: { - shadow_pass: { value: null }, - resolution: { value: new Vector2() }, - radius: { value: 4.0 } - }, - - vertexShader: vsm_vert, - - fragmentShader: vsm_frag - - } ); - - const shadowMaterialHorizontal = shadowMaterialVertical.clone(); - shadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1; - - const fullScreenTri = new BufferGeometry(); - fullScreenTri.setAttribute( - 'position', - new BufferAttribute( - new Float32Array( [ - 1, - 1, 0.5, 3, - 1, 0.5, - 1, 3, 0.5 ] ), - 3 - ) +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) ); - - const fullScreenMesh = new Mesh( fullScreenTri, shadowMaterialVertical ); - - const scope = this; - - this.enabled = false; - - this.autoUpdate = true; - this.needsUpdate = false; - - this.type = PCFShadowMap; - - this.render = function ( lights, scene, camera ) { - - if ( scope.enabled === false ) return; - if ( scope.autoUpdate === false && scope.needsUpdate === false ) return; - - if ( lights.length === 0 ) return; - - const currentRenderTarget = _renderer.getRenderTarget(); - const activeCubeFace = _renderer.getActiveCubeFace(); - const activeMipmapLevel = _renderer.getActiveMipmapLevel(); - - const _state = _renderer.state; - - // Set GL state for depth map. - _state.setBlending( NoBlending ); - _state.buffers.color.setClear( 1, 1, 1, 1 ); - _state.buffers.depth.setTest( true ); - _state.setScissorTest( false ); - - // render depth map - - for ( let i = 0, il = lights.length; i < il; i ++ ) { - - const light = lights[ i ]; - const shadow = light.shadow; - - if ( shadow === undefined ) { - - console.warn( 'THREE.WebGLShadowMap:', light, 'has no shadow.' ); - continue; - - } - - if ( shadow.autoUpdate === false && shadow.needsUpdate === false ) continue; - - _shadowMapSize.copy( shadow.mapSize ); - - const shadowFrameExtents = shadow.getFrameExtents(); - - _shadowMapSize.multiply( shadowFrameExtents ); - - _viewportSize.copy( shadow.mapSize ); - - if ( _shadowMapSize.x > maxTextureSize || _shadowMapSize.y > maxTextureSize ) { - - if ( _shadowMapSize.x > maxTextureSize ) { - - _viewportSize.x = Math.floor( maxTextureSize / shadowFrameExtents.x ); - _shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x; - shadow.mapSize.x = _viewportSize.x; - - } - - if ( _shadowMapSize.y > maxTextureSize ) { - - _viewportSize.y = Math.floor( maxTextureSize / shadowFrameExtents.y ); - _shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y; - shadow.mapSize.y = _viewportSize.y; - - } - - } - - if ( shadow.map === null && ! shadow.isPointLightShadow && this.type === VSMShadowMap ) { - - const pars = { minFilter: LinearFilter, magFilter: LinearFilter, format: RGBAFormat }; - - shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars ); - shadow.map.texture.name = light.name + '.shadowMap'; - - shadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars ); - - shadow.camera.updateProjectionMatrix(); - - } - - if ( shadow.map === null ) { - - const pars = { minFilter: NearestFilter, magFilter: NearestFilter, format: RGBAFormat }; - - shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars ); - shadow.map.texture.name = light.name + '.shadowMap'; - - shadow.camera.updateProjectionMatrix(); - - } - - _renderer.setRenderTarget( shadow.map ); - _renderer.clear(); - - const viewportCount = shadow.getViewportCount(); - - for ( let vp = 0; vp < viewportCount; vp ++ ) { - - const viewport = shadow.getViewport( vp ); - - _viewport.set( - _viewportSize.x * viewport.x, - _viewportSize.y * viewport.y, - _viewportSize.x * viewport.z, - _viewportSize.y * viewport.w - ); - - _state.viewport( _viewport ); - - shadow.updateMatrices( light, vp ); - - _frustum = shadow.getFrustum(); - - renderObject( scene, camera, shadow.camera, light, this.type ); - - } - - // do blur pass for VSM - - if ( ! shadow.isPointLightShadow && this.type === VSMShadowMap ) { - - VSMPass( shadow, camera ); - - } - - shadow.needsUpdate = false; - - } - - scope.needsUpdate = false; - - _renderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel ); - - }; - - function VSMPass( shadow, camera ) { - - const geometry = _objects.update( fullScreenMesh ); - - // vertical pass - - shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture; - shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize; - shadowMaterialVertical.uniforms.radius.value = shadow.radius; - _renderer.setRenderTarget( shadow.mapPass ); - _renderer.clear(); - _renderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null ); - - // horizontal pass - - shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture; - shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize; - shadowMaterialHorizontal.uniforms.radius.value = shadow.radius; - _renderer.setRenderTarget( shadow.map ); - _renderer.clear(); - _renderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null ); - - } - - function getDepthMaterialVariant( useMorphing, useSkinning, useInstancing ) { - - const index = useMorphing << 0 | useSkinning << 1 | useInstancing << 2; - - let material = _depthMaterials[ index ]; - - if ( material === undefined ) { - - material = new MeshDepthMaterial( { - - depthPacking: RGBADepthPacking, - - morphTargets: useMorphing, - skinning: useSkinning - - } ); - - _depthMaterials[ index ] = material; - - } - - return material; - - } - - function getDistanceMaterialVariant( useMorphing, useSkinning, useInstancing ) { - - const index = useMorphing << 0 | useSkinning << 1 | useInstancing << 2; - - let material = _distanceMaterials[ index ]; - - if ( material === undefined ) { - - material = new MeshDistanceMaterial( { - - morphTargets: useMorphing, - skinning: useSkinning - - } ); - - _distanceMaterials[ index ] = material; - - } - - return material; - - } - - function getDepthMaterial( object, geometry, material, light, shadowCameraNear, shadowCameraFar, type ) { - - let result = null; - - let getMaterialVariant = getDepthMaterialVariant; - let customMaterial = object.customDepthMaterial; - - if ( light.isPointLight === true ) { - - getMaterialVariant = getDistanceMaterialVariant; - customMaterial = object.customDistanceMaterial; - - } - - if ( customMaterial === undefined ) { - - let useMorphing = false; - - if ( material.morphTargets === true ) { - - useMorphing = geometry.morphAttributes && geometry.morphAttributes.position && geometry.morphAttributes.position.length > 0; - - } - - let useSkinning = false; - - if ( object.isSkinnedMesh === true ) { - - if ( material.skinning === true ) { - - useSkinning = true; - - } else { - - console.warn( 'THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:', object ); - - } - - } - - const useInstancing = object.isInstancedMesh === true; - - result = getMaterialVariant( useMorphing, useSkinning, useInstancing ); - - } else { - - result = customMaterial; - - } - - if ( _renderer.localClippingEnabled && - material.clipShadows === true && - material.clippingPlanes.length !== 0 ) { - - // in this case we need a unique material instance reflecting the - // appropriate state - - const keyA = result.uuid, keyB = material.uuid; - - let materialsForVariant = _materialCache[ keyA ]; - - if ( materialsForVariant === undefined ) { - - materialsForVariant = {}; - _materialCache[ keyA ] = materialsForVariant; - - } - - let cachedMaterial = materialsForVariant[ keyB ]; - - if ( cachedMaterial === undefined ) { - - cachedMaterial = result.clone(); - materialsForVariant[ keyB ] = cachedMaterial; - - } - - result = cachedMaterial; - - } - - result.visible = material.visible; - result.wireframe = material.wireframe; - - if ( type === VSMShadowMap ) { - - result.side = ( material.shadowSide !== null ) ? material.shadowSide : material.side; - - } else { - - result.side = ( material.shadowSide !== null ) ? material.shadowSide : shadowSide[ material.side ]; - - } - - result.clipShadows = material.clipShadows; - result.clippingPlanes = material.clippingPlanes; - result.clipIntersection = material.clipIntersection; - - result.wireframeLinewidth = material.wireframeLinewidth; - result.linewidth = material.linewidth; - - if ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) { - - result.referencePosition.setFromMatrixPosition( light.matrixWorld ); - result.nearDistance = shadowCameraNear; - result.farDistance = shadowCameraFar; - - } - - return result; - - } - - function renderObject( object, camera, shadowCamera, light, type ) { - - if ( object.visible === false ) return; - - const visible = object.layers.test( camera.layers ); - - if ( visible && ( object.isMesh || object.isLine || object.isPoints ) ) { - - if ( ( object.castShadow || ( object.receiveShadow && type === VSMShadowMap ) ) && ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) ) { - - object.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld ); - - const geometry = _objects.update( object ); - const material = object.material; - - if ( Array.isArray( material ) ) { - - const groups = geometry.groups; - - for ( let k = 0, kl = groups.length; k < kl; k ++ ) { - - const group = groups[ k ]; - const groupMaterial = material[ group.materialIndex ]; - - if ( groupMaterial && groupMaterial.visible ) { - - const depthMaterial = getDepthMaterial( object, geometry, groupMaterial, light, shadowCamera.near, shadowCamera.far, type ); - - _renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group ); - - } - - } - - } else if ( material.visible ) { - - const depthMaterial = getDepthMaterial( object, geometry, material, light, shadowCamera.near, shadowCamera.far, type ); - - _renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null ); - - } - - } - - } - - const children = object.children; - - for ( let i = 0, l = children.length; i < l; i ++ ) { - - renderObject( children[ i ], camera, shadowCamera, light, type ); - - } - - } - -} - -function WebGLState( gl, extensions, capabilities ) { - - const isWebGL2 = capabilities.isWebGL2; - - function ColorBuffer() { - - let locked = false; - - const color = new Vector4(); - let currentColorMask = null; - const currentColorClear = new Vector4( 0, 0, 0, 0 ); - - return { - - setMask: function ( colorMask ) { - - if ( currentColorMask !== colorMask && ! locked ) { - - gl.colorMask( colorMask, colorMask, colorMask, colorMask ); - currentColorMask = colorMask; - - } - - }, - - setLocked: function ( lock ) { - - locked = lock; - - }, - - setClear: function ( r, g, b, a, premultipliedAlpha ) { - - if ( premultipliedAlpha === true ) { - - r *= a; g *= a; b *= a; - - } - - color.set( r, g, b, a ); - - if ( currentColorClear.equals( color ) === false ) { - - gl.clearColor( r, g, b, a ); - currentColorClear.copy( color ); - - } - - }, - - reset: function () { - - locked = false; - - currentColorMask = null; - currentColorClear.set( - 1, 0, 0, 0 ); // set to invalid state - - } - - }; - - } - - function DepthBuffer() { - - let locked = false; - - let currentDepthMask = null; - let currentDepthFunc = null; - let currentDepthClear = null; - - return { - - setTest: function ( depthTest ) { - - if ( depthTest ) { - - enable( 2929 ); - - } else { - - disable( 2929 ); - - } - - }, - - setMask: function ( depthMask ) { - - if ( currentDepthMask !== depthMask && ! locked ) { - - gl.depthMask( depthMask ); - currentDepthMask = depthMask; - - } - - }, - - setFunc: function ( depthFunc ) { - - if ( currentDepthFunc !== depthFunc ) { - - if ( depthFunc ) { - - switch ( depthFunc ) { - - case NeverDepth: - - gl.depthFunc( 512 ); - break; - - case AlwaysDepth: - - gl.depthFunc( 519 ); - break; - - case LessDepth: - - gl.depthFunc( 513 ); - break; - - case LessEqualDepth: - - gl.depthFunc( 515 ); - break; - - case EqualDepth: - - gl.depthFunc( 514 ); - break; - - case GreaterEqualDepth: - - gl.depthFunc( 518 ); - break; - - case GreaterDepth: - - gl.depthFunc( 516 ); - break; - - case NotEqualDepth: - - gl.depthFunc( 517 ); - break; - - default: - - gl.depthFunc( 515 ); - - } - - } else { - - gl.depthFunc( 515 ); - - } - - currentDepthFunc = depthFunc; - - } - - }, - - setLocked: function ( lock ) { - - locked = lock; - - }, - - setClear: function ( depth ) { - - if ( currentDepthClear !== depth ) { - - gl.clearDepth( depth ); - currentDepthClear = depth; - - } - - }, - - reset: function () { - - locked = false; - - currentDepthMask = null; - currentDepthFunc = null; - currentDepthClear = null; - - } - - }; - - } - - function StencilBuffer() { - - let locked = false; - - let currentStencilMask = null; - let currentStencilFunc = null; - let currentStencilRef = null; - let currentStencilFuncMask = null; - let currentStencilFail = null; - let currentStencilZFail = null; - let currentStencilZPass = null; - let currentStencilClear = null; - - return { - - setTest: function ( stencilTest ) { - - if ( ! locked ) { - - if ( stencilTest ) { - - enable( 2960 ); - - } else { - - disable( 2960 ); - - } - - } - - }, - - setMask: function ( stencilMask ) { - - if ( currentStencilMask !== stencilMask && ! locked ) { - - gl.stencilMask( stencilMask ); - currentStencilMask = stencilMask; - - } - - }, - - setFunc: function ( stencilFunc, stencilRef, stencilMask ) { - - if ( currentStencilFunc !== stencilFunc || - currentStencilRef !== stencilRef || - currentStencilFuncMask !== stencilMask ) { - - gl.stencilFunc( stencilFunc, stencilRef, stencilMask ); - - currentStencilFunc = stencilFunc; - currentStencilRef = stencilRef; - currentStencilFuncMask = stencilMask; - - } - - }, - - setOp: function ( stencilFail, stencilZFail, stencilZPass ) { - - if ( currentStencilFail !== stencilFail || - currentStencilZFail !== stencilZFail || - currentStencilZPass !== stencilZPass ) { - - gl.stencilOp( stencilFail, stencilZFail, stencilZPass ); - - currentStencilFail = stencilFail; - currentStencilZFail = stencilZFail; - currentStencilZPass = stencilZPass; - - } - - }, - - setLocked: function ( lock ) { - - locked = lock; - - }, - - setClear: function ( stencil ) { - - if ( currentStencilClear !== stencil ) { - - gl.clearStencil( stencil ); - currentStencilClear = stencil; - - } - - }, - - reset: function () { - - locked = false; - - currentStencilMask = null; - currentStencilFunc = null; - currentStencilRef = null; - currentStencilFuncMask = null; - currentStencilFail = null; - currentStencilZFail = null; - currentStencilZPass = null; - currentStencilClear = null; - - } - - }; - - } - - // - - const colorBuffer = new ColorBuffer(); - const depthBuffer = new DepthBuffer(); - const stencilBuffer = new StencilBuffer(); - - let enabledCapabilities = {}; - - let currentProgram = null; - - let currentBlendingEnabled = false; - let currentBlending = null; - let currentBlendEquation = null; - let currentBlendSrc = null; - let currentBlendDst = null; - let currentBlendEquationAlpha = null; - let currentBlendSrcAlpha = null; - let currentBlendDstAlpha = null; - let currentPremultipledAlpha = false; - - let currentFlipSided = null; - let currentCullFace = null; - - let currentLineWidth = null; - - let currentPolygonOffsetFactor = null; - let currentPolygonOffsetUnits = null; - - const maxTextures = gl.getParameter( 35661 ); - - let lineWidthAvailable = false; - let version = 0; - const glVersion = gl.getParameter( 7938 ); - - if ( glVersion.indexOf( 'WebGL' ) !== - 1 ) { - - version = parseFloat( /^WebGL (\d)/.exec( glVersion )[ 1 ] ); - lineWidthAvailable = ( version >= 1.0 ); - - } else if ( glVersion.indexOf( 'OpenGL ES' ) !== - 1 ) { - - version = parseFloat( /^OpenGL ES (\d)/.exec( glVersion )[ 1 ] ); - lineWidthAvailable = ( version >= 2.0 ); - - } - - let currentTextureSlot = null; - let currentBoundTextures = {}; - - const currentScissor = new Vector4(); - const currentViewport = new Vector4(); - - function createTexture( type, target, count ) { - - const data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4. - const texture = gl.createTexture(); - - gl.bindTexture( type, texture ); - gl.texParameteri( type, 10241, 9728 ); - gl.texParameteri( type, 10240, 9728 ); - - for ( let i = 0; i < count; i ++ ) { - - gl.texImage2D( target + i, 0, 6408, 1, 1, 0, 6408, 5121, data ); - - } - - return texture; - - } - - const emptyTextures = {}; - emptyTextures[ 3553 ] = createTexture( 3553, 3553, 1 ); - emptyTextures[ 34067 ] = createTexture( 34067, 34069, 6 ); - - // init - - colorBuffer.setClear( 0, 0, 0, 1 ); - depthBuffer.setClear( 1 ); - stencilBuffer.setClear( 0 ); - - enable( 2929 ); - depthBuffer.setFunc( LessEqualDepth ); - - setFlipSided( false ); - setCullFace( CullFaceBack ); - enable( 2884 ); - - setBlending( NoBlending ); - - // - - function enable( id ) { - - if ( enabledCapabilities[ id ] !== true ) { - - gl.enable( id ); - enabledCapabilities[ id ] = true; - - } - - } - - function disable( id ) { - - if ( enabledCapabilities[ id ] !== false ) { - - gl.disable( id ); - enabledCapabilities[ id ] = false; - - } - - } - - function useProgram( program ) { - - if ( currentProgram !== program ) { - - gl.useProgram( program ); - - currentProgram = program; - - return true; - - } - - return false; - - } - - const equationToGL = { - [ AddEquation ]: 32774, - [ SubtractEquation ]: 32778, - [ ReverseSubtractEquation ]: 32779 - }; - - if ( isWebGL2 ) { - - equationToGL[ MinEquation ] = 32775; - equationToGL[ MaxEquation ] = 32776; - - } else { - - const extension = extensions.get( 'EXT_blend_minmax' ); - - if ( extension !== null ) { - - equationToGL[ MinEquation ] = extension.MIN_EXT; - equationToGL[ MaxEquation ] = extension.MAX_EXT; - - } - - } - - const factorToGL = { - [ ZeroFactor ]: 0, - [ OneFactor ]: 1, - [ SrcColorFactor ]: 768, - [ SrcAlphaFactor ]: 770, - [ SrcAlphaSaturateFactor ]: 776, - [ DstColorFactor ]: 774, - [ DstAlphaFactor ]: 772, - [ OneMinusSrcColorFactor ]: 769, - [ OneMinusSrcAlphaFactor ]: 771, - [ OneMinusDstColorFactor ]: 775, - [ OneMinusDstAlphaFactor ]: 773 - }; - - function setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha ) { - - if ( blending === NoBlending ) { - - if ( currentBlendingEnabled === true ) { - - disable( 3042 ); - currentBlendingEnabled = false; - - } - - return; - - } - - if ( currentBlendingEnabled === false ) { - - enable( 3042 ); - currentBlendingEnabled = true; - - } - - if ( blending !== CustomBlending ) { - - if ( blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha ) { - - if ( currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation ) { - - gl.blendEquation( 32774 ); - - currentBlendEquation = AddEquation; - currentBlendEquationAlpha = AddEquation; - - } - - if ( premultipliedAlpha ) { - - switch ( blending ) { - - case NormalBlending: - gl.blendFuncSeparate( 1, 771, 1, 771 ); - break; - - case AdditiveBlending: - gl.blendFunc( 1, 1 ); - break; - - case SubtractiveBlending: - gl.blendFuncSeparate( 0, 0, 769, 771 ); - break; - - case MultiplyBlending: - gl.blendFuncSeparate( 0, 768, 0, 770 ); - break; - - default: - console.error( 'THREE.WebGLState: Invalid blending: ', blending ); - break; - - } - - } else { - - switch ( blending ) { - - case NormalBlending: - gl.blendFuncSeparate( 770, 771, 1, 771 ); - break; - - case AdditiveBlending: - gl.blendFunc( 770, 1 ); - break; - - case SubtractiveBlending: - gl.blendFunc( 0, 769 ); - break; - - case MultiplyBlending: - gl.blendFunc( 0, 768 ); - break; - - default: - console.error( 'THREE.WebGLState: Invalid blending: ', blending ); - break; - - } - - } - - currentBlendSrc = null; - currentBlendDst = null; - currentBlendSrcAlpha = null; - currentBlendDstAlpha = null; - - currentBlending = blending; - currentPremultipledAlpha = premultipliedAlpha; - - } - - return; - - } - - // custom blending - - blendEquationAlpha = blendEquationAlpha || blendEquation; - blendSrcAlpha = blendSrcAlpha || blendSrc; - blendDstAlpha = blendDstAlpha || blendDst; - - if ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) { - - gl.blendEquationSeparate( equationToGL[ blendEquation ], equationToGL[ blendEquationAlpha ] ); - - currentBlendEquation = blendEquation; - currentBlendEquationAlpha = blendEquationAlpha; - - } - - if ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) { - - gl.blendFuncSeparate( factorToGL[ blendSrc ], factorToGL[ blendDst ], factorToGL[ blendSrcAlpha ], factorToGL[ blendDstAlpha ] ); - - currentBlendSrc = blendSrc; - currentBlendDst = blendDst; - currentBlendSrcAlpha = blendSrcAlpha; - currentBlendDstAlpha = blendDstAlpha; - - } - - currentBlending = blending; - currentPremultipledAlpha = null; - - } - - function setMaterial( material, frontFaceCW ) { - - material.side === DoubleSide - ? disable( 2884 ) - : enable( 2884 ); - - let flipSided = ( material.side === BackSide ); - if ( frontFaceCW ) flipSided = ! flipSided; - - setFlipSided( flipSided ); - - ( material.blending === NormalBlending && material.transparent === false ) - ? setBlending( NoBlending ) - : setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha ); - - depthBuffer.setFunc( material.depthFunc ); - depthBuffer.setTest( material.depthTest ); - depthBuffer.setMask( material.depthWrite ); - colorBuffer.setMask( material.colorWrite ); - - const stencilWrite = material.stencilWrite; - stencilBuffer.setTest( stencilWrite ); - if ( stencilWrite ) { - - stencilBuffer.setMask( material.stencilWriteMask ); - stencilBuffer.setFunc( material.stencilFunc, material.stencilRef, material.stencilFuncMask ); - stencilBuffer.setOp( material.stencilFail, material.stencilZFail, material.stencilZPass ); - - } - - setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits ); - - } - - // - - function setFlipSided( flipSided ) { - - if ( currentFlipSided !== flipSided ) { - - if ( flipSided ) { - - gl.frontFace( 2304 ); - - } else { - - gl.frontFace( 2305 ); - - } - - currentFlipSided = flipSided; - - } - - } - - function setCullFace( cullFace ) { - - if ( cullFace !== CullFaceNone ) { - - enable( 2884 ); - - if ( cullFace !== currentCullFace ) { - - if ( cullFace === CullFaceBack ) { - - gl.cullFace( 1029 ); - - } else if ( cullFace === CullFaceFront ) { - - gl.cullFace( 1028 ); - - } else { - - gl.cullFace( 1032 ); - - } - - } - - } else { - - disable( 2884 ); - - } - - currentCullFace = cullFace; - - } - - function setLineWidth( width ) { - - if ( width !== currentLineWidth ) { - - if ( lineWidthAvailable ) gl.lineWidth( width ); - - currentLineWidth = width; - - } - - } - - function setPolygonOffset( polygonOffset, factor, units ) { - - if ( polygonOffset ) { - - enable( 32823 ); - - if ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) { - - gl.polygonOffset( factor, units ); - - currentPolygonOffsetFactor = factor; - currentPolygonOffsetUnits = units; - - } - - } else { - - disable( 32823 ); - - } - - } - - function setScissorTest( scissorTest ) { - - if ( scissorTest ) { - - enable( 3089 ); - - } else { - - disable( 3089 ); - - } - - } - - // texture - - function activeTexture( webglSlot ) { - - if ( webglSlot === undefined ) webglSlot = 33984 + maxTextures - 1; - - if ( currentTextureSlot !== webglSlot ) { - - gl.activeTexture( webglSlot ); - currentTextureSlot = webglSlot; - - } - - } - - function bindTexture( webglType, webglTexture ) { - - if ( currentTextureSlot === null ) { - - activeTexture(); - - } - - let boundTexture = currentBoundTextures[ currentTextureSlot ]; - - if ( boundTexture === undefined ) { - - boundTexture = { type: undefined, texture: undefined }; - currentBoundTextures[ currentTextureSlot ] = boundTexture; - - } - - if ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) { - - gl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] ); - - boundTexture.type = webglType; - boundTexture.texture = webglTexture; - - } - - } - - function unbindTexture() { - - const boundTexture = currentBoundTextures[ currentTextureSlot ]; - - if ( boundTexture !== undefined && boundTexture.type !== undefined ) { - - gl.bindTexture( boundTexture.type, null ); - - boundTexture.type = undefined; - boundTexture.texture = undefined; - - } - - } - - function compressedTexImage2D() { - - try { - - gl.compressedTexImage2D.apply( gl, arguments ); - - } catch ( error ) { - - console.error( 'THREE.WebGLState:', error ); - - } - - } - - function texImage2D() { - - try { - - gl.texImage2D.apply( gl, arguments ); - - } catch ( error ) { - - console.error( 'THREE.WebGLState:', error ); - - } - - } - - function texImage3D() { - - try { - - gl.texImage3D.apply( gl, arguments ); - - } catch ( error ) { - - console.error( 'THREE.WebGLState:', error ); - - } - - } - - // - - function scissor( scissor ) { - - if ( currentScissor.equals( scissor ) === false ) { - - gl.scissor( scissor.x, scissor.y, scissor.z, scissor.w ); - currentScissor.copy( scissor ); - - } - - } - - function viewport( viewport ) { - - if ( currentViewport.equals( viewport ) === false ) { - - gl.viewport( viewport.x, viewport.y, viewport.z, viewport.w ); - currentViewport.copy( viewport ); - - } - - } - - // - - function reset() { - - // reset state - - gl.disable( 3042 ); - gl.disable( 2884 ); - gl.disable( 2929 ); - gl.disable( 32823 ); - gl.disable( 3089 ); - gl.disable( 2960 ); - - gl.blendEquation( 32774 ); - gl.blendFunc( 1, 0 ); - gl.blendFuncSeparate( 1, 0, 1, 0 ); - - gl.colorMask( true, true, true, true ); - gl.clearColor( 0, 0, 0, 0 ); - - gl.depthMask( true ); - gl.depthFunc( 513 ); - gl.clearDepth( 1 ); - - gl.stencilMask( 0xffffffff ); - gl.stencilFunc( 519, 0, 0xffffffff ); - gl.stencilOp( 7680, 7680, 7680 ); - gl.clearStencil( 0 ); - - gl.cullFace( 1029 ); - gl.frontFace( 2305 ); - - gl.polygonOffset( 0, 0 ); - - gl.activeTexture( 33984 ); - - gl.useProgram( null ); - - gl.lineWidth( 1 ); - - gl.scissor( 0, 0, gl.canvas.width, gl.canvas.height ); - gl.viewport( 0, 0, gl.canvas.width, gl.canvas.height ); - - // reset internals - - enabledCapabilities = {}; - - currentTextureSlot = null; - currentBoundTextures = {}; - - currentProgram = null; - - currentBlendingEnabled = false; - currentBlending = null; - currentBlendEquation = null; - currentBlendSrc = null; - currentBlendDst = null; - currentBlendEquationAlpha = null; - currentBlendSrcAlpha = null; - currentBlendDstAlpha = null; - currentPremultipledAlpha = false; - - currentFlipSided = null; - currentCullFace = null; - - currentLineWidth = null; - - currentPolygonOffsetFactor = null; - currentPolygonOffsetUnits = null; - - colorBuffer.reset(); - depthBuffer.reset(); - stencilBuffer.reset(); - - } - - return { - - buffers: { - color: colorBuffer, - depth: depthBuffer, - stencil: stencilBuffer - }, - - enable: enable, - disable: disable, - - useProgram: useProgram, - - setBlending: setBlending, - setMaterial: setMaterial, - - setFlipSided: setFlipSided, - setCullFace: setCullFace, - - setLineWidth: setLineWidth, - setPolygonOffset: setPolygonOffset, - - setScissorTest: setScissorTest, - - activeTexture: activeTexture, - bindTexture: bindTexture, - unbindTexture: unbindTexture, - compressedTexImage2D: compressedTexImage2D, - texImage2D: texImage2D, - texImage3D: texImage3D, - - scissor: scissor, - viewport: viewport, - - reset: reset - - }; - -} - -function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) { - - const isWebGL2 = capabilities.isWebGL2; - const maxTextures = capabilities.maxTextures; - const maxCubemapSize = capabilities.maxCubemapSize; - const maxTextureSize = capabilities.maxTextureSize; - const maxSamples = capabilities.maxSamples; - - const _videoTextures = new WeakMap(); - let _canvas; - - // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas, - // also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")! - // Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d). - - let useOffscreenCanvas = false; - - try { - - useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined' - && ( new OffscreenCanvas( 1, 1 ).getContext( '2d' ) ) !== null; - - } catch ( err ) { - - // Ignore any errors - - } - - function createCanvas( width, height ) { - - // Use OffscreenCanvas when available. Specially needed in web workers - - return useOffscreenCanvas ? - new OffscreenCanvas( width, height ) : - document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ); - - } - - function resizeImage( image, needsPowerOfTwo, needsNewCanvas, maxSize ) { - - let scale = 1; - - // handle case if texture exceeds max size - - if ( image.width > maxSize || image.height > maxSize ) { - - scale = maxSize / Math.max( image.width, image.height ); - - } - - // only perform resize if necessary - - if ( scale < 1 || needsPowerOfTwo === true ) { - - // only perform resize for certain image types - - if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) || - ( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) || - ( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) { - - const floor = needsPowerOfTwo ? MathUtils.floorPowerOfTwo : Math.floor; - - const width = floor( scale * image.width ); - const height = floor( scale * image.height ); - - if ( _canvas === undefined ) _canvas = createCanvas( width, height ); - - // cube textures can't reuse the same canvas - - const canvas = needsNewCanvas ? createCanvas( width, height ) : _canvas; - - canvas.width = width; - canvas.height = height; - - const context = canvas.getContext( '2d' ); - context.drawImage( image, 0, 0, width, height ); - - console.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + image.width + 'x' + image.height + ') to (' + width + 'x' + height + ').' ); - - return canvas; - - } else { - - if ( 'data' in image ) { - - console.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').' ); - - } - - return image; - - } - - } - - return image; - - } - - function isPowerOfTwo( image ) { - - return MathUtils.isPowerOfTwo( image.width ) && MathUtils.isPowerOfTwo( image.height ); - - } - - function textureNeedsPowerOfTwo( texture ) { - - if ( isWebGL2 ) return false; - - return ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) || - ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ); - - } - - function textureNeedsGenerateMipmaps( texture, supportsMips ) { - - return texture.generateMipmaps && supportsMips && - texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter; - - } - - function generateMipmap( target, texture, width, height ) { - - _gl.generateMipmap( target ); - - const textureProperties = properties.get( texture ); - - textureProperties.__maxMipLevel = Math.log2( Math.max( width, height ) ); - - } - - function getInternalFormat( internalFormatName, glFormat, glType ) { - - if ( isWebGL2 === false ) return glFormat; - - if ( internalFormatName !== null ) { - - if ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ]; - - console.warn( 'THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \'' + internalFormatName + '\'' ); - - } - - let internalFormat = glFormat; - - if ( glFormat === 6403 ) { - - if ( glType === 5126 ) internalFormat = 33326; - if ( glType === 5131 ) internalFormat = 33325; - if ( glType === 5121 ) internalFormat = 33321; - - } - - if ( glFormat === 6407 ) { - - if ( glType === 5126 ) internalFormat = 34837; - if ( glType === 5131 ) internalFormat = 34843; - if ( glType === 5121 ) internalFormat = 32849; - - } - - if ( glFormat === 6408 ) { - - if ( glType === 5126 ) internalFormat = 34836; - if ( glType === 5131 ) internalFormat = 34842; - if ( glType === 5121 ) internalFormat = 32856; - - } - - if ( internalFormat === 33325 || internalFormat === 33326 || - internalFormat === 34842 || internalFormat === 34836 ) { - - extensions.get( 'EXT_color_buffer_float' ); - - } - - return internalFormat; - - } - - // Fallback filters for non-power-of-2 textures - - function filterFallback( f ) { - - if ( f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter ) { - - return 9728; - - } - - return 9729; - - } - - // - - function onTextureDispose( event ) { - - const texture = event.target; - - texture.removeEventListener( 'dispose', onTextureDispose ); - - deallocateTexture( texture ); - - if ( texture.isVideoTexture ) { - - _videoTextures.delete( texture ); - - } - - info.memory.textures --; - - } - - function onRenderTargetDispose( event ) { - - const renderTarget = event.target; - - renderTarget.removeEventListener( 'dispose', onRenderTargetDispose ); - - deallocateRenderTarget( renderTarget ); - - info.memory.textures --; - - } - - // - - function deallocateTexture( texture ) { - - const textureProperties = properties.get( texture ); - - if ( textureProperties.__webglInit === undefined ) return; - - _gl.deleteTexture( textureProperties.__webglTexture ); - - properties.remove( texture ); - - } - - function deallocateRenderTarget( renderTarget ) { - - const texture = renderTarget.texture; - - const renderTargetProperties = properties.get( renderTarget ); - const textureProperties = properties.get( texture ); - - if ( ! renderTarget ) return; - - if ( textureProperties.__webglTexture !== undefined ) { - - _gl.deleteTexture( textureProperties.__webglTexture ); - - } - - if ( renderTarget.depthTexture ) { - - renderTarget.depthTexture.dispose(); - - } - - if ( renderTarget.isWebGLCubeRenderTarget ) { - - for ( let i = 0; i < 6; i ++ ) { - - _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] ); - if ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] ); - - } - - } else { - - _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer ); - if ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer ); - if ( renderTargetProperties.__webglMultisampledFramebuffer ) _gl.deleteFramebuffer( renderTargetProperties.__webglMultisampledFramebuffer ); - if ( renderTargetProperties.__webglColorRenderbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglColorRenderbuffer ); - if ( renderTargetProperties.__webglDepthRenderbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthRenderbuffer ); - - } - - properties.remove( texture ); - properties.remove( renderTarget ); - - } - - // - - let textureUnits = 0; - - function resetTextureUnits() { - - textureUnits = 0; - - } - - function allocateTextureUnit() { - - const textureUnit = textureUnits; - - if ( textureUnit >= maxTextures ) { - - console.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures ); - - } - - textureUnits += 1; - - return textureUnit; - - } - - // - - function setTexture2D( texture, slot ) { - - const textureProperties = properties.get( texture ); - - if ( texture.isVideoTexture ) updateVideoTexture( texture ); - - if ( texture.version > 0 && textureProperties.__version !== texture.version ) { - - const image = texture.image; - - if ( image === undefined ) { - - console.warn( 'THREE.WebGLRenderer: Texture marked for update but image is undefined' ); - - } else if ( image.complete === false ) { - - console.warn( 'THREE.WebGLRenderer: Texture marked for update but image is incomplete' ); - - } else { - - uploadTexture( textureProperties, texture, slot ); - return; - - } - - } - - state.activeTexture( 33984 + slot ); - state.bindTexture( 3553, textureProperties.__webglTexture ); - - } - - function setTexture2DArray( texture, slot ) { - - const textureProperties = properties.get( texture ); - - if ( texture.version > 0 && textureProperties.__version !== texture.version ) { - - uploadTexture( textureProperties, texture, slot ); - return; - - } - - state.activeTexture( 33984 + slot ); - state.bindTexture( 35866, textureProperties.__webglTexture ); - - } - - function setTexture3D( texture, slot ) { - - const textureProperties = properties.get( texture ); - - if ( texture.version > 0 && textureProperties.__version !== texture.version ) { - - uploadTexture( textureProperties, texture, slot ); - return; - - } - - state.activeTexture( 33984 + slot ); - state.bindTexture( 32879, textureProperties.__webglTexture ); - - } - - function setTextureCube( texture, slot ) { - - const textureProperties = properties.get( texture ); - - if ( texture.version > 0 && textureProperties.__version !== texture.version ) { - - uploadCubeTexture( textureProperties, texture, slot ); - return; - - } - - state.activeTexture( 33984 + slot ); - state.bindTexture( 34067, textureProperties.__webglTexture ); - - } - - const wrappingToGL = { - [ RepeatWrapping ]: 10497, - [ ClampToEdgeWrapping ]: 33071, - [ MirroredRepeatWrapping ]: 33648 - }; - - const filterToGL = { - [ NearestFilter ]: 9728, - [ NearestMipmapNearestFilter ]: 9984, - [ NearestMipmapLinearFilter ]: 9986, - - [ LinearFilter ]: 9729, - [ LinearMipmapNearestFilter ]: 9985, - [ LinearMipmapLinearFilter ]: 9987 - }; - - function setTextureParameters( textureType, texture, supportsMips ) { - - if ( supportsMips ) { - - _gl.texParameteri( textureType, 10242, wrappingToGL[ texture.wrapS ] ); - _gl.texParameteri( textureType, 10243, wrappingToGL[ texture.wrapT ] ); - - if ( textureType === 32879 || textureType === 35866 ) { - - _gl.texParameteri( textureType, 32882, wrappingToGL[ texture.wrapR ] ); - - } - - _gl.texParameteri( textureType, 10240, filterToGL[ texture.magFilter ] ); - _gl.texParameteri( textureType, 10241, filterToGL[ texture.minFilter ] ); - - } else { - - _gl.texParameteri( textureType, 10242, 33071 ); - _gl.texParameteri( textureType, 10243, 33071 ); - - if ( textureType === 32879 || textureType === 35866 ) { - - _gl.texParameteri( textureType, 32882, 33071 ); - - } - - if ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) { - - console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.' ); - - } - - _gl.texParameteri( textureType, 10240, filterFallback( texture.magFilter ) ); - _gl.texParameteri( textureType, 10241, filterFallback( texture.minFilter ) ); - - if ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) { - - console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.' ); - - } - - } - - if ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) { - - const extension = extensions.get( 'EXT_texture_filter_anisotropic' ); - - if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension for WebGL 1 and WebGL 2 - if ( isWebGL2 === false && ( texture.type === HalfFloatType && extensions.has( 'OES_texture_half_float_linear' ) === false ) ) return; // verify extension for WebGL 1 only - - if ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) { - - _gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) ); - properties.get( texture ).__currentAnisotropy = texture.anisotropy; - - } - - } - - } - - function initTexture( textureProperties, texture ) { - - if ( textureProperties.__webglInit === undefined ) { - - textureProperties.__webglInit = true; - - texture.addEventListener( 'dispose', onTextureDispose ); - - textureProperties.__webglTexture = _gl.createTexture(); - - info.memory.textures ++; - - } - - } - - function uploadTexture( textureProperties, texture, slot ) { - - let textureType = 3553; - - if ( texture.isDataTexture2DArray ) textureType = 35866; - if ( texture.isDataTexture3D ) textureType = 32879; - - initTexture( textureProperties, texture ); - - state.activeTexture( 33984 + slot ); - state.bindTexture( textureType, textureProperties.__webglTexture ); - - _gl.pixelStorei( 37440, texture.flipY ); - _gl.pixelStorei( 37441, texture.premultiplyAlpha ); - _gl.pixelStorei( 3317, texture.unpackAlignment ); - _gl.pixelStorei( 37443, 0 ); - - const needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo( texture.image ) === false; - const image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize ); - - const supportsMips = isPowerOfTwo( image ) || isWebGL2, - glFormat = utils.convert( texture.format ); - - let glType = utils.convert( texture.type ), - glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType ); - - setTextureParameters( textureType, texture, supportsMips ); - - let mipmap; - const mipmaps = texture.mipmaps; - - if ( texture.isDepthTexture ) { - - // populate depth texture with dummy data - - glInternalFormat = 6402; - - if ( isWebGL2 ) { - - if ( texture.type === FloatType ) { - - glInternalFormat = 36012; - - } else if ( texture.type === UnsignedIntType ) { - - glInternalFormat = 33190; - - } else if ( texture.type === UnsignedInt248Type ) { - - glInternalFormat = 35056; - - } else { - - glInternalFormat = 33189; // WebGL2 requires sized internalformat for glTexImage2D - - } - - } else { - - if ( texture.type === FloatType ) { - - console.error( 'WebGLRenderer: Floating point depth texture requires WebGL2.' ); - - } - - } - - // validation checks for WebGL 1 - - if ( texture.format === DepthFormat && glInternalFormat === 6402 ) { - - // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are - // DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT - // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/) - if ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) { - - console.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' ); - - texture.type = UnsignedShortType; - glType = utils.convert( texture.type ); - - } - - } - - if ( texture.format === DepthStencilFormat && glInternalFormat === 6402 ) { - - // Depth stencil textures need the DEPTH_STENCIL internal format - // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/) - glInternalFormat = 34041; - - // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are - // DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL. - // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/) - if ( texture.type !== UnsignedInt248Type ) { - - console.warn( 'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' ); - - texture.type = UnsignedInt248Type; - glType = utils.convert( texture.type ); - - } - - } - - // - - state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null ); - - } else if ( texture.isDataTexture ) { - - // use manually created mipmaps if available - // if there are no manual mipmaps - // set 0 level mipmap and then use GL to generate other mipmap levels - - if ( mipmaps.length > 0 && supportsMips ) { - - for ( let i = 0, il = mipmaps.length; i < il; i ++ ) { - - mipmap = mipmaps[ i ]; - state.texImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - - } - - texture.generateMipmaps = false; - textureProperties.__maxMipLevel = mipmaps.length - 1; - - } else { - - state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data ); - textureProperties.__maxMipLevel = 0; - - } - - } else if ( texture.isCompressedTexture ) { - - for ( let i = 0, il = mipmaps.length; i < il; i ++ ) { - - mipmap = mipmaps[ i ]; - - if ( texture.format !== RGBAFormat && texture.format !== RGBFormat ) { - - if ( glFormat !== null ) { - - state.compressedTexImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data ); - - } else { - - console.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' ); - - } - - } else { - - state.texImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - - } - - } - - textureProperties.__maxMipLevel = mipmaps.length - 1; - - } else if ( texture.isDataTexture2DArray ) { - - state.texImage3D( 35866, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data ); - textureProperties.__maxMipLevel = 0; - - } else if ( texture.isDataTexture3D ) { - - state.texImage3D( 32879, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data ); - textureProperties.__maxMipLevel = 0; - - } else { - - // regular Texture (image, video, canvas) - - // use manually created mipmaps if available - // if there are no manual mipmaps - // set 0 level mipmap and then use GL to generate other mipmap levels - - if ( mipmaps.length > 0 && supportsMips ) { - - for ( let i = 0, il = mipmaps.length; i < il; i ++ ) { - - mipmap = mipmaps[ i ]; - state.texImage2D( 3553, i, glInternalFormat, glFormat, glType, mipmap ); - - } - - texture.generateMipmaps = false; - textureProperties.__maxMipLevel = mipmaps.length - 1; - - } else { - - state.texImage2D( 3553, 0, glInternalFormat, glFormat, glType, image ); - textureProperties.__maxMipLevel = 0; - - } - - } - - if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) { - - generateMipmap( textureType, texture, image.width, image.height ); - - } - - textureProperties.__version = texture.version; - - if ( texture.onUpdate ) texture.onUpdate( texture ); - - } - - function uploadCubeTexture( textureProperties, texture, slot ) { - - if ( texture.image.length !== 6 ) return; - - initTexture( textureProperties, texture ); - - state.activeTexture( 33984 + slot ); - state.bindTexture( 34067, textureProperties.__webglTexture ); - - _gl.pixelStorei( 37440, texture.flipY ); - _gl.pixelStorei( 37441, texture.premultiplyAlpha ); - _gl.pixelStorei( 3317, texture.unpackAlignment ); - _gl.pixelStorei( 37443, 0 ); - - const isCompressed = ( texture && ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture ) ); - const isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture ); - - const cubeImage = []; - - for ( let i = 0; i < 6; i ++ ) { - - if ( ! isCompressed && ! isDataTexture ) { - - cubeImage[ i ] = resizeImage( texture.image[ i ], false, true, maxCubemapSize ); - - } else { - - cubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ]; - - } - - } - - const image = cubeImage[ 0 ], - supportsMips = isPowerOfTwo( image ) || isWebGL2, - glFormat = utils.convert( texture.format ), - glType = utils.convert( texture.type ), - glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType ); - - setTextureParameters( 34067, texture, supportsMips ); - - let mipmaps; - - if ( isCompressed ) { - - for ( let i = 0; i < 6; i ++ ) { - - mipmaps = cubeImage[ i ].mipmaps; - - for ( let j = 0; j < mipmaps.length; j ++ ) { - - const mipmap = mipmaps[ j ]; - - if ( texture.format !== RGBAFormat && texture.format !== RGBFormat ) { - - if ( glFormat !== null ) { - - state.compressedTexImage2D( 34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data ); - - } else { - - console.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' ); - - } - - } else { - - state.texImage2D( 34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - - } - - } - - } - - textureProperties.__maxMipLevel = mipmaps.length - 1; - - } else { - - mipmaps = texture.mipmaps; - - for ( let i = 0; i < 6; i ++ ) { - - if ( isDataTexture ) { - - state.texImage2D( 34069 + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data ); - - for ( let j = 0; j < mipmaps.length; j ++ ) { - - const mipmap = mipmaps[ j ]; - const mipmapImage = mipmap.image[ i ].image; - - state.texImage2D( 34069 + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data ); - - } - - } else { - - state.texImage2D( 34069 + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] ); - - for ( let j = 0; j < mipmaps.length; j ++ ) { - - const mipmap = mipmaps[ j ]; - - state.texImage2D( 34069 + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] ); - - } - - } - - } - - textureProperties.__maxMipLevel = mipmaps.length; - - } - - if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) { - - // We assume images for cube map have the same size. - generateMipmap( 34067, texture, image.width, image.height ); - - } - - textureProperties.__version = texture.version; - - if ( texture.onUpdate ) texture.onUpdate( texture ); - - } - - // Render targets - - // Setup storage for target texture and bind it to correct framebuffer - function setupFrameBufferTexture( framebuffer, renderTarget, attachment, textureTarget ) { - - const texture = renderTarget.texture; - - const glFormat = utils.convert( texture.format ); - const glType = utils.convert( texture.type ); - const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType ); - - if ( textureTarget === 32879 || textureTarget === 35866 ) { - - state.texImage3D( textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.depth, 0, glFormat, glType, null ); - - } else { - - state.texImage2D( textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null ); - - } - - _gl.bindFramebuffer( 36160, framebuffer ); - _gl.framebufferTexture2D( 36160, attachment, textureTarget, properties.get( texture ).__webglTexture, 0 ); - _gl.bindFramebuffer( 36160, null ); - - } - - // Setup storage for internal depth/stencil buffers and bind to correct framebuffer - function setupRenderBufferStorage( renderbuffer, renderTarget, isMultisample ) { - - _gl.bindRenderbuffer( 36161, renderbuffer ); - - if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) { - - let glInternalFormat = 33189; - - if ( isMultisample ) { - - const depthTexture = renderTarget.depthTexture; - - if ( depthTexture && depthTexture.isDepthTexture ) { - - if ( depthTexture.type === FloatType ) { - - glInternalFormat = 36012; - - } else if ( depthTexture.type === UnsignedIntType ) { - - glInternalFormat = 33190; - - } - - } - - const samples = getRenderTargetSamples( renderTarget ); - - _gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height ); - - } else { - - _gl.renderbufferStorage( 36161, glInternalFormat, renderTarget.width, renderTarget.height ); - - } - - _gl.framebufferRenderbuffer( 36160, 36096, 36161, renderbuffer ); - - } else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) { - - if ( isMultisample ) { - - const samples = getRenderTargetSamples( renderTarget ); - - _gl.renderbufferStorageMultisample( 36161, samples, 35056, renderTarget.width, renderTarget.height ); - - } else { - - _gl.renderbufferStorage( 36161, 34041, renderTarget.width, renderTarget.height ); - - } - - - _gl.framebufferRenderbuffer( 36160, 33306, 36161, renderbuffer ); - - } else { - - const texture = renderTarget.texture; - - const glFormat = utils.convert( texture.format ); - const glType = utils.convert( texture.type ); - const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType ); - - if ( isMultisample ) { - - const samples = getRenderTargetSamples( renderTarget ); - - _gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height ); - - } else { - - _gl.renderbufferStorage( 36161, glInternalFormat, renderTarget.width, renderTarget.height ); - - } - - } - - _gl.bindRenderbuffer( 36161, null ); - - } - - // Setup resources for a Depth Texture for a FBO (needs an extension) - function setupDepthTexture( framebuffer, renderTarget ) { - - const isCube = ( renderTarget && renderTarget.isWebGLCubeRenderTarget ); - if ( isCube ) throw new Error( 'Depth Texture with cube render targets is not supported' ); - - _gl.bindFramebuffer( 36160, framebuffer ); - - if ( ! ( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) { - - throw new Error( 'renderTarget.depthTexture must be an instance of THREE.DepthTexture' ); - - } - - // upload an empty depth texture with framebuffer size - if ( ! properties.get( renderTarget.depthTexture ).__webglTexture || - renderTarget.depthTexture.image.width !== renderTarget.width || - renderTarget.depthTexture.image.height !== renderTarget.height ) { - - renderTarget.depthTexture.image.width = renderTarget.width; - renderTarget.depthTexture.image.height = renderTarget.height; - renderTarget.depthTexture.needsUpdate = true; - - } - - setTexture2D( renderTarget.depthTexture, 0 ); - - const webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture; - - if ( renderTarget.depthTexture.format === DepthFormat ) { - - _gl.framebufferTexture2D( 36160, 36096, 3553, webglDepthTexture, 0 ); - - } else if ( renderTarget.depthTexture.format === DepthStencilFormat ) { - - _gl.framebufferTexture2D( 36160, 33306, 3553, webglDepthTexture, 0 ); - - } else { - - throw new Error( 'Unknown depthTexture format' ); - - } - - } - - // Setup GL resources for a non-texture depth buffer - function setupDepthRenderbuffer( renderTarget ) { - - const renderTargetProperties = properties.get( renderTarget ); - - const isCube = ( renderTarget.isWebGLCubeRenderTarget === true ); - - if ( renderTarget.depthTexture ) { - - if ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' ); - - setupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget ); - - } else { - - if ( isCube ) { - - renderTargetProperties.__webglDepthbuffer = []; - - for ( let i = 0; i < 6; i ++ ) { - - _gl.bindFramebuffer( 36160, renderTargetProperties.__webglFramebuffer[ i ] ); - renderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer(); - setupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget, false ); - - } - - } else { - - _gl.bindFramebuffer( 36160, renderTargetProperties.__webglFramebuffer ); - renderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer(); - setupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget, false ); - - } - - } - - _gl.bindFramebuffer( 36160, null ); - - } - - // Set up GL resources for the render target - function setupRenderTarget( renderTarget ) { - - const texture = renderTarget.texture; - - const renderTargetProperties = properties.get( renderTarget ); - const textureProperties = properties.get( texture ); - - renderTarget.addEventListener( 'dispose', onRenderTargetDispose ); - - textureProperties.__webglTexture = _gl.createTexture(); - - info.memory.textures ++; - - const isCube = ( renderTarget.isWebGLCubeRenderTarget === true ); - const isMultisample = ( renderTarget.isWebGLMultisampleRenderTarget === true ); - const isRenderTarget3D = texture.isDataTexture3D || texture.isDataTexture2DArray; - const supportsMips = isPowerOfTwo( renderTarget ) || isWebGL2; - - // Handles WebGL2 RGBFormat fallback - #18858 - - if ( isWebGL2 && texture.format === RGBFormat && ( texture.type === FloatType || texture.type === HalfFloatType ) ) { - - texture.format = RGBAFormat; - - console.warn( 'THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.' ); - - } - - // Setup framebuffer - - if ( isCube ) { - - renderTargetProperties.__webglFramebuffer = []; - - for ( let i = 0; i < 6; i ++ ) { - - renderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer(); - - } - - } else { - - renderTargetProperties.__webglFramebuffer = _gl.createFramebuffer(); - - if ( isMultisample ) { - - if ( isWebGL2 ) { - - renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer(); - renderTargetProperties.__webglColorRenderbuffer = _gl.createRenderbuffer(); - - _gl.bindRenderbuffer( 36161, renderTargetProperties.__webglColorRenderbuffer ); - - const glFormat = utils.convert( texture.format ); - const glType = utils.convert( texture.type ); - const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType ); - const samples = getRenderTargetSamples( renderTarget ); - _gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height ); - - _gl.bindFramebuffer( 36160, renderTargetProperties.__webglMultisampledFramebuffer ); - _gl.framebufferRenderbuffer( 36160, 36064, 36161, renderTargetProperties.__webglColorRenderbuffer ); - _gl.bindRenderbuffer( 36161, null ); - - if ( renderTarget.depthBuffer ) { - - renderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer(); - setupRenderBufferStorage( renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true ); - - } - - _gl.bindFramebuffer( 36160, null ); - - - } else { - - console.warn( 'THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.' ); - - } - - } - - } - - // Setup color buffer - - if ( isCube ) { - - state.bindTexture( 34067, textureProperties.__webglTexture ); - setTextureParameters( 34067, texture, supportsMips ); - - for ( let i = 0; i < 6; i ++ ) { - - setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, 36064, 34069 + i ); - - } - - if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) { - - generateMipmap( 34067, texture, renderTarget.width, renderTarget.height ); - - } - - state.bindTexture( 34067, null ); - - } else { - - let glTextureType = 3553; - - if ( isRenderTarget3D ) { - - // Render targets containing layers, i.e: Texture 3D and 2d arrays - - if ( isWebGL2 ) { - - const isTexture3D = texture.isDataTexture3D; - glTextureType = isTexture3D ? 32879 : 35866; - - } else { - - console.warn( 'THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.' ); - - } - - } - - state.bindTexture( glTextureType, textureProperties.__webglTexture ); - setTextureParameters( glTextureType, texture, supportsMips ); - setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, 36064, glTextureType ); - - if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) { - - generateMipmap( 3553, texture, renderTarget.width, renderTarget.height ); - - } - - state.bindTexture( 3553, null ); - - } - - // Setup depth and stencil buffers - - if ( renderTarget.depthBuffer ) { - - setupDepthRenderbuffer( renderTarget ); - - } - - } - - function updateRenderTargetMipmap( renderTarget ) { - - const texture = renderTarget.texture; - - const supportsMips = isPowerOfTwo( renderTarget ) || isWebGL2; - - if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) { - - const target = renderTarget.isWebGLCubeRenderTarget ? 34067 : 3553; - const webglTexture = properties.get( texture ).__webglTexture; - - state.bindTexture( target, webglTexture ); - generateMipmap( target, texture, renderTarget.width, renderTarget.height ); - state.bindTexture( target, null ); - - } - - } - - function updateMultisampleRenderTarget( renderTarget ) { - - if ( renderTarget.isWebGLMultisampleRenderTarget ) { - - if ( isWebGL2 ) { - - const renderTargetProperties = properties.get( renderTarget ); - - _gl.bindFramebuffer( 36008, renderTargetProperties.__webglMultisampledFramebuffer ); - _gl.bindFramebuffer( 36009, renderTargetProperties.__webglFramebuffer ); - - const width = renderTarget.width; - const height = renderTarget.height; - let mask = 16384; - - if ( renderTarget.depthBuffer ) mask |= 256; - if ( renderTarget.stencilBuffer ) mask |= 1024; - - _gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, 9728 ); - - _gl.bindFramebuffer( 36160, renderTargetProperties.__webglMultisampledFramebuffer ); // see #18905 - - } else { - - console.warn( 'THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.' ); - - } - - } - - } - - function getRenderTargetSamples( renderTarget ) { - - return ( isWebGL2 && renderTarget.isWebGLMultisampleRenderTarget ) ? - Math.min( maxSamples, renderTarget.samples ) : 0; - - } - - function updateVideoTexture( texture ) { - - const frame = info.render.frame; - - // Check the last frame we updated the VideoTexture - - if ( _videoTextures.get( texture ) !== frame ) { - - _videoTextures.set( texture, frame ); - texture.update(); - - } - - } - - // backwards compatibility - - let warnedTexture2D = false; - let warnedTextureCube = false; - - function safeSetTexture2D( texture, slot ) { - - if ( texture && texture.isWebGLRenderTarget ) { - - if ( warnedTexture2D === false ) { - - console.warn( 'THREE.WebGLTextures.safeSetTexture2D: don\'t use render targets as textures. Use their .texture property instead.' ); - warnedTexture2D = true; - - } - - texture = texture.texture; - - } - - setTexture2D( texture, slot ); - - } - - function safeSetTextureCube( texture, slot ) { - - if ( texture && texture.isWebGLCubeRenderTarget ) { - - if ( warnedTextureCube === false ) { - - console.warn( 'THREE.WebGLTextures.safeSetTextureCube: don\'t use cube render targets as textures. Use their .texture property instead.' ); - warnedTextureCube = true; - - } - - texture = texture.texture; - - } - - - setTextureCube( texture, slot ); - - } - - // - - this.allocateTextureUnit = allocateTextureUnit; - this.resetTextureUnits = resetTextureUnits; - - this.setTexture2D = setTexture2D; - this.setTexture2DArray = setTexture2DArray; - this.setTexture3D = setTexture3D; - this.setTextureCube = setTextureCube; - this.setupRenderTarget = setupRenderTarget; - this.updateRenderTargetMipmap = updateRenderTargetMipmap; - this.updateMultisampleRenderTarget = updateMultisampleRenderTarget; - - this.safeSetTexture2D = safeSetTexture2D; - this.safeSetTextureCube = safeSetTextureCube; - -} - -function WebGLUtils( gl, extensions, capabilities ) { - - const isWebGL2 = capabilities.isWebGL2; - - function convert( p ) { - - let extension; - - if ( p === UnsignedByteType ) return 5121; - if ( p === UnsignedShort4444Type ) return 32819; - if ( p === UnsignedShort5551Type ) return 32820; - if ( p === UnsignedShort565Type ) return 33635; - - if ( p === ByteType ) return 5120; - if ( p === ShortType ) return 5122; - if ( p === UnsignedShortType ) return 5123; - if ( p === IntType ) return 5124; - if ( p === UnsignedIntType ) return 5125; - if ( p === FloatType ) return 5126; - - if ( p === HalfFloatType ) { - - if ( isWebGL2 ) return 5131; - - extension = extensions.get( 'OES_texture_half_float' ); - - if ( extension !== null ) { - - return extension.HALF_FLOAT_OES; - - } else { - - return null; - - } - - } - - if ( p === AlphaFormat ) return 6406; - if ( p === RGBFormat ) return 6407; - if ( p === RGBAFormat ) return 6408; - if ( p === LuminanceFormat ) return 6409; - if ( p === LuminanceAlphaFormat ) return 6410; - if ( p === DepthFormat ) return 6402; - if ( p === DepthStencilFormat ) return 34041; - if ( p === RedFormat ) return 6403; - - // WebGL2 formats. - - if ( p === RedIntegerFormat ) return 36244; - if ( p === RGFormat ) return 33319; - if ( p === RGIntegerFormat ) return 33320; - if ( p === RGBIntegerFormat ) return 36248; - if ( p === RGBAIntegerFormat ) return 36249; - - if ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || - p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) { - - extension = extensions.get( 'WEBGL_compressed_texture_s3tc' ); - - if ( extension !== null ) { - - if ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT; - if ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT; - if ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT; - if ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT; - - } else { - - return null; - - } - - } - - if ( p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || - p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format ) { - - extension = extensions.get( 'WEBGL_compressed_texture_pvrtc' ); - - if ( extension !== null ) { - - if ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; - if ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; - if ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; - if ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; - - } else { - - return null; - - } - - } - - if ( p === RGB_ETC1_Format ) { - - extension = extensions.get( 'WEBGL_compressed_texture_etc1' ); - - if ( extension !== null ) { - - return extension.COMPRESSED_RGB_ETC1_WEBGL; - - } else { - - return null; - - } - - } - - if ( p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) { - - extension = extensions.get( 'WEBGL_compressed_texture_etc' ); - - if ( extension !== null ) { - - if ( p === RGB_ETC2_Format ) return extension.COMPRESSED_RGB8_ETC2; - if ( p === RGBA_ETC2_EAC_Format ) return extension.COMPRESSED_RGBA8_ETC2_EAC; - - } - - } - - if ( p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format || - p === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format || - p === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format || - p === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format || - p === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format || - p === SRGB8_ALPHA8_ASTC_4x4_Format || p === SRGB8_ALPHA8_ASTC_5x4_Format || p === SRGB8_ALPHA8_ASTC_5x5_Format || - p === SRGB8_ALPHA8_ASTC_6x5_Format || p === SRGB8_ALPHA8_ASTC_6x6_Format || p === SRGB8_ALPHA8_ASTC_8x5_Format || - p === SRGB8_ALPHA8_ASTC_8x6_Format || p === SRGB8_ALPHA8_ASTC_8x8_Format || p === SRGB8_ALPHA8_ASTC_10x5_Format || - p === SRGB8_ALPHA8_ASTC_10x6_Format || p === SRGB8_ALPHA8_ASTC_10x8_Format || p === SRGB8_ALPHA8_ASTC_10x10_Format || - p === SRGB8_ALPHA8_ASTC_12x10_Format || p === SRGB8_ALPHA8_ASTC_12x12_Format ) { - - extension = extensions.get( 'WEBGL_compressed_texture_astc' ); - - if ( extension !== null ) { - - // TODO Complete? - - return p; - - } else { - - return null; - - } - - } - - if ( p === RGBA_BPTC_Format ) { - - extension = extensions.get( 'EXT_texture_compression_bptc' ); - - if ( extension !== null ) { - - // TODO Complete? - - return p; - - } else { - - return null; - - } - - } - - if ( p === UnsignedInt248Type ) { - - if ( isWebGL2 ) return 34042; - - extension = extensions.get( 'WEBGL_depth_texture' ); - - if ( extension !== null ) { - - return extension.UNSIGNED_INT_24_8_WEBGL; - - } else { - - return null; - - } - - } - - } - - return { convert: convert }; - -} - -function ArrayCamera( array = [] ) { - - PerspectiveCamera.call( this ); - - this.cameras = array; - -} - -ArrayCamera.prototype = Object.assign( Object.create( PerspectiveCamera.prototype ), { - - constructor: ArrayCamera, - - isArrayCamera: true - -} ); - -class Group extends Object3D { - - constructor() { - - super(); - - this.type = 'Group'; - - } - -} - -Group.prototype.isGroup = true; - -function WebXRController() { - - this._targetRay = null; - this._grip = null; - this._hand = null; - -} - -Object.assign( WebXRController.prototype, { - - constructor: WebXRController, - - getHandSpace: function () { - - if ( this._hand === null ) { - - this._hand = new Group(); - this._hand.matrixAutoUpdate = false; - this._hand.visible = false; - - this._hand.joints = {}; - this._hand.inputState = { pinching: false }; - - } - - return this._hand; - - }, - - getTargetRaySpace: function () { - - if ( this._targetRay === null ) { - - this._targetRay = new Group(); - this._targetRay.matrixAutoUpdate = false; - this._targetRay.visible = false; - - } - - return this._targetRay; - - }, - - getGripSpace: function () { - - if ( this._grip === null ) { - - this._grip = new Group(); - this._grip.matrixAutoUpdate = false; - this._grip.visible = false; - - } - - return this._grip; - - }, - - dispatchEvent: function ( event ) { - - if ( this._targetRay !== null ) { - - this._targetRay.dispatchEvent( event ); - - } - - if ( this._grip !== null ) { - - this._grip.dispatchEvent( event ); - - } - - if ( this._hand !== null ) { - - this._hand.dispatchEvent( event ); - - } - - return this; - - }, - - disconnect: function ( inputSource ) { - - this.dispatchEvent( { type: 'disconnected', data: inputSource } ); - - if ( this._targetRay !== null ) { - - this._targetRay.visible = false; - - } - - if ( this._grip !== null ) { - - this._grip.visible = false; - - } - - if ( this._hand !== null ) { - - this._hand.visible = false; - - } - - return this; - - }, - - update: function ( inputSource, frame, referenceSpace ) { - - let inputPose = null; - let gripPose = null; - let handPose = null; - - const targetRay = this._targetRay; - const grip = this._grip; - const hand = this._hand; - - if ( inputSource && frame.session.visibilityState !== 'visible-blurred' ) { - - if ( hand && inputSource.hand ) { - - handPose = true; - - for ( const inputjoint of inputSource.hand.values() ) { - - // Update the joints groups with the XRJoint poses - const jointPose = frame.getJointPose( inputjoint, referenceSpace ); - - if ( hand.joints[ inputjoint.jointName ] === undefined ) { - - // The transform of this joint will be updated with the joint pose on each frame - const joint = new Group(); - joint.matrixAutoUpdate = false; - joint.visible = false; - hand.joints[ inputjoint.jointName ] = joint; - // ?? - hand.add( joint ); - - } - - const joint = hand.joints[ inputjoint.jointName ]; - - if ( jointPose !== null ) { - - joint.matrix.fromArray( jointPose.transform.matrix ); - joint.matrix.decompose( joint.position, joint.rotation, joint.scale ); - joint.jointRadius = jointPose.radius; - - } - - joint.visible = jointPose !== null; - - } - - // Custom events - - // Check pinchz - const indexTip = hand.joints[ 'index-finger-tip' ]; - const thumbTip = hand.joints[ 'thumb-tip' ]; - const distance = indexTip.position.distanceTo( thumbTip.position ); - - const distanceToPinch = 0.02; - const threshold = 0.005; - - if ( hand.inputState.pinching && distance > distanceToPinch + threshold ) { - - hand.inputState.pinching = false; - this.dispatchEvent( { - type: 'pinchend', - handedness: inputSource.handedness, - target: this - } ); - - } else if ( ! hand.inputState.pinching && distance <= distanceToPinch - threshold ) { - - hand.inputState.pinching = true; - this.dispatchEvent( { - type: 'pinchstart', - handedness: inputSource.handedness, - target: this - } ); - - } - - } else { - - if ( targetRay !== null ) { - - inputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace ); - - if ( inputPose !== null ) { - - targetRay.matrix.fromArray( inputPose.transform.matrix ); - targetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale ); - - } - - } - - if ( grip !== null && inputSource.gripSpace ) { - - gripPose = frame.getPose( inputSource.gripSpace, referenceSpace ); - - if ( gripPose !== null ) { - - grip.matrix.fromArray( gripPose.transform.matrix ); - grip.matrix.decompose( grip.position, grip.rotation, grip.scale ); - - } - - } - - } - - } - - if ( targetRay !== null ) { - - targetRay.visible = ( inputPose !== null ); - - } - - if ( grip !== null ) { - - grip.visible = ( gripPose !== null ); - - } - - if ( hand !== null ) { - - hand.visible = ( handPose !== null ); - - } - - return this; - - } - -} ); - -function WebXRManager( renderer, gl ) { - - const scope = this; - - let session = null; - - let framebufferScaleFactor = 1.0; - - let referenceSpace = null; - let referenceSpaceType = 'local-floor'; - - let pose = null; - - const controllers = []; - const inputSourcesMap = new Map(); - - // - - const cameraL = new PerspectiveCamera(); - cameraL.layers.enable( 1 ); - cameraL.viewport = new Vector4(); - - const cameraR = new PerspectiveCamera(); - cameraR.layers.enable( 2 ); - cameraR.viewport = new Vector4(); - - const cameras = [ cameraL, cameraR ]; - - const cameraVR = new ArrayCamera(); - cameraVR.layers.enable( 1 ); - cameraVR.layers.enable( 2 ); - - let _currentDepthNear = null; - let _currentDepthFar = null; - - // - - this.enabled = false; - - this.isPresenting = false; - - this.getController = function ( index ) { - - let controller = controllers[ index ]; - - if ( controller === undefined ) { - - controller = new WebXRController(); - controllers[ index ] = controller; - - } - - return controller.getTargetRaySpace(); - - }; - - this.getControllerGrip = function ( index ) { - - let controller = controllers[ index ]; - - if ( controller === undefined ) { - - controller = new WebXRController(); - controllers[ index ] = controller; - - } - - return controller.getGripSpace(); - - }; - - this.getHand = function ( index ) { - - let controller = controllers[ index ]; - - if ( controller === undefined ) { - - controller = new WebXRController(); - controllers[ index ] = controller; - - } - - return controller.getHandSpace(); - - }; - - // - - function onSessionEvent( event ) { - - const controller = inputSourcesMap.get( event.inputSource ); - - if ( controller ) { - - controller.dispatchEvent( { type: event.type, data: event.inputSource } ); - - } - - } - - function onSessionEnd() { - - inputSourcesMap.forEach( function ( controller, inputSource ) { - - controller.disconnect( inputSource ); - - } ); - - inputSourcesMap.clear(); - - _currentDepthNear = null; - _currentDepthFar = null; - - // - - renderer.setFramebuffer( null ); - renderer.setRenderTarget( renderer.getRenderTarget() ); // Hack #15830 - animation.stop(); - - scope.isPresenting = false; - - scope.dispatchEvent( { type: 'sessionend' } ); - - } - - this.setFramebufferScaleFactor = function ( value ) { - - framebufferScaleFactor = value; - - if ( scope.isPresenting === true ) { - - console.warn( 'THREE.WebXRManager: Cannot change framebuffer scale while presenting.' ); - - } - - }; - - this.setReferenceSpaceType = function ( value ) { - - referenceSpaceType = value; - - if ( scope.isPresenting === true ) { - - console.warn( 'THREE.WebXRManager: Cannot change reference space type while presenting.' ); - - } - - }; - - this.getReferenceSpace = function () { - - return referenceSpace; - - }; - - this.getSession = function () { - - return session; - - }; - - this.setSession = async function ( value ) { - - session = value; - - if ( session !== null ) { - - session.addEventListener( 'select', onSessionEvent ); - session.addEventListener( 'selectstart', onSessionEvent ); - session.addEventListener( 'selectend', onSessionEvent ); - session.addEventListener( 'squeeze', onSessionEvent ); - session.addEventListener( 'squeezestart', onSessionEvent ); - session.addEventListener( 'squeezeend', onSessionEvent ); - session.addEventListener( 'end', onSessionEnd ); - session.addEventListener( 'inputsourceschange', onInputSourcesChange ); - - const attributes = gl.getContextAttributes(); - - if ( attributes.xrCompatible !== true ) { - - await gl.makeXRCompatible(); - - } - - const layerInit = { - antialias: attributes.antialias, - alpha: attributes.alpha, - depth: attributes.depth, - stencil: attributes.stencil, - framebufferScaleFactor: framebufferScaleFactor - }; - - // eslint-disable-next-line no-undef - const baseLayer = new XRWebGLLayer( session, gl, layerInit ); - - session.updateRenderState( { baseLayer: baseLayer } ); - - referenceSpace = await session.requestReferenceSpace( referenceSpaceType ); - - animation.setContext( session ); - animation.start(); - - scope.isPresenting = true; - - scope.dispatchEvent( { type: 'sessionstart' } ); - - } - - }; - - function onInputSourcesChange( event ) { - - const inputSources = session.inputSources; - - // Assign inputSources to available controllers - - for ( let i = 0; i < controllers.length; i ++ ) { - - inputSourcesMap.set( inputSources[ i ], controllers[ i ] ); - - } - - // Notify disconnected - - for ( let i = 0; i < event.removed.length; i ++ ) { - - const inputSource = event.removed[ i ]; - const controller = inputSourcesMap.get( inputSource ); - - if ( controller ) { - - controller.dispatchEvent( { type: 'disconnected', data: inputSource } ); - inputSourcesMap.delete( inputSource ); - - } - - } - - // Notify connected - - for ( let i = 0; i < event.added.length; i ++ ) { - - const inputSource = event.added[ i ]; - const controller = inputSourcesMap.get( inputSource ); - - if ( controller ) { - - controller.dispatchEvent( { type: 'connected', data: inputSource } ); - - } - - } - - } - - // - - const cameraLPos = new Vector3(); - const cameraRPos = new Vector3(); - - /** - * Assumes 2 cameras that are parallel and share an X-axis, and that - * the cameras' projection and world matrices have already been set. - * And that near and far planes are identical for both cameras. - * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765 - */ - function setProjectionFromUnion( camera, cameraL, cameraR ) { - - cameraLPos.setFromMatrixPosition( cameraL.matrixWorld ); - cameraRPos.setFromMatrixPosition( cameraR.matrixWorld ); - - const ipd = cameraLPos.distanceTo( cameraRPos ); - - const projL = cameraL.projectionMatrix.elements; - const projR = cameraR.projectionMatrix.elements; - - // VR systems will have identical far and near planes, and - // most likely identical top and bottom frustum extents. - // Use the left camera for these values. - const near = projL[ 14 ] / ( projL[ 10 ] - 1 ); - const far = projL[ 14 ] / ( projL[ 10 ] + 1 ); - const topFov = ( projL[ 9 ] + 1 ) / projL[ 5 ]; - const bottomFov = ( projL[ 9 ] - 1 ) / projL[ 5 ]; - - const leftFov = ( projL[ 8 ] - 1 ) / projL[ 0 ]; - const rightFov = ( projR[ 8 ] + 1 ) / projR[ 0 ]; - const left = near * leftFov; - const right = near * rightFov; - - // Calculate the new camera's position offset from the - // left camera. xOffset should be roughly half `ipd`. - const zOffset = ipd / ( - leftFov + rightFov ); - const xOffset = zOffset * - leftFov; - - // TODO: Better way to apply this offset? - cameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale ); - camera.translateX( xOffset ); - camera.translateZ( zOffset ); - camera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale ); - camera.matrixWorldInverse.copy( camera.matrixWorld ).invert(); - - // Find the union of the frustum values of the cameras and scale - // the values so that the near plane's position does not change in world space, - // although must now be relative to the new union camera. - const near2 = near + zOffset; - const far2 = far + zOffset; - const left2 = left - xOffset; - const right2 = right + ( ipd - xOffset ); - const top2 = topFov * far / far2 * near2; - const bottom2 = bottomFov * far / far2 * near2; - - camera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 ); - - } - - function updateCamera( camera, parent ) { - - if ( parent === null ) { - - camera.matrixWorld.copy( camera.matrix ); - - } else { - - camera.matrixWorld.multiplyMatrices( parent.matrixWorld, camera.matrix ); - - } - - camera.matrixWorldInverse.copy( camera.matrixWorld ).invert(); - - } - - this.getCamera = function ( camera ) { - - cameraVR.near = cameraR.near = cameraL.near = camera.near; - cameraVR.far = cameraR.far = cameraL.far = camera.far; - - if ( _currentDepthNear !== cameraVR.near || _currentDepthFar !== cameraVR.far ) { - - // Note that the new renderState won't apply until the next frame. See #18320 - - session.updateRenderState( { - depthNear: cameraVR.near, - depthFar: cameraVR.far - } ); - - _currentDepthNear = cameraVR.near; - _currentDepthFar = cameraVR.far; - - } - - const parent = camera.parent; - const cameras = cameraVR.cameras; - - updateCamera( cameraVR, parent ); - - for ( let i = 0; i < cameras.length; i ++ ) { - - updateCamera( cameras[ i ], parent ); - - } - - // update camera and its children - - camera.matrixWorld.copy( cameraVR.matrixWorld ); - camera.matrix.copy( cameraVR.matrix ); - camera.matrix.decompose( camera.position, camera.quaternion, camera.scale ); - - const children = camera.children; - - for ( let i = 0, l = children.length; i < l; i ++ ) { - - children[ i ].updateMatrixWorld( true ); - - } - - // update projection matrix for proper view frustum culling - - if ( cameras.length === 2 ) { - - setProjectionFromUnion( cameraVR, cameraL, cameraR ); - - } else { - - // assume single camera setup (AR) - - cameraVR.projectionMatrix.copy( cameraL.projectionMatrix ); - - } - - return cameraVR; - - }; - - // Animation Loop - - let onAnimationFrameCallback = null; - - function onAnimationFrame( time, frame ) { - - pose = frame.getViewerPose( referenceSpace ); - - if ( pose !== null ) { - - const views = pose.views; - const baseLayer = session.renderState.baseLayer; - - renderer.setFramebuffer( baseLayer.framebuffer ); - - let cameraVRNeedsUpdate = false; - - // check if it's necessary to rebuild cameraVR's camera list - - if ( views.length !== cameraVR.cameras.length ) { - - cameraVR.cameras.length = 0; - cameraVRNeedsUpdate = true; - - } - - for ( let i = 0; i < views.length; i ++ ) { - - const view = views[ i ]; - const viewport = baseLayer.getViewport( view ); - - const camera = cameras[ i ]; - camera.matrix.fromArray( view.transform.matrix ); - camera.projectionMatrix.fromArray( view.projectionMatrix ); - camera.viewport.set( viewport.x, viewport.y, viewport.width, viewport.height ); - - if ( i === 0 ) { - - cameraVR.matrix.copy( camera.matrix ); - - } - - if ( cameraVRNeedsUpdate === true ) { - - cameraVR.cameras.push( camera ); - - } - - } - - } - - // - - const inputSources = session.inputSources; - - for ( let i = 0; i < controllers.length; i ++ ) { - - const controller = controllers[ i ]; - const inputSource = inputSources[ i ]; - - controller.update( inputSource, frame, referenceSpace ); - - } - - if ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame ); - - } - - const animation = new WebGLAnimation(); - animation.setAnimationLoop( onAnimationFrame ); - - this.setAnimationLoop = function ( callback ) { - - onAnimationFrameCallback = callback; - - }; - - this.dispose = function () {}; - -} - -Object.assign( WebXRManager.prototype, EventDispatcher.prototype ); - -function WebGLMaterials( properties ) { - - function refreshFogUniforms( uniforms, fog ) { - - uniforms.fogColor.value.copy( fog.color ); - - if ( fog.isFog ) { - - uniforms.fogNear.value = fog.near; - uniforms.fogFar.value = fog.far; - - } else if ( fog.isFogExp2 ) { - - uniforms.fogDensity.value = fog.density; - - } - - } - - function refreshMaterialUniforms( uniforms, material, pixelRatio, height ) { - - if ( material.isMeshBasicMaterial ) { - - refreshUniformsCommon( uniforms, material ); - - } else if ( material.isMeshLambertMaterial ) { - - refreshUniformsCommon( uniforms, material ); - refreshUniformsLambert( uniforms, material ); - - } else if ( material.isMeshToonMaterial ) { - - refreshUniformsCommon( uniforms, material ); - refreshUniformsToon( uniforms, material ); - - } else if ( material.isMeshPhongMaterial ) { - - refreshUniformsCommon( uniforms, material ); - refreshUniformsPhong( uniforms, material ); - - } else if ( material.isMeshStandardMaterial ) { - - refreshUniformsCommon( uniforms, material ); - - if ( material.isMeshPhysicalMaterial ) { - - refreshUniformsPhysical( uniforms, material ); - - } else { - - refreshUniformsStandard( uniforms, material ); - - } - - } else if ( material.isMeshMatcapMaterial ) { - - refreshUniformsCommon( uniforms, material ); - refreshUniformsMatcap( uniforms, material ); - - } else if ( material.isMeshDepthMaterial ) { - - refreshUniformsCommon( uniforms, material ); - refreshUniformsDepth( uniforms, material ); - - } else if ( material.isMeshDistanceMaterial ) { - - refreshUniformsCommon( uniforms, material ); - refreshUniformsDistance( uniforms, material ); - - } else if ( material.isMeshNormalMaterial ) { - - refreshUniformsCommon( uniforms, material ); - refreshUniformsNormal( uniforms, material ); - - } else if ( material.isLineBasicMaterial ) { - - refreshUniformsLine( uniforms, material ); - - if ( material.isLineDashedMaterial ) { - - refreshUniformsDash( uniforms, material ); - - } - - } else if ( material.isPointsMaterial ) { - - refreshUniformsPoints( uniforms, material, pixelRatio, height ); - - } else if ( material.isSpriteMaterial ) { - - refreshUniformsSprites( uniforms, material ); - - } else if ( material.isShadowMaterial ) { - - uniforms.color.value.copy( material.color ); - uniforms.opacity.value = material.opacity; - - } else if ( material.isShaderMaterial ) { - - material.uniformsNeedUpdate = false; // #15581 - - } - - } - - function refreshUniformsCommon( uniforms, material ) { - - uniforms.opacity.value = material.opacity; - - if ( material.color ) { - - uniforms.diffuse.value.copy( material.color ); - - } - - if ( material.emissive ) { - - uniforms.emissive.value.copy( material.emissive ).multiplyScalar( material.emissiveIntensity ); - - } - - if ( material.map ) { - - uniforms.map.value = material.map; - - } - - if ( material.alphaMap ) { - - uniforms.alphaMap.value = material.alphaMap; - - } - - if ( material.specularMap ) { - - uniforms.specularMap.value = material.specularMap; - - } - - const envMap = properties.get( material ).envMap; - - if ( envMap ) { - - uniforms.envMap.value = envMap; - - uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap._needsFlipEnvMap ) ? - 1 : 1; - - uniforms.reflectivity.value = material.reflectivity; - uniforms.refractionRatio.value = material.refractionRatio; - - const maxMipLevel = properties.get( envMap ).__maxMipLevel; - - if ( maxMipLevel !== undefined ) { - - uniforms.maxMipLevel.value = maxMipLevel; - - } - - } - - if ( material.lightMap ) { - - uniforms.lightMap.value = material.lightMap; - uniforms.lightMapIntensity.value = material.lightMapIntensity; - - } - - if ( material.aoMap ) { - - uniforms.aoMap.value = material.aoMap; - uniforms.aoMapIntensity.value = material.aoMapIntensity; - - } - - // uv repeat and offset setting priorities - // 1. color map - // 2. specular map - // 3. displacementMap map - // 4. normal map - // 5. bump map - // 6. roughnessMap map - // 7. metalnessMap map - // 8. alphaMap map - // 9. emissiveMap map - // 10. clearcoat map - // 11. clearcoat normal map - // 12. clearcoat roughnessMap map - - let uvScaleMap; - - if ( material.map ) { - - uvScaleMap = material.map; - - } else if ( material.specularMap ) { - - uvScaleMap = material.specularMap; - - } else if ( material.displacementMap ) { - - uvScaleMap = material.displacementMap; - - } else if ( material.normalMap ) { - - uvScaleMap = material.normalMap; - - } else if ( material.bumpMap ) { - - uvScaleMap = material.bumpMap; - - } else if ( material.roughnessMap ) { - - uvScaleMap = material.roughnessMap; - - } else if ( material.metalnessMap ) { - - uvScaleMap = material.metalnessMap; - - } else if ( material.alphaMap ) { - - uvScaleMap = material.alphaMap; - - } else if ( material.emissiveMap ) { - - uvScaleMap = material.emissiveMap; - - } else if ( material.clearcoatMap ) { - - uvScaleMap = material.clearcoatMap; - - } else if ( material.clearcoatNormalMap ) { - - uvScaleMap = material.clearcoatNormalMap; - - } else if ( material.clearcoatRoughnessMap ) { - - uvScaleMap = material.clearcoatRoughnessMap; - - } - - if ( uvScaleMap !== undefined ) { - - // backwards compatibility - if ( uvScaleMap.isWebGLRenderTarget ) { - - uvScaleMap = uvScaleMap.texture; - - } - - if ( uvScaleMap.matrixAutoUpdate === true ) { - - uvScaleMap.updateMatrix(); - - } - - uniforms.uvTransform.value.copy( uvScaleMap.matrix ); - - } - - // uv repeat and offset setting priorities for uv2 - // 1. ao map - // 2. light map - - let uv2ScaleMap; - - if ( material.aoMap ) { - - uv2ScaleMap = material.aoMap; - - } else if ( material.lightMap ) { - - uv2ScaleMap = material.lightMap; - - } - - if ( uv2ScaleMap !== undefined ) { - - // backwards compatibility - if ( uv2ScaleMap.isWebGLRenderTarget ) { - - uv2ScaleMap = uv2ScaleMap.texture; - - } - - if ( uv2ScaleMap.matrixAutoUpdate === true ) { - - uv2ScaleMap.updateMatrix(); - - } - - uniforms.uv2Transform.value.copy( uv2ScaleMap.matrix ); - - } - - } - - function refreshUniformsLine( uniforms, material ) { - - uniforms.diffuse.value.copy( material.color ); - uniforms.opacity.value = material.opacity; - - } - - function refreshUniformsDash( uniforms, material ) { - - uniforms.dashSize.value = material.dashSize; - uniforms.totalSize.value = material.dashSize + material.gapSize; - uniforms.scale.value = material.scale; - - } - - function refreshUniformsPoints( uniforms, material, pixelRatio, height ) { - - uniforms.diffuse.value.copy( material.color ); - uniforms.opacity.value = material.opacity; - uniforms.size.value = material.size * pixelRatio; - uniforms.scale.value = height * 0.5; - - if ( material.map ) { - - uniforms.map.value = material.map; - - } - - if ( material.alphaMap ) { - - uniforms.alphaMap.value = material.alphaMap; - - } - - // uv repeat and offset setting priorities - // 1. color map - // 2. alpha map - - let uvScaleMap; - - if ( material.map ) { - - uvScaleMap = material.map; - - } else if ( material.alphaMap ) { - - uvScaleMap = material.alphaMap; - - } - - if ( uvScaleMap !== undefined ) { - - if ( uvScaleMap.matrixAutoUpdate === true ) { - - uvScaleMap.updateMatrix(); - - } - - uniforms.uvTransform.value.copy( uvScaleMap.matrix ); - - } - - } - - function refreshUniformsSprites( uniforms, material ) { - - uniforms.diffuse.value.copy( material.color ); - uniforms.opacity.value = material.opacity; - uniforms.rotation.value = material.rotation; - - if ( material.map ) { - - uniforms.map.value = material.map; - - } - - if ( material.alphaMap ) { - - uniforms.alphaMap.value = material.alphaMap; - - } - - // uv repeat and offset setting priorities - // 1. color map - // 2. alpha map - - let uvScaleMap; - - if ( material.map ) { - - uvScaleMap = material.map; - - } else if ( material.alphaMap ) { - - uvScaleMap = material.alphaMap; - - } - - if ( uvScaleMap !== undefined ) { - - if ( uvScaleMap.matrixAutoUpdate === true ) { - - uvScaleMap.updateMatrix(); - - } - - uniforms.uvTransform.value.copy( uvScaleMap.matrix ); - - } - - } - - function refreshUniformsLambert( uniforms, material ) { - - if ( material.emissiveMap ) { - - uniforms.emissiveMap.value = material.emissiveMap; - - } - - } - - function refreshUniformsPhong( uniforms, material ) { - - uniforms.specular.value.copy( material.specular ); - uniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 ) - - if ( material.emissiveMap ) { - - uniforms.emissiveMap.value = material.emissiveMap; - - } - - if ( material.bumpMap ) { - - uniforms.bumpMap.value = material.bumpMap; - uniforms.bumpScale.value = material.bumpScale; - if ( material.side === BackSide ) uniforms.bumpScale.value *= - 1; - - } - - if ( material.normalMap ) { - - uniforms.normalMap.value = material.normalMap; - uniforms.normalScale.value.copy( material.normalScale ); - if ( material.side === BackSide ) uniforms.normalScale.value.negate(); - - } - - if ( material.displacementMap ) { - - uniforms.displacementMap.value = material.displacementMap; - uniforms.displacementScale.value = material.displacementScale; - uniforms.displacementBias.value = material.displacementBias; - - } - - } - - function refreshUniformsToon( uniforms, material ) { - - if ( material.gradientMap ) { - - uniforms.gradientMap.value = material.gradientMap; - - } - - if ( material.emissiveMap ) { - - uniforms.emissiveMap.value = material.emissiveMap; - - } - - if ( material.bumpMap ) { - - uniforms.bumpMap.value = material.bumpMap; - uniforms.bumpScale.value = material.bumpScale; - if ( material.side === BackSide ) uniforms.bumpScale.value *= - 1; - - } - - if ( material.normalMap ) { - - uniforms.normalMap.value = material.normalMap; - uniforms.normalScale.value.copy( material.normalScale ); - if ( material.side === BackSide ) uniforms.normalScale.value.negate(); - - } - - if ( material.displacementMap ) { - - uniforms.displacementMap.value = material.displacementMap; - uniforms.displacementScale.value = material.displacementScale; - uniforms.displacementBias.value = material.displacementBias; - - } - - } - - function refreshUniformsStandard( uniforms, material ) { - - uniforms.roughness.value = material.roughness; - uniforms.metalness.value = material.metalness; - - if ( material.roughnessMap ) { - - uniforms.roughnessMap.value = material.roughnessMap; - - } - - if ( material.metalnessMap ) { - - uniforms.metalnessMap.value = material.metalnessMap; - - } - - if ( material.emissiveMap ) { - - uniforms.emissiveMap.value = material.emissiveMap; - - } - - if ( material.bumpMap ) { - - uniforms.bumpMap.value = material.bumpMap; - uniforms.bumpScale.value = material.bumpScale; - if ( material.side === BackSide ) uniforms.bumpScale.value *= - 1; - - } - - if ( material.normalMap ) { - - uniforms.normalMap.value = material.normalMap; - uniforms.normalScale.value.copy( material.normalScale ); - if ( material.side === BackSide ) uniforms.normalScale.value.negate(); - - } - - if ( material.displacementMap ) { - - uniforms.displacementMap.value = material.displacementMap; - uniforms.displacementScale.value = material.displacementScale; - uniforms.displacementBias.value = material.displacementBias; - - } - - const envMap = properties.get( material ).envMap; - - if ( envMap ) { - - //uniforms.envMap.value = material.envMap; // part of uniforms common - uniforms.envMapIntensity.value = material.envMapIntensity; - - } - - } - - function refreshUniformsPhysical( uniforms, material ) { - - refreshUniformsStandard( uniforms, material ); - - uniforms.reflectivity.value = material.reflectivity; // also part of uniforms common - - uniforms.clearcoat.value = material.clearcoat; - uniforms.clearcoatRoughness.value = material.clearcoatRoughness; - if ( material.sheen ) uniforms.sheen.value.copy( material.sheen ); - - if ( material.clearcoatMap ) { - - uniforms.clearcoatMap.value = material.clearcoatMap; - - } - - if ( material.clearcoatRoughnessMap ) { - - uniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap; - - } - - if ( material.clearcoatNormalMap ) { - - uniforms.clearcoatNormalScale.value.copy( material.clearcoatNormalScale ); - uniforms.clearcoatNormalMap.value = material.clearcoatNormalMap; - - if ( material.side === BackSide ) { - - uniforms.clearcoatNormalScale.value.negate(); - - } - - } - - uniforms.transmission.value = material.transmission; - - if ( material.transmissionMap ) { - - uniforms.transmissionMap.value = material.transmissionMap; - - } - - } - - function refreshUniformsMatcap( uniforms, material ) { - - if ( material.matcap ) { - - uniforms.matcap.value = material.matcap; - - } - - if ( material.bumpMap ) { - - uniforms.bumpMap.value = material.bumpMap; - uniforms.bumpScale.value = material.bumpScale; - if ( material.side === BackSide ) uniforms.bumpScale.value *= - 1; - - } - - if ( material.normalMap ) { - - uniforms.normalMap.value = material.normalMap; - uniforms.normalScale.value.copy( material.normalScale ); - if ( material.side === BackSide ) uniforms.normalScale.value.negate(); - - } - - if ( material.displacementMap ) { - - uniforms.displacementMap.value = material.displacementMap; - uniforms.displacementScale.value = material.displacementScale; - uniforms.displacementBias.value = material.displacementBias; - - } - - } - - function refreshUniformsDepth( uniforms, material ) { - - if ( material.displacementMap ) { - - uniforms.displacementMap.value = material.displacementMap; - uniforms.displacementScale.value = material.displacementScale; - uniforms.displacementBias.value = material.displacementBias; - - } - - } - - function refreshUniformsDistance( uniforms, material ) { - - if ( material.displacementMap ) { - - uniforms.displacementMap.value = material.displacementMap; - uniforms.displacementScale.value = material.displacementScale; - uniforms.displacementBias.value = material.displacementBias; - - } - - uniforms.referencePosition.value.copy( material.referencePosition ); - uniforms.nearDistance.value = material.nearDistance; - uniforms.farDistance.value = material.farDistance; - - } - - function refreshUniformsNormal( uniforms, material ) { - - if ( material.bumpMap ) { - - uniforms.bumpMap.value = material.bumpMap; - uniforms.bumpScale.value = material.bumpScale; - if ( material.side === BackSide ) uniforms.bumpScale.value *= - 1; - - } - - if ( material.normalMap ) { - - uniforms.normalMap.value = material.normalMap; - uniforms.normalScale.value.copy( material.normalScale ); - if ( material.side === BackSide ) uniforms.normalScale.value.negate(); - - } - - if ( material.displacementMap ) { - - uniforms.displacementMap.value = material.displacementMap; - uniforms.displacementScale.value = material.displacementScale; - uniforms.displacementBias.value = material.displacementBias; - - } - - } - - return { - refreshFogUniforms: refreshFogUniforms, - refreshMaterialUniforms: refreshMaterialUniforms - }; - -} - -function createCanvasElement() { - - const canvas = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ); - canvas.style.display = 'block'; - return canvas; - -} - -function WebGLRenderer( parameters ) { - - parameters = parameters || {}; - - const _canvas = parameters.canvas !== undefined ? parameters.canvas : createCanvasElement(), - _context = parameters.context !== undefined ? parameters.context : null, - - _alpha = parameters.alpha !== undefined ? parameters.alpha : false, - _depth = parameters.depth !== undefined ? parameters.depth : true, - _stencil = parameters.stencil !== undefined ? parameters.stencil : true, - _antialias = parameters.antialias !== undefined ? parameters.antialias : false, - _premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true, - _preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false, - _powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default', - _failIfMajorPerformanceCaveat = parameters.failIfMajorPerformanceCaveat !== undefined ? parameters.failIfMajorPerformanceCaveat : false; - - let currentRenderList = null; - let currentRenderState = null; - - // render() can be called from within a callback triggered by another render. - // We track this so that the nested render call gets its list and state isolated from the parent render call. - - const renderListStack = []; - const renderStateStack = []; - - // public properties - - this.domElement = _canvas; - - // Debug configuration container - this.debug = { - - /** - * Enables error checking and reporting when shader programs are being compiled - * @type {boolean} - */ - checkShaderErrors: true - }; - - // clearing - - this.autoClear = true; - this.autoClearColor = true; - this.autoClearDepth = true; - this.autoClearStencil = true; - - // scene graph - - this.sortObjects = true; - - // user-defined clipping - - this.clippingPlanes = []; - this.localClippingEnabled = false; - - // physically based shading - - this.gammaFactor = 2.0; // for backwards compatibility - this.outputEncoding = LinearEncoding; - - // physical lights - - this.physicallyCorrectLights = false; - - // tone mapping - - this.toneMapping = NoToneMapping; - this.toneMappingExposure = 1.0; - - // morphs - - this.maxMorphTargets = 8; - this.maxMorphNormals = 4; - - // internal properties - - const _this = this; - - let _isContextLost = false; - - // internal state cache - - let _framebuffer = null; - - let _currentActiveCubeFace = 0; - let _currentActiveMipmapLevel = 0; - let _currentRenderTarget = null; - let _currentFramebuffer = null; - let _currentMaterialId = - 1; - - let _currentCamera = null; - - const _currentViewport = new Vector4(); - const _currentScissor = new Vector4(); - let _currentScissorTest = null; - - // - - let _width = _canvas.width; - let _height = _canvas.height; - - let _pixelRatio = 1; - let _opaqueSort = null; - let _transparentSort = null; - - const _viewport = new Vector4( 0, 0, _width, _height ); - const _scissor = new Vector4( 0, 0, _width, _height ); - let _scissorTest = false; - - // frustum - - const _frustum = new Frustum(); - - // clipping - - let _clippingEnabled = false; - let _localClippingEnabled = false; - - // camera matrices cache - - const _projScreenMatrix = new Matrix4(); - - const _vector3 = new Vector3(); - - const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true }; - - function getTargetPixelRatio() { - - return _currentRenderTarget === null ? _pixelRatio : 1; - - } - - // initialize - - let _gl = _context; - - function getContext( contextNames, contextAttributes ) { - - for ( let i = 0; i < contextNames.length; i ++ ) { - - const contextName = contextNames[ i ]; - const context = _canvas.getContext( contextName, contextAttributes ); - if ( context !== null ) return context; - - } - - return null; - - } - - try { - - const contextAttributes = { - alpha: _alpha, - depth: _depth, - stencil: _stencil, - antialias: _antialias, - premultipliedAlpha: _premultipliedAlpha, - preserveDrawingBuffer: _preserveDrawingBuffer, - powerPreference: _powerPreference, - failIfMajorPerformanceCaveat: _failIfMajorPerformanceCaveat - }; - - // event listeners must be registered before WebGL context is created, see #12753 - - _canvas.addEventListener( 'webglcontextlost', onContextLost, false ); - _canvas.addEventListener( 'webglcontextrestored', onContextRestore, false ); - - if ( _gl === null ) { - - const contextNames = [ 'webgl2', 'webgl', 'experimental-webgl' ]; - - if ( _this.isWebGL1Renderer === true ) { - - contextNames.shift(); - - } - - _gl = getContext( contextNames, contextAttributes ); - - if ( _gl === null ) { - - if ( getContext( contextNames ) ) { - - throw new Error( 'Error creating WebGL context with your selected attributes.' ); - - } else { - - throw new Error( 'Error creating WebGL context.' ); - - } - - } - - } - - // Some experimental-webgl implementations do not have getShaderPrecisionFormat - - if ( _gl.getShaderPrecisionFormat === undefined ) { - - _gl.getShaderPrecisionFormat = function () { - - return { 'rangeMin': 1, 'rangeMax': 1, 'precision': 1 }; - - }; - - } - - } catch ( error ) { - - console.error( 'THREE.WebGLRenderer: ' + error.message ); - throw error; - - } - - let extensions, capabilities, state, info; - let properties, textures, cubemaps, attributes, geometries, objects; - let programCache, materials, renderLists, renderStates, clipping; - - let background, morphtargets, bufferRenderer, indexedBufferRenderer; - - let utils, bindingStates; - - function initGLContext() { - - extensions = new WebGLExtensions( _gl ); - - capabilities = new WebGLCapabilities( _gl, extensions, parameters ); - - extensions.init( capabilities ); - - utils = new WebGLUtils( _gl, extensions, capabilities ); - - state = new WebGLState( _gl, extensions, capabilities ); - state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() ); - state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() ); - - info = new WebGLInfo( _gl ); - properties = new WebGLProperties(); - textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ); - cubemaps = new WebGLCubeMaps( _this ); - attributes = new WebGLAttributes( _gl, capabilities ); - bindingStates = new WebGLBindingStates( _gl, extensions, attributes, capabilities ); - geometries = new WebGLGeometries( _gl, attributes, info, bindingStates ); - objects = new WebGLObjects( _gl, geometries, attributes, info ); - morphtargets = new WebGLMorphtargets( _gl ); - clipping = new WebGLClipping( properties ); - programCache = new WebGLPrograms( _this, cubemaps, extensions, capabilities, bindingStates, clipping ); - materials = new WebGLMaterials( properties ); - renderLists = new WebGLRenderLists( properties ); - renderStates = new WebGLRenderStates( extensions, capabilities ); - background = new WebGLBackground( _this, cubemaps, state, objects, _premultipliedAlpha ); - - bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities ); - indexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info, capabilities ); - - info.programs = programCache.programs; - - _this.capabilities = capabilities; - _this.extensions = extensions; - _this.properties = properties; - _this.renderLists = renderLists; - _this.state = state; - _this.info = info; - - } - - initGLContext(); - - // xr - - const xr = new WebXRManager( _this, _gl ); - - this.xr = xr; - - // shadow map - - const shadowMap = new WebGLShadowMap( _this, objects, capabilities.maxTextureSize ); - - this.shadowMap = shadowMap; - - // API - - this.getContext = function () { - - return _gl; - - }; - - this.getContextAttributes = function () { - - return _gl.getContextAttributes(); - - }; - - this.forceContextLoss = function () { - - const extension = extensions.get( 'WEBGL_lose_context' ); - if ( extension ) extension.loseContext(); - - }; - - this.forceContextRestore = function () { - - const extension = extensions.get( 'WEBGL_lose_context' ); - if ( extension ) extension.restoreContext(); - - }; - - this.getPixelRatio = function () { - - return _pixelRatio; - - }; - - this.setPixelRatio = function ( value ) { - - if ( value === undefined ) return; - - _pixelRatio = value; - - this.setSize( _width, _height, false ); - - }; - - this.getSize = function ( target ) { - - if ( target === undefined ) { - - console.warn( 'WebGLRenderer: .getsize() now requires a Vector2 as an argument' ); - - target = new Vector2(); - - } - - return target.set( _width, _height ); - - }; - - this.setSize = function ( width, height, updateStyle ) { - - if ( xr.isPresenting ) { - - console.warn( 'THREE.WebGLRenderer: Can\'t change size while VR device is presenting.' ); - return; - - } - - _width = width; - _height = height; - - _canvas.width = Math.floor( width * _pixelRatio ); - _canvas.height = Math.floor( height * _pixelRatio ); - - if ( updateStyle !== false ) { - - _canvas.style.width = width + 'px'; - _canvas.style.height = height + 'px'; - - } - - this.setViewport( 0, 0, width, height ); - - }; - - this.getDrawingBufferSize = function ( target ) { - - if ( target === undefined ) { - - console.warn( 'WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument' ); - - target = new Vector2(); - - } - - return target.set( _width * _pixelRatio, _height * _pixelRatio ).floor(); - - }; - - this.setDrawingBufferSize = function ( width, height, pixelRatio ) { - - _width = width; - _height = height; - - _pixelRatio = pixelRatio; - - _canvas.width = Math.floor( width * pixelRatio ); - _canvas.height = Math.floor( height * pixelRatio ); - - this.setViewport( 0, 0, width, height ); - - }; - - this.getCurrentViewport = function ( target ) { - - if ( target === undefined ) { - - console.warn( 'WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument' ); - - target = new Vector4(); - - } - - return target.copy( _currentViewport ); - - }; - - this.getViewport = function ( target ) { - - return target.copy( _viewport ); - - }; - - this.setViewport = function ( x, y, width, height ) { - - if ( x.isVector4 ) { - - _viewport.set( x.x, x.y, x.z, x.w ); - - } else { - - _viewport.set( x, y, width, height ); - - } - - state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() ); - - }; - - this.getScissor = function ( target ) { - - return target.copy( _scissor ); - - }; - - this.setScissor = function ( x, y, width, height ) { - - if ( x.isVector4 ) { - - _scissor.set( x.x, x.y, x.z, x.w ); - - } else { - - _scissor.set( x, y, width, height ); - - } - - state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() ); - - }; - - this.getScissorTest = function () { - - return _scissorTest; - - }; - - this.setScissorTest = function ( boolean ) { - - state.setScissorTest( _scissorTest = boolean ); - - }; - - this.setOpaqueSort = function ( method ) { - - _opaqueSort = method; - - }; - - this.setTransparentSort = function ( method ) { - - _transparentSort = method; - - }; - - // Clearing - - this.getClearColor = function ( target ) { - - if ( target === undefined ) { - - console.warn( 'WebGLRenderer: .getClearColor() now requires a Color as an argument' ); - - target = new Color(); - - } - - return target.copy( background.getClearColor() ); - - }; - - this.setClearColor = function () { - - background.setClearColor.apply( background, arguments ); - - }; - - this.getClearAlpha = function () { - - return background.getClearAlpha(); - - }; - - this.setClearAlpha = function () { - - background.setClearAlpha.apply( background, arguments ); - - }; - - this.clear = function ( color, depth, stencil ) { - - let bits = 0; - - if ( color === undefined || color ) bits |= 16384; - if ( depth === undefined || depth ) bits |= 256; - if ( stencil === undefined || stencil ) bits |= 1024; - - _gl.clear( bits ); - - }; - - this.clearColor = function () { - - this.clear( true, false, false ); - - }; - - this.clearDepth = function () { - - this.clear( false, true, false ); - - }; - - this.clearStencil = function () { - - this.clear( false, false, true ); - - }; - - // - - this.dispose = function () { - - _canvas.removeEventListener( 'webglcontextlost', onContextLost, false ); - _canvas.removeEventListener( 'webglcontextrestored', onContextRestore, false ); - - renderLists.dispose(); - renderStates.dispose(); - properties.dispose(); - cubemaps.dispose(); - objects.dispose(); - bindingStates.dispose(); - - xr.dispose(); - - animation.stop(); - - }; - - // Events - - function onContextLost( event ) { - - event.preventDefault(); - - console.log( 'THREE.WebGLRenderer: Context Lost.' ); - - _isContextLost = true; - - } - - function onContextRestore( /* event */ ) { - - console.log( 'THREE.WebGLRenderer: Context Restored.' ); - - _isContextLost = false; - - initGLContext(); - - } - - function onMaterialDispose( event ) { - - const material = event.target; - - material.removeEventListener( 'dispose', onMaterialDispose ); - - deallocateMaterial( material ); - - } - - // Buffer deallocation - - function deallocateMaterial( material ) { - - releaseMaterialProgramReference( material ); - - properties.remove( material ); - - } - - - function releaseMaterialProgramReference( material ) { - - const programInfo = properties.get( material ).program; - - if ( programInfo !== undefined ) { - - programCache.releaseProgram( programInfo ); - - } - - } - - // Buffer rendering - - function renderObjectImmediate( object, program ) { - - object.render( function ( object ) { - - _this.renderBufferImmediate( object, program ); - - } ); - - } - - this.renderBufferImmediate = function ( object, program ) { - - bindingStates.initAttributes(); - - const buffers = properties.get( object ); - - if ( object.hasPositions && ! buffers.position ) buffers.position = _gl.createBuffer(); - if ( object.hasNormals && ! buffers.normal ) buffers.normal = _gl.createBuffer(); - if ( object.hasUvs && ! buffers.uv ) buffers.uv = _gl.createBuffer(); - if ( object.hasColors && ! buffers.color ) buffers.color = _gl.createBuffer(); - - const programAttributes = program.getAttributes(); - - if ( object.hasPositions ) { - - _gl.bindBuffer( 34962, buffers.position ); - _gl.bufferData( 34962, object.positionArray, 35048 ); - - bindingStates.enableAttribute( programAttributes.position ); - _gl.vertexAttribPointer( programAttributes.position, 3, 5126, false, 0, 0 ); - - } - - if ( object.hasNormals ) { - - _gl.bindBuffer( 34962, buffers.normal ); - _gl.bufferData( 34962, object.normalArray, 35048 ); - - bindingStates.enableAttribute( programAttributes.normal ); - _gl.vertexAttribPointer( programAttributes.normal, 3, 5126, false, 0, 0 ); - - } - - if ( object.hasUvs ) { - - _gl.bindBuffer( 34962, buffers.uv ); - _gl.bufferData( 34962, object.uvArray, 35048 ); - - bindingStates.enableAttribute( programAttributes.uv ); - _gl.vertexAttribPointer( programAttributes.uv, 2, 5126, false, 0, 0 ); - - } - - if ( object.hasColors ) { - - _gl.bindBuffer( 34962, buffers.color ); - _gl.bufferData( 34962, object.colorArray, 35048 ); - - bindingStates.enableAttribute( programAttributes.color ); - _gl.vertexAttribPointer( programAttributes.color, 3, 5126, false, 0, 0 ); - - } - - bindingStates.disableUnusedAttributes(); - - _gl.drawArrays( 4, 0, object.count ); - - object.count = 0; - - }; - - this.renderBufferDirect = function ( camera, scene, geometry, material, object, group ) { - - if ( scene === null ) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null) - - const frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 ); - - const program = setProgram( camera, scene, material, object ); - - state.setMaterial( material, frontFaceCW ); - - // - - let index = geometry.index; - const position = geometry.attributes.position; - - // - - if ( index === null ) { - - if ( position === undefined || position.count === 0 ) return; - - } else if ( index.count === 0 ) { - - return; - - } - - // - - let rangeFactor = 1; - - if ( material.wireframe === true ) { - - index = geometries.getWireframeAttribute( geometry ); - rangeFactor = 2; - - } - - if ( material.morphTargets || material.morphNormals ) { - - morphtargets.update( object, geometry, material, program ); - - } - - bindingStates.setup( object, material, program, geometry, index ); - - let attribute; - let renderer = bufferRenderer; - - if ( index !== null ) { - - attribute = attributes.get( index ); - - renderer = indexedBufferRenderer; - renderer.setIndex( attribute ); - - } - - // - - const dataCount = ( index !== null ) ? index.count : position.count; - - const rangeStart = geometry.drawRange.start * rangeFactor; - const rangeCount = geometry.drawRange.count * rangeFactor; - - const groupStart = group !== null ? group.start * rangeFactor : 0; - const groupCount = group !== null ? group.count * rangeFactor : Infinity; - - const drawStart = Math.max( rangeStart, groupStart ); - const drawEnd = Math.min( dataCount, rangeStart + rangeCount, groupStart + groupCount ) - 1; - - const drawCount = Math.max( 0, drawEnd - drawStart + 1 ); - - if ( drawCount === 0 ) return; - - // - - if ( object.isMesh ) { - - if ( material.wireframe === true ) { - - state.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() ); - renderer.setMode( 1 ); - - } else { - - renderer.setMode( 4 ); - - } - - } else if ( object.isLine ) { - - let lineWidth = material.linewidth; - - if ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material - - state.setLineWidth( lineWidth * getTargetPixelRatio() ); - - if ( object.isLineSegments ) { - - renderer.setMode( 1 ); - - } else if ( object.isLineLoop ) { - - renderer.setMode( 2 ); - - } else { - - renderer.setMode( 3 ); - - } - - } else if ( object.isPoints ) { - - renderer.setMode( 0 ); - - } else if ( object.isSprite ) { - - renderer.setMode( 4 ); - - } - - if ( object.isInstancedMesh ) { - - renderer.renderInstances( drawStart, drawCount, object.count ); - - } else if ( geometry.isInstancedBufferGeometry ) { - - const instanceCount = Math.min( geometry.instanceCount, geometry._maxInstanceCount ); - - renderer.renderInstances( drawStart, drawCount, instanceCount ); - - } else { - - renderer.render( drawStart, drawCount ); - - } - - }; - - // Compile - - this.compile = function ( scene, camera ) { - - currentRenderState = renderStates.get( scene ); - currentRenderState.init(); - - scene.traverseVisible( function ( object ) { - - if ( object.isLight && object.layers.test( camera.layers ) ) { - - currentRenderState.pushLight( object ); - - if ( object.castShadow ) { - - currentRenderState.pushShadow( object ); - - } - - } - - } ); - - currentRenderState.setupLights(); - - const compiled = new WeakMap(); - - scene.traverse( function ( object ) { - - const material = object.material; - - if ( material ) { - - if ( Array.isArray( material ) ) { - - for ( let i = 0; i < material.length; i ++ ) { - - const material2 = material[ i ]; - - if ( compiled.has( material2 ) === false ) { - - initMaterial( material2, scene, object ); - compiled.set( material2 ); - - } - - } - - } else if ( compiled.has( material ) === false ) { - - initMaterial( material, scene, object ); - compiled.set( material ); - - } - - } - - } ); - - }; - - // Animation Loop - - let onAnimationFrameCallback = null; - - function onAnimationFrame( time ) { - - if ( xr.isPresenting ) return; - if ( onAnimationFrameCallback ) onAnimationFrameCallback( time ); - - } - - const animation = new WebGLAnimation(); - animation.setAnimationLoop( onAnimationFrame ); - - if ( typeof window !== 'undefined' ) animation.setContext( window ); - - this.setAnimationLoop = function ( callback ) { - - onAnimationFrameCallback = callback; - xr.setAnimationLoop( callback ); - - ( callback === null ) ? animation.stop() : animation.start(); - - }; - - // Rendering - - this.render = function ( scene, camera ) { - - let renderTarget, forceClear; - - if ( arguments[ 2 ] !== undefined ) { - - console.warn( 'THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.' ); - renderTarget = arguments[ 2 ]; - - } - - if ( arguments[ 3 ] !== undefined ) { - - console.warn( 'THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead.' ); - forceClear = arguments[ 3 ]; - - } - - if ( camera !== undefined && camera.isCamera !== true ) { - - console.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' ); - return; - - } - - if ( _isContextLost === true ) return; - - // reset caching for this frame - - bindingStates.resetDefaultState(); - _currentMaterialId = - 1; - _currentCamera = null; - - // update scene graph - - if ( scene.autoUpdate === true ) scene.updateMatrixWorld(); - - // update camera matrices and frustum - - if ( camera.parent === null ) camera.updateMatrixWorld(); - - if ( xr.enabled === true && xr.isPresenting === true ) { - - camera = xr.getCamera( camera ); - - } - - // - if ( scene.isScene === true ) scene.onBeforeRender( _this, scene, camera, renderTarget || _currentRenderTarget ); - - currentRenderState = renderStates.get( scene, renderStateStack.length ); - currentRenderState.init(); - - renderStateStack.push( currentRenderState ); - - _projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse ); - _frustum.setFromProjectionMatrix( _projScreenMatrix ); - - _localClippingEnabled = this.localClippingEnabled; - _clippingEnabled = clipping.init( this.clippingPlanes, _localClippingEnabled, camera ); - - currentRenderList = renderLists.get( scene, renderListStack.length ); - currentRenderList.init(); - - renderListStack.push( currentRenderList ); - - projectObject( scene, camera, 0, _this.sortObjects ); - - currentRenderList.finish(); - - if ( _this.sortObjects === true ) { - - currentRenderList.sort( _opaqueSort, _transparentSort ); - - } - - // - - if ( _clippingEnabled === true ) clipping.beginShadows(); - - const shadowsArray = currentRenderState.state.shadowsArray; - - shadowMap.render( shadowsArray, scene, camera ); - - currentRenderState.setupLights(); - currentRenderState.setupLightsView( camera ); - - if ( _clippingEnabled === true ) clipping.endShadows(); - - // - - if ( this.info.autoReset === true ) this.info.reset(); - - if ( renderTarget !== undefined ) { - - this.setRenderTarget( renderTarget ); - - } - - // - - background.render( currentRenderList, scene, camera, forceClear ); - - // render scene - - const opaqueObjects = currentRenderList.opaque; - const transparentObjects = currentRenderList.transparent; - - if ( opaqueObjects.length > 0 ) renderObjects( opaqueObjects, scene, camera ); - if ( transparentObjects.length > 0 ) renderObjects( transparentObjects, scene, camera ); - - // - - if ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera ); - - // - - if ( _currentRenderTarget !== null ) { - - // Generate mipmap if we're using any kind of mipmap filtering - - textures.updateRenderTargetMipmap( _currentRenderTarget ); - - // resolve multisample renderbuffers to a single-sample texture if necessary - - textures.updateMultisampleRenderTarget( _currentRenderTarget ); - - } - - // Ensure depth buffer writing is enabled so it can be cleared on next render - - state.buffers.depth.setTest( true ); - state.buffers.depth.setMask( true ); - state.buffers.color.setMask( true ); - - state.setPolygonOffset( false ); - - // _gl.finish(); - - renderStateStack.pop(); - - if ( renderStateStack.length > 0 ) { - - currentRenderState = renderStateStack[ renderStateStack.length - 1 ]; - - } else { - - currentRenderState = null; - - } - - renderListStack.pop(); - - if ( renderListStack.length > 0 ) { - - currentRenderList = renderListStack[ renderListStack.length - 1 ]; - - } else { - - currentRenderList = null; - - } - - }; - - function projectObject( object, camera, groupOrder, sortObjects ) { - - if ( object.visible === false ) return; - - const visible = object.layers.test( camera.layers ); - - if ( visible ) { - - if ( object.isGroup ) { - - groupOrder = object.renderOrder; - - } else if ( object.isLOD ) { - - if ( object.autoUpdate === true ) object.update( camera ); - - } else if ( object.isLight ) { - - currentRenderState.pushLight( object ); - - if ( object.castShadow ) { - - currentRenderState.pushShadow( object ); - - } - - } else if ( object.isSprite ) { - - if ( ! object.frustumCulled || _frustum.intersectsSprite( object ) ) { - - if ( sortObjects ) { - - _vector3.setFromMatrixPosition( object.matrixWorld ) - .applyMatrix4( _projScreenMatrix ); - - } - - const geometry = objects.update( object ); - const material = object.material; - - if ( material.visible ) { - - currentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null ); - - } - - } - - } else if ( object.isImmediateRenderObject ) { - - if ( sortObjects ) { - - _vector3.setFromMatrixPosition( object.matrixWorld ) - .applyMatrix4( _projScreenMatrix ); - - } - - currentRenderList.push( object, null, object.material, groupOrder, _vector3.z, null ); - - } else if ( object.isMesh || object.isLine || object.isPoints ) { - - if ( object.isSkinnedMesh ) { - - // update skeleton only once in a frame - - if ( object.skeleton.frame !== info.render.frame ) { - - object.skeleton.update(); - object.skeleton.frame = info.render.frame; - - } - - } - - if ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) { - - if ( sortObjects ) { - - _vector3.setFromMatrixPosition( object.matrixWorld ) - .applyMatrix4( _projScreenMatrix ); - - } - - const geometry = objects.update( object ); - const material = object.material; - - if ( Array.isArray( material ) ) { - - const groups = geometry.groups; - - for ( let i = 0, l = groups.length; i < l; i ++ ) { - - const group = groups[ i ]; - const groupMaterial = material[ group.materialIndex ]; - - if ( groupMaterial && groupMaterial.visible ) { - - currentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector3.z, group ); - - } - - } - - } else if ( material.visible ) { - - currentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null ); - - } - - } - - } - - } - - const children = object.children; - - for ( let i = 0, l = children.length; i < l; i ++ ) { - - projectObject( children[ i ], camera, groupOrder, sortObjects ); - - } - - } - - function renderObjects( renderList, scene, camera ) { - - const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null; - - for ( let i = 0, l = renderList.length; i < l; i ++ ) { - - const renderItem = renderList[ i ]; - - const object = renderItem.object; - const geometry = renderItem.geometry; - const material = overrideMaterial === null ? renderItem.material : overrideMaterial; - const group = renderItem.group; - - if ( camera.isArrayCamera ) { - - const cameras = camera.cameras; - - for ( let j = 0, jl = cameras.length; j < jl; j ++ ) { - - const camera2 = cameras[ j ]; - - if ( object.layers.test( camera2.layers ) ) { - - state.viewport( _currentViewport.copy( camera2.viewport ) ); - - currentRenderState.setupLightsView( camera2 ); - - renderObject( object, scene, camera2, geometry, material, group ); - - } - - } - - } else { - - renderObject( object, scene, camera, geometry, material, group ); - - } - - } - - } - - function renderObject( object, scene, camera, geometry, material, group ) { - - object.onBeforeRender( _this, scene, camera, geometry, material, group ); - - object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld ); - object.normalMatrix.getNormalMatrix( object.modelViewMatrix ); - - if ( object.isImmediateRenderObject ) { - - const program = setProgram( camera, scene, material, object ); - - state.setMaterial( material ); - - bindingStates.reset(); - - renderObjectImmediate( object, program ); - - } else { - - _this.renderBufferDirect( camera, scene, geometry, material, object, group ); - - } - - object.onAfterRender( _this, scene, camera, geometry, material, group ); - - } - - function initMaterial( material, scene, object ) { - - if ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ... - - const materialProperties = properties.get( material ); - - const lights = currentRenderState.state.lights; - const shadowsArray = currentRenderState.state.shadowsArray; - - const lightsStateVersion = lights.state.version; - - const parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, object ); - const programCacheKey = programCache.getProgramCacheKey( parameters ); - - let program = materialProperties.program; - let programChange = true; - - // always update environment and fog - changing these trigger an initMaterial call, but it's possible that the program doesn't change - - materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null; - materialProperties.fog = scene.fog; - materialProperties.envMap = cubemaps.get( material.envMap || materialProperties.environment ); - - if ( program === undefined ) { - - // new material - material.addEventListener( 'dispose', onMaterialDispose ); - - } else if ( program.cacheKey !== programCacheKey ) { - - // changed glsl or parameters - releaseMaterialProgramReference( material ); - - } else if ( materialProperties.lightsStateVersion !== lightsStateVersion ) { - - programChange = false; - - } else if ( parameters.shaderID !== undefined ) { - - // same glsl and uniform list - return; - - } else { - - // only rebuild uniform list - programChange = false; - - } - - if ( programChange ) { - - parameters.uniforms = programCache.getUniforms( material ); - - material.onBeforeCompile( parameters, _this ); - - program = programCache.acquireProgram( parameters, programCacheKey ); - - materialProperties.program = program; - materialProperties.uniforms = parameters.uniforms; - materialProperties.outputEncoding = parameters.outputEncoding; - - } - - const uniforms = materialProperties.uniforms; - - if ( ! material.isShaderMaterial && - ! material.isRawShaderMaterial || - material.clipping === true ) { - - materialProperties.numClippingPlanes = clipping.numPlanes; - materialProperties.numIntersection = clipping.numIntersection; - uniforms.clippingPlanes = clipping.uniform; - - } - - // store the light setup it was created for - - materialProperties.needsLights = materialNeedsLights( material ); - materialProperties.lightsStateVersion = lightsStateVersion; - - if ( materialProperties.needsLights ) { - - // wire up the material to this renderer's lighting state - - uniforms.ambientLightColor.value = lights.state.ambient; - uniforms.lightProbe.value = lights.state.probe; - uniforms.directionalLights.value = lights.state.directional; - uniforms.directionalLightShadows.value = lights.state.directionalShadow; - uniforms.spotLights.value = lights.state.spot; - uniforms.spotLightShadows.value = lights.state.spotShadow; - uniforms.rectAreaLights.value = lights.state.rectArea; - uniforms.ltc_1.value = lights.state.rectAreaLTC1; - uniforms.ltc_2.value = lights.state.rectAreaLTC2; - uniforms.pointLights.value = lights.state.point; - uniforms.pointLightShadows.value = lights.state.pointShadow; - uniforms.hemisphereLights.value = lights.state.hemi; - - uniforms.directionalShadowMap.value = lights.state.directionalShadowMap; - uniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix; - uniforms.spotShadowMap.value = lights.state.spotShadowMap; - uniforms.spotShadowMatrix.value = lights.state.spotShadowMatrix; - uniforms.pointShadowMap.value = lights.state.pointShadowMap; - uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix; - // TODO (abelnation): add area lights shadow info to uniforms - - } - - const progUniforms = materialProperties.program.getUniforms(); - const uniformsList = WebGLUniforms.seqWithValue( progUniforms.seq, uniforms ); - - materialProperties.uniformsList = uniformsList; - - } - - function setProgram( camera, scene, material, object ) { - - if ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ... - - textures.resetTextureUnits(); - - const fog = scene.fog; - const environment = material.isMeshStandardMaterial ? scene.environment : null; - const encoding = ( _currentRenderTarget === null ) ? _this.outputEncoding : _currentRenderTarget.texture.encoding; - const envMap = cubemaps.get( material.envMap || environment ); - - const materialProperties = properties.get( material ); - const lights = currentRenderState.state.lights; - - if ( _clippingEnabled === true ) { - - if ( _localClippingEnabled === true || camera !== _currentCamera ) { - - const useCache = - camera === _currentCamera && - material.id === _currentMaterialId; - - // we might want to call this function with some ClippingGroup - // object instead of the material, once it becomes feasible - // (#8465, #8379) - clipping.setState( material, camera, useCache ); - - } - - } - - if ( material.version === materialProperties.__version ) { - - if ( material.fog && materialProperties.fog !== fog ) { - - initMaterial( material, scene, object ); - - } else if ( materialProperties.environment !== environment ) { - - initMaterial( material, scene, object ); - - } else if ( materialProperties.needsLights && ( materialProperties.lightsStateVersion !== lights.state.version ) ) { - - initMaterial( material, scene, object ); - - } else if ( materialProperties.numClippingPlanes !== undefined && - ( materialProperties.numClippingPlanes !== clipping.numPlanes || - materialProperties.numIntersection !== clipping.numIntersection ) ) { - - initMaterial( material, scene, object ); - - } else if ( materialProperties.outputEncoding !== encoding ) { - - initMaterial( material, scene, object ); - - } else if ( materialProperties.envMap !== envMap ) { - - initMaterial( material, scene, object ); - - } - - } else { - - initMaterial( material, scene, object ); - materialProperties.__version = material.version; - - } - - let refreshProgram = false; - let refreshMaterial = false; - let refreshLights = false; - - const program = materialProperties.program, - p_uniforms = program.getUniforms(), - m_uniforms = materialProperties.uniforms; - - if ( state.useProgram( program.program ) ) { - - refreshProgram = true; - refreshMaterial = true; - refreshLights = true; - - } - - if ( material.id !== _currentMaterialId ) { - - _currentMaterialId = material.id; - - refreshMaterial = true; - - } - - if ( refreshProgram || _currentCamera !== camera ) { - - p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix ); - - if ( capabilities.logarithmicDepthBuffer ) { - - p_uniforms.setValue( _gl, 'logDepthBufFC', - 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) ); - - } - - if ( _currentCamera !== camera ) { - - _currentCamera = camera; - - // lighting uniforms depend on the camera so enforce an update - // now, in case this material supports lights - or later, when - // the next material that does gets activated: - - refreshMaterial = true; // set to true on material change - refreshLights = true; // remains set until update done - - } - - // load material specific uniforms - // (shader material also gets them for the sake of genericity) - - if ( material.isShaderMaterial || - material.isMeshPhongMaterial || - material.isMeshToonMaterial || - material.isMeshStandardMaterial || - material.envMap ) { - - const uCamPos = p_uniforms.map.cameraPosition; - - if ( uCamPos !== undefined ) { - - uCamPos.setValue( _gl, - _vector3.setFromMatrixPosition( camera.matrixWorld ) ); - - } - - } - - if ( material.isMeshPhongMaterial || - material.isMeshToonMaterial || - material.isMeshLambertMaterial || - material.isMeshBasicMaterial || - material.isMeshStandardMaterial || - material.isShaderMaterial ) { - - p_uniforms.setValue( _gl, 'isOrthographic', camera.isOrthographicCamera === true ); - - } - - if ( material.isMeshPhongMaterial || - material.isMeshToonMaterial || - material.isMeshLambertMaterial || - material.isMeshBasicMaterial || - material.isMeshStandardMaterial || - material.isShaderMaterial || - material.isShadowMaterial || - material.skinning ) { - - p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse ); - - } - - } - - // skinning uniforms must be set even if material didn't change - // auto-setting of texture unit for bone texture must go before other textures - // otherwise textures used for skinning can take over texture units reserved for other material textures - - if ( material.skinning ) { - - p_uniforms.setOptional( _gl, object, 'bindMatrix' ); - p_uniforms.setOptional( _gl, object, 'bindMatrixInverse' ); - - const skeleton = object.skeleton; - - if ( skeleton ) { - - const bones = skeleton.bones; - - if ( capabilities.floatVertexTextures ) { - - if ( skeleton.boneTexture === null ) { - - // layout (1 matrix = 4 pixels) - // RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4) - // with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8) - // 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16) - // 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32) - // 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64) - - - let size = Math.sqrt( bones.length * 4 ); // 4 pixels needed for 1 matrix - size = MathUtils.ceilPowerOfTwo( size ); - size = Math.max( size, 4 ); - - const boneMatrices = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel - boneMatrices.set( skeleton.boneMatrices ); // copy current values - - const boneTexture = new DataTexture( boneMatrices, size, size, RGBAFormat, FloatType ); - - skeleton.boneMatrices = boneMatrices; - skeleton.boneTexture = boneTexture; - skeleton.boneTextureSize = size; - - } - - p_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures ); - p_uniforms.setValue( _gl, 'boneTextureSize', skeleton.boneTextureSize ); - - } else { - - p_uniforms.setOptional( _gl, skeleton, 'boneMatrices' ); - - } - - } - - } - - if ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) { - - materialProperties.receiveShadow = object.receiveShadow; - p_uniforms.setValue( _gl, 'receiveShadow', object.receiveShadow ); - - } - - if ( refreshMaterial ) { - - p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure ); - - if ( materialProperties.needsLights ) { - - // the current material requires lighting info - - // note: all lighting uniforms are always set correctly - // they simply reference the renderer's state for their - // values - // - // use the current material's .needsUpdate flags to set - // the GL state when required - - markUniformsLightsNeedsUpdate( m_uniforms, refreshLights ); - - } - - // refresh uniforms common to several materials - - if ( fog && material.fog ) { - - materials.refreshFogUniforms( m_uniforms, fog ); - - } - - materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height ); - - WebGLUniforms.upload( _gl, materialProperties.uniformsList, m_uniforms, textures ); - - } - - if ( material.isShaderMaterial && material.uniformsNeedUpdate === true ) { - - WebGLUniforms.upload( _gl, materialProperties.uniformsList, m_uniforms, textures ); - material.uniformsNeedUpdate = false; - - } - - if ( material.isSpriteMaterial ) { - - p_uniforms.setValue( _gl, 'center', object.center ); - - } - - // common matrices - - p_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix ); - p_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix ); - p_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld ); - - return program; - - } - - // If uniforms are marked as clean, they don't need to be loaded to the GPU. - - function markUniformsLightsNeedsUpdate( uniforms, value ) { - - uniforms.ambientLightColor.needsUpdate = value; - uniforms.lightProbe.needsUpdate = value; - - uniforms.directionalLights.needsUpdate = value; - uniforms.directionalLightShadows.needsUpdate = value; - uniforms.pointLights.needsUpdate = value; - uniforms.pointLightShadows.needsUpdate = value; - uniforms.spotLights.needsUpdate = value; - uniforms.spotLightShadows.needsUpdate = value; - uniforms.rectAreaLights.needsUpdate = value; - uniforms.hemisphereLights.needsUpdate = value; - - } - - function materialNeedsLights( material ) { - - return material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial || - material.isMeshStandardMaterial || material.isShadowMaterial || - ( material.isShaderMaterial && material.lights === true ); - - } - - // - this.setFramebuffer = function ( value ) { - - if ( _framebuffer !== value && _currentRenderTarget === null ) _gl.bindFramebuffer( 36160, value ); - - _framebuffer = value; - - }; - - this.getActiveCubeFace = function () { - - return _currentActiveCubeFace; - - }; - - this.getActiveMipmapLevel = function () { - - return _currentActiveMipmapLevel; - - }; - - this.getRenderTarget = function () { - - return _currentRenderTarget; - - }; - - this.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) { - - _currentRenderTarget = renderTarget; - _currentActiveCubeFace = activeCubeFace; - _currentActiveMipmapLevel = activeMipmapLevel; - - if ( renderTarget && properties.get( renderTarget ).__webglFramebuffer === undefined ) { - - textures.setupRenderTarget( renderTarget ); - - } - - let framebuffer = _framebuffer; - let isCube = false; - let isRenderTarget3D = false; - - if ( renderTarget ) { - - const texture = renderTarget.texture; - - if ( texture.isDataTexture3D || texture.isDataTexture2DArray ) { - - isRenderTarget3D = true; - - } - - const __webglFramebuffer = properties.get( renderTarget ).__webglFramebuffer; - - if ( renderTarget.isWebGLCubeRenderTarget ) { - - framebuffer = __webglFramebuffer[ activeCubeFace ]; - isCube = true; - - } else if ( renderTarget.isWebGLMultisampleRenderTarget ) { - - framebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer; - - } else { - - framebuffer = __webglFramebuffer; - - } - - _currentViewport.copy( renderTarget.viewport ); - _currentScissor.copy( renderTarget.scissor ); - _currentScissorTest = renderTarget.scissorTest; - - } else { - - _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor(); - _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor(); - _currentScissorTest = _scissorTest; - - } - - if ( _currentFramebuffer !== framebuffer ) { - - _gl.bindFramebuffer( 36160, framebuffer ); - _currentFramebuffer = framebuffer; - - } - - state.viewport( _currentViewport ); - state.scissor( _currentScissor ); - state.setScissorTest( _currentScissorTest ); - - if ( isCube ) { - - const textureProperties = properties.get( renderTarget.texture ); - _gl.framebufferTexture2D( 36160, 36064, 34069 + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel ); - - } else if ( isRenderTarget3D ) { - - const textureProperties = properties.get( renderTarget.texture ); - const layer = activeCubeFace || 0; - _gl.framebufferTextureLayer( 36160, 36064, textureProperties.__webglTexture, activeMipmapLevel || 0, layer ); - - } - - }; - - this.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) { - - if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) { - - console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' ); - return; - - } - - let framebuffer = properties.get( renderTarget ).__webglFramebuffer; - - if ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) { - - framebuffer = framebuffer[ activeCubeFaceIndex ]; - - } - - if ( framebuffer ) { - - let restore = false; - - if ( framebuffer !== _currentFramebuffer ) { - - _gl.bindFramebuffer( 36160, framebuffer ); - - restore = true; - - } - - try { - - const texture = renderTarget.texture; - const textureFormat = texture.format; - const textureType = texture.type; - - if ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== _gl.getParameter( 35739 ) ) { - - console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' ); - return; - - } - - const halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || ( capabilities.isWebGL2 && extensions.has( 'EXT_color_buffer_float' ) ) ); - - if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( 35738 ) && // Edge and Chrome Mac < 52 (#9513) - ! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.has( 'OES_texture_float' ) || extensions.has( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox - ! halfFloatSupportedByExt ) { - - console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' ); - return; - - } - - if ( _gl.checkFramebufferStatus( 36160 ) === 36053 ) { - - // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604) - - if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) { - - _gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer ); - - } - - } else { - - console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.' ); - - } - - } finally { - - if ( restore ) { - - _gl.bindFramebuffer( 36160, _currentFramebuffer ); - - } - - } - - } - - }; - - this.copyFramebufferToTexture = function ( position, texture, level = 0 ) { - - const levelScale = Math.pow( 2, - level ); - const width = Math.floor( texture.image.width * levelScale ); - const height = Math.floor( texture.image.height * levelScale ); - const glFormat = utils.convert( texture.format ); - - textures.setTexture2D( texture, 0 ); - - _gl.copyTexImage2D( 3553, level, glFormat, position.x, position.y, width, height, 0 ); - - state.unbindTexture(); - - }; - - this.copyTextureToTexture = function ( position, srcTexture, dstTexture, level = 0 ) { - - const width = srcTexture.image.width; - const height = srcTexture.image.height; - const glFormat = utils.convert( dstTexture.format ); - const glType = utils.convert( dstTexture.type ); - - textures.setTexture2D( dstTexture, 0 ); - - // As another texture upload may have changed pixelStorei - // parameters, make sure they are correct for the dstTexture - _gl.pixelStorei( 37440, dstTexture.flipY ); - _gl.pixelStorei( 37441, dstTexture.premultiplyAlpha ); - _gl.pixelStorei( 3317, dstTexture.unpackAlignment ); - - if ( srcTexture.isDataTexture ) { - - _gl.texSubImage2D( 3553, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data ); - - } else { - - if ( srcTexture.isCompressedTexture ) { - - _gl.compressedTexSubImage2D( 3553, level, position.x, position.y, srcTexture.mipmaps[ 0 ].width, srcTexture.mipmaps[ 0 ].height, glFormat, srcTexture.mipmaps[ 0 ].data ); - - } else { - - _gl.texSubImage2D( 3553, level, position.x, position.y, glFormat, glType, srcTexture.image ); - - } - - } - - // Generate mipmaps only when copying level 0 - if ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( 3553 ); - - state.unbindTexture(); - - }; - - this.copyTextureToTexture3D = function ( sourceBox, position, srcTexture, dstTexture, level = 0 ) { - - if ( _this.isWebGL1Renderer ) { - - console.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.' ); - return; - - } - - const { width, height, data } = srcTexture.image; - const glFormat = utils.convert( dstTexture.format ); - const glType = utils.convert( dstTexture.type ); - let glTarget; - - if ( dstTexture.isDataTexture3D ) { - - textures.setTexture3D( dstTexture, 0 ); - glTarget = 32879; - - } else if ( dstTexture.isDataTexture2DArray ) { - - textures.setTexture2DArray( dstTexture, 0 ); - glTarget = 35866; - - } else { - - console.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.' ); - return; - - } - - _gl.pixelStorei( 37440, dstTexture.flipY ); - _gl.pixelStorei( 37441, dstTexture.premultiplyAlpha ); - _gl.pixelStorei( 3317, dstTexture.unpackAlignment ); - - const unpackRowLen = _gl.getParameter( 3314 ); - const unpackImageHeight = _gl.getParameter( 32878 ); - const unpackSkipPixels = _gl.getParameter( 3316 ); - const unpackSkipRows = _gl.getParameter( 3315 ); - const unpackSkipImages = _gl.getParameter( 32877 ); - - _gl.pixelStorei( 3314, width ); - _gl.pixelStorei( 32878, height ); - _gl.pixelStorei( 3316, sourceBox.min.x ); - _gl.pixelStorei( 3315, sourceBox.min.y ); - _gl.pixelStorei( 32877, sourceBox.min.z ); - - _gl.texSubImage3D( - glTarget, - level, - position.x, - position.y, - position.z, - sourceBox.max.x - sourceBox.min.x + 1, - sourceBox.max.y - sourceBox.min.y + 1, - sourceBox.max.z - sourceBox.min.z + 1, - glFormat, - glType, - data - ); - - _gl.pixelStorei( 3314, unpackRowLen ); - _gl.pixelStorei( 32878, unpackImageHeight ); - _gl.pixelStorei( 3316, unpackSkipPixels ); - _gl.pixelStorei( 3315, unpackSkipRows ); - _gl.pixelStorei( 32877, unpackSkipImages ); - - // Generate mipmaps only when copying level 0 - if ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( glTarget ); - - state.unbindTexture(); - - }; - - this.initTexture = function ( texture ) { - - textures.setTexture2D( texture, 0 ); - - state.unbindTexture(); - - }; - - this.resetState = function () { - - state.reset(); - bindingStates.reset(); - - }; - - if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) { - - __THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) ); // eslint-disable-line no-undef - - } - -} - -class WebGL1Renderer extends WebGLRenderer {} - -WebGL1Renderer.prototype.isWebGL1Renderer = true; - -class FogExp2 { - - constructor( color, density ) { - - this.name = ''; - - this.color = new Color( color ); - this.density = ( density !== undefined ) ? density : 0.00025; - - } - - clone() { - - return new FogExp2( this.color, this.density ); - - } - - toJSON( /* meta */ ) { - - return { - type: 'FogExp2', - color: this.color.getHex(), - density: this.density - }; - - } - -} - -FogExp2.prototype.isFogExp2 = true; - -class Fog { - - constructor( color, near, far ) { - - this.name = ''; - - this.color = new Color( color ); - - this.near = ( near !== undefined ) ? near : 1; - this.far = ( far !== undefined ) ? far : 1000; - - } - - clone() { - - return new Fog( this.color, this.near, this.far ); - - } - - toJSON( /* meta */ ) { - - return { - type: 'Fog', - color: this.color.getHex(), - near: this.near, - far: this.far - }; - - } - -} - -Fog.prototype.isFog = true; - -class Scene extends Object3D { - - constructor() { - - super(); - - this.type = 'Scene'; - - this.background = null; - this.environment = null; - this.fog = null; - - this.overrideMaterial = null; - - this.autoUpdate = true; // checked by the renderer - - if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) { - - __THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) ); // eslint-disable-line no-undef - - } - - } - - copy( source, recursive ) { - - super.copy( source, recursive ); - - if ( source.background !== null ) this.background = source.background.clone(); - if ( source.environment !== null ) this.environment = source.environment.clone(); - if ( source.fog !== null ) this.fog = source.fog.clone(); - - if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone(); - - this.autoUpdate = source.autoUpdate; - this.matrixAutoUpdate = source.matrixAutoUpdate; - - return this; - - } - - toJSON( meta ) { - - const data = super.toJSON( meta ); - - if ( this.background !== null ) data.object.background = this.background.toJSON( meta ); - if ( this.environment !== null ) data.object.environment = this.environment.toJSON( meta ); - if ( this.fog !== null ) data.object.fog = this.fog.toJSON(); - - return data; - - } - -} - -Scene.prototype.isScene = true; - -function InterleavedBuffer( array, stride ) { - - this.array = array; - this.stride = stride; - this.count = array !== undefined ? array.length / stride : 0; - - this.usage = StaticDrawUsage; - this.updateRange = { offset: 0, count: - 1 }; - - this.version = 0; - - this.uuid = MathUtils.generateUUID(); - -} - -Object.defineProperty( InterleavedBuffer.prototype, 'needsUpdate', { - - set: function ( value ) { - - if ( value === true ) this.version ++; - - } - -} ); - -Object.assign( InterleavedBuffer.prototype, { - - isInterleavedBuffer: true, - - onUploadCallback: function () {}, - - setUsage: function ( value ) { - - this.usage = value; - - return this; - - }, - - copy: function ( source ) { - - this.array = new source.array.constructor( source.array ); - this.count = source.count; - this.stride = source.stride; - this.usage = source.usage; - - return this; - - }, - - copyAt: function ( index1, attribute, index2 ) { - - index1 *= this.stride; - index2 *= attribute.stride; - - for ( let i = 0, l = this.stride; i < l; i ++ ) { - - this.array[ index1 + i ] = attribute.array[ index2 + i ]; - - } - - return this; - - }, - - set: function ( value, offset = 0 ) { - - this.array.set( value, offset ); - - return this; - - }, - - clone: function ( data ) { - - if ( data.arrayBuffers === undefined ) { - - data.arrayBuffers = {}; - - } - - if ( this.array.buffer._uuid === undefined ) { - - this.array.buffer._uuid = MathUtils.generateUUID(); - - } - - if ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) { - - data.arrayBuffers[ this.array.buffer._uuid ] = this.array.slice( 0 ).buffer; - - } - - const array = new this.array.constructor( data.arrayBuffers[ this.array.buffer._uuid ] ); - - const ib = new InterleavedBuffer( array, this.stride ); - ib.setUsage( this.usage ); - - return ib; - - }, - - onUpload: function ( callback ) { - - this.onUploadCallback = callback; - - return this; - - }, - - toJSON: function ( data ) { - - if ( data.arrayBuffers === undefined ) { - - data.arrayBuffers = {}; - - } - - // generate UUID for array buffer if necessary - - if ( this.array.buffer._uuid === undefined ) { - - this.array.buffer._uuid = MathUtils.generateUUID(); - - } - - if ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) { - - data.arrayBuffers[ this.array.buffer._uuid ] = Array.prototype.slice.call( new Uint32Array( this.array.buffer ) ); - - } - - // - - return { - uuid: this.uuid, - buffer: this.array.buffer._uuid, - type: this.array.constructor.name, - stride: this.stride - }; - - } - -} ); - -const _vector$6 = new Vector3(); - -function InterleavedBufferAttribute( interleavedBuffer, itemSize, offset, normalized ) { - - this.name = ''; - - this.data = interleavedBuffer; - this.itemSize = itemSize; - this.offset = offset; - - this.normalized = normalized === true; - -} - -Object.defineProperties( InterleavedBufferAttribute.prototype, { - - count: { - - get: function () { - - return this.data.count; - - } - - }, - - array: { - - get: function () { - - return this.data.array; - - } - - }, - - needsUpdate: { - - set: function ( value ) { - - this.data.needsUpdate = value; - - } - - } - -} ); - -Object.assign( InterleavedBufferAttribute.prototype, { - - isInterleavedBufferAttribute: true, - - applyMatrix4: function ( m ) { - - for ( let i = 0, l = this.data.count; i < l; i ++ ) { - - _vector$6.x = this.getX( i ); - _vector$6.y = this.getY( i ); - _vector$6.z = this.getZ( i ); - - _vector$6.applyMatrix4( m ); - - this.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z ); - - } - - return this; - - }, - - setX: function ( index, x ) { - - this.data.array[ index * this.data.stride + this.offset ] = x; - - return this; - - }, - - setY: function ( index, y ) { - - this.data.array[ index * this.data.stride + this.offset + 1 ] = y; - - return this; - - }, - - setZ: function ( index, z ) { - - this.data.array[ index * this.data.stride + this.offset + 2 ] = z; - - return this; - - }, - - setW: function ( index, w ) { - - this.data.array[ index * this.data.stride + this.offset + 3 ] = w; - - return this; - - }, - - getX: function ( index ) { - - return this.data.array[ index * this.data.stride + this.offset ]; - - }, - - getY: function ( index ) { - - return this.data.array[ index * this.data.stride + this.offset + 1 ]; - - }, - - getZ: function ( index ) { - - return this.data.array[ index * this.data.stride + this.offset + 2 ]; - - }, - - getW: function ( index ) { - - return this.data.array[ index * this.data.stride + this.offset + 3 ]; - - }, - - setXY: function ( index, x, y ) { - - index = index * this.data.stride + this.offset; - - this.data.array[ index + 0 ] = x; - this.data.array[ index + 1 ] = y; - - return this; - - }, - - setXYZ: function ( index, x, y, z ) { - - index = index * this.data.stride + this.offset; - - this.data.array[ index + 0 ] = x; - this.data.array[ index + 1 ] = y; - this.data.array[ index + 2 ] = z; - - return this; - - }, - - setXYZW: function ( index, x, y, z, w ) { - - index = index * this.data.stride + this.offset; - - this.data.array[ index + 0 ] = x; - this.data.array[ index + 1 ] = y; - this.data.array[ index + 2 ] = z; - this.data.array[ index + 3 ] = w; - - return this; - - }, - - clone: function ( data ) { - - if ( data === undefined ) { - - console.log( 'THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.' ); - - const array = []; - - for ( let i = 0; i < this.count; i ++ ) { - - const index = i * this.data.stride + this.offset; - - for ( let j = 0; j < this.itemSize; j ++ ) { - - array.push( this.data.array[ index + j ] ); - - } - - } - - return new BufferAttribute( new this.array.constructor( array ), this.itemSize, this.normalized ); - - } else { - - if ( data.interleavedBuffers === undefined ) { - - data.interleavedBuffers = {}; - - } - - if ( data.interleavedBuffers[ this.data.uuid ] === undefined ) { - - data.interleavedBuffers[ this.data.uuid ] = this.data.clone( data ); - - } - - return new InterleavedBufferAttribute( data.interleavedBuffers[ this.data.uuid ], this.itemSize, this.offset, this.normalized ); - - } - - }, - - toJSON: function ( data ) { - - if ( data === undefined ) { - - console.log( 'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.' ); - - const array = []; - - for ( let i = 0; i < this.count; i ++ ) { - - const index = i * this.data.stride + this.offset; - - for ( let j = 0; j < this.itemSize; j ++ ) { - - array.push( this.data.array[ index + j ] ); - - } - - } - - // deinterleave data and save it as an ordinary buffer attribute for now - - return { - itemSize: this.itemSize, - type: this.array.constructor.name, - array: array, - normalized: this.normalized - }; - - } else { - - // save as true interlaved attribtue - - if ( data.interleavedBuffers === undefined ) { - - data.interleavedBuffers = {}; - - } - - if ( data.interleavedBuffers[ this.data.uuid ] === undefined ) { - - data.interleavedBuffers[ this.data.uuid ] = this.data.toJSON( data ); - - } - - return { - isInterleavedBufferAttribute: true, - itemSize: this.itemSize, - data: this.data.uuid, - offset: this.offset, - normalized: this.normalized - }; - - } - - } - -} ); - -/** - * parameters = { - * color: , - * map: new THREE.Texture( ), - * alphaMap: new THREE.Texture( ), - * rotation: , - * sizeAttenuation: - * } - */ - -class SpriteMaterial extends Material { - - constructor( parameters ) { - - super(); - - this.type = 'SpriteMaterial'; - - this.color = new Color( 0xffffff ); - - this.map = null; - - this.alphaMap = null; - - this.rotation = 0; - - this.sizeAttenuation = true; - - this.transparent = true; - - this.setValues( parameters ); - - } - - copy( source ) { - - super.copy( source ); - - this.color.copy( source.color ); - - this.map = source.map; - - this.alphaMap = source.alphaMap; - - this.rotation = source.rotation; - - this.sizeAttenuation = source.sizeAttenuation; - - return this; - - } - -} - -SpriteMaterial.prototype.isSpriteMaterial = true; - -let _geometry; - -const _intersectPoint = /*@__PURE__*/ new Vector3(); -const _worldScale = /*@__PURE__*/ new Vector3(); -const _mvPosition = /*@__PURE__*/ new Vector3(); - -const _alignedPosition = /*@__PURE__*/ new Vector2(); -const _rotatedPosition = /*@__PURE__*/ new Vector2(); -const _viewWorldMatrix = /*@__PURE__*/ new Matrix4(); - -const _vA$1 = /*@__PURE__*/ new Vector3(); -const _vB$1 = /*@__PURE__*/ new Vector3(); -const _vC$1 = /*@__PURE__*/ new Vector3(); - -const _uvA$1 = /*@__PURE__*/ new Vector2(); -const _uvB$1 = /*@__PURE__*/ new Vector2(); -const _uvC$1 = /*@__PURE__*/ new Vector2(); - -class Sprite extends Object3D { - - constructor( material ) { - - super(); - - this.type = 'Sprite'; - - if ( _geometry === undefined ) { - - _geometry = new BufferGeometry(); - - const float32Array = new Float32Array( [ - - 0.5, - 0.5, 0, 0, 0, - 0.5, - 0.5, 0, 1, 0, - 0.5, 0.5, 0, 1, 1, - - 0.5, 0.5, 0, 0, 1 - ] ); - - const interleavedBuffer = new InterleavedBuffer( float32Array, 5 ); - - _geometry.setIndex( [ 0, 1, 2, 0, 2, 3 ] ); - _geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) ); - _geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) ); - - } - - this.geometry = _geometry; - this.material = ( material !== undefined ) ? material : new SpriteMaterial(); - - this.center = new Vector2( 0.5, 0.5 ); - - } - - raycast( raycaster, intersects ) { - - if ( raycaster.camera === null ) { - - console.error( 'THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.' ); - - } - - _worldScale.setFromMatrixScale( this.matrixWorld ); - - _viewWorldMatrix.copy( raycaster.camera.matrixWorld ); - this.modelViewMatrix.multiplyMatrices( raycaster.camera.matrixWorldInverse, this.matrixWorld ); - - _mvPosition.setFromMatrixPosition( this.modelViewMatrix ); - - if ( raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false ) { - - _worldScale.multiplyScalar( - _mvPosition.z ); - - } - - const rotation = this.material.rotation; - let sin, cos; - - if ( rotation !== 0 ) { - - cos = Math.cos( rotation ); - sin = Math.sin( rotation ); - - } - - const center = this.center; - - transformVertex( _vA$1.set( - 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos ); - transformVertex( _vB$1.set( 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos ); - transformVertex( _vC$1.set( 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos ); - - _uvA$1.set( 0, 0 ); - _uvB$1.set( 1, 0 ); - _uvC$1.set( 1, 1 ); - - // check first triangle - let intersect = raycaster.ray.intersectTriangle( _vA$1, _vB$1, _vC$1, false, _intersectPoint ); - - if ( intersect === null ) { - - // check second triangle - transformVertex( _vB$1.set( - 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos ); - _uvB$1.set( 0, 1 ); - - intersect = raycaster.ray.intersectTriangle( _vA$1, _vC$1, _vB$1, false, _intersectPoint ); - if ( intersect === null ) { - - return; - - } - - } - - const distance = raycaster.ray.origin.distanceTo( _intersectPoint ); - - if ( distance < raycaster.near || distance > raycaster.far ) return; - - intersects.push( { - - distance: distance, - point: _intersectPoint.clone(), - uv: Triangle.getUV( _intersectPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() ), - face: null, - object: this - - } ); - - } - - copy( source ) { - - super.copy( source ); - - if ( source.center !== undefined ) this.center.copy( source.center ); - - this.material = source.material; - - return this; - - } - -} - -Sprite.prototype.isSprite = true; - -function transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) { - - // compute position in camera space - _alignedPosition.subVectors( vertexPosition, center ).addScalar( 0.5 ).multiply( scale ); - - // to check if rotation is not zero - if ( sin !== undefined ) { - - _rotatedPosition.x = ( cos * _alignedPosition.x ) - ( sin * _alignedPosition.y ); - _rotatedPosition.y = ( sin * _alignedPosition.x ) + ( cos * _alignedPosition.y ); - - } else { - - _rotatedPosition.copy( _alignedPosition ); - - } - - - vertexPosition.copy( mvPosition ); - vertexPosition.x += _rotatedPosition.x; - vertexPosition.y += _rotatedPosition.y; - - // transform to world space - vertexPosition.applyMatrix4( _viewWorldMatrix ); - -} - -const _v1$4 = /*@__PURE__*/ new Vector3(); -const _v2$2 = /*@__PURE__*/ new Vector3(); - -class LOD extends Object3D { - - constructor() { - - super(); - - this._currentLevel = 0; - - this.type = 'LOD'; - - Object.defineProperties( this, { - levels: { - enumerable: true, - value: [] - }, - isLOD: { - value: true, - } - } ); - - this.autoUpdate = true; - - } - - copy( source ) { - - super.copy( source, false ); - - const levels = source.levels; - - for ( let i = 0, l = levels.length; i < l; i ++ ) { - - const level = levels[ i ]; - - this.addLevel( level.object.clone(), level.distance ); - - } - - this.autoUpdate = source.autoUpdate; - - return this; - - } - - addLevel( object, distance = 0 ) { - - distance = Math.abs( distance ); - - const levels = this.levels; - - let l; - - for ( l = 0; l < levels.length; l ++ ) { - - if ( distance < levels[ l ].distance ) { - - break; - - } - - } - - levels.splice( l, 0, { distance: distance, object: object } ); - - this.add( object ); - - return this; - - } - - getCurrentLevel() { - - return this._currentLevel; - - } - - getObjectForDistance( distance ) { - - const levels = this.levels; - - if ( levels.length > 0 ) { - - let i, l; - - for ( i = 1, l = levels.length; i < l; i ++ ) { - - if ( distance < levels[ i ].distance ) { - - break; - - } - - } - - return levels[ i - 1 ].object; - - } - - return null; - - } - - raycast( raycaster, intersects ) { - - const levels = this.levels; - - if ( levels.length > 0 ) { - - _v1$4.setFromMatrixPosition( this.matrixWorld ); - - const distance = raycaster.ray.origin.distanceTo( _v1$4 ); - - this.getObjectForDistance( distance ).raycast( raycaster, intersects ); - - } - - } - - update( camera ) { - - const levels = this.levels; - - if ( levels.length > 1 ) { - - _v1$4.setFromMatrixPosition( camera.matrixWorld ); - _v2$2.setFromMatrixPosition( this.matrixWorld ); - - const distance = _v1$4.distanceTo( _v2$2 ) / camera.zoom; - - levels[ 0 ].object.visible = true; - - let i, l; - - for ( i = 1, l = levels.length; i < l; i ++ ) { - - if ( distance >= levels[ i ].distance ) { - - levels[ i - 1 ].object.visible = false; - levels[ i ].object.visible = true; - - } else { - - break; - - } - - } - - this._currentLevel = i - 1; - - for ( ; i < l; i ++ ) { - - levels[ i ].object.visible = false; - - } - - } - - } - - toJSON( meta ) { - - const data = super.toJSON( meta ); - - if ( this.autoUpdate === false ) data.object.autoUpdate = false; - - data.object.levels = []; - - const levels = this.levels; - - for ( let i = 0, l = levels.length; i < l; i ++ ) { - - const level = levels[ i ]; - - data.object.levels.push( { - object: level.object.uuid, - distance: level.distance - } ); - - } - - return data; - - } - -} - -const _basePosition = new Vector3(); - -const _skinIndex = new Vector4(); -const _skinWeight = new Vector4(); - -const _vector$7 = new Vector3(); -const _matrix$1 = new Matrix4(); - -function SkinnedMesh( geometry, material ) { - - Mesh.call( this, geometry, material ); - - this.type = 'SkinnedMesh'; - - this.bindMode = 'attached'; - this.bindMatrix = new Matrix4(); - this.bindMatrixInverse = new Matrix4(); - -} - -SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { - - constructor: SkinnedMesh, - - isSkinnedMesh: true, - - copy: function ( source ) { - - Mesh.prototype.copy.call( this, source ); - - this.bindMode = source.bindMode; - this.bindMatrix.copy( source.bindMatrix ); - this.bindMatrixInverse.copy( source.bindMatrixInverse ); - - this.skeleton = source.skeleton; - - return this; - - }, - - bind: function ( skeleton, bindMatrix ) { - - this.skeleton = skeleton; - - if ( bindMatrix === undefined ) { - - this.updateMatrixWorld( true ); - - this.skeleton.calculateInverses(); - - bindMatrix = this.matrixWorld; - - } - - this.bindMatrix.copy( bindMatrix ); - this.bindMatrixInverse.copy( bindMatrix ).invert(); - - }, - - pose: function () { - - this.skeleton.pose(); - - }, - - normalizeSkinWeights: function () { - - const vector = new Vector4(); - - const skinWeight = this.geometry.attributes.skinWeight; - - for ( let i = 0, l = skinWeight.count; i < l; i ++ ) { - - vector.x = skinWeight.getX( i ); - vector.y = skinWeight.getY( i ); - vector.z = skinWeight.getZ( i ); - vector.w = skinWeight.getW( i ); - - const scale = 1.0 / vector.manhattanLength(); - - if ( scale !== Infinity ) { - - vector.multiplyScalar( scale ); - - } else { - - vector.set( 1, 0, 0, 0 ); // do something reasonable - - } - - skinWeight.setXYZW( i, vector.x, vector.y, vector.z, vector.w ); - - } - - }, - - updateMatrixWorld: function ( force ) { - - Mesh.prototype.updateMatrixWorld.call( this, force ); - - if ( this.bindMode === 'attached' ) { - - this.bindMatrixInverse.copy( this.matrixWorld ).invert(); - - } else if ( this.bindMode === 'detached' ) { - - this.bindMatrixInverse.copy( this.bindMatrix ).invert(); - - } else { - - console.warn( 'THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode ); - - } - - }, - - boneTransform: function ( index, target ) { - - const skeleton = this.skeleton; - const geometry = this.geometry; - - _skinIndex.fromBufferAttribute( geometry.attributes.skinIndex, index ); - _skinWeight.fromBufferAttribute( geometry.attributes.skinWeight, index ); - - _basePosition.fromBufferAttribute( geometry.attributes.position, index ).applyMatrix4( this.bindMatrix ); - - target.set( 0, 0, 0 ); - - for ( let i = 0; i < 4; i ++ ) { - - const weight = _skinWeight.getComponent( i ); - - if ( weight !== 0 ) { - - const boneIndex = _skinIndex.getComponent( i ); - - _matrix$1.multiplyMatrices( skeleton.bones[ boneIndex ].matrixWorld, skeleton.boneInverses[ boneIndex ] ); - - target.addScaledVector( _vector$7.copy( _basePosition ).applyMatrix4( _matrix$1 ), weight ); - - } - - } - - return target.applyMatrix4( this.bindMatrixInverse ); - - } - -} ); - -function Bone() { - - Object3D.call( this ); - - this.type = 'Bone'; - -} - -Bone.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Bone, - - isBone: true - -} ); - -const _offsetMatrix = /*@__PURE__*/ new Matrix4(); -const _identityMatrix = /*@__PURE__*/ new Matrix4(); - -class Skeleton { - - constructor( bones = [], boneInverses = [] ) { - - this.uuid = MathUtils.generateUUID(); - - this.bones = bones.slice( 0 ); - this.boneInverses = boneInverses; - this.boneMatrices = null; - - this.boneTexture = null; - this.boneTextureSize = 0; - - this.frame = - 1; - - this.init(); - - } - - init() { - - const bones = this.bones; - const boneInverses = this.boneInverses; - - this.boneMatrices = new Float32Array( bones.length * 16 ); - - // calculate inverse bone matrices if necessary - - if ( boneInverses.length === 0 ) { - - this.calculateInverses(); - - } else { - - // handle special case - - if ( bones.length !== boneInverses.length ) { - - console.warn( 'THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.' ); - - this.boneInverses = []; - - for ( let i = 0, il = this.bones.length; i < il; i ++ ) { - - this.boneInverses.push( new Matrix4() ); - - } - - } - - } - - } - - calculateInverses() { - - this.boneInverses.length = 0; - - for ( let i = 0, il = this.bones.length; i < il; i ++ ) { - - const inverse = new Matrix4(); - - if ( this.bones[ i ] ) { - - inverse.copy( this.bones[ i ].matrixWorld ).invert(); - - } - - this.boneInverses.push( inverse ); - - } - - } - - pose() { - - // recover the bind-time world matrices - - for ( let i = 0, il = this.bones.length; i < il; i ++ ) { - - const bone = this.bones[ i ]; - - if ( bone ) { - - bone.matrixWorld.copy( this.boneInverses[ i ] ).invert(); - - } - - } - - // compute the local matrices, positions, rotations and scales - - for ( let i = 0, il = this.bones.length; i < il; i ++ ) { - - const bone = this.bones[ i ]; - - if ( bone ) { - - if ( bone.parent && bone.parent.isBone ) { - - bone.matrix.copy( bone.parent.matrixWorld ).invert(); - bone.matrix.multiply( bone.matrixWorld ); - - } else { - - bone.matrix.copy( bone.matrixWorld ); - - } - - bone.matrix.decompose( bone.position, bone.quaternion, bone.scale ); - - } - - } - - } - - update() { - - const bones = this.bones; - const boneInverses = this.boneInverses; - const boneMatrices = this.boneMatrices; - const boneTexture = this.boneTexture; - - // flatten bone matrices to array - - for ( let i = 0, il = bones.length; i < il; i ++ ) { - - // compute the offset between the current and the original transform - - const matrix = bones[ i ] ? bones[ i ].matrixWorld : _identityMatrix; - - _offsetMatrix.multiplyMatrices( matrix, boneInverses[ i ] ); - _offsetMatrix.toArray( boneMatrices, i * 16 ); - - } - - if ( boneTexture !== null ) { - - boneTexture.needsUpdate = true; - - } - - } - - clone() { - - return new Skeleton( this.bones, this.boneInverses ); - - } - - getBoneByName( name ) { - - for ( let i = 0, il = this.bones.length; i < il; i ++ ) { - - const bone = this.bones[ i ]; - - if ( bone.name === name ) { - - return bone; - - } - - } - - return undefined; - - } - - dispose( ) { - - if ( this.boneTexture !== null ) { - - this.boneTexture.dispose(); - - this.boneTexture = null; - - } - - } - - fromJSON( json, bones ) { - - this.uuid = json.uuid; - - for ( let i = 0, l = json.bones.length; i < l; i ++ ) { - - const uuid = json.bones[ i ]; - let bone = bones[ uuid ]; - - if ( bone === undefined ) { - - console.warn( 'THREE.Skeleton: No bone found with UUID:', uuid ); - bone = new Bone(); - - } - - this.bones.push( bone ); - this.boneInverses.push( new Matrix4().fromArray( json.boneInverses[ i ] ) ); - - } - - this.init(); - - return this; - - } - - toJSON() { - - const data = { - metadata: { - version: 4.5, - type: 'Skeleton', - generator: 'Skeleton.toJSON' - }, - bones: [], - boneInverses: [] - }; - - data.uuid = this.uuid; - - const bones = this.bones; - const boneInverses = this.boneInverses; - - for ( let i = 0, l = bones.length; i < l; i ++ ) { - - const bone = bones[ i ]; - data.bones.push( bone.uuid ); - - const boneInverse = boneInverses[ i ]; - data.boneInverses.push( boneInverse.toArray() ); - - } - - return data; - - } - -} - -const _instanceLocalMatrix = new Matrix4(); -const _instanceWorldMatrix = new Matrix4(); - -const _instanceIntersects = []; - -const _mesh = new Mesh(); - -function InstancedMesh( geometry, material, count ) { - - Mesh.call( this, geometry, material ); - - this.instanceMatrix = new BufferAttribute( new Float32Array( count * 16 ), 16 ); - this.instanceColor = null; - - this.count = count; - - this.frustumCulled = false; - -} - -InstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { - - constructor: InstancedMesh, - - isInstancedMesh: true, - - copy: function ( source ) { - - Mesh.prototype.copy.call( this, source ); - - this.instanceMatrix.copy( source.instanceMatrix ); - - if ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone(); - - this.count = source.count; - - return this; - - }, - - getColorAt: function ( index, color ) { - - color.fromArray( this.instanceColor.array, index * 3 ); - - }, - - getMatrixAt: function ( index, matrix ) { - - matrix.fromArray( this.instanceMatrix.array, index * 16 ); - - }, - - raycast: function ( raycaster, intersects ) { - - const matrixWorld = this.matrixWorld; - const raycastTimes = this.count; - - _mesh.geometry = this.geometry; - _mesh.material = this.material; - - if ( _mesh.material === undefined ) return; - - for ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) { - - // calculate the world matrix for each instance - - this.getMatrixAt( instanceId, _instanceLocalMatrix ); - - _instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix ); - - // the mesh represents this single instance - - _mesh.matrixWorld = _instanceWorldMatrix; - - _mesh.raycast( raycaster, _instanceIntersects ); - - // process the result of raycast - - for ( let i = 0, l = _instanceIntersects.length; i < l; i ++ ) { - - const intersect = _instanceIntersects[ i ]; - intersect.instanceId = instanceId; - intersect.object = this; - intersects.push( intersect ); - - } - - _instanceIntersects.length = 0; - - } - - }, - - setColorAt: function ( index, color ) { - - if ( this.instanceColor === null ) { - - this.instanceColor = new BufferAttribute( new Float32Array( this.count * 3 ), 3 ); - - } - - color.toArray( this.instanceColor.array, index * 3 ); - - }, - - setMatrixAt: function ( index, matrix ) { - - matrix.toArray( this.instanceMatrix.array, index * 16 ); - - }, - - updateMorphTargets: function () { - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -} ); - -/** - * parameters = { - * color: , - * opacity: , - * - * linewidth: , - * linecap: "round", - * linejoin: "round" - * } - */ - -class LineBasicMaterial extends Material { - - constructor( parameters ) { - - super(); - - this.type = 'LineBasicMaterial'; - - this.color = new Color( 0xffffff ); - - this.linewidth = 1; - this.linecap = 'round'; - this.linejoin = 'round'; - - this.morphTargets = false; - - this.setValues( parameters ); - - } - - - copy( source ) { - - super.copy( source ); - - this.color.copy( source.color ); - - this.linewidth = source.linewidth; - this.linecap = source.linecap; - this.linejoin = source.linejoin; - - this.morphTargets = source.morphTargets; - - return this; - - } - -} - -LineBasicMaterial.prototype.isLineBasicMaterial = true; - -const _start = new Vector3(); -const _end = new Vector3(); -const _inverseMatrix$1 = new Matrix4(); -const _ray$1 = new Ray(); -const _sphere$2 = new Sphere(); - -function Line( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) { - - Object3D.call( this ); - - this.type = 'Line'; - - this.geometry = geometry; - this.material = material; - - this.updateMorphTargets(); - -} - -Line.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Line, - - isLine: true, - - copy: function ( source ) { - - Object3D.prototype.copy.call( this, source ); - - this.material = source.material; - this.geometry = source.geometry; - - return this; - - }, - - computeLineDistances: function () { - - const geometry = this.geometry; - - if ( geometry.isBufferGeometry ) { - - // we assume non-indexed geometry - - if ( geometry.index === null ) { - - const positionAttribute = geometry.attributes.position; - const lineDistances = [ 0 ]; - - for ( let i = 1, l = positionAttribute.count; i < l; i ++ ) { - - _start.fromBufferAttribute( positionAttribute, i - 1 ); - _end.fromBufferAttribute( positionAttribute, i ); - - lineDistances[ i ] = lineDistances[ i - 1 ]; - lineDistances[ i ] += _start.distanceTo( _end ); - - } - - geometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) ); - - } else { - - console.warn( 'THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' ); - - } - - } else if ( geometry.isGeometry ) { - - console.error( 'THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' ); - - } - - return this; - - }, - - raycast: function ( raycaster, intersects ) { - - const geometry = this.geometry; - const matrixWorld = this.matrixWorld; - const threshold = raycaster.params.Line.threshold; - - // Checking boundingSphere distance to ray - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - _sphere$2.copy( geometry.boundingSphere ); - _sphere$2.applyMatrix4( matrixWorld ); - _sphere$2.radius += threshold; - - if ( raycaster.ray.intersectsSphere( _sphere$2 ) === false ) return; - - // - - _inverseMatrix$1.copy( matrixWorld ).invert(); - _ray$1.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$1 ); - - const localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 ); - const localThresholdSq = localThreshold * localThreshold; - - const vStart = new Vector3(); - const vEnd = new Vector3(); - const interSegment = new Vector3(); - const interRay = new Vector3(); - const step = this.isLineSegments ? 2 : 1; - - if ( geometry.isBufferGeometry ) { - - const index = geometry.index; - const attributes = geometry.attributes; - const positionAttribute = attributes.position; - - if ( index !== null ) { - - const indices = index.array; - - for ( let i = 0, l = indices.length - 1; i < l; i += step ) { - - const a = indices[ i ]; - const b = indices[ i + 1 ]; - - vStart.fromBufferAttribute( positionAttribute, a ); - vEnd.fromBufferAttribute( positionAttribute, b ); - - const distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment ); - - if ( distSq > localThresholdSq ) continue; - - interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation - - const distance = raycaster.ray.origin.distanceTo( interRay ); - - if ( distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - // What do we want? intersection point on the ray or on the segment?? - // point: raycaster.ray.at( distance ), - point: interSegment.clone().applyMatrix4( this.matrixWorld ), - index: i, - face: null, - faceIndex: null, - object: this - - } ); - - } - - } else { - - for ( let i = 0, l = positionAttribute.count - 1; i < l; i += step ) { - - vStart.fromBufferAttribute( positionAttribute, i ); - vEnd.fromBufferAttribute( positionAttribute, i + 1 ); - - const distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment ); - - if ( distSq > localThresholdSq ) continue; - - interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation - - const distance = raycaster.ray.origin.distanceTo( interRay ); - - if ( distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - // What do we want? intersection point on the ray or on the segment?? - // point: raycaster.ray.at( distance ), - point: interSegment.clone().applyMatrix4( this.matrixWorld ), - index: i, - face: null, - faceIndex: null, - object: this - - } ); - - } - - } - - } else if ( geometry.isGeometry ) { - - console.error( 'THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' ); - - } - - }, - - updateMorphTargets: function () { - - const geometry = this.geometry; - - if ( geometry.isBufferGeometry ) { - - const morphAttributes = geometry.morphAttributes; - const keys = Object.keys( morphAttributes ); - - if ( keys.length > 0 ) { - - const morphAttribute = morphAttributes[ keys[ 0 ] ]; - - if ( morphAttribute !== undefined ) { - - this.morphTargetInfluences = []; - this.morphTargetDictionary = {}; - - for ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) { - - const name = morphAttribute[ m ].name || String( m ); - - this.morphTargetInfluences.push( 0 ); - this.morphTargetDictionary[ name ] = m; - - } - - } - - } - - } else { - - const morphTargets = geometry.morphTargets; - - if ( morphTargets !== undefined && morphTargets.length > 0 ) { - - console.error( 'THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.' ); - - } - - } - - } - -} ); - -const _start$1 = new Vector3(); -const _end$1 = new Vector3(); - -function LineSegments( geometry, material ) { - - Line.call( this, geometry, material ); - - this.type = 'LineSegments'; - -} - -LineSegments.prototype = Object.assign( Object.create( Line.prototype ), { - - constructor: LineSegments, - - isLineSegments: true, - - computeLineDistances: function () { - - const geometry = this.geometry; - - if ( geometry.isBufferGeometry ) { - - // we assume non-indexed geometry - - if ( geometry.index === null ) { - - const positionAttribute = geometry.attributes.position; - const lineDistances = []; - - for ( let i = 0, l = positionAttribute.count; i < l; i += 2 ) { - - _start$1.fromBufferAttribute( positionAttribute, i ); - _end$1.fromBufferAttribute( positionAttribute, i + 1 ); - - lineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ]; - lineDistances[ i + 1 ] = lineDistances[ i ] + _start$1.distanceTo( _end$1 ); - - } - - geometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) ); - - } else { - - console.warn( 'THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' ); - - } - - } else if ( geometry.isGeometry ) { - - console.error( 'THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' ); - - } - - return this; - - } - -} ); - -class LineLoop extends Line { - - constructor( geometry, material ) { - - super( geometry, material ); - - this.type = 'LineLoop'; - - } - -} - -LineLoop.prototype.isLineLoop = true; - -/** - * parameters = { - * color: , - * opacity: , - * map: new THREE.Texture( ), - * alphaMap: new THREE.Texture( ), - * - * size: , - * sizeAttenuation: - * - * morphTargets: - * } - */ - -class PointsMaterial extends Material { - - constructor( parameters ) { - - super(); - - this.type = 'PointsMaterial'; - - this.color = new Color( 0xffffff ); - - this.map = null; - - this.alphaMap = null; - - this.size = 1; - this.sizeAttenuation = true; - - this.morphTargets = false; - - this.setValues( parameters ); - - } - - copy( source ) { - - super.copy( source ); - - this.color.copy( source.color ); - - this.map = source.map; - - this.alphaMap = source.alphaMap; - - this.size = source.size; - this.sizeAttenuation = source.sizeAttenuation; - - this.morphTargets = source.morphTargets; - - return this; - - } - -} - -PointsMaterial.prototype.isPointsMaterial = true; - -const _inverseMatrix$2 = new Matrix4(); -const _ray$2 = new Ray(); -const _sphere$3 = new Sphere(); -const _position$1 = new Vector3(); - -function Points( geometry = new BufferGeometry(), material = new PointsMaterial() ) { - - Object3D.call( this ); - - this.type = 'Points'; - - this.geometry = geometry; - this.material = material; - - this.updateMorphTargets(); - -} - -Points.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Points, - - isPoints: true, - - copy: function ( source ) { - - Object3D.prototype.copy.call( this, source ); - - this.material = source.material; - this.geometry = source.geometry; - - return this; - - }, - - raycast: function ( raycaster, intersects ) { - - const geometry = this.geometry; - const matrixWorld = this.matrixWorld; - const threshold = raycaster.params.Points.threshold; - - // Checking boundingSphere distance to ray - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - _sphere$3.copy( geometry.boundingSphere ); - _sphere$3.applyMatrix4( matrixWorld ); - _sphere$3.radius += threshold; - - if ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return; - - // - - _inverseMatrix$2.copy( matrixWorld ).invert(); - _ray$2.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$2 ); - - const localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 ); - const localThresholdSq = localThreshold * localThreshold; - - if ( geometry.isBufferGeometry ) { - - const index = geometry.index; - const attributes = geometry.attributes; - const positionAttribute = attributes.position; - - if ( index !== null ) { - - const indices = index.array; - - for ( let i = 0, il = indices.length; i < il; i ++ ) { - - const a = indices[ i ]; - - _position$1.fromBufferAttribute( positionAttribute, a ); - - testPoint( _position$1, a, localThresholdSq, matrixWorld, raycaster, intersects, this ); - - } - - } else { - - for ( let i = 0, l = positionAttribute.count; i < l; i ++ ) { - - _position$1.fromBufferAttribute( positionAttribute, i ); - - testPoint( _position$1, i, localThresholdSq, matrixWorld, raycaster, intersects, this ); - - } - - } - - } else { - - console.error( 'THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' ); - - } - - }, - - updateMorphTargets: function () { - - const geometry = this.geometry; - - if ( geometry.isBufferGeometry ) { - - const morphAttributes = geometry.morphAttributes; - const keys = Object.keys( morphAttributes ); - - if ( keys.length > 0 ) { - - const morphAttribute = morphAttributes[ keys[ 0 ] ]; - - if ( morphAttribute !== undefined ) { - - this.morphTargetInfluences = []; - this.morphTargetDictionary = {}; - - for ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) { - - const name = morphAttribute[ m ].name || String( m ); - - this.morphTargetInfluences.push( 0 ); - this.morphTargetDictionary[ name ] = m; - - } - - } - - } - - } else { - - const morphTargets = geometry.morphTargets; - - if ( morphTargets !== undefined && morphTargets.length > 0 ) { - - console.error( 'THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.' ); - - } - - } - - } - -} ); - -function testPoint( point, index, localThresholdSq, matrixWorld, raycaster, intersects, object ) { - - const rayPointDistanceSq = _ray$2.distanceSqToPoint( point ); - - if ( rayPointDistanceSq < localThresholdSq ) { - - const intersectPoint = new Vector3(); - - _ray$2.closestPointToPoint( point, intersectPoint ); - intersectPoint.applyMatrix4( matrixWorld ); - - const distance = raycaster.ray.origin.distanceTo( intersectPoint ); - - if ( distance < raycaster.near || distance > raycaster.far ) return; - - intersects.push( { - - distance: distance, - distanceToRay: Math.sqrt( rayPointDistanceSq ), - point: intersectPoint, - index: index, - face: null, - object: object - - } ); - - } - -} - -class VideoTexture extends Texture { - - constructor( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) { - - super( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); - - this.format = format !== undefined ? format : RGBFormat; - - this.minFilter = minFilter !== undefined ? minFilter : LinearFilter; - this.magFilter = magFilter !== undefined ? magFilter : LinearFilter; - - this.generateMipmaps = false; - - const scope = this; - - function updateVideo() { - - scope.needsUpdate = true; - video.requestVideoFrameCallback( updateVideo ); - - } - - if ( 'requestVideoFrameCallback' in video ) { - - video.requestVideoFrameCallback( updateVideo ); - - } - - } - - clone() { - - return new this.constructor( this.image ).copy( this ); - - } - - update() { - - const video = this.image; - const hasVideoFrameCallback = 'requestVideoFrameCallback' in video; - - if ( hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA ) { - - this.needsUpdate = true; - - } - - } - -} - -VideoTexture.prototype.isVideoTexture = true; - -class CompressedTexture extends Texture { - - constructor( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) { - - super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ); - - this.image = { width: width, height: height }; - this.mipmaps = mipmaps; - - // no flipping for cube textures - // (also flipping doesn't work for compressed textures ) - - this.flipY = false; - - // can't generate mipmaps for compressed textures - // mips must be embedded in DDS files - - this.generateMipmaps = false; - - } - -} - -CompressedTexture.prototype.isCompressedTexture = true; - -class CanvasTexture extends Texture { - - constructor( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) { - - super( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); - - this.needsUpdate = true; - - } - -} - -CanvasTexture.prototype.isCanvasTexture = true; - -class DepthTexture extends Texture { - - constructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) { - - format = format !== undefined ? format : DepthFormat; - - if ( format !== DepthFormat && format !== DepthStencilFormat ) { - - throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' ); - - } - - if ( type === undefined && format === DepthFormat ) type = UnsignedShortType; - if ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type; - - super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); - - this.image = { width: width, height: height }; - - this.magFilter = magFilter !== undefined ? magFilter : NearestFilter; - this.minFilter = minFilter !== undefined ? minFilter : NearestFilter; - - this.flipY = false; - this.generateMipmaps = false; - - } - - -} - -DepthTexture.prototype.isDepthTexture = true; - -class CircleGeometry extends BufferGeometry { - - constructor( radius = 1, segments = 8, thetaStart = 0, thetaLength = Math.PI * 2 ) { - - super(); - - this.type = 'CircleGeometry'; - - this.parameters = { - radius: radius, - segments: segments, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - segments = Math.max( 3, segments ); - - // buffers - - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - - // helper variables - - const vertex = new Vector3(); - const uv = new Vector2(); - - // center point - - vertices.push( 0, 0, 0 ); - normals.push( 0, 0, 1 ); - uvs.push( 0.5, 0.5 ); - - for ( let s = 0, i = 3; s <= segments; s ++, i += 3 ) { - - const segment = thetaStart + s / segments * thetaLength; - - // vertex - - vertex.x = radius * Math.cos( segment ); - vertex.y = radius * Math.sin( segment ); - - vertices.push( vertex.x, vertex.y, vertex.z ); - - // normal - - normals.push( 0, 0, 1 ); - - // uvs - - uv.x = ( vertices[ i ] / radius + 1 ) / 2; - uv.y = ( vertices[ i + 1 ] / radius + 1 ) / 2; - - uvs.push( uv.x, uv.y ); - - } - - // indices - - for ( let i = 1; i <= segments; i ++ ) { - - indices.push( i, i + 1, 0 ); - - } - - // build geometry - - this.setIndex( indices ); - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - } - -} - -class CylinderGeometry extends BufferGeometry { - - constructor( radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 8, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) { - - super(); - this.type = 'CylinderGeometry'; - - this.parameters = { - radiusTop: radiusTop, - radiusBottom: radiusBottom, - height: height, - radialSegments: radialSegments, - heightSegments: heightSegments, - openEnded: openEnded, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - const scope = this; - - radialSegments = Math.floor( radialSegments ); - heightSegments = Math.floor( heightSegments ); - - // buffers - - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - - // helper variables - - let index = 0; - const indexArray = []; - const halfHeight = height / 2; - let groupStart = 0; - - // generate geometry - - generateTorso(); - - if ( openEnded === false ) { - - if ( radiusTop > 0 ) generateCap( true ); - if ( radiusBottom > 0 ) generateCap( false ); - - } - - // build geometry - - this.setIndex( indices ); - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - function generateTorso() { - - const normal = new Vector3(); - const vertex = new Vector3(); - - let groupCount = 0; - - // this will be used to calculate the normal - const slope = ( radiusBottom - radiusTop ) / height; - - // generate vertices, normals and uvs - - for ( let y = 0; y <= heightSegments; y ++ ) { - - const indexRow = []; - - const v = y / heightSegments; - - // calculate the radius of the current row - - const radius = v * ( radiusBottom - radiusTop ) + radiusTop; - - for ( let x = 0; x <= radialSegments; x ++ ) { - - const u = x / radialSegments; - - const theta = u * thetaLength + thetaStart; - - const sinTheta = Math.sin( theta ); - const cosTheta = Math.cos( theta ); - - // vertex - - vertex.x = radius * sinTheta; - vertex.y = - v * height + halfHeight; - vertex.z = radius * cosTheta; - vertices.push( vertex.x, vertex.y, vertex.z ); - - // normal - - normal.set( sinTheta, slope, cosTheta ).normalize(); - normals.push( normal.x, normal.y, normal.z ); - - // uv - - uvs.push( u, 1 - v ); - - // save index of vertex in respective row - - indexRow.push( index ++ ); - - } - - // now save vertices of the row in our index array - - indexArray.push( indexRow ); - - } - - // generate indices - - for ( let x = 0; x < radialSegments; x ++ ) { - - for ( let y = 0; y < heightSegments; y ++ ) { - - // we use the index array to access the correct indices - - const a = indexArray[ y ][ x ]; - const b = indexArray[ y + 1 ][ x ]; - const c = indexArray[ y + 1 ][ x + 1 ]; - const d = indexArray[ y ][ x + 1 ]; - - // faces - - indices.push( a, b, d ); - indices.push( b, c, d ); - - // update group counter - - groupCount += 6; - - } - - } - - // add a group to the geometry. this will ensure multi material support - - scope.addGroup( groupStart, groupCount, 0 ); - - // calculate new start value for groups - - groupStart += groupCount; - - } - - function generateCap( top ) { - - // save the index of the first center vertex - const centerIndexStart = index; - - const uv = new Vector2(); - const vertex = new Vector3(); - - let groupCount = 0; - - const radius = ( top === true ) ? radiusTop : radiusBottom; - const sign = ( top === true ) ? 1 : - 1; - - // first we generate the center vertex data of the cap. - // because the geometry needs one set of uvs per face, - // we must generate a center vertex per face/segment - - for ( let x = 1; x <= radialSegments; x ++ ) { - - // vertex - - vertices.push( 0, halfHeight * sign, 0 ); - - // normal - - normals.push( 0, sign, 0 ); - - // uv - - uvs.push( 0.5, 0.5 ); - - // increase index - - index ++; - - } - - // save the index of the last center vertex - const centerIndexEnd = index; - - // now we generate the surrounding vertices, normals and uvs - - for ( let x = 0; x <= radialSegments; x ++ ) { - - const u = x / radialSegments; - const theta = u * thetaLength + thetaStart; - - const cosTheta = Math.cos( theta ); - const sinTheta = Math.sin( theta ); - - // vertex - - vertex.x = radius * sinTheta; - vertex.y = halfHeight * sign; - vertex.z = radius * cosTheta; - vertices.push( vertex.x, vertex.y, vertex.z ); - - // normal - - normals.push( 0, sign, 0 ); - - // uv - - uv.x = ( cosTheta * 0.5 ) + 0.5; - uv.y = ( sinTheta * 0.5 * sign ) + 0.5; - uvs.push( uv.x, uv.y ); - - // increase index - - index ++; - - } - - // generate indices - - for ( let x = 0; x < radialSegments; x ++ ) { - - const c = centerIndexStart + x; - const i = centerIndexEnd + x; - - if ( top === true ) { - - // face top - - indices.push( i, i + 1, c ); - - } else { - - // face bottom - - indices.push( i + 1, i, c ); - - } - - groupCount += 3; - - } - - // add a group to the geometry. this will ensure multi material support - - scope.addGroup( groupStart, groupCount, top === true ? 1 : 2 ); - - // calculate new start value for groups - - groupStart += groupCount; - - } - - } - -} - -class ConeGeometry extends CylinderGeometry { - - constructor( radius = 1, height = 1, radialSegments = 8, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) { - - super( 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ); - - this.type = 'ConeGeometry'; - - this.parameters = { - radius: radius, - height: height, - radialSegments: radialSegments, - heightSegments: heightSegments, - openEnded: openEnded, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - } - -} - -class PolyhedronGeometry extends BufferGeometry { - - constructor( vertices, indices, radius = 1, detail = 0 ) { - - super(); - - this.type = 'PolyhedronGeometry'; - - this.parameters = { - vertices: vertices, - indices: indices, - radius: radius, - detail: detail - }; - - // default buffer data - - const vertexBuffer = []; - const uvBuffer = []; - - // the subdivision creates the vertex buffer data - - subdivide( detail ); - - // all vertices should lie on a conceptual sphere with a given radius - - applyRadius( radius ); - - // finally, create the uv data - - generateUVs(); - - // build non-indexed geometry - - this.setAttribute( 'position', new Float32BufferAttribute( vertexBuffer, 3 ) ); - this.setAttribute( 'normal', new Float32BufferAttribute( vertexBuffer.slice(), 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) ); - - if ( detail === 0 ) { - - this.computeVertexNormals(); // flat normals - - } else { - - this.normalizeNormals(); // smooth normals - - } - - // helper functions - - function subdivide( detail ) { - - const a = new Vector3(); - const b = new Vector3(); - const c = new Vector3(); - - // iterate over all faces and apply a subdivison with the given detail value - - for ( let i = 0; i < indices.length; i += 3 ) { - - // get the vertices of the face - - getVertexByIndex( indices[ i + 0 ], a ); - getVertexByIndex( indices[ i + 1 ], b ); - getVertexByIndex( indices[ i + 2 ], c ); - - // perform subdivision - - subdivideFace( a, b, c, detail ); - - } - - } - - function subdivideFace( a, b, c, detail ) { - - const cols = detail + 1; - - // we use this multidimensional array as a data structure for creating the subdivision - - const v = []; - - // construct all of the vertices for this subdivision - - for ( let i = 0; i <= cols; i ++ ) { - - v[ i ] = []; - - const aj = a.clone().lerp( c, i / cols ); - const bj = b.clone().lerp( c, i / cols ); - - const rows = cols - i; - - for ( let j = 0; j <= rows; j ++ ) { - - if ( j === 0 && i === cols ) { - - v[ i ][ j ] = aj; - - } else { - - v[ i ][ j ] = aj.clone().lerp( bj, j / rows ); - - } - - } - - } - - // construct all of the faces - - for ( let i = 0; i < cols; i ++ ) { - - for ( let j = 0; j < 2 * ( cols - i ) - 1; j ++ ) { - - const k = Math.floor( j / 2 ); - - if ( j % 2 === 0 ) { - - pushVertex( v[ i ][ k + 1 ] ); - pushVertex( v[ i + 1 ][ k ] ); - pushVertex( v[ i ][ k ] ); - - } else { - - pushVertex( v[ i ][ k + 1 ] ); - pushVertex( v[ i + 1 ][ k + 1 ] ); - pushVertex( v[ i + 1 ][ k ] ); - - } - - } - - } - - } - - function applyRadius( radius ) { - - const vertex = new Vector3(); - - // iterate over the entire buffer and apply the radius to each vertex - - for ( let i = 0; i < vertexBuffer.length; i += 3 ) { - - vertex.x = vertexBuffer[ i + 0 ]; - vertex.y = vertexBuffer[ i + 1 ]; - vertex.z = vertexBuffer[ i + 2 ]; - - vertex.normalize().multiplyScalar( radius ); - - vertexBuffer[ i + 0 ] = vertex.x; - vertexBuffer[ i + 1 ] = vertex.y; - vertexBuffer[ i + 2 ] = vertex.z; - - } - - } - - function generateUVs() { - - const vertex = new Vector3(); - - for ( let i = 0; i < vertexBuffer.length; i += 3 ) { - - vertex.x = vertexBuffer[ i + 0 ]; - vertex.y = vertexBuffer[ i + 1 ]; - vertex.z = vertexBuffer[ i + 2 ]; - - const u = azimuth( vertex ) / 2 / Math.PI + 0.5; - const v = inclination( vertex ) / Math.PI + 0.5; - uvBuffer.push( u, 1 - v ); - - } - - correctUVs(); - - correctSeam(); - - } - - function correctSeam() { - - // handle case when face straddles the seam, see #3269 - - for ( let i = 0; i < uvBuffer.length; i += 6 ) { - - // uv data of a single face - - const x0 = uvBuffer[ i + 0 ]; - const x1 = uvBuffer[ i + 2 ]; - const x2 = uvBuffer[ i + 4 ]; - - const max = Math.max( x0, x1, x2 ); - const min = Math.min( x0, x1, x2 ); - - // 0.9 is somewhat arbitrary - - if ( max > 0.9 && min < 0.1 ) { - - if ( x0 < 0.2 ) uvBuffer[ i + 0 ] += 1; - if ( x1 < 0.2 ) uvBuffer[ i + 2 ] += 1; - if ( x2 < 0.2 ) uvBuffer[ i + 4 ] += 1; - - } - - } - - } - - function pushVertex( vertex ) { - - vertexBuffer.push( vertex.x, vertex.y, vertex.z ); - - } - - function getVertexByIndex( index, vertex ) { - - const stride = index * 3; - - vertex.x = vertices[ stride + 0 ]; - vertex.y = vertices[ stride + 1 ]; - vertex.z = vertices[ stride + 2 ]; - - } - - function correctUVs() { - - const a = new Vector3(); - const b = new Vector3(); - const c = new Vector3(); - - const centroid = new Vector3(); - - const uvA = new Vector2(); - const uvB = new Vector2(); - const uvC = new Vector2(); - - for ( let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6 ) { - - a.set( vertexBuffer[ i + 0 ], vertexBuffer[ i + 1 ], vertexBuffer[ i + 2 ] ); - b.set( vertexBuffer[ i + 3 ], vertexBuffer[ i + 4 ], vertexBuffer[ i + 5 ] ); - c.set( vertexBuffer[ i + 6 ], vertexBuffer[ i + 7 ], vertexBuffer[ i + 8 ] ); - - uvA.set( uvBuffer[ j + 0 ], uvBuffer[ j + 1 ] ); - uvB.set( uvBuffer[ j + 2 ], uvBuffer[ j + 3 ] ); - uvC.set( uvBuffer[ j + 4 ], uvBuffer[ j + 5 ] ); - - centroid.copy( a ).add( b ).add( c ).divideScalar( 3 ); - - const azi = azimuth( centroid ); - - correctUV( uvA, j + 0, a, azi ); - correctUV( uvB, j + 2, b, azi ); - correctUV( uvC, j + 4, c, azi ); - - } - - } - - function correctUV( uv, stride, vector, azimuth ) { - - if ( ( azimuth < 0 ) && ( uv.x === 1 ) ) { - - uvBuffer[ stride ] = uv.x - 1; - - } - - if ( ( vector.x === 0 ) && ( vector.z === 0 ) ) { - - uvBuffer[ stride ] = azimuth / 2 / Math.PI + 0.5; - - } - - } - - // Angle around the Y axis, counter-clockwise when looking from above. - - function azimuth( vector ) { - - return Math.atan2( vector.z, - vector.x ); - - } - - - // Angle above the XZ plane. - - function inclination( vector ) { - - return Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) ); - - } - - } - -} - -class DodecahedronGeometry extends PolyhedronGeometry { - - constructor( radius = 1, detail = 0 ) { - - const t = ( 1 + Math.sqrt( 5 ) ) / 2; - const r = 1 / t; - - const vertices = [ - - // (±1, ±1, ±1) - - 1, - 1, - 1, - 1, - 1, 1, - - 1, 1, - 1, - 1, 1, 1, - 1, - 1, - 1, 1, - 1, 1, - 1, 1, - 1, 1, 1, 1, - - // (0, ±1/φ, ±φ) - 0, - r, - t, 0, - r, t, - 0, r, - t, 0, r, t, - - // (±1/φ, ±φ, 0) - - r, - t, 0, - r, t, 0, - r, - t, 0, r, t, 0, - - // (±φ, 0, ±1/φ) - - t, 0, - r, t, 0, - r, - - t, 0, r, t, 0, r - ]; - - const indices = [ - 3, 11, 7, 3, 7, 15, 3, 15, 13, - 7, 19, 17, 7, 17, 6, 7, 6, 15, - 17, 4, 8, 17, 8, 10, 17, 10, 6, - 8, 0, 16, 8, 16, 2, 8, 2, 10, - 0, 12, 1, 0, 1, 18, 0, 18, 16, - 6, 10, 2, 6, 2, 13, 6, 13, 15, - 2, 16, 18, 2, 18, 3, 2, 3, 13, - 18, 1, 9, 18, 9, 11, 18, 11, 3, - 4, 14, 12, 4, 12, 0, 4, 0, 8, - 11, 9, 5, 11, 5, 19, 11, 19, 7, - 19, 5, 14, 19, 14, 4, 19, 4, 17, - 1, 12, 14, 1, 14, 5, 1, 5, 9 - ]; - - super( vertices, indices, radius, detail ); - - this.type = 'DodecahedronGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - - } - -} - -const _v0$2 = new Vector3(); -const _v1$5 = new Vector3(); -const _normal$1 = new Vector3(); -const _triangle = new Triangle(); - -class EdgesGeometry extends BufferGeometry { - - constructor( geometry, thresholdAngle ) { - - super(); - - this.type = 'EdgesGeometry'; - - this.parameters = { - thresholdAngle: thresholdAngle - }; - - thresholdAngle = ( thresholdAngle !== undefined ) ? thresholdAngle : 1; - - if ( geometry.isGeometry === true ) { - - console.error( 'THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' ); - return; - - } - - const precisionPoints = 4; - const precision = Math.pow( 10, precisionPoints ); - const thresholdDot = Math.cos( MathUtils.DEG2RAD * thresholdAngle ); - - const indexAttr = geometry.getIndex(); - const positionAttr = geometry.getAttribute( 'position' ); - const indexCount = indexAttr ? indexAttr.count : positionAttr.count; - - const indexArr = [ 0, 0, 0 ]; - const vertKeys = [ 'a', 'b', 'c' ]; - const hashes = new Array( 3 ); - - const edgeData = {}; - const vertices = []; - for ( let i = 0; i < indexCount; i += 3 ) { - - if ( indexAttr ) { - - indexArr[ 0 ] = indexAttr.getX( i ); - indexArr[ 1 ] = indexAttr.getX( i + 1 ); - indexArr[ 2 ] = indexAttr.getX( i + 2 ); - - } else { - - indexArr[ 0 ] = i; - indexArr[ 1 ] = i + 1; - indexArr[ 2 ] = i + 2; - - } - - const { a, b, c } = _triangle; - a.fromBufferAttribute( positionAttr, indexArr[ 0 ] ); - b.fromBufferAttribute( positionAttr, indexArr[ 1 ] ); - c.fromBufferAttribute( positionAttr, indexArr[ 2 ] ); - _triangle.getNormal( _normal$1 ); - - // create hashes for the edge from the vertices - hashes[ 0 ] = `${ Math.round( a.x * precision ) },${ Math.round( a.y * precision ) },${ Math.round( a.z * precision ) }`; - hashes[ 1 ] = `${ Math.round( b.x * precision ) },${ Math.round( b.y * precision ) },${ Math.round( b.z * precision ) }`; - hashes[ 2 ] = `${ Math.round( c.x * precision ) },${ Math.round( c.y * precision ) },${ Math.round( c.z * precision ) }`; - - // skip degenerate triangles - if ( hashes[ 0 ] === hashes[ 1 ] || hashes[ 1 ] === hashes[ 2 ] || hashes[ 2 ] === hashes[ 0 ] ) { - - continue; - - } - - // iterate over every edge - for ( let j = 0; j < 3; j ++ ) { - - // get the first and next vertex making up the edge - const jNext = ( j + 1 ) % 3; - const vecHash0 = hashes[ j ]; - const vecHash1 = hashes[ jNext ]; - const v0 = _triangle[ vertKeys[ j ] ]; - const v1 = _triangle[ vertKeys[ jNext ] ]; - - const hash = `${ vecHash0 }_${ vecHash1 }`; - const reverseHash = `${ vecHash1 }_${ vecHash0 }`; - - if ( reverseHash in edgeData && edgeData[ reverseHash ] ) { - - // if we found a sibling edge add it into the vertex array if - // it meets the angle threshold and delete the edge from the map. - if ( _normal$1.dot( edgeData[ reverseHash ].normal ) <= thresholdDot ) { - - vertices.push( v0.x, v0.y, v0.z ); - vertices.push( v1.x, v1.y, v1.z ); - - } - - edgeData[ reverseHash ] = null; - - } else if ( ! ( hash in edgeData ) ) { - - // if we've already got an edge here then skip adding a new one - edgeData[ hash ] = { - - index0: indexArr[ j ], - index1: indexArr[ jNext ], - normal: _normal$1.clone(), - - }; - - } - - } - - } - - // iterate over all remaining, unmatched edges and add them to the vertex array - for ( const key in edgeData ) { - - if ( edgeData[ key ] ) { - - const { index0, index1 } = edgeData[ key ]; - _v0$2.fromBufferAttribute( positionAttr, index0 ); - _v1$5.fromBufferAttribute( positionAttr, index1 ); - - vertices.push( _v0$2.x, _v0$2.y, _v0$2.z ); - vertices.push( _v1$5.x, _v1$5.y, _v1$5.z ); - - } - - } - - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - - } - -} - -/** - * Port from https://github.com/mapbox/earcut (v2.2.2) - */ - -const Earcut = { - - triangulate: function ( data, holeIndices, dim ) { - - dim = dim || 2; - - const hasHoles = holeIndices && holeIndices.length; - const outerLen = hasHoles ? holeIndices[ 0 ] * dim : data.length; - let outerNode = linkedList( data, 0, outerLen, dim, true ); - const triangles = []; - - if ( ! outerNode || outerNode.next === outerNode.prev ) return triangles; - - let minX, minY, maxX, maxY, x, y, invSize; - - if ( hasHoles ) outerNode = eliminateHoles( data, holeIndices, outerNode, dim ); - - // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox - if ( data.length > 80 * dim ) { - - minX = maxX = data[ 0 ]; - minY = maxY = data[ 1 ]; - - for ( let i = dim; i < outerLen; i += dim ) { - - x = data[ i ]; - y = data[ i + 1 ]; - if ( x < minX ) minX = x; - if ( y < minY ) minY = y; - if ( x > maxX ) maxX = x; - if ( y > maxY ) maxY = y; - - } - - // minX, minY and invSize are later used to transform coords into integers for z-order calculation - invSize = Math.max( maxX - minX, maxY - minY ); - invSize = invSize !== 0 ? 1 / invSize : 0; - - } - - earcutLinked( outerNode, triangles, dim, minX, minY, invSize ); - - return triangles; - - } - -}; - -// create a circular doubly linked list from polygon points in the specified winding order -function linkedList( data, start, end, dim, clockwise ) { - - let i, last; - - if ( clockwise === ( signedArea( data, start, end, dim ) > 0 ) ) { - - for ( i = start; i < end; i += dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last ); - - } else { - - for ( i = end - dim; i >= start; i -= dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last ); - - } - - if ( last && equals( last, last.next ) ) { - - removeNode( last ); - last = last.next; - - } - - return last; - -} - -// eliminate colinear or duplicate points -function filterPoints( start, end ) { - - if ( ! start ) return start; - if ( ! end ) end = start; - - let p = start, - again; - do { - - again = false; - - if ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) { - - removeNode( p ); - p = end = p.prev; - if ( p === p.next ) break; - again = true; - - } else { - - p = p.next; - - } - - } while ( again || p !== end ); - - return end; - -} - -// main ear slicing loop which triangulates a polygon (given as a linked list) -function earcutLinked( ear, triangles, dim, minX, minY, invSize, pass ) { - - if ( ! ear ) return; - - // interlink polygon nodes in z-order - if ( ! pass && invSize ) indexCurve( ear, minX, minY, invSize ); - - let stop = ear, - prev, next; - - // iterate through ears, slicing them one by one - while ( ear.prev !== ear.next ) { - - prev = ear.prev; - next = ear.next; - - if ( invSize ? isEarHashed( ear, minX, minY, invSize ) : isEar( ear ) ) { - - // cut off the triangle - triangles.push( prev.i / dim ); - triangles.push( ear.i / dim ); - triangles.push( next.i / dim ); - - removeNode( ear ); - - // skipping the next vertex leads to less sliver triangles - ear = next.next; - stop = next.next; - - continue; - - } - - ear = next; - - // if we looped through the whole remaining polygon and can't find any more ears - if ( ear === stop ) { - - // try filtering points and slicing again - if ( ! pass ) { - - earcutLinked( filterPoints( ear ), triangles, dim, minX, minY, invSize, 1 ); - - // if this didn't work, try curing all small self-intersections locally - - } else if ( pass === 1 ) { - - ear = cureLocalIntersections( filterPoints( ear ), triangles, dim ); - earcutLinked( ear, triangles, dim, minX, minY, invSize, 2 ); - - // as a last resort, try splitting the remaining polygon into two - - } else if ( pass === 2 ) { - - splitEarcut( ear, triangles, dim, minX, minY, invSize ); - - } - - break; - - } - - } - -} - -// check whether a polygon node forms a valid ear with adjacent nodes -function isEar( ear ) { - - const a = ear.prev, - b = ear, - c = ear.next; - - if ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear - - // now make sure we don't have other points inside the potential ear - let p = ear.next.next; - - while ( p !== ear.prev ) { - - if ( pointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y ) && - area( p.prev, p, p.next ) >= 0 ) return false; - p = p.next; - - } - - return true; - -} - -function isEarHashed( ear, minX, minY, invSize ) { - - const a = ear.prev, - b = ear, - c = ear.next; - - if ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear - - // triangle bbox; min & max are calculated like this for speed - const minTX = a.x < b.x ? ( a.x < c.x ? a.x : c.x ) : ( b.x < c.x ? b.x : c.x ), - minTY = a.y < b.y ? ( a.y < c.y ? a.y : c.y ) : ( b.y < c.y ? b.y : c.y ), - maxTX = a.x > b.x ? ( a.x > c.x ? a.x : c.x ) : ( b.x > c.x ? b.x : c.x ), - maxTY = a.y > b.y ? ( a.y > c.y ? a.y : c.y ) : ( b.y > c.y ? b.y : c.y ); - - // z-order range for the current triangle bbox; - const minZ = zOrder( minTX, minTY, minX, minY, invSize ), - maxZ = zOrder( maxTX, maxTY, minX, minY, invSize ); - - let p = ear.prevZ, - n = ear.nextZ; - - // look for points inside the triangle in both directions - while ( p && p.z >= minZ && n && n.z <= maxZ ) { - - if ( p !== ear.prev && p !== ear.next && - pointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y ) && - area( p.prev, p, p.next ) >= 0 ) return false; - p = p.prevZ; - - if ( n !== ear.prev && n !== ear.next && - pointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y ) && - area( n.prev, n, n.next ) >= 0 ) return false; - n = n.nextZ; - - } - - // look for remaining points in decreasing z-order - while ( p && p.z >= minZ ) { - - if ( p !== ear.prev && p !== ear.next && - pointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y ) && - area( p.prev, p, p.next ) >= 0 ) return false; - p = p.prevZ; - - } - - // look for remaining points in increasing z-order - while ( n && n.z <= maxZ ) { - - if ( n !== ear.prev && n !== ear.next && - pointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y ) && - area( n.prev, n, n.next ) >= 0 ) return false; - n = n.nextZ; - - } - - return true; - -} - -// go through all polygon nodes and cure small local self-intersections -function cureLocalIntersections( start, triangles, dim ) { - - let p = start; - do { - - const a = p.prev, - b = p.next.next; - - if ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) { - - triangles.push( a.i / dim ); - triangles.push( p.i / dim ); - triangles.push( b.i / dim ); - - // remove two nodes involved - removeNode( p ); - removeNode( p.next ); - - p = start = b; - - } - - p = p.next; - - } while ( p !== start ); - - return filterPoints( p ); - -} - -// try splitting polygon into two and triangulate them independently -function splitEarcut( start, triangles, dim, minX, minY, invSize ) { - - // look for a valid diagonal that divides the polygon into two - let a = start; - do { - - let b = a.next.next; - while ( b !== a.prev ) { - - if ( a.i !== b.i && isValidDiagonal( a, b ) ) { - - // split the polygon in two by the diagonal - let c = splitPolygon( a, b ); - - // filter colinear points around the cuts - a = filterPoints( a, a.next ); - c = filterPoints( c, c.next ); - - // run earcut on each half - earcutLinked( a, triangles, dim, minX, minY, invSize ); - earcutLinked( c, triangles, dim, minX, minY, invSize ); - return; - - } - - b = b.next; - - } - - a = a.next; - - } while ( a !== start ); - -} - -// link every hole into the outer loop, producing a single-ring polygon without holes -function eliminateHoles( data, holeIndices, outerNode, dim ) { - - const queue = []; - let i, len, start, end, list; - - for ( i = 0, len = holeIndices.length; i < len; i ++ ) { - - start = holeIndices[ i ] * dim; - end = i < len - 1 ? holeIndices[ i + 1 ] * dim : data.length; - list = linkedList( data, start, end, dim, false ); - if ( list === list.next ) list.steiner = true; - queue.push( getLeftmost( list ) ); - - } - - queue.sort( compareX ); - - // process holes from left to right - for ( i = 0; i < queue.length; i ++ ) { - - eliminateHole( queue[ i ], outerNode ); - outerNode = filterPoints( outerNode, outerNode.next ); - - } - - return outerNode; - -} - -function compareX( a, b ) { - - return a.x - b.x; - -} - -// find a bridge between vertices that connects hole with an outer ring and and link it -function eliminateHole( hole, outerNode ) { - - outerNode = findHoleBridge( hole, outerNode ); - if ( outerNode ) { - - const b = splitPolygon( outerNode, hole ); - - // filter collinear points around the cuts - filterPoints( outerNode, outerNode.next ); - filterPoints( b, b.next ); - - } - -} - -// David Eberly's algorithm for finding a bridge between hole and outer polygon -function findHoleBridge( hole, outerNode ) { - - let p = outerNode; - const hx = hole.x; - const hy = hole.y; - let qx = - Infinity, m; - - // find a segment intersected by a ray from the hole's leftmost point to the left; - // segment's endpoint with lesser x will be potential connection point - do { - - if ( hy <= p.y && hy >= p.next.y && p.next.y !== p.y ) { - - const x = p.x + ( hy - p.y ) * ( p.next.x - p.x ) / ( p.next.y - p.y ); - if ( x <= hx && x > qx ) { - - qx = x; - if ( x === hx ) { - - if ( hy === p.y ) return p; - if ( hy === p.next.y ) return p.next; - - } - - m = p.x < p.next.x ? p : p.next; - - } - - } - - p = p.next; - - } while ( p !== outerNode ); - - if ( ! m ) return null; - - if ( hx === qx ) return m; // hole touches outer segment; pick leftmost endpoint - - // look for points inside the triangle of hole point, segment intersection and endpoint; - // if there are no points found, we have a valid connection; - // otherwise choose the point of the minimum angle with the ray as connection point - - const stop = m, - mx = m.x, - my = m.y; - let tanMin = Infinity, tan; - - p = m; - - do { - - if ( hx >= p.x && p.x >= mx && hx !== p.x && - pointInTriangle( hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y ) ) { - - tan = Math.abs( hy - p.y ) / ( hx - p.x ); // tangential - - if ( locallyInside( p, hole ) && ( tan < tanMin || ( tan === tanMin && ( p.x > m.x || ( p.x === m.x && sectorContainsSector( m, p ) ) ) ) ) ) { - - m = p; - tanMin = tan; - - } - - } - - p = p.next; - - } while ( p !== stop ); - - return m; - -} - -// whether sector in vertex m contains sector in vertex p in the same coordinates -function sectorContainsSector( m, p ) { - - return area( m.prev, m, p.prev ) < 0 && area( p.next, m, m.next ) < 0; - -} - -// interlink polygon nodes in z-order -function indexCurve( start, minX, minY, invSize ) { - - let p = start; - do { - - if ( p.z === null ) p.z = zOrder( p.x, p.y, minX, minY, invSize ); - p.prevZ = p.prev; - p.nextZ = p.next; - p = p.next; - - } while ( p !== start ); - - p.prevZ.nextZ = null; - p.prevZ = null; - - sortLinked( p ); - -} - -// Simon Tatham's linked list merge sort algorithm -// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html -function sortLinked( list ) { - - let i, p, q, e, tail, numMerges, pSize, qSize, - inSize = 1; - - do { - - p = list; - list = null; - tail = null; - numMerges = 0; - - while ( p ) { - - numMerges ++; - q = p; - pSize = 0; - for ( i = 0; i < inSize; i ++ ) { - - pSize ++; - q = q.nextZ; - if ( ! q ) break; - - } - - qSize = inSize; - - while ( pSize > 0 || ( qSize > 0 && q ) ) { - - if ( pSize !== 0 && ( qSize === 0 || ! q || p.z <= q.z ) ) { - - e = p; - p = p.nextZ; - pSize --; - - } else { - - e = q; - q = q.nextZ; - qSize --; - - } - - if ( tail ) tail.nextZ = e; - else list = e; - - e.prevZ = tail; - tail = e; - - } - - p = q; - - } - - tail.nextZ = null; - inSize *= 2; - - } while ( numMerges > 1 ); - - return list; - -} - -// z-order of a point given coords and inverse of the longer side of data bbox -function zOrder( x, y, minX, minY, invSize ) { - - // coords are transformed into non-negative 15-bit integer range - x = 32767 * ( x - minX ) * invSize; - y = 32767 * ( y - minY ) * invSize; - - x = ( x | ( x << 8 ) ) & 0x00FF00FF; - x = ( x | ( x << 4 ) ) & 0x0F0F0F0F; - x = ( x | ( x << 2 ) ) & 0x33333333; - x = ( x | ( x << 1 ) ) & 0x55555555; - - y = ( y | ( y << 8 ) ) & 0x00FF00FF; - y = ( y | ( y << 4 ) ) & 0x0F0F0F0F; - y = ( y | ( y << 2 ) ) & 0x33333333; - y = ( y | ( y << 1 ) ) & 0x55555555; - - return x | ( y << 1 ); - -} - -// find the leftmost node of a polygon ring -function getLeftmost( start ) { - - let p = start, - leftmost = start; - do { - - if ( p.x < leftmost.x || ( p.x === leftmost.x && p.y < leftmost.y ) ) leftmost = p; - p = p.next; - - } while ( p !== start ); - - return leftmost; - -} - -// check if a point lies within a convex triangle -function pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) { - - return ( cx - px ) * ( ay - py ) - ( ax - px ) * ( cy - py ) >= 0 && - ( ax - px ) * ( by - py ) - ( bx - px ) * ( ay - py ) >= 0 && - ( bx - px ) * ( cy - py ) - ( cx - px ) * ( by - py ) >= 0; - -} - -// check if a diagonal between two polygon nodes is valid (lies in polygon interior) -function isValidDiagonal( a, b ) { - - return a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) && // dones't intersect other edges - ( locallyInside( a, b ) && locallyInside( b, a ) && middleInside( a, b ) && // locally visible - ( area( a.prev, a, b.prev ) || area( a, b.prev, b ) ) || // does not create opposite-facing sectors - equals( a, b ) && area( a.prev, a, a.next ) > 0 && area( b.prev, b, b.next ) > 0 ); // special zero-length case - -} - -// signed area of a triangle -function area( p, q, r ) { - - return ( q.y - p.y ) * ( r.x - q.x ) - ( q.x - p.x ) * ( r.y - q.y ); - -} - -// check if two points are equal -function equals( p1, p2 ) { - - return p1.x === p2.x && p1.y === p2.y; - -} - -// check if two segments intersect -function intersects( p1, q1, p2, q2 ) { - - const o1 = sign( area( p1, q1, p2 ) ); - const o2 = sign( area( p1, q1, q2 ) ); - const o3 = sign( area( p2, q2, p1 ) ); - const o4 = sign( area( p2, q2, q1 ) ); - - if ( o1 !== o2 && o3 !== o4 ) return true; // general case - - if ( o1 === 0 && onSegment( p1, p2, q1 ) ) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1 - if ( o2 === 0 && onSegment( p1, q2, q1 ) ) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1 - if ( o3 === 0 && onSegment( p2, p1, q2 ) ) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2 - if ( o4 === 0 && onSegment( p2, q1, q2 ) ) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2 - - return false; - -} - -// for collinear points p, q, r, check if point q lies on segment pr -function onSegment( p, q, r ) { - - return q.x <= Math.max( p.x, r.x ) && q.x >= Math.min( p.x, r.x ) && q.y <= Math.max( p.y, r.y ) && q.y >= Math.min( p.y, r.y ); - -} - -function sign( num ) { - - return num > 0 ? 1 : num < 0 ? - 1 : 0; - -} - -// check if a polygon diagonal intersects any polygon segments -function intersectsPolygon( a, b ) { - - let p = a; - do { - - if ( p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && - intersects( p, p.next, a, b ) ) return true; - p = p.next; - - } while ( p !== a ); - - return false; - -} - -// check if a polygon diagonal is locally inside the polygon -function locallyInside( a, b ) { - - return area( a.prev, a, a.next ) < 0 ? - area( a, b, a.next ) >= 0 && area( a, a.prev, b ) >= 0 : - area( a, b, a.prev ) < 0 || area( a, a.next, b ) < 0; - -} - -// check if the middle point of a polygon diagonal is inside the polygon -function middleInside( a, b ) { - - let p = a, - inside = false; - const px = ( a.x + b.x ) / 2, - py = ( a.y + b.y ) / 2; - do { - - if ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y && - ( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) ) - inside = ! inside; - p = p.next; - - } while ( p !== a ); - - return inside; - -} - -// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; -// if one belongs to the outer ring and another to a hole, it merges it into a single ring -function splitPolygon( a, b ) { - - const a2 = new Node( a.i, a.x, a.y ), - b2 = new Node( b.i, b.x, b.y ), - an = a.next, - bp = b.prev; - - a.next = b; - b.prev = a; - - a2.next = an; - an.prev = a2; - - b2.next = a2; - a2.prev = b2; - - bp.next = b2; - b2.prev = bp; - - return b2; - -} - -// create a node and optionally link it with previous one (in a circular doubly linked list) -function insertNode( i, x, y, last ) { - - const p = new Node( i, x, y ); - - if ( ! last ) { - - p.prev = p; - p.next = p; - - } else { - - p.next = last.next; - p.prev = last; - last.next.prev = p; - last.next = p; - - } - - return p; - -} - -function removeNode( p ) { - - p.next.prev = p.prev; - p.prev.next = p.next; - - if ( p.prevZ ) p.prevZ.nextZ = p.nextZ; - if ( p.nextZ ) p.nextZ.prevZ = p.prevZ; - -} - -function Node( i, x, y ) { - - // vertex index in coordinates array - this.i = i; - - // vertex coordinates - this.x = x; - this.y = y; - - // previous and next vertex nodes in a polygon ring - this.prev = null; - this.next = null; - - // z-order curve value - this.z = null; - - // previous and next nodes in z-order - this.prevZ = null; - this.nextZ = null; - - // indicates whether this is a steiner point - this.steiner = false; - -} - -function signedArea( data, start, end, dim ) { - - let sum = 0; - for ( let i = start, j = end - dim; i < end; i += dim ) { - - sum += ( data[ j ] - data[ i ] ) * ( data[ i + 1 ] + data[ j + 1 ] ); - j = i; - - } - - return sum; - -} - -const ShapeUtils = { - - // calculate area of the contour polygon - - area: function ( contour ) { - - const n = contour.length; - let a = 0.0; - - for ( let p = n - 1, q = 0; q < n; p = q ++ ) { - - a += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y; - - } - - return a * 0.5; - - }, - - isClockWise: function ( pts ) { - - return ShapeUtils.area( pts ) < 0; - - }, - - triangulateShape: function ( contour, holes ) { - - const vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ] - const holeIndices = []; // array of hole indices - const faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ] - - removeDupEndPts( contour ); - addContour( vertices, contour ); - - // - - let holeIndex = contour.length; - - holes.forEach( removeDupEndPts ); - - for ( let i = 0; i < holes.length; i ++ ) { - - holeIndices.push( holeIndex ); - holeIndex += holes[ i ].length; - addContour( vertices, holes[ i ] ); - - } - - // - - const triangles = Earcut.triangulate( vertices, holeIndices ); - - // - - for ( let i = 0; i < triangles.length; i += 3 ) { - - faces.push( triangles.slice( i, i + 3 ) ); - - } - - return faces; - - } - -}; - -function removeDupEndPts( points ) { - - const l = points.length; - - if ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) { - - points.pop(); - - } - -} - -function addContour( vertices, contour ) { - - for ( let i = 0; i < contour.length; i ++ ) { - - vertices.push( contour[ i ].x ); - vertices.push( contour[ i ].y ); - - } - -} - -/** - * Creates extruded geometry from a path shape. - * - * parameters = { - * - * curveSegments: , // number of points on the curves - * steps: , // number of points for z-side extrusions / used for subdividing segments of extrude spline too - * depth: , // Depth to extrude the shape - * - * bevelEnabled: , // turn on bevel - * bevelThickness: , // how deep into the original shape bevel goes - * bevelSize: , // how far from shape outline (including bevelOffset) is bevel - * bevelOffset: , // how far from shape outline does bevel start - * bevelSegments: , // number of bevel layers - * - * extrudePath: // curve to extrude shape along - * - * UVGenerator: // object that provides UV generator functions - * - * } - */ - -class ExtrudeGeometry extends BufferGeometry { - - constructor( shapes, options ) { - - super(); - - this.type = 'ExtrudeGeometry'; - - this.parameters = { - shapes: shapes, - options: options - }; - - shapes = Array.isArray( shapes ) ? shapes : [ shapes ]; - - const scope = this; - - const verticesArray = []; - const uvArray = []; - - for ( let i = 0, l = shapes.length; i < l; i ++ ) { - - const shape = shapes[ i ]; - addShape( shape ); - - } - - // build geometry - - this.setAttribute( 'position', new Float32BufferAttribute( verticesArray, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvArray, 2 ) ); - - this.computeVertexNormals(); - - // functions - - function addShape( shape ) { - - const placeholder = []; - - // options - - const curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12; - const steps = options.steps !== undefined ? options.steps : 1; - let depth = options.depth !== undefined ? options.depth : 100; - - let bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true; - let bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6; - let bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 2; - let bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0; - let bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3; - - const extrudePath = options.extrudePath; - - const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator; - - // deprecated options - - if ( options.amount !== undefined ) { - - console.warn( 'THREE.ExtrudeBufferGeometry: amount has been renamed to depth.' ); - depth = options.amount; - - } - - // - - let extrudePts, extrudeByPath = false; - let splineTube, binormal, normal, position2; - - if ( extrudePath ) { - - extrudePts = extrudePath.getSpacedPoints( steps ); - - extrudeByPath = true; - bevelEnabled = false; // bevels not supported for path extrusion - - // SETUP TNB variables - - // TODO1 - have a .isClosed in spline? - - splineTube = extrudePath.computeFrenetFrames( steps, false ); - - // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length); - - binormal = new Vector3(); - normal = new Vector3(); - position2 = new Vector3(); - - } - - // Safeguards if bevels are not enabled - - if ( ! bevelEnabled ) { - - bevelSegments = 0; - bevelThickness = 0; - bevelSize = 0; - bevelOffset = 0; - - } - - // Variables initialization - - const shapePoints = shape.extractPoints( curveSegments ); - - let vertices = shapePoints.shape; - const holes = shapePoints.holes; - - const reverse = ! ShapeUtils.isClockWise( vertices ); - - if ( reverse ) { - - vertices = vertices.reverse(); - - // Maybe we should also check if holes are in the opposite direction, just to be safe ... - - for ( let h = 0, hl = holes.length; h < hl; h ++ ) { - - const ahole = holes[ h ]; - - if ( ShapeUtils.isClockWise( ahole ) ) { - - holes[ h ] = ahole.reverse(); - - } - - } - - } - - - const faces = ShapeUtils.triangulateShape( vertices, holes ); - - /* Vertices */ - - const contour = vertices; // vertices has all points but contour has only points of circumference - - for ( let h = 0, hl = holes.length; h < hl; h ++ ) { - - const ahole = holes[ h ]; - - vertices = vertices.concat( ahole ); - - } - - - function scalePt2( pt, vec, size ) { - - if ( ! vec ) console.error( 'THREE.ExtrudeGeometry: vec does not exist' ); - - return vec.clone().multiplyScalar( size ).add( pt ); - - } - - const vlen = vertices.length, flen = faces.length; - - - // Find directions for point movement - - - function getBevelVec( inPt, inPrev, inNext ) { - - // computes for inPt the corresponding point inPt' on a new contour - // shifted by 1 unit (length of normalized vector) to the left - // if we walk along contour clockwise, this new contour is outside the old one - // - // inPt' is the intersection of the two lines parallel to the two - // adjacent edges of inPt at a distance of 1 unit on the left side. - - let v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt - - // good reading for geometry algorithms (here: line-line intersection) - // http://geomalgorithms.com/a05-_intersect-1.html - - const v_prev_x = inPt.x - inPrev.x, - v_prev_y = inPt.y - inPrev.y; - const v_next_x = inNext.x - inPt.x, - v_next_y = inNext.y - inPt.y; - - const v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y ); - - // check for collinear edges - const collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x ); - - if ( Math.abs( collinear0 ) > Number.EPSILON ) { - - // not collinear - - // length of vectors for normalizing - - const v_prev_len = Math.sqrt( v_prev_lensq ); - const v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y ); - - // shift adjacent points by unit vectors to the left - - const ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len ); - const ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len ); - - const ptNextShift_x = ( inNext.x - v_next_y / v_next_len ); - const ptNextShift_y = ( inNext.y + v_next_x / v_next_len ); - - // scaling factor for v_prev to intersection point - - const sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y - - ( ptNextShift_y - ptPrevShift_y ) * v_next_x ) / - ( v_prev_x * v_next_y - v_prev_y * v_next_x ); - - // vector from inPt to intersection point - - v_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x ); - v_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y ); - - // Don't normalize!, otherwise sharp corners become ugly - // but prevent crazy spikes - const v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y ); - if ( v_trans_lensq <= 2 ) { - - return new Vector2( v_trans_x, v_trans_y ); - - } else { - - shrink_by = Math.sqrt( v_trans_lensq / 2 ); - - } - - } else { - - // handle special case of collinear edges - - let direction_eq = false; // assumes: opposite - - if ( v_prev_x > Number.EPSILON ) { - - if ( v_next_x > Number.EPSILON ) { - - direction_eq = true; - - } - - } else { - - if ( v_prev_x < - Number.EPSILON ) { - - if ( v_next_x < - Number.EPSILON ) { - - direction_eq = true; - - } - - } else { - - if ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) { - - direction_eq = true; - - } - - } - - } - - if ( direction_eq ) { - - // console.log("Warning: lines are a straight sequence"); - v_trans_x = - v_prev_y; - v_trans_y = v_prev_x; - shrink_by = Math.sqrt( v_prev_lensq ); - - } else { - - // console.log("Warning: lines are a straight spike"); - v_trans_x = v_prev_x; - v_trans_y = v_prev_y; - shrink_by = Math.sqrt( v_prev_lensq / 2 ); - - } - - } - - return new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by ); - - } - - - const contourMovements = []; - - for ( let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) { - - if ( j === il ) j = 0; - if ( k === il ) k = 0; - - // (j)---(i)---(k) - // console.log('i,j,k', i, j , k) - - contourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] ); - - } - - const holesMovements = []; - let oneHoleMovements, verticesMovements = contourMovements.concat(); - - for ( let h = 0, hl = holes.length; h < hl; h ++ ) { - - const ahole = holes[ h ]; - - oneHoleMovements = []; - - for ( let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) { - - if ( j === il ) j = 0; - if ( k === il ) k = 0; - - // (j)---(i)---(k) - oneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] ); - - } - - holesMovements.push( oneHoleMovements ); - verticesMovements = verticesMovements.concat( oneHoleMovements ); - - } - - - // Loop bevelSegments, 1 for the front, 1 for the back - - for ( let b = 0; b < bevelSegments; b ++ ) { - - //for ( b = bevelSegments; b > 0; b -- ) { - - const t = b / bevelSegments; - const z = bevelThickness * Math.cos( t * Math.PI / 2 ); - const bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset; - - // contract shape - - for ( let i = 0, il = contour.length; i < il; i ++ ) { - - const vert = scalePt2( contour[ i ], contourMovements[ i ], bs ); - - v( vert.x, vert.y, - z ); - - } - - // expand holes - - for ( let h = 0, hl = holes.length; h < hl; h ++ ) { - - const ahole = holes[ h ]; - oneHoleMovements = holesMovements[ h ]; - - for ( let i = 0, il = ahole.length; i < il; i ++ ) { - - const vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs ); - - v( vert.x, vert.y, - z ); - - } - - } - - } - - const bs = bevelSize + bevelOffset; - - // Back facing vertices - - for ( let i = 0; i < vlen; i ++ ) { - - const vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ]; - - if ( ! extrudeByPath ) { - - v( vert.x, vert.y, 0 ); - - } else { - - // v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x ); - - normal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x ); - binormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y ); - - position2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal ); - - v( position2.x, position2.y, position2.z ); - - } - - } - - // Add stepped vertices... - // Including front facing vertices - - for ( let s = 1; s <= steps; s ++ ) { - - for ( let i = 0; i < vlen; i ++ ) { - - const vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ]; - - if ( ! extrudeByPath ) { - - v( vert.x, vert.y, depth / steps * s ); - - } else { - - // v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x ); - - normal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x ); - binormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y ); - - position2.copy( extrudePts[ s ] ).add( normal ).add( binormal ); - - v( position2.x, position2.y, position2.z ); - - } - - } - - } - - - // Add bevel segments planes - - //for ( b = 1; b <= bevelSegments; b ++ ) { - for ( let b = bevelSegments - 1; b >= 0; b -- ) { - - const t = b / bevelSegments; - const z = bevelThickness * Math.cos( t * Math.PI / 2 ); - const bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset; - - // contract shape - - for ( let i = 0, il = contour.length; i < il; i ++ ) { - - const vert = scalePt2( contour[ i ], contourMovements[ i ], bs ); - v( vert.x, vert.y, depth + z ); - - } - - // expand holes - - for ( let h = 0, hl = holes.length; h < hl; h ++ ) { - - const ahole = holes[ h ]; - oneHoleMovements = holesMovements[ h ]; - - for ( let i = 0, il = ahole.length; i < il; i ++ ) { - - const vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs ); - - if ( ! extrudeByPath ) { - - v( vert.x, vert.y, depth + z ); - - } else { - - v( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z ); - - } - - } - - } - - } - - /* Faces */ - - // Top and bottom faces - - buildLidFaces(); - - // Sides faces - - buildSideFaces(); - - - ///// Internal functions - - function buildLidFaces() { - - const start = verticesArray.length / 3; - - if ( bevelEnabled ) { - - let layer = 0; // steps + 1 - let offset = vlen * layer; - - // Bottom faces - - for ( let i = 0; i < flen; i ++ ) { - - const face = faces[ i ]; - f3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset ); - - } - - layer = steps + bevelSegments * 2; - offset = vlen * layer; - - // Top faces - - for ( let i = 0; i < flen; i ++ ) { - - const face = faces[ i ]; - f3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset ); - - } - - } else { - - // Bottom faces - - for ( let i = 0; i < flen; i ++ ) { - - const face = faces[ i ]; - f3( face[ 2 ], face[ 1 ], face[ 0 ] ); - - } - - // Top faces - - for ( let i = 0; i < flen; i ++ ) { - - const face = faces[ i ]; - f3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps ); - - } - - } - - scope.addGroup( start, verticesArray.length / 3 - start, 0 ); - - } - - // Create faces for the z-sides of the shape - - function buildSideFaces() { - - const start = verticesArray.length / 3; - let layeroffset = 0; - sidewalls( contour, layeroffset ); - layeroffset += contour.length; - - for ( let h = 0, hl = holes.length; h < hl; h ++ ) { - - const ahole = holes[ h ]; - sidewalls( ahole, layeroffset ); - - //, true - layeroffset += ahole.length; - - } - - - scope.addGroup( start, verticesArray.length / 3 - start, 1 ); - - - } - - function sidewalls( contour, layeroffset ) { - - let i = contour.length; - - while ( -- i >= 0 ) { - - const j = i; - let k = i - 1; - if ( k < 0 ) k = contour.length - 1; - - //console.log('b', i,j, i-1, k,vertices.length); - - for ( let s = 0, sl = ( steps + bevelSegments * 2 ); s < sl; s ++ ) { - - const slen1 = vlen * s; - const slen2 = vlen * ( s + 1 ); - - const a = layeroffset + j + slen1, - b = layeroffset + k + slen1, - c = layeroffset + k + slen2, - d = layeroffset + j + slen2; - - f4( a, b, c, d ); - - } - - } - - } - - function v( x, y, z ) { - - placeholder.push( x ); - placeholder.push( y ); - placeholder.push( z ); - - } - - - function f3( a, b, c ) { - - addVertex( a ); - addVertex( b ); - addVertex( c ); - - const nextIndex = verticesArray.length / 3; - const uvs = uvgen.generateTopUV( scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1 ); - - addUV( uvs[ 0 ] ); - addUV( uvs[ 1 ] ); - addUV( uvs[ 2 ] ); - - } - - function f4( a, b, c, d ) { - - addVertex( a ); - addVertex( b ); - addVertex( d ); - - addVertex( b ); - addVertex( c ); - addVertex( d ); - - - const nextIndex = verticesArray.length / 3; - const uvs = uvgen.generateSideWallUV( scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1 ); - - addUV( uvs[ 0 ] ); - addUV( uvs[ 1 ] ); - addUV( uvs[ 3 ] ); - - addUV( uvs[ 1 ] ); - addUV( uvs[ 2 ] ); - addUV( uvs[ 3 ] ); - - } - - function addVertex( index ) { - - verticesArray.push( placeholder[ index * 3 + 0 ] ); - verticesArray.push( placeholder[ index * 3 + 1 ] ); - verticesArray.push( placeholder[ index * 3 + 2 ] ); - - } - - - function addUV( vector2 ) { - - uvArray.push( vector2.x ); - uvArray.push( vector2.y ); - - } - - } - - } - - toJSON() { - - const data = BufferGeometry.prototype.toJSON.call( this ); - - const shapes = this.parameters.shapes; - const options = this.parameters.options; - - return toJSON( shapes, options, data ); - - } - -} - -const WorldUVGenerator = { - - generateTopUV: function ( geometry, vertices, indexA, indexB, indexC ) { - - const a_x = vertices[ indexA * 3 ]; - const a_y = vertices[ indexA * 3 + 1 ]; - const b_x = vertices[ indexB * 3 ]; - const b_y = vertices[ indexB * 3 + 1 ]; - const c_x = vertices[ indexC * 3 ]; - const c_y = vertices[ indexC * 3 + 1 ]; - - return [ - new Vector2( a_x, a_y ), - new Vector2( b_x, b_y ), - new Vector2( c_x, c_y ) - ]; - - }, - - generateSideWallUV: function ( geometry, vertices, indexA, indexB, indexC, indexD ) { - - const a_x = vertices[ indexA * 3 ]; - const a_y = vertices[ indexA * 3 + 1 ]; - const a_z = vertices[ indexA * 3 + 2 ]; - const b_x = vertices[ indexB * 3 ]; - const b_y = vertices[ indexB * 3 + 1 ]; - const b_z = vertices[ indexB * 3 + 2 ]; - const c_x = vertices[ indexC * 3 ]; - const c_y = vertices[ indexC * 3 + 1 ]; - const c_z = vertices[ indexC * 3 + 2 ]; - const d_x = vertices[ indexD * 3 ]; - const d_y = vertices[ indexD * 3 + 1 ]; - const d_z = vertices[ indexD * 3 + 2 ]; - - if ( Math.abs( a_y - b_y ) < 0.01 ) { - - return [ - new Vector2( a_x, 1 - a_z ), - new Vector2( b_x, 1 - b_z ), - new Vector2( c_x, 1 - c_z ), - new Vector2( d_x, 1 - d_z ) - ]; - - } else { - - return [ - new Vector2( a_y, 1 - a_z ), - new Vector2( b_y, 1 - b_z ), - new Vector2( c_y, 1 - c_z ), - new Vector2( d_y, 1 - d_z ) - ]; - - } - - } - -}; - -function toJSON( shapes, options, data ) { - - data.shapes = []; - - if ( Array.isArray( shapes ) ) { - - for ( let i = 0, l = shapes.length; i < l; i ++ ) { - - const shape = shapes[ i ]; - - data.shapes.push( shape.uuid ); - - } - - } else { - - data.shapes.push( shapes.uuid ); - - } - - if ( options.extrudePath !== undefined ) data.options.extrudePath = options.extrudePath.toJSON(); - - return data; - -} - -class IcosahedronGeometry extends PolyhedronGeometry { - - constructor( radius = 1, detail = 0 ) { - - const t = ( 1 + Math.sqrt( 5 ) ) / 2; - - const vertices = [ - - 1, t, 0, 1, t, 0, - 1, - t, 0, 1, - t, 0, - 0, - 1, t, 0, 1, t, 0, - 1, - t, 0, 1, - t, - t, 0, - 1, t, 0, 1, - t, 0, - 1, - t, 0, 1 - ]; - - const indices = [ - 0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11, - 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8, - 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9, - 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1 - ]; - - super( vertices, indices, radius, detail ); - - this.type = 'IcosahedronGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - - } - -} - -class LatheGeometry extends BufferGeometry { - - constructor( points, segments = 12, phiStart = 0, phiLength = Math.PI * 2 ) { - - super(); - - this.type = 'LatheGeometry'; - - this.parameters = { - points: points, - segments: segments, - phiStart: phiStart, - phiLength: phiLength - }; - - segments = Math.floor( segments ); - - // clamp phiLength so it's in range of [ 0, 2PI ] - - phiLength = MathUtils.clamp( phiLength, 0, Math.PI * 2 ); - - // buffers - - const indices = []; - const vertices = []; - const uvs = []; - - // helper variables - - const inverseSegments = 1.0 / segments; - const vertex = new Vector3(); - const uv = new Vector2(); - - // generate vertices and uvs - - for ( let i = 0; i <= segments; i ++ ) { - - const phi = phiStart + i * inverseSegments * phiLength; - - const sin = Math.sin( phi ); - const cos = Math.cos( phi ); - - for ( let j = 0; j <= ( points.length - 1 ); j ++ ) { - - // vertex - - vertex.x = points[ j ].x * sin; - vertex.y = points[ j ].y; - vertex.z = points[ j ].x * cos; - - vertices.push( vertex.x, vertex.y, vertex.z ); - - // uv - - uv.x = i / segments; - uv.y = j / ( points.length - 1 ); - - uvs.push( uv.x, uv.y ); - - - } - - } - - // indices - - for ( let i = 0; i < segments; i ++ ) { - - for ( let j = 0; j < ( points.length - 1 ); j ++ ) { - - const base = j + i * points.length; - - const a = base; - const b = base + points.length; - const c = base + points.length + 1; - const d = base + 1; - - // faces - - indices.push( a, b, d ); - indices.push( b, c, d ); - - } - - } - - // build geometry - - this.setIndex( indices ); - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - // generate normals - - this.computeVertexNormals(); - - // if the geometry is closed, we need to average the normals along the seam. - // because the corresponding vertices are identical (but still have different UVs). - - if ( phiLength === Math.PI * 2 ) { - - const normals = this.attributes.normal.array; - const n1 = new Vector3(); - const n2 = new Vector3(); - const n = new Vector3(); - - // this is the buffer offset for the last line of vertices - - const base = segments * points.length * 3; - - for ( let i = 0, j = 0; i < points.length; i ++, j += 3 ) { - - // select the normal of the vertex in the first line - - n1.x = normals[ j + 0 ]; - n1.y = normals[ j + 1 ]; - n1.z = normals[ j + 2 ]; - - // select the normal of the vertex in the last line - - n2.x = normals[ base + j + 0 ]; - n2.y = normals[ base + j + 1 ]; - n2.z = normals[ base + j + 2 ]; - - // average normals - - n.addVectors( n1, n2 ).normalize(); - - // assign the new values to both normals - - normals[ j + 0 ] = normals[ base + j + 0 ] = n.x; - normals[ j + 1 ] = normals[ base + j + 1 ] = n.y; - normals[ j + 2 ] = normals[ base + j + 2 ] = n.z; - - } - - } - - } - -} - -class OctahedronGeometry extends PolyhedronGeometry { - - constructor( radius = 1, detail = 0 ) { - - const vertices = [ - 1, 0, 0, - 1, 0, 0, 0, 1, 0, - 0, - 1, 0, 0, 0, 1, 0, 0, - 1 - ]; - - const indices = [ - 0, 2, 4, 0, 4, 3, 0, 3, 5, - 0, 5, 2, 1, 2, 5, 1, 5, 3, - 1, 3, 4, 1, 4, 2 - ]; - - super( vertices, indices, radius, detail ); - - this.type = 'OctahedronGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - - } - -} - -/** - * Parametric Surfaces Geometry - * based on the brilliant article by @prideout https://prideout.net/blog/old/blog/index.html@p=44.html - */ - -function ParametricGeometry( func, slices, stacks ) { - - BufferGeometry.call( this ); - - this.type = 'ParametricGeometry'; - - this.parameters = { - func: func, - slices: slices, - stacks: stacks - }; - - // buffers - - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - - const EPS = 0.00001; - - const normal = new Vector3(); - - const p0 = new Vector3(), p1 = new Vector3(); - const pu = new Vector3(), pv = new Vector3(); - - if ( func.length < 3 ) { - - console.error( 'THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.' ); - - } - - // generate vertices, normals and uvs - - const sliceCount = slices + 1; - - for ( let i = 0; i <= stacks; i ++ ) { - - const v = i / stacks; - - for ( let j = 0; j <= slices; j ++ ) { - - const u = j / slices; - - // vertex - - func( u, v, p0 ); - vertices.push( p0.x, p0.y, p0.z ); - - // normal - - // approximate tangent vectors via finite differences - - if ( u - EPS >= 0 ) { - - func( u - EPS, v, p1 ); - pu.subVectors( p0, p1 ); - - } else { - - func( u + EPS, v, p1 ); - pu.subVectors( p1, p0 ); - - } - - if ( v - EPS >= 0 ) { - - func( u, v - EPS, p1 ); - pv.subVectors( p0, p1 ); - - } else { - - func( u, v + EPS, p1 ); - pv.subVectors( p1, p0 ); - - } - - // cross product of tangent vectors returns surface normal - - normal.crossVectors( pu, pv ).normalize(); - normals.push( normal.x, normal.y, normal.z ); - - // uv - - uvs.push( u, v ); - - } - - } - - // generate indices - - for ( let i = 0; i < stacks; i ++ ) { - - for ( let j = 0; j < slices; j ++ ) { - - const a = i * sliceCount + j; - const b = i * sliceCount + j + 1; - const c = ( i + 1 ) * sliceCount + j + 1; - const d = ( i + 1 ) * sliceCount + j; - - // faces one and two - - indices.push( a, b, d ); - indices.push( b, c, d ); - - } - - } - - // build geometry - - this.setIndex( indices ); - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - -} - -ParametricGeometry.prototype = Object.create( BufferGeometry.prototype ); -ParametricGeometry.prototype.constructor = ParametricGeometry; - -class RingGeometry extends BufferGeometry { - - constructor( innerRadius = 0.5, outerRadius = 1, thetaSegments = 8, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2 ) { - - super(); - - this.type = 'RingGeometry'; - - this.parameters = { - innerRadius: innerRadius, - outerRadius: outerRadius, - thetaSegments: thetaSegments, - phiSegments: phiSegments, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - thetaSegments = Math.max( 3, thetaSegments ); - phiSegments = Math.max( 1, phiSegments ); - - // buffers - - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - - // some helper variables - - let radius = innerRadius; - const radiusStep = ( ( outerRadius - innerRadius ) / phiSegments ); - const vertex = new Vector3(); - const uv = new Vector2(); - - // generate vertices, normals and uvs - - for ( let j = 0; j <= phiSegments; j ++ ) { - - for ( let i = 0; i <= thetaSegments; i ++ ) { - - // values are generate from the inside of the ring to the outside - - const segment = thetaStart + i / thetaSegments * thetaLength; - - // vertex - - vertex.x = radius * Math.cos( segment ); - vertex.y = radius * Math.sin( segment ); - - vertices.push( vertex.x, vertex.y, vertex.z ); - - // normal - - normals.push( 0, 0, 1 ); - - // uv - - uv.x = ( vertex.x / outerRadius + 1 ) / 2; - uv.y = ( vertex.y / outerRadius + 1 ) / 2; - - uvs.push( uv.x, uv.y ); - - } - - // increase the radius for next row of vertices - - radius += radiusStep; - - } - - // indices - - for ( let j = 0; j < phiSegments; j ++ ) { - - const thetaSegmentLevel = j * ( thetaSegments + 1 ); - - for ( let i = 0; i < thetaSegments; i ++ ) { - - const segment = i + thetaSegmentLevel; - - const a = segment; - const b = segment + thetaSegments + 1; - const c = segment + thetaSegments + 2; - const d = segment + 1; - - // faces - - indices.push( a, b, d ); - indices.push( b, c, d ); - - } - - } - - // build geometry - - this.setIndex( indices ); - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - } - -} - -class ShapeGeometry extends BufferGeometry { - - constructor( shapes, curveSegments = 12 ) { - - super(); - this.type = 'ShapeGeometry'; - - this.parameters = { - shapes: shapes, - curveSegments: curveSegments - }; - - // buffers - - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - - // helper variables - - let groupStart = 0; - let groupCount = 0; - - // allow single and array values for "shapes" parameter - - if ( Array.isArray( shapes ) === false ) { - - addShape( shapes ); - - } else { - - for ( let i = 0; i < shapes.length; i ++ ) { - - addShape( shapes[ i ] ); - - this.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support - - groupStart += groupCount; - groupCount = 0; - - } - - } - - // build geometry - - this.setIndex( indices ); - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - - // helper functions - - function addShape( shape ) { - - const indexOffset = vertices.length / 3; - const points = shape.extractPoints( curveSegments ); - - let shapeVertices = points.shape; - const shapeHoles = points.holes; - - // check direction of vertices - - if ( ShapeUtils.isClockWise( shapeVertices ) === false ) { - - shapeVertices = shapeVertices.reverse(); - - } - - for ( let i = 0, l = shapeHoles.length; i < l; i ++ ) { - - const shapeHole = shapeHoles[ i ]; - - if ( ShapeUtils.isClockWise( shapeHole ) === true ) { - - shapeHoles[ i ] = shapeHole.reverse(); - - } - - } - - const faces = ShapeUtils.triangulateShape( shapeVertices, shapeHoles ); - - // join vertices of inner and outer paths to a single array - - for ( let i = 0, l = shapeHoles.length; i < l; i ++ ) { - - const shapeHole = shapeHoles[ i ]; - shapeVertices = shapeVertices.concat( shapeHole ); - - } - - // vertices, normals, uvs - - for ( let i = 0, l = shapeVertices.length; i < l; i ++ ) { - - const vertex = shapeVertices[ i ]; - - vertices.push( vertex.x, vertex.y, 0 ); - normals.push( 0, 0, 1 ); - uvs.push( vertex.x, vertex.y ); // world uvs - - } - - // incides - - for ( let i = 0, l = faces.length; i < l; i ++ ) { - - const face = faces[ i ]; - - const a = face[ 0 ] + indexOffset; - const b = face[ 1 ] + indexOffset; - const c = face[ 2 ] + indexOffset; - - indices.push( a, b, c ); - groupCount += 3; - - } - - } - - } - - toJSON() { - - const data = BufferGeometry.prototype.toJSON.call( this ); - - const shapes = this.parameters.shapes; - - return toJSON$1( shapes, data ); - - } - -} - -function toJSON$1( shapes, data ) { - - data.shapes = []; - - if ( Array.isArray( shapes ) ) { - - for ( let i = 0, l = shapes.length; i < l; i ++ ) { - - const shape = shapes[ i ]; - - data.shapes.push( shape.uuid ); - - } - - } else { - - data.shapes.push( shapes.uuid ); - - } - - return data; - -} - -class SphereGeometry extends BufferGeometry { - - constructor( radius = 1, widthSegments = 8, heightSegments = 6, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI ) { - - super(); - this.type = 'SphereGeometry'; - - this.parameters = { - radius: radius, - widthSegments: widthSegments, - heightSegments: heightSegments, - phiStart: phiStart, - phiLength: phiLength, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - widthSegments = Math.max( 3, Math.floor( widthSegments ) ); - heightSegments = Math.max( 2, Math.floor( heightSegments ) ); - - const thetaEnd = Math.min( thetaStart + thetaLength, Math.PI ); - - let index = 0; - const grid = []; - - const vertex = new Vector3(); - const normal = new Vector3(); - - // buffers - - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - - // generate vertices, normals and uvs - - for ( let iy = 0; iy <= heightSegments; iy ++ ) { - - const verticesRow = []; - - const v = iy / heightSegments; - - // special case for the poles - - let uOffset = 0; - - if ( iy == 0 && thetaStart == 0 ) { - - uOffset = 0.5 / widthSegments; - - } else if ( iy == heightSegments && thetaEnd == Math.PI ) { - - uOffset = - 0.5 / widthSegments; - - } - - for ( let ix = 0; ix <= widthSegments; ix ++ ) { - - const u = ix / widthSegments; - - // vertex - - vertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength ); - vertex.y = radius * Math.cos( thetaStart + v * thetaLength ); - vertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength ); - - vertices.push( vertex.x, vertex.y, vertex.z ); - - // normal - - normal.copy( vertex ).normalize(); - normals.push( normal.x, normal.y, normal.z ); - - // uv - - uvs.push( u + uOffset, 1 - v ); - - verticesRow.push( index ++ ); - - } - - grid.push( verticesRow ); - - } - - // indices - - for ( let iy = 0; iy < heightSegments; iy ++ ) { - - for ( let ix = 0; ix < widthSegments; ix ++ ) { - - const a = grid[ iy ][ ix + 1 ]; - const b = grid[ iy ][ ix ]; - const c = grid[ iy + 1 ][ ix ]; - const d = grid[ iy + 1 ][ ix + 1 ]; - - if ( iy !== 0 || thetaStart > 0 ) indices.push( a, b, d ); - if ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( b, c, d ); - - } - - } - - // build geometry - - this.setIndex( indices ); - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - } - -} - -class TetrahedronGeometry extends PolyhedronGeometry { - - constructor( radius = 1, detail = 0 ) { - - const vertices = [ - 1, 1, 1, - 1, - 1, 1, - 1, 1, - 1, 1, - 1, - 1 - ]; - - const indices = [ - 2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1 - ]; - - super( vertices, indices, radius, detail ); - - this.type = 'TetrahedronGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - - } - -} - -/** - * Text = 3D Text - * - * parameters = { - * font: , // font - * - * size: , // size of the text - * height: , // thickness to extrude text - * curveSegments: , // number of points on the curves - * - * bevelEnabled: , // turn on bevel - * bevelThickness: , // how deep into text bevel goes - * bevelSize: , // how far from text outline (including bevelOffset) is bevel - * bevelOffset: // how far from text outline does bevel start - * } - */ - -class TextGeometry extends ExtrudeGeometry { - - constructor( text, parameters = {} ) { - - const font = parameters.font; - - if ( ! ( font && font.isFont ) ) { - - console.error( 'THREE.TextGeometry: font parameter is not an instance of THREE.Font.' ); - return new BufferGeometry(); - - } - - const shapes = font.generateShapes( text, parameters.size ); - - // translate parameters to ExtrudeGeometry API - - parameters.depth = parameters.height !== undefined ? parameters.height : 50; - - // defaults - - if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10; - if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8; - if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false; - - super( shapes, parameters ); - - this.type = 'TextGeometry'; - - } - -} - -class TorusGeometry extends BufferGeometry { - - constructor( radius = 1, tube = 0.4, radialSegments = 8, tubularSegments = 6, arc = Math.PI * 2 ) { - - super(); - this.type = 'TorusGeometry'; - - this.parameters = { - radius: radius, - tube: tube, - radialSegments: radialSegments, - tubularSegments: tubularSegments, - arc: arc - }; - - radialSegments = Math.floor( radialSegments ); - tubularSegments = Math.floor( tubularSegments ); - - // buffers - - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - - // helper variables - - const center = new Vector3(); - const vertex = new Vector3(); - const normal = new Vector3(); - - // generate vertices, normals and uvs - - for ( let j = 0; j <= radialSegments; j ++ ) { - - for ( let i = 0; i <= tubularSegments; i ++ ) { - - const u = i / tubularSegments * arc; - const v = j / radialSegments * Math.PI * 2; - - // vertex - - vertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u ); - vertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u ); - vertex.z = tube * Math.sin( v ); - - vertices.push( vertex.x, vertex.y, vertex.z ); - - // normal - - center.x = radius * Math.cos( u ); - center.y = radius * Math.sin( u ); - normal.subVectors( vertex, center ).normalize(); - - normals.push( normal.x, normal.y, normal.z ); - - // uv - - uvs.push( i / tubularSegments ); - uvs.push( j / radialSegments ); - - } - - } - - // generate indices - - for ( let j = 1; j <= radialSegments; j ++ ) { - - for ( let i = 1; i <= tubularSegments; i ++ ) { - - // indices - - const a = ( tubularSegments + 1 ) * j + i - 1; - const b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1; - const c = ( tubularSegments + 1 ) * ( j - 1 ) + i; - const d = ( tubularSegments + 1 ) * j + i; - - // faces - - indices.push( a, b, d ); - indices.push( b, c, d ); - - } - - } - - // build geometry - - this.setIndex( indices ); - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - } - -} - -class TorusKnotGeometry extends BufferGeometry { - - constructor( radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3 ) { - - super(); - this.type = 'TorusKnotGeometry'; - - this.parameters = { - radius: radius, - tube: tube, - tubularSegments: tubularSegments, - radialSegments: radialSegments, - p: p, - q: q - }; - - tubularSegments = Math.floor( tubularSegments ); - radialSegments = Math.floor( radialSegments ); - - // buffers - - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - - // helper variables - - const vertex = new Vector3(); - const normal = new Vector3(); - - const P1 = new Vector3(); - const P2 = new Vector3(); - - const B = new Vector3(); - const T = new Vector3(); - const N = new Vector3(); - - // generate vertices, normals and uvs - - for ( let i = 0; i <= tubularSegments; ++ i ) { - - // the radian "u" is used to calculate the position on the torus curve of the current tubular segement - - const u = i / tubularSegments * p * Math.PI * 2; - - // now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead. - // these points are used to create a special "coordinate space", which is necessary to calculate the correct vertex positions - - calculatePositionOnCurve( u, p, q, radius, P1 ); - calculatePositionOnCurve( u + 0.01, p, q, radius, P2 ); - - // calculate orthonormal basis - - T.subVectors( P2, P1 ); - N.addVectors( P2, P1 ); - B.crossVectors( T, N ); - N.crossVectors( B, T ); - - // normalize B, N. T can be ignored, we don't use it - - B.normalize(); - N.normalize(); - - for ( let j = 0; j <= radialSegments; ++ j ) { - - // now calculate the vertices. they are nothing more than an extrusion of the torus curve. - // because we extrude a shape in the xy-plane, there is no need to calculate a z-value. - - const v = j / radialSegments * Math.PI * 2; - const cx = - tube * Math.cos( v ); - const cy = tube * Math.sin( v ); - - // now calculate the final vertex position. - // first we orient the extrusion with our basis vectos, then we add it to the current position on the curve - - vertex.x = P1.x + ( cx * N.x + cy * B.x ); - vertex.y = P1.y + ( cx * N.y + cy * B.y ); - vertex.z = P1.z + ( cx * N.z + cy * B.z ); - - vertices.push( vertex.x, vertex.y, vertex.z ); - - // normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal) - - normal.subVectors( vertex, P1 ).normalize(); - - normals.push( normal.x, normal.y, normal.z ); - - // uv - - uvs.push( i / tubularSegments ); - uvs.push( j / radialSegments ); - - } - - } - - // generate indices - - for ( let j = 1; j <= tubularSegments; j ++ ) { - - for ( let i = 1; i <= radialSegments; i ++ ) { - - // indices - - const a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 ); - const b = ( radialSegments + 1 ) * j + ( i - 1 ); - const c = ( radialSegments + 1 ) * j + i; - const d = ( radialSegments + 1 ) * ( j - 1 ) + i; - - // faces - - indices.push( a, b, d ); - indices.push( b, c, d ); - - } - - } - - // build geometry - - this.setIndex( indices ); - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - // this function calculates the current position on the torus curve - - function calculatePositionOnCurve( u, p, q, radius, position ) { - - const cu = Math.cos( u ); - const su = Math.sin( u ); - const quOverP = q / p * u; - const cs = Math.cos( quOverP ); - - position.x = radius * ( 2 + cs ) * 0.5 * cu; - position.y = radius * ( 2 + cs ) * su * 0.5; - position.z = radius * Math.sin( quOverP ) * 0.5; - - } - - } - -} - -class TubeGeometry extends BufferGeometry { - - constructor( path, tubularSegments = 64, radius = 1, radialSegments = 8, closed = false ) { - - super(); - this.type = 'TubeGeometry'; - - this.parameters = { - path: path, - tubularSegments: tubularSegments, - radius: radius, - radialSegments: radialSegments, - closed: closed - }; - - const frames = path.computeFrenetFrames( tubularSegments, closed ); - - // expose internals - - this.tangents = frames.tangents; - this.normals = frames.normals; - this.binormals = frames.binormals; - - // helper variables - - const vertex = new Vector3(); - const normal = new Vector3(); - const uv = new Vector2(); - let P = new Vector3(); - - // buffer - - const vertices = []; - const normals = []; - const uvs = []; - const indices = []; - - // create buffer data - - generateBufferData(); - - // build geometry - - this.setIndex( indices ); - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - // functions - - function generateBufferData() { - - for ( let i = 0; i < tubularSegments; i ++ ) { - - generateSegment( i ); - - } - - // if the geometry is not closed, generate the last row of vertices and normals - // at the regular position on the given path - // - // if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ) - - generateSegment( ( closed === false ) ? tubularSegments : 0 ); - - // uvs are generated in a separate function. - // this makes it easy compute correct values for closed geometries - - generateUVs(); - - // finally create faces - - generateIndices(); - - } - - function generateSegment( i ) { - - // we use getPointAt to sample evenly distributed points from the given path - - P = path.getPointAt( i / tubularSegments, P ); - - // retrieve corresponding normal and binormal - - const N = frames.normals[ i ]; - const B = frames.binormals[ i ]; - - // generate normals and vertices for the current segment - - for ( let j = 0; j <= radialSegments; j ++ ) { - - const v = j / radialSegments * Math.PI * 2; - - const sin = Math.sin( v ); - const cos = - Math.cos( v ); - - // normal - - normal.x = ( cos * N.x + sin * B.x ); - normal.y = ( cos * N.y + sin * B.y ); - normal.z = ( cos * N.z + sin * B.z ); - normal.normalize(); - - normals.push( normal.x, normal.y, normal.z ); - - // vertex - - vertex.x = P.x + radius * normal.x; - vertex.y = P.y + radius * normal.y; - vertex.z = P.z + radius * normal.z; - - vertices.push( vertex.x, vertex.y, vertex.z ); - - } - - } - - function generateIndices() { - - for ( let j = 1; j <= tubularSegments; j ++ ) { - - for ( let i = 1; i <= radialSegments; i ++ ) { - - const a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 ); - const b = ( radialSegments + 1 ) * j + ( i - 1 ); - const c = ( radialSegments + 1 ) * j + i; - const d = ( radialSegments + 1 ) * ( j - 1 ) + i; - - // faces - - indices.push( a, b, d ); - indices.push( b, c, d ); - - } - - } - - } - - function generateUVs() { - - for ( let i = 0; i <= tubularSegments; i ++ ) { - - for ( let j = 0; j <= radialSegments; j ++ ) { - - uv.x = i / tubularSegments; - uv.y = j / radialSegments; - - uvs.push( uv.x, uv.y ); - - } - - } - - } - - } - toJSON() { - - const data = BufferGeometry.prototype.toJSON.call( this ); - - data.path = this.parameters.path.toJSON(); - - return data; - - } - -} - -class WireframeGeometry extends BufferGeometry { - - constructor( geometry ) { - - super(); - this.type = 'WireframeGeometry'; - - if ( geometry.isGeometry === true ) { - - console.error( 'THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' ); - return; - - } - - // buffer - - const vertices = []; - - // helper variables - - const edge = [ 0, 0 ], edges = {}; - - const vertex = new Vector3(); - - if ( geometry.index !== null ) { - - // indexed BufferGeometry - - const position = geometry.attributes.position; - const indices = geometry.index; - let groups = geometry.groups; - - if ( groups.length === 0 ) { - - groups = [ { start: 0, count: indices.count, materialIndex: 0 } ]; - - } - - // create a data structure that contains all eges without duplicates - - for ( let o = 0, ol = groups.length; o < ol; ++ o ) { - - const group = groups[ o ]; - - const start = group.start; - const count = group.count; - - for ( let i = start, l = ( start + count ); i < l; i += 3 ) { - - for ( let j = 0; j < 3; j ++ ) { - - const edge1 = indices.getX( i + j ); - const edge2 = indices.getX( i + ( j + 1 ) % 3 ); - edge[ 0 ] = Math.min( edge1, edge2 ); // sorting prevents duplicates - edge[ 1 ] = Math.max( edge1, edge2 ); - - const key = edge[ 0 ] + ',' + edge[ 1 ]; - - if ( edges[ key ] === undefined ) { - - edges[ key ] = { index1: edge[ 0 ], index2: edge[ 1 ] }; - - } - - } - - } - - } - - // generate vertices - - for ( const key in edges ) { - - const e = edges[ key ]; - - vertex.fromBufferAttribute( position, e.index1 ); - vertices.push( vertex.x, vertex.y, vertex.z ); - - vertex.fromBufferAttribute( position, e.index2 ); - vertices.push( vertex.x, vertex.y, vertex.z ); - - } - - } else { - - // non-indexed BufferGeometry - - const position = geometry.attributes.position; - - for ( let i = 0, l = ( position.count / 3 ); i < l; i ++ ) { - - for ( let j = 0; j < 3; j ++ ) { - - // three edges per triangle, an edge is represented as (index1, index2) - // e.g. the first triangle has the following edges: (0,1),(1,2),(2,0) - - const index1 = 3 * i + j; - vertex.fromBufferAttribute( position, index1 ); - vertices.push( vertex.x, vertex.y, vertex.z ); - - const index2 = 3 * i + ( ( j + 1 ) % 3 ); - vertex.fromBufferAttribute( position, index2 ); - vertices.push( vertex.x, vertex.y, vertex.z ); - - } - - } - - } - - // build geometry - - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - - } - -} - -var Geometries = /*#__PURE__*/Object.freeze({ - __proto__: null, - BoxGeometry: BoxGeometry, - BoxBufferGeometry: BoxGeometry, - CircleGeometry: CircleGeometry, - CircleBufferGeometry: CircleGeometry, - ConeGeometry: ConeGeometry, - ConeBufferGeometry: ConeGeometry, - CylinderGeometry: CylinderGeometry, - CylinderBufferGeometry: CylinderGeometry, - DodecahedronGeometry: DodecahedronGeometry, - DodecahedronBufferGeometry: DodecahedronGeometry, - EdgesGeometry: EdgesGeometry, - ExtrudeGeometry: ExtrudeGeometry, - ExtrudeBufferGeometry: ExtrudeGeometry, - IcosahedronGeometry: IcosahedronGeometry, - IcosahedronBufferGeometry: IcosahedronGeometry, - LatheGeometry: LatheGeometry, - LatheBufferGeometry: LatheGeometry, - OctahedronGeometry: OctahedronGeometry, - OctahedronBufferGeometry: OctahedronGeometry, - ParametricGeometry: ParametricGeometry, - ParametricBufferGeometry: ParametricGeometry, - PlaneGeometry: PlaneGeometry, - PlaneBufferGeometry: PlaneGeometry, - PolyhedronGeometry: PolyhedronGeometry, - PolyhedronBufferGeometry: PolyhedronGeometry, - RingGeometry: RingGeometry, - RingBufferGeometry: RingGeometry, - ShapeGeometry: ShapeGeometry, - ShapeBufferGeometry: ShapeGeometry, - SphereGeometry: SphereGeometry, - SphereBufferGeometry: SphereGeometry, - TetrahedronGeometry: TetrahedronGeometry, - TetrahedronBufferGeometry: TetrahedronGeometry, - TextGeometry: TextGeometry, - TextBufferGeometry: TextGeometry, - TorusGeometry: TorusGeometry, - TorusBufferGeometry: TorusGeometry, - TorusKnotGeometry: TorusKnotGeometry, - TorusKnotBufferGeometry: TorusKnotGeometry, - TubeGeometry: TubeGeometry, - TubeBufferGeometry: TubeGeometry, - WireframeGeometry: WireframeGeometry -}); - -/** - * parameters = { - * color: - * } - */ - -class ShadowMaterial extends Material { - - constructor( parameters ) { - - super(); - - this.type = 'ShadowMaterial'; - - this.color = new Color( 0x000000 ); - this.transparent = true; - - this.setValues( parameters ); - - } - - copy( source ) { - - super.copy( source ); - - this.color.copy( source.color ); - - return this; - - } - -} - -ShadowMaterial.prototype.isShadowMaterial = true; - -class RawShaderMaterial extends ShaderMaterial { - - constructor( parameters ) { - - super( parameters ); - - this.type = 'RawShaderMaterial'; - - } - -} - -RawShaderMaterial.prototype.isRawShaderMaterial = true; - -/** - * parameters = { - * color: , - * roughness: , - * metalness: , - * opacity: , - * - * map: new THREE.Texture( ), - * - * lightMap: new THREE.Texture( ), - * lightMapIntensity: - * - * aoMap: new THREE.Texture( ), - * aoMapIntensity: - * - * emissive: , - * emissiveIntensity: - * emissiveMap: new THREE.Texture( ), - * - * bumpMap: new THREE.Texture( ), - * bumpScale: , - * - * normalMap: new THREE.Texture( ), - * normalMapType: THREE.TangentSpaceNormalMap, - * normalScale: , - * - * displacementMap: new THREE.Texture( ), - * displacementScale: , - * displacementBias: , - * - * roughnessMap: new THREE.Texture( ), - * - * metalnessMap: new THREE.Texture( ), - * - * alphaMap: new THREE.Texture( ), - * - * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ), - * envMapIntensity: - * - * refractionRatio: , - * - * wireframe: , - * wireframeLinewidth: , - * - * skinning: , - * morphTargets: , - * morphNormals: , - * - * flatShading: - * } - */ - -function MeshStandardMaterial( parameters ) { - - Material.call( this ); - - this.defines = { 'STANDARD': '' }; - - this.type = 'MeshStandardMaterial'; - - this.color = new Color( 0xffffff ); // diffuse - this.roughness = 1.0; - this.metalness = 0.0; - - this.map = null; - - this.lightMap = null; - this.lightMapIntensity = 1.0; - - this.aoMap = null; - this.aoMapIntensity = 1.0; - - this.emissive = new Color( 0x000000 ); - this.emissiveIntensity = 1.0; - this.emissiveMap = null; - - this.bumpMap = null; - this.bumpScale = 1; - - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2( 1, 1 ); - - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - - this.roughnessMap = null; - - this.metalnessMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.envMapIntensity = 1.0; - - this.refractionRatio = 0.98; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.flatShading = false; - - this.vertexTangents = false; - - this.setValues( parameters ); - -} - -MeshStandardMaterial.prototype = Object.create( Material.prototype ); -MeshStandardMaterial.prototype.constructor = MeshStandardMaterial; - -MeshStandardMaterial.prototype.isMeshStandardMaterial = true; - -MeshStandardMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.defines = { 'STANDARD': '' }; - - this.color.copy( source.color ); - this.roughness = source.roughness; - this.metalness = source.metalness; - - this.map = source.map; - - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.emissive.copy( source.emissive ); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy( source.normalScale ); - - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - - this.roughnessMap = source.roughnessMap; - - this.metalnessMap = source.metalnessMap; - - this.alphaMap = source.alphaMap; - - this.envMap = source.envMap; - this.envMapIntensity = source.envMapIntensity; - - this.refractionRatio = source.refractionRatio; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - this.morphNormals = source.morphNormals; - - this.flatShading = source.flatShading; - - this.vertexTangents = source.vertexTangents; - - return this; - -}; - -/** - * parameters = { - * clearcoat: , - * clearcoatMap: new THREE.Texture( ), - * clearcoatRoughness: , - * clearcoatRoughnessMap: new THREE.Texture( ), - * clearcoatNormalScale: , - * clearcoatNormalMap: new THREE.Texture( ), - * - * reflectivity: , - * ior: , - * - * sheen: , - * - * transmission: , - * transmissionMap: new THREE.Texture( ) - * } - */ - -function MeshPhysicalMaterial( parameters ) { - - MeshStandardMaterial.call( this ); - - this.defines = { - - 'STANDARD': '', - 'PHYSICAL': '' - - }; - - this.type = 'MeshPhysicalMaterial'; - - this.clearcoat = 0.0; - this.clearcoatMap = null; - this.clearcoatRoughness = 0.0; - this.clearcoatRoughnessMap = null; - this.clearcoatNormalScale = new Vector2( 1, 1 ); - this.clearcoatNormalMap = null; - - this.reflectivity = 0.5; // maps to F0 = 0.04 - - Object.defineProperty( this, 'ior', { - get: function () { - - return ( 1 + 0.4 * this.reflectivity ) / ( 1 - 0.4 * this.reflectivity ); - - }, - set: function ( ior ) { - - this.reflectivity = MathUtils.clamp( 2.5 * ( ior - 1 ) / ( ior + 1 ), 0, 1 ); - - } - } ); - - this.sheen = null; // null will disable sheen bsdf - - this.transmission = 0.0; - this.transmissionMap = null; - - this.setValues( parameters ); - -} - -MeshPhysicalMaterial.prototype = Object.create( MeshStandardMaterial.prototype ); -MeshPhysicalMaterial.prototype.constructor = MeshPhysicalMaterial; - -MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true; - -MeshPhysicalMaterial.prototype.copy = function ( source ) { - - MeshStandardMaterial.prototype.copy.call( this, source ); - - this.defines = { - - 'STANDARD': '', - 'PHYSICAL': '' - - }; - - this.clearcoat = source.clearcoat; - this.clearcoatMap = source.clearcoatMap; - this.clearcoatRoughness = source.clearcoatRoughness; - this.clearcoatRoughnessMap = source.clearcoatRoughnessMap; - this.clearcoatNormalMap = source.clearcoatNormalMap; - this.clearcoatNormalScale.copy( source.clearcoatNormalScale ); - - this.reflectivity = source.reflectivity; - - if ( source.sheen ) { - - this.sheen = ( this.sheen || new Color() ).copy( source.sheen ); - - } else { - - this.sheen = null; - - } - - this.transmission = source.transmission; - this.transmissionMap = source.transmissionMap; - - return this; - -}; - -/** - * parameters = { - * color: , - * specular: , - * shininess: , - * opacity: , - * - * map: new THREE.Texture( ), - * - * lightMap: new THREE.Texture( ), - * lightMapIntensity: - * - * aoMap: new THREE.Texture( ), - * aoMapIntensity: - * - * emissive: , - * emissiveIntensity: - * emissiveMap: new THREE.Texture( ), - * - * bumpMap: new THREE.Texture( ), - * bumpScale: , - * - * normalMap: new THREE.Texture( ), - * normalMapType: THREE.TangentSpaceNormalMap, - * normalScale: , - * - * displacementMap: new THREE.Texture( ), - * displacementScale: , - * displacementBias: , - * - * specularMap: new THREE.Texture( ), - * - * alphaMap: new THREE.Texture( ), - * - * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.MultiplyOperation, - * reflectivity: , - * refractionRatio: , - * - * wireframe: , - * wireframeLinewidth: , - * - * skinning: , - * morphTargets: , - * morphNormals: , - * - * flatShading: - * } - */ - -class MeshPhongMaterial extends Material { - - constructor( parameters ) { - - super(); - - this.type = 'MeshPhongMaterial'; - - this.color = new Color( 0xffffff ); // diffuse - this.specular = new Color( 0x111111 ); - this.shininess = 30; - - this.map = null; - - this.lightMap = null; - this.lightMapIntensity = 1.0; - - this.aoMap = null; - this.aoMapIntensity = 1.0; - - this.emissive = new Color( 0x000000 ); - this.emissiveIntensity = 1.0; - this.emissiveMap = null; - - this.bumpMap = null; - this.bumpScale = 1; - - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2( 1, 1 ); - - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - - this.specularMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.flatShading = false; - - this.setValues( parameters ); - - } - - copy( source ) { - - super.copy( source ); - - this.color.copy( source.color ); - this.specular.copy( source.specular ); - this.shininess = source.shininess; - - this.map = source.map; - - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.emissive.copy( source.emissive ); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy( source.normalScale ); - - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - - this.specularMap = source.specularMap; - - this.alphaMap = source.alphaMap; - - this.envMap = source.envMap; - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - this.morphNormals = source.morphNormals; - - this.flatShading = source.flatShading; - - return this; - - } - -} - -MeshPhongMaterial.prototype.isMeshPhongMaterial = true; - -/** - * parameters = { - * color: , - * - * map: new THREE.Texture( ), - * gradientMap: new THREE.Texture( ), - * - * lightMap: new THREE.Texture( ), - * lightMapIntensity: - * - * aoMap: new THREE.Texture( ), - * aoMapIntensity: - * - * emissive: , - * emissiveIntensity: - * emissiveMap: new THREE.Texture( ), - * - * bumpMap: new THREE.Texture( ), - * bumpScale: , - * - * normalMap: new THREE.Texture( ), - * normalMapType: THREE.TangentSpaceNormalMap, - * normalScale: , - * - * displacementMap: new THREE.Texture( ), - * displacementScale: , - * displacementBias: , - * - * alphaMap: new THREE.Texture( ), - * - * wireframe: , - * wireframeLinewidth: , - * - * skinning: , - * morphTargets: , - * morphNormals: - * } - */ - -class MeshToonMaterial extends Material { - - constructor( parameters ) { - - super(); - - this.defines = { 'TOON': '' }; - - this.type = 'MeshToonMaterial'; - - this.color = new Color( 0xffffff ); - - this.map = null; - this.gradientMap = null; - - this.lightMap = null; - this.lightMapIntensity = 1.0; - - this.aoMap = null; - this.aoMapIntensity = 1.0; - - this.emissive = new Color( 0x000000 ); - this.emissiveIntensity = 1.0; - this.emissiveMap = null; - - this.bumpMap = null; - this.bumpScale = 1; - - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2( 1, 1 ); - - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - - this.alphaMap = null; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.setValues( parameters ); - - } - - copy( source ) { - - super.copy( source ); - - this.color.copy( source.color ); - - this.map = source.map; - this.gradientMap = source.gradientMap; - - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.emissive.copy( source.emissive ); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy( source.normalScale ); - - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - - this.alphaMap = source.alphaMap; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - this.morphNormals = source.morphNormals; - - return this; - - } - -} - -MeshToonMaterial.prototype.isMeshToonMaterial = true; - -/** - * parameters = { - * opacity: , - * - * bumpMap: new THREE.Texture( ), - * bumpScale: , - * - * normalMap: new THREE.Texture( ), - * normalMapType: THREE.TangentSpaceNormalMap, - * normalScale: , - * - * displacementMap: new THREE.Texture( ), - * displacementScale: , - * displacementBias: , - * - * wireframe: , - * wireframeLinewidth: - * - * skinning: , - * morphTargets: , - * morphNormals: , - * - * flatShading: - * } - */ - -class MeshNormalMaterial extends Material { - - constructor( parameters ) { - - super(); - - this.type = 'MeshNormalMaterial'; - - this.bumpMap = null; - this.bumpScale = 1; - - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2( 1, 1 ); - - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - - this.wireframe = false; - this.wireframeLinewidth = 1; - - this.fog = false; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.flatShading = false; - - this.setValues( parameters ); - - } - - copy( source ) { - - super.copy( source ); - - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy( source.normalScale ); - - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - this.morphNormals = source.morphNormals; - - this.flatShading = source.flatShading; - - return this; - - } - -} - -MeshNormalMaterial.prototype.isMeshNormalMaterial = true; - -/** - * parameters = { - * color: , - * opacity: , - * - * map: new THREE.Texture( ), - * - * lightMap: new THREE.Texture( ), - * lightMapIntensity: - * - * aoMap: new THREE.Texture( ), - * aoMapIntensity: - * - * emissive: , - * emissiveIntensity: - * emissiveMap: new THREE.Texture( ), - * - * specularMap: new THREE.Texture( ), - * - * alphaMap: new THREE.Texture( ), - * - * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: , - * refractionRatio: , - * - * wireframe: , - * wireframeLinewidth: , - * - * skinning: , - * morphTargets: , - * morphNormals: - * } - */ - -class MeshLambertMaterial extends Material { - - constructor( parameters ) { - - super(); - - this.type = 'MeshLambertMaterial'; - - this.color = new Color( 0xffffff ); // diffuse - - this.map = null; - - this.lightMap = null; - this.lightMapIntensity = 1.0; - - this.aoMap = null; - this.aoMapIntensity = 1.0; - - this.emissive = new Color( 0x000000 ); - this.emissiveIntensity = 1.0; - this.emissiveMap = null; - - this.specularMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.setValues( parameters ); - - } - - copy( source ) { - - super.copy( source ); - - this.color.copy( source.color ); - - this.map = source.map; - - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.emissive.copy( source.emissive ); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - - this.specularMap = source.specularMap; - - this.alphaMap = source.alphaMap; - - this.envMap = source.envMap; - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - this.morphNormals = source.morphNormals; - - return this; - - } - -} - -MeshLambertMaterial.prototype.isMeshLambertMaterial = true; - -/** - * parameters = { - * color: , - * opacity: , - * - * matcap: new THREE.Texture( ), - * - * map: new THREE.Texture( ), - * - * bumpMap: new THREE.Texture( ), - * bumpScale: , - * - * normalMap: new THREE.Texture( ), - * normalMapType: THREE.TangentSpaceNormalMap, - * normalScale: , - * - * displacementMap: new THREE.Texture( ), - * displacementScale: , - * displacementBias: , - * - * alphaMap: new THREE.Texture( ), - * - * skinning: , - * morphTargets: , - * morphNormals: - * - * flatShading: - * } - */ - -class MeshMatcapMaterial extends Material { - - constructor( parameters ) { - - super(); - - this.defines = { 'MATCAP': '' }; - - this.type = 'MeshMatcapMaterial'; - - this.color = new Color( 0xffffff ); // diffuse - - this.matcap = null; - - this.map = null; - - this.bumpMap = null; - this.bumpScale = 1; - - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2( 1, 1 ); - - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - - this.alphaMap = null; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.flatShading = false; - - this.setValues( parameters ); - - } - - - copy( source ) { - - super.copy( source ); - - this.defines = { 'MATCAP': '' }; - - this.color.copy( source.color ); - - this.matcap = source.matcap; - - this.map = source.map; - - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy( source.normalScale ); - - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - - this.alphaMap = source.alphaMap; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - this.morphNormals = source.morphNormals; - - this.flatShading = source.flatShading; - - return this; - - } - -} - -MeshMatcapMaterial.prototype.isMeshMatcapMaterial = true; - -/** - * parameters = { - * color: , - * opacity: , - * - * linewidth: , - * - * scale: , - * dashSize: , - * gapSize: - * } - */ - -class LineDashedMaterial extends LineBasicMaterial { - - constructor( parameters ) { - - super(); - - this.type = 'LineDashedMaterial'; - - this.scale = 1; - this.dashSize = 3; - this.gapSize = 1; - - this.setValues( parameters ); - - } - - copy( source ) { - - super.copy( source ); - - this.scale = source.scale; - this.dashSize = source.dashSize; - this.gapSize = source.gapSize; - - return this; - - } - -} - -LineDashedMaterial.prototype.isLineDashedMaterial = true; - -var Materials = /*#__PURE__*/Object.freeze({ - __proto__: null, - ShadowMaterial: ShadowMaterial, - SpriteMaterial: SpriteMaterial, - RawShaderMaterial: RawShaderMaterial, - ShaderMaterial: ShaderMaterial, - PointsMaterial: PointsMaterial, - MeshPhysicalMaterial: MeshPhysicalMaterial, - MeshStandardMaterial: MeshStandardMaterial, - MeshPhongMaterial: MeshPhongMaterial, - MeshToonMaterial: MeshToonMaterial, - MeshNormalMaterial: MeshNormalMaterial, - MeshLambertMaterial: MeshLambertMaterial, - MeshDepthMaterial: MeshDepthMaterial, - MeshDistanceMaterial: MeshDistanceMaterial, - MeshBasicMaterial: MeshBasicMaterial, - MeshMatcapMaterial: MeshMatcapMaterial, - LineDashedMaterial: LineDashedMaterial, - LineBasicMaterial: LineBasicMaterial, - Material: Material -}); - -const AnimationUtils = { - - // same as Array.prototype.slice, but also works on typed arrays - arraySlice: function ( array, from, to ) { - - if ( AnimationUtils.isTypedArray( array ) ) { - - // in ios9 array.subarray(from, undefined) will return empty array - // but array.subarray(from) or array.subarray(from, len) is correct - return new array.constructor( array.subarray( from, to !== undefined ? to : array.length ) ); - - } - - return array.slice( from, to ); - - }, - - // converts an array to a specific type - convertArray: function ( array, type, forceClone ) { - - if ( ! array || // let 'undefined' and 'null' pass - ! forceClone && array.constructor === type ) return array; - - if ( typeof type.BYTES_PER_ELEMENT === 'number' ) { - - return new type( array ); // create typed array - - } - - return Array.prototype.slice.call( array ); // create Array - - }, - - isTypedArray: function ( object ) { - - return ArrayBuffer.isView( object ) && - ! ( object instanceof DataView ); - - }, - - // returns an array by which times and values can be sorted - getKeyframeOrder: function ( times ) { - - function compareTime( i, j ) { - - return times[ i ] - times[ j ]; - - } - - const n = times.length; - const result = new Array( n ); - for ( let i = 0; i !== n; ++ i ) result[ i ] = i; - - result.sort( compareTime ); - - return result; - - }, - - // uses the array previously returned by 'getKeyframeOrder' to sort data - sortedArray: function ( values, stride, order ) { - - const nValues = values.length; - const result = new values.constructor( nValues ); - - for ( let i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) { - - const srcOffset = order[ i ] * stride; - - for ( let j = 0; j !== stride; ++ j ) { - - result[ dstOffset ++ ] = values[ srcOffset + j ]; - - } - - } - - return result; - - }, - - // function for parsing AOS keyframe formats - flattenJSON: function ( jsonKeys, times, values, valuePropertyName ) { - - let i = 1, key = jsonKeys[ 0 ]; - - while ( key !== undefined && key[ valuePropertyName ] === undefined ) { - - key = jsonKeys[ i ++ ]; - - } - - if ( key === undefined ) return; // no data - - let value = key[ valuePropertyName ]; - if ( value === undefined ) return; // no data - - if ( Array.isArray( value ) ) { - - do { - - value = key[ valuePropertyName ]; - - if ( value !== undefined ) { - - times.push( key.time ); - values.push.apply( values, value ); // push all elements - - } - - key = jsonKeys[ i ++ ]; - - } while ( key !== undefined ); - - } else if ( value.toArray !== undefined ) { - - // ...assume THREE.Math-ish - - do { - - value = key[ valuePropertyName ]; - - if ( value !== undefined ) { - - times.push( key.time ); - value.toArray( values, values.length ); - - } - - key = jsonKeys[ i ++ ]; - - } while ( key !== undefined ); - - } else { - - // otherwise push as-is - - do { - - value = key[ valuePropertyName ]; - - if ( value !== undefined ) { - - times.push( key.time ); - values.push( value ); - - } - - key = jsonKeys[ i ++ ]; - - } while ( key !== undefined ); - - } - - }, - - subclip: function ( sourceClip, name, startFrame, endFrame, fps = 30 ) { - - const clip = sourceClip.clone(); - - clip.name = name; - - const tracks = []; - - for ( let i = 0; i < clip.tracks.length; ++ i ) { - - const track = clip.tracks[ i ]; - const valueSize = track.getValueSize(); - - const times = []; - const values = []; - - for ( let j = 0; j < track.times.length; ++ j ) { - - const frame = track.times[ j ] * fps; - - if ( frame < startFrame || frame >= endFrame ) continue; - - times.push( track.times[ j ] ); - - for ( let k = 0; k < valueSize; ++ k ) { - - values.push( track.values[ j * valueSize + k ] ); - - } - - } - - if ( times.length === 0 ) continue; - - track.times = AnimationUtils.convertArray( times, track.times.constructor ); - track.values = AnimationUtils.convertArray( values, track.values.constructor ); - - tracks.push( track ); - - } - - clip.tracks = tracks; - - // find minimum .times value across all tracks in the trimmed clip - - let minStartTime = Infinity; - - for ( let i = 0; i < clip.tracks.length; ++ i ) { - - if ( minStartTime > clip.tracks[ i ].times[ 0 ] ) { - - minStartTime = clip.tracks[ i ].times[ 0 ]; - - } - - } - - // shift all tracks such that clip begins at t=0 - - for ( let i = 0; i < clip.tracks.length; ++ i ) { - - clip.tracks[ i ].shift( - 1 * minStartTime ); - - } - - clip.resetDuration(); - - return clip; - - }, - - makeClipAdditive: function ( targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30 ) { - - if ( fps <= 0 ) fps = 30; - - const numTracks = referenceClip.tracks.length; - const referenceTime = referenceFrame / fps; - - // Make each track's values relative to the values at the reference frame - for ( let i = 0; i < numTracks; ++ i ) { - - const referenceTrack = referenceClip.tracks[ i ]; - const referenceTrackType = referenceTrack.ValueTypeName; - - // Skip this track if it's non-numeric - if ( referenceTrackType === 'bool' || referenceTrackType === 'string' ) continue; - - // Find the track in the target clip whose name and type matches the reference track - const targetTrack = targetClip.tracks.find( function ( track ) { - - return track.name === referenceTrack.name - && track.ValueTypeName === referenceTrackType; - - } ); - - if ( targetTrack === undefined ) continue; - - let referenceOffset = 0; - const referenceValueSize = referenceTrack.getValueSize(); - - if ( referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) { - - referenceOffset = referenceValueSize / 3; - - } - - let targetOffset = 0; - const targetValueSize = targetTrack.getValueSize(); - - if ( targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) { - - targetOffset = targetValueSize / 3; - - } - - const lastIndex = referenceTrack.times.length - 1; - let referenceValue; - - // Find the value to subtract out of the track - if ( referenceTime <= referenceTrack.times[ 0 ] ) { - - // Reference frame is earlier than the first keyframe, so just use the first keyframe - const startIndex = referenceOffset; - const endIndex = referenceValueSize - referenceOffset; - referenceValue = AnimationUtils.arraySlice( referenceTrack.values, startIndex, endIndex ); - - } else if ( referenceTime >= referenceTrack.times[ lastIndex ] ) { - - // Reference frame is after the last keyframe, so just use the last keyframe - const startIndex = lastIndex * referenceValueSize + referenceOffset; - const endIndex = startIndex + referenceValueSize - referenceOffset; - referenceValue = AnimationUtils.arraySlice( referenceTrack.values, startIndex, endIndex ); - - } else { - - // Interpolate to the reference value - const interpolant = referenceTrack.createInterpolant(); - const startIndex = referenceOffset; - const endIndex = referenceValueSize - referenceOffset; - interpolant.evaluate( referenceTime ); - referenceValue = AnimationUtils.arraySlice( interpolant.resultBuffer, startIndex, endIndex ); - - } - - // Conjugate the quaternion - if ( referenceTrackType === 'quaternion' ) { - - const referenceQuat = new Quaternion().fromArray( referenceValue ).normalize().conjugate(); - referenceQuat.toArray( referenceValue ); - - } - - // Subtract the reference value from all of the track values - - const numTimes = targetTrack.times.length; - for ( let j = 0; j < numTimes; ++ j ) { - - const valueStart = j * targetValueSize + targetOffset; - - if ( referenceTrackType === 'quaternion' ) { - - // Multiply the conjugate for quaternion track types - Quaternion.multiplyQuaternionsFlat( - targetTrack.values, - valueStart, - referenceValue, - 0, - targetTrack.values, - valueStart - ); - - } else { - - const valueEnd = targetValueSize - targetOffset * 2; - - // Subtract each value for all other numeric track types - for ( let k = 0; k < valueEnd; ++ k ) { - - targetTrack.values[ valueStart + k ] -= referenceValue[ k ]; - - } - - } - - } - - } - - targetClip.blendMode = AdditiveAnimationBlendMode; - - return targetClip; - - } - -}; - -/** - * Abstract base class of interpolants over parametric samples. - * - * The parameter domain is one dimensional, typically the time or a path - * along a curve defined by the data. - * - * The sample values can have any dimensionality and derived classes may - * apply special interpretations to the data. - * - * This class provides the interval seek in a Template Method, deferring - * the actual interpolation to derived classes. - * - * Time complexity is O(1) for linear access crossing at most two points - * and O(log N) for random access, where N is the number of positions. - * - * References: - * - * http://www.oodesign.com/template-method-pattern.html - * - */ - -function Interpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) { - - this.parameterPositions = parameterPositions; - this._cachedIndex = 0; - - this.resultBuffer = resultBuffer !== undefined ? - resultBuffer : new sampleValues.constructor( sampleSize ); - this.sampleValues = sampleValues; - this.valueSize = sampleSize; - -} - -Object.assign( Interpolant.prototype, { - - evaluate: function ( t ) { - - const pp = this.parameterPositions; - let i1 = this._cachedIndex, - t1 = pp[ i1 ], - t0 = pp[ i1 - 1 ]; - - validate_interval: { - - seek: { - - let right; - - linear_scan: { - - //- See http://jsperf.com/comparison-to-undefined/3 - //- slower code: - //- - //- if ( t >= t1 || t1 === undefined ) { - forward_scan: if ( ! ( t < t1 ) ) { - - for ( let giveUpAt = i1 + 2; ; ) { - - if ( t1 === undefined ) { - - if ( t < t0 ) break forward_scan; - - // after end - - i1 = pp.length; - this._cachedIndex = i1; - return this.afterEnd_( i1 - 1, t, t0 ); - - } - - if ( i1 === giveUpAt ) break; // this loop - - t0 = t1; - t1 = pp[ ++ i1 ]; - - if ( t < t1 ) { - - // we have arrived at the sought interval - break seek; - - } - - } - - // prepare binary search on the right side of the index - right = pp.length; - break linear_scan; - - } - - //- slower code: - //- if ( t < t0 || t0 === undefined ) { - if ( ! ( t >= t0 ) ) { - - // looping? - - const t1global = pp[ 1 ]; - - if ( t < t1global ) { - - i1 = 2; // + 1, using the scan for the details - t0 = t1global; - - } - - // linear reverse scan - - for ( let giveUpAt = i1 - 2; ; ) { - - if ( t0 === undefined ) { - - // before start - - this._cachedIndex = 0; - return this.beforeStart_( 0, t, t1 ); - - } - - if ( i1 === giveUpAt ) break; // this loop - - t1 = t0; - t0 = pp[ -- i1 - 1 ]; - - if ( t >= t0 ) { - - // we have arrived at the sought interval - break seek; - - } - - } - - // prepare binary search on the left side of the index - right = i1; - i1 = 0; - break linear_scan; - - } - - // the interval is valid - - break validate_interval; - - } // linear scan - - // binary search - - while ( i1 < right ) { - - const mid = ( i1 + right ) >>> 1; - - if ( t < pp[ mid ] ) { - - right = mid; - - } else { - - i1 = mid + 1; - - } - - } - - t1 = pp[ i1 ]; - t0 = pp[ i1 - 1 ]; - - // check boundary cases, again - - if ( t0 === undefined ) { - - this._cachedIndex = 0; - return this.beforeStart_( 0, t, t1 ); - - } - - if ( t1 === undefined ) { - - i1 = pp.length; - this._cachedIndex = i1; - return this.afterEnd_( i1 - 1, t0, t ); - - } - - } // seek - - this._cachedIndex = i1; - - this.intervalChanged_( i1, t0, t1 ); - - } // validate_interval - - return this.interpolate_( i1, t0, t, t1 ); - - }, - - settings: null, // optional, subclass-specific settings structure - // Note: The indirection allows central control of many interpolants. - - // --- Protected interface - - DefaultSettings_: {}, - - getSettings_: function () { - - return this.settings || this.DefaultSettings_; - - }, - - copySampleValue_: function ( index ) { - - // copies a sample value to the result buffer - - const result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - offset = index * stride; - - for ( let i = 0; i !== stride; ++ i ) { - - result[ i ] = values[ offset + i ]; - - } - - return result; - - }, - - // Template methods for derived classes: - - interpolate_: function ( /* i1, t0, t, t1 */ ) { - - throw new Error( 'call to abstract method' ); - // implementations shall return this.resultBuffer - - }, - - intervalChanged_: function ( /* i1, t0, t1 */ ) { - - // empty - - } - -} ); - -// DECLARE ALIAS AFTER assign prototype -Object.assign( Interpolant.prototype, { - - //( 0, t, t0 ), returns this.resultBuffer - beforeStart_: Interpolant.prototype.copySampleValue_, - - //( N-1, tN-1, t ), returns this.resultBuffer - afterEnd_: Interpolant.prototype.copySampleValue_, - -} ); - -/** - * Fast and simple cubic spline interpolant. - * - * It was derived from a Hermitian construction setting the first derivative - * at each sample position to the linear slope between neighboring positions - * over their parameter interval. - */ - -function CubicInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) { - - Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer ); - - this._weightPrev = - 0; - this._offsetPrev = - 0; - this._weightNext = - 0; - this._offsetNext = - 0; - -} - -CubicInterpolant.prototype = Object.assign( Object.create( Interpolant.prototype ), { - - constructor: CubicInterpolant, - - DefaultSettings_: { - - endingStart: ZeroCurvatureEnding, - endingEnd: ZeroCurvatureEnding - - }, - - intervalChanged_: function ( i1, t0, t1 ) { - - const pp = this.parameterPositions; - let iPrev = i1 - 2, - iNext = i1 + 1, - - tPrev = pp[ iPrev ], - tNext = pp[ iNext ]; - - if ( tPrev === undefined ) { - - switch ( this.getSettings_().endingStart ) { - - case ZeroSlopeEnding: - - // f'(t0) = 0 - iPrev = i1; - tPrev = 2 * t0 - t1; - - break; - - case WrapAroundEnding: - - // use the other end of the curve - iPrev = pp.length - 2; - tPrev = t0 + pp[ iPrev ] - pp[ iPrev + 1 ]; - - break; - - default: // ZeroCurvatureEnding - - // f''(t0) = 0 a.k.a. Natural Spline - iPrev = i1; - tPrev = t1; - - } - - } - - if ( tNext === undefined ) { - - switch ( this.getSettings_().endingEnd ) { - - case ZeroSlopeEnding: - - // f'(tN) = 0 - iNext = i1; - tNext = 2 * t1 - t0; - - break; - - case WrapAroundEnding: - - // use the other end of the curve - iNext = 1; - tNext = t1 + pp[ 1 ] - pp[ 0 ]; - - break; - - default: // ZeroCurvatureEnding - - // f''(tN) = 0, a.k.a. Natural Spline - iNext = i1 - 1; - tNext = t0; - - } - - } - - const halfDt = ( t1 - t0 ) * 0.5, - stride = this.valueSize; - - this._weightPrev = halfDt / ( t0 - tPrev ); - this._weightNext = halfDt / ( tNext - t1 ); - this._offsetPrev = iPrev * stride; - this._offsetNext = iNext * stride; - - }, - - interpolate_: function ( i1, t0, t, t1 ) { - - const result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - - o1 = i1 * stride, o0 = o1 - stride, - oP = this._offsetPrev, oN = this._offsetNext, - wP = this._weightPrev, wN = this._weightNext, - - p = ( t - t0 ) / ( t1 - t0 ), - pp = p * p, - ppp = pp * p; - - // evaluate polynomials - - const sP = - wP * ppp + 2 * wP * pp - wP * p; - const s0 = ( 1 + wP ) * ppp + ( - 1.5 - 2 * wP ) * pp + ( - 0.5 + wP ) * p + 1; - const s1 = ( - 1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p; - const sN = wN * ppp - wN * pp; - - // combine data linearly - - for ( let i = 0; i !== stride; ++ i ) { - - result[ i ] = - sP * values[ oP + i ] + - s0 * values[ o0 + i ] + - s1 * values[ o1 + i ] + - sN * values[ oN + i ]; - - } - - return result; - - } - -} ); - -function LinearInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) { - - Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer ); - -} - -LinearInterpolant.prototype = Object.assign( Object.create( Interpolant.prototype ), { - - constructor: LinearInterpolant, - - interpolate_: function ( i1, t0, t, t1 ) { - - const result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - - offset1 = i1 * stride, - offset0 = offset1 - stride, - - weight1 = ( t - t0 ) / ( t1 - t0 ), - weight0 = 1 - weight1; - - for ( let i = 0; i !== stride; ++ i ) { - - result[ i ] = - values[ offset0 + i ] * weight0 + - values[ offset1 + i ] * weight1; - - } - - return result; - - } - -} ); - -/** - * - * Interpolant that evaluates to the sample value at the position preceeding - * the parameter. - */ - -function DiscreteInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) { - - Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer ); - -} - -DiscreteInterpolant.prototype = Object.assign( Object.create( Interpolant.prototype ), { - - constructor: DiscreteInterpolant, - - interpolate_: function ( i1 /*, t0, t, t1 */ ) { - - return this.copySampleValue_( i1 - 1 ); - - } - -} ); - -class KeyframeTrack { - - constructor( name, times, values, interpolation ) { - - if ( name === undefined ) throw new Error( 'THREE.KeyframeTrack: track name is undefined' ); - if ( times === undefined || times.length === 0 ) throw new Error( 'THREE.KeyframeTrack: no keyframes in track named ' + name ); - - this.name = name; - - this.times = AnimationUtils.convertArray( times, this.TimeBufferType ); - this.values = AnimationUtils.convertArray( values, this.ValueBufferType ); - - this.setInterpolation( interpolation || this.DefaultInterpolation ); - - } - - // Serialization (in static context, because of constructor invocation - // and automatic invocation of .toJSON): - - static toJSON( track ) { - - const trackType = track.constructor; - - let json; - - // derived classes can define a static toJSON method - if ( trackType.toJSON !== this.toJSON ) { - - json = trackType.toJSON( track ); - - } else { - - // by default, we assume the data can be serialized as-is - json = { - - 'name': track.name, - 'times': AnimationUtils.convertArray( track.times, Array ), - 'values': AnimationUtils.convertArray( track.values, Array ) - - }; - - const interpolation = track.getInterpolation(); - - if ( interpolation !== track.DefaultInterpolation ) { - - json.interpolation = interpolation; - - } - - } - - json.type = track.ValueTypeName; // mandatory - - return json; - - } - - InterpolantFactoryMethodDiscrete( result ) { - - return new DiscreteInterpolant( this.times, this.values, this.getValueSize(), result ); - - } - - InterpolantFactoryMethodLinear( result ) { - - return new LinearInterpolant( this.times, this.values, this.getValueSize(), result ); - - } - - InterpolantFactoryMethodSmooth( result ) { - - return new CubicInterpolant( this.times, this.values, this.getValueSize(), result ); - - } - - setInterpolation( interpolation ) { - - let factoryMethod; - - switch ( interpolation ) { - - case InterpolateDiscrete: - - factoryMethod = this.InterpolantFactoryMethodDiscrete; - - break; - - case InterpolateLinear: - - factoryMethod = this.InterpolantFactoryMethodLinear; - - break; - - case InterpolateSmooth: - - factoryMethod = this.InterpolantFactoryMethodSmooth; - - break; - - } - - if ( factoryMethod === undefined ) { - - const message = 'unsupported interpolation for ' + - this.ValueTypeName + ' keyframe track named ' + this.name; - - if ( this.createInterpolant === undefined ) { - - // fall back to default, unless the default itself is messed up - if ( interpolation !== this.DefaultInterpolation ) { - - this.setInterpolation( this.DefaultInterpolation ); - - } else { - - throw new Error( message ); // fatal, in this case - - } - - } - - console.warn( 'THREE.KeyframeTrack:', message ); - return this; - - } - - this.createInterpolant = factoryMethod; - - return this; - - } - - getInterpolation() { - - switch ( this.createInterpolant ) { - - case this.InterpolantFactoryMethodDiscrete: - - return InterpolateDiscrete; - - case this.InterpolantFactoryMethodLinear: - - return InterpolateLinear; - - case this.InterpolantFactoryMethodSmooth: - - return InterpolateSmooth; - - } - - } - - getValueSize() { - - return this.values.length / this.times.length; - - } - - // move all keyframes either forwards or backwards in time - shift( timeOffset ) { - - if ( timeOffset !== 0.0 ) { - - const times = this.times; - - for ( let i = 0, n = times.length; i !== n; ++ i ) { - - times[ i ] += timeOffset; - - } - - } - - return this; - - } - - // scale all keyframe times by a factor (useful for frame <-> seconds conversions) - scale( timeScale ) { - - if ( timeScale !== 1.0 ) { - - const times = this.times; - - for ( let i = 0, n = times.length; i !== n; ++ i ) { - - times[ i ] *= timeScale; - - } - - } - - return this; - - } - - // removes keyframes before and after animation without changing any values within the range [startTime, endTime]. - // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values - trim( startTime, endTime ) { - - const times = this.times, - nKeys = times.length; - - let from = 0, - to = nKeys - 1; - - while ( from !== nKeys && times[ from ] < startTime ) { - - ++ from; - - } - - while ( to !== - 1 && times[ to ] > endTime ) { - - -- to; - - } - - ++ to; // inclusive -> exclusive bound - - if ( from !== 0 || to !== nKeys ) { - - // empty tracks are forbidden, so keep at least one keyframe - if ( from >= to ) { - - to = Math.max( to, 1 ); - from = to - 1; - - } - - const stride = this.getValueSize(); - this.times = AnimationUtils.arraySlice( times, from, to ); - this.values = AnimationUtils.arraySlice( this.values, from * stride, to * stride ); - - } - - return this; - - } - - // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable - validate() { - - let valid = true; - - const valueSize = this.getValueSize(); - if ( valueSize - Math.floor( valueSize ) !== 0 ) { - - console.error( 'THREE.KeyframeTrack: Invalid value size in track.', this ); - valid = false; - - } - - const times = this.times, - values = this.values, - - nKeys = times.length; - - if ( nKeys === 0 ) { - - console.error( 'THREE.KeyframeTrack: Track is empty.', this ); - valid = false; - - } - - let prevTime = null; - - for ( let i = 0; i !== nKeys; i ++ ) { - - const currTime = times[ i ]; - - if ( typeof currTime === 'number' && isNaN( currTime ) ) { - - console.error( 'THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime ); - valid = false; - break; - - } - - if ( prevTime !== null && prevTime > currTime ) { - - console.error( 'THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime ); - valid = false; - break; - - } - - prevTime = currTime; - - } - - if ( values !== undefined ) { - - if ( AnimationUtils.isTypedArray( values ) ) { - - for ( let i = 0, n = values.length; i !== n; ++ i ) { - - const value = values[ i ]; - - if ( isNaN( value ) ) { - - console.error( 'THREE.KeyframeTrack: Value is not a valid number.', this, i, value ); - valid = false; - break; - - } - - } - - } - - } - - return valid; - - } - - // removes equivalent sequential keys as common in morph target sequences - // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0) - optimize() { - - // times or values may be shared with other tracks, so overwriting is unsafe - const times = AnimationUtils.arraySlice( this.times ), - values = AnimationUtils.arraySlice( this.values ), - stride = this.getValueSize(), - - smoothInterpolation = this.getInterpolation() === InterpolateSmooth, - - lastIndex = times.length - 1; - - let writeIndex = 1; - - for ( let i = 1; i < lastIndex; ++ i ) { - - let keep = false; - - const time = times[ i ]; - const timeNext = times[ i + 1 ]; - - // remove adjacent keyframes scheduled at the same time - - if ( time !== timeNext && ( i !== 1 || time !== times[ 0 ] ) ) { - - if ( ! smoothInterpolation ) { - - // remove unnecessary keyframes same as their neighbors - - const offset = i * stride, - offsetP = offset - stride, - offsetN = offset + stride; - - for ( let j = 0; j !== stride; ++ j ) { - - const value = values[ offset + j ]; - - if ( value !== values[ offsetP + j ] || - value !== values[ offsetN + j ] ) { - - keep = true; - break; - - } - - } - - } else { - - keep = true; - - } - - } - - // in-place compaction - - if ( keep ) { - - if ( i !== writeIndex ) { - - times[ writeIndex ] = times[ i ]; - - const readOffset = i * stride, - writeOffset = writeIndex * stride; - - for ( let j = 0; j !== stride; ++ j ) { - - values[ writeOffset + j ] = values[ readOffset + j ]; - - } - - } - - ++ writeIndex; - - } - - } - - // flush last keyframe (compaction looks ahead) - - if ( lastIndex > 0 ) { - - times[ writeIndex ] = times[ lastIndex ]; - - for ( let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) { - - values[ writeOffset + j ] = values[ readOffset + j ]; - - } - - ++ writeIndex; - - } - - if ( writeIndex !== times.length ) { - - this.times = AnimationUtils.arraySlice( times, 0, writeIndex ); - this.values = AnimationUtils.arraySlice( values, 0, writeIndex * stride ); - - } else { - - this.times = times; - this.values = values; - - } - - return this; - - } - - clone() { - - const times = AnimationUtils.arraySlice( this.times, 0 ); - const values = AnimationUtils.arraySlice( this.values, 0 ); - - const TypedKeyframeTrack = this.constructor; - const track = new TypedKeyframeTrack( this.name, times, values ); - - // Interpolant argument to constructor is not saved, so copy the factory method directly. - track.createInterpolant = this.createInterpolant; - - return track; - - } - -} - -KeyframeTrack.prototype.TimeBufferType = Float32Array; -KeyframeTrack.prototype.ValueBufferType = Float32Array; -KeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear; - -/** - * A Track of Boolean keyframe values. - */ -class BooleanKeyframeTrack extends KeyframeTrack {} - -BooleanKeyframeTrack.prototype.ValueTypeName = 'bool'; -BooleanKeyframeTrack.prototype.ValueBufferType = Array; -BooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete; -BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined; -BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined; - -/** - * A Track of keyframe values that represent color. - */ -class ColorKeyframeTrack extends KeyframeTrack {} - -ColorKeyframeTrack.prototype.ValueTypeName = 'color'; - -/** - * A Track of numeric keyframe values. - */ -class NumberKeyframeTrack extends KeyframeTrack {} - -NumberKeyframeTrack.prototype.ValueTypeName = 'number'; - -/** - * Spherical linear unit quaternion interpolant. - */ - -function QuaternionLinearInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) { - - Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer ); - -} - -QuaternionLinearInterpolant.prototype = Object.assign( Object.create( Interpolant.prototype ), { - - constructor: QuaternionLinearInterpolant, - - interpolate_: function ( i1, t0, t, t1 ) { - - const result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - - alpha = ( t - t0 ) / ( t1 - t0 ); - - let offset = i1 * stride; - - for ( let end = offset + stride; offset !== end; offset += 4 ) { - - Quaternion.slerpFlat( result, 0, values, offset - stride, values, offset, alpha ); - - } - - return result; - - } - -} ); - -/** - * A Track of quaternion keyframe values. - */ -class QuaternionKeyframeTrack extends KeyframeTrack { - - InterpolantFactoryMethodLinear( result ) { - - return new QuaternionLinearInterpolant( this.times, this.values, this.getValueSize(), result ); - - } - -} - -QuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion'; -// ValueBufferType is inherited -QuaternionKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear; -QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined; - -/** - * A Track that interpolates Strings - */ -class StringKeyframeTrack extends KeyframeTrack {} - -StringKeyframeTrack.prototype.ValueTypeName = 'string'; -StringKeyframeTrack.prototype.ValueBufferType = Array; -StringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete; -StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined; -StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined; - -/** - * A Track of vectored keyframe values. - */ -class VectorKeyframeTrack extends KeyframeTrack {} - -VectorKeyframeTrack.prototype.ValueTypeName = 'vector'; - -class AnimationClip { - - constructor( name, duration = - 1, tracks, blendMode = NormalAnimationBlendMode ) { - - this.name = name; - this.tracks = tracks; - this.duration = duration; - this.blendMode = blendMode; - - this.uuid = MathUtils.generateUUID(); - - // this means it should figure out its duration by scanning the tracks - if ( this.duration < 0 ) { - - this.resetDuration(); - - } - - } - - - static parse( json ) { - - const tracks = [], - jsonTracks = json.tracks, - frameTime = 1.0 / ( json.fps || 1.0 ); - - for ( let i = 0, n = jsonTracks.length; i !== n; ++ i ) { - - tracks.push( parseKeyframeTrack( jsonTracks[ i ] ).scale( frameTime ) ); - - } - - const clip = new this( json.name, json.duration, tracks, json.blendMode ); - clip.uuid = json.uuid; - - return clip; - - } - - static toJSON( clip ) { - - const tracks = [], - clipTracks = clip.tracks; - - const json = { - - 'name': clip.name, - 'duration': clip.duration, - 'tracks': tracks, - 'uuid': clip.uuid, - 'blendMode': clip.blendMode - - }; - - for ( let i = 0, n = clipTracks.length; i !== n; ++ i ) { - - tracks.push( KeyframeTrack.toJSON( clipTracks[ i ] ) ); - - } - - return json; - - } - - static CreateFromMorphTargetSequence( name, morphTargetSequence, fps, noLoop ) { - - const numMorphTargets = morphTargetSequence.length; - const tracks = []; - - for ( let i = 0; i < numMorphTargets; i ++ ) { - - let times = []; - let values = []; - - times.push( - ( i + numMorphTargets - 1 ) % numMorphTargets, - i, - ( i + 1 ) % numMorphTargets ); - - values.push( 0, 1, 0 ); - - const order = AnimationUtils.getKeyframeOrder( times ); - times = AnimationUtils.sortedArray( times, 1, order ); - values = AnimationUtils.sortedArray( values, 1, order ); - - // if there is a key at the first frame, duplicate it as the - // last frame as well for perfect loop. - if ( ! noLoop && times[ 0 ] === 0 ) { - - times.push( numMorphTargets ); - values.push( values[ 0 ] ); - - } - - tracks.push( - new NumberKeyframeTrack( - '.morphTargetInfluences[' + morphTargetSequence[ i ].name + ']', - times, values - ).scale( 1.0 / fps ) ); - - } - - return new this( name, - 1, tracks ); - - } - - static findByName( objectOrClipArray, name ) { - - let clipArray = objectOrClipArray; - - if ( ! Array.isArray( objectOrClipArray ) ) { - - const o = objectOrClipArray; - clipArray = o.geometry && o.geometry.animations || o.animations; - - } - - for ( let i = 0; i < clipArray.length; i ++ ) { - - if ( clipArray[ i ].name === name ) { - - return clipArray[ i ]; - - } - - } - - return null; - - } - - static CreateClipsFromMorphTargetSequences( morphTargets, fps, noLoop ) { - - const animationToMorphTargets = {}; - - // tested with https://regex101.com/ on trick sequences - // such flamingo_flyA_003, flamingo_run1_003, crdeath0059 - const pattern = /^([\w-]*?)([\d]+)$/; - - // sort morph target names into animation groups based - // patterns like Walk_001, Walk_002, Run_001, Run_002 - for ( let i = 0, il = morphTargets.length; i < il; i ++ ) { - - const morphTarget = morphTargets[ i ]; - const parts = morphTarget.name.match( pattern ); - - if ( parts && parts.length > 1 ) { - - const name = parts[ 1 ]; - - let animationMorphTargets = animationToMorphTargets[ name ]; - - if ( ! animationMorphTargets ) { - - animationToMorphTargets[ name ] = animationMorphTargets = []; - - } - - animationMorphTargets.push( morphTarget ); - - } - - } - - const clips = []; - - for ( const name in animationToMorphTargets ) { - - clips.push( this.CreateFromMorphTargetSequence( name, animationToMorphTargets[ name ], fps, noLoop ) ); - - } - - return clips; - - } - - // parse the animation.hierarchy format - static parseAnimation( animation, bones ) { - - if ( ! animation ) { - - console.error( 'THREE.AnimationClip: No animation in JSONLoader data.' ); - return null; - - } - - const addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) { - - // only return track if there are actually keys. - if ( animationKeys.length !== 0 ) { - - const times = []; - const values = []; - - AnimationUtils.flattenJSON( animationKeys, times, values, propertyName ); - - // empty keys are filtered out, so check again - if ( times.length !== 0 ) { - - destTracks.push( new trackType( trackName, times, values ) ); - - } - - } - - }; - - const tracks = []; - - const clipName = animation.name || 'default'; - const fps = animation.fps || 30; - const blendMode = animation.blendMode; - - // automatic length determination in AnimationClip. - let duration = animation.length || - 1; - - const hierarchyTracks = animation.hierarchy || []; - - for ( let h = 0; h < hierarchyTracks.length; h ++ ) { - - const animationKeys = hierarchyTracks[ h ].keys; - - // skip empty tracks - if ( ! animationKeys || animationKeys.length === 0 ) continue; - - // process morph targets - if ( animationKeys[ 0 ].morphTargets ) { - - // figure out all morph targets used in this track - const morphTargetNames = {}; - - let k; - - for ( k = 0; k < animationKeys.length; k ++ ) { - - if ( animationKeys[ k ].morphTargets ) { - - for ( let m = 0; m < animationKeys[ k ].morphTargets.length; m ++ ) { - - morphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = - 1; - - } - - } - - } - - // create a track for each morph target with all zero - // morphTargetInfluences except for the keys in which - // the morphTarget is named. - for ( const morphTargetName in morphTargetNames ) { - - const times = []; - const values = []; - - for ( let m = 0; m !== animationKeys[ k ].morphTargets.length; ++ m ) { - - const animationKey = animationKeys[ k ]; - - times.push( animationKey.time ); - values.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 ); - - } - - tracks.push( new NumberKeyframeTrack( '.morphTargetInfluence[' + morphTargetName + ']', times, values ) ); - - } - - duration = morphTargetNames.length * ( fps || 1.0 ); - - } else { - - // ...assume skeletal animation - - const boneName = '.bones[' + bones[ h ].name + ']'; - - addNonemptyTrack( - VectorKeyframeTrack, boneName + '.position', - animationKeys, 'pos', tracks ); - - addNonemptyTrack( - QuaternionKeyframeTrack, boneName + '.quaternion', - animationKeys, 'rot', tracks ); - - addNonemptyTrack( - VectorKeyframeTrack, boneName + '.scale', - animationKeys, 'scl', tracks ); - - } - - } - - if ( tracks.length === 0 ) { - - return null; - - } - - const clip = new this( clipName, duration, tracks, blendMode ); - - return clip; - - } - - resetDuration() { - - const tracks = this.tracks; - let duration = 0; - - for ( let i = 0, n = tracks.length; i !== n; ++ i ) { - - const track = this.tracks[ i ]; - - duration = Math.max( duration, track.times[ track.times.length - 1 ] ); - - } - - this.duration = duration; - - return this; - - } - - trim() { - - for ( let i = 0; i < this.tracks.length; i ++ ) { - - this.tracks[ i ].trim( 0, this.duration ); - - } - - return this; - - } - - validate() { - - let valid = true; - - for ( let i = 0; i < this.tracks.length; i ++ ) { - - valid = valid && this.tracks[ i ].validate(); - - } - - return valid; - - } - - optimize() { - - for ( let i = 0; i < this.tracks.length; i ++ ) { - - this.tracks[ i ].optimize(); - - } - - return this; - - } - - clone() { - - const tracks = []; - - for ( let i = 0; i < this.tracks.length; i ++ ) { - - tracks.push( this.tracks[ i ].clone() ); - - } - - return new this.constructor( this.name, this.duration, tracks, this.blendMode ); - - } - - toJSON() { - - return this.constructor.toJSON( this ); - - } - -} - -function getTrackTypeForValueTypeName( typeName ) { - - switch ( typeName.toLowerCase() ) { - - case 'scalar': - case 'double': - case 'float': - case 'number': - case 'integer': - - return NumberKeyframeTrack; - - case 'vector': - case 'vector2': - case 'vector3': - case 'vector4': - - return VectorKeyframeTrack; - - case 'color': - - return ColorKeyframeTrack; - - case 'quaternion': - - return QuaternionKeyframeTrack; - - case 'bool': - case 'boolean': - - return BooleanKeyframeTrack; - - case 'string': - - return StringKeyframeTrack; - - } - - throw new Error( 'THREE.KeyframeTrack: Unsupported typeName: ' + typeName ); - -} - -function parseKeyframeTrack( json ) { - - if ( json.type === undefined ) { - - throw new Error( 'THREE.KeyframeTrack: track type undefined, can not parse' ); - - } - - const trackType = getTrackTypeForValueTypeName( json.type ); - - if ( json.times === undefined ) { - - const times = [], values = []; - - AnimationUtils.flattenJSON( json.keys, times, values, 'value' ); - - json.times = times; - json.values = values; - - } - - // derived classes can define a static parse method - if ( trackType.parse !== undefined ) { - - return trackType.parse( json ); - - } else { - - // by default, we assume a constructor compatible with the base - return new trackType( json.name, json.times, json.values, json.interpolation ); - - } - -} - -const Cache = { - - enabled: false, - - files: {}, - - add: function ( key, file ) { - - if ( this.enabled === false ) return; - - // console.log( 'THREE.Cache', 'Adding key:', key ); - - this.files[ key ] = file; - - }, - - get: function ( key ) { - - if ( this.enabled === false ) return; - - // console.log( 'THREE.Cache', 'Checking key:', key ); - - return this.files[ key ]; - - }, - - remove: function ( key ) { - - delete this.files[ key ]; - - }, - - clear: function () { - - this.files = {}; - - } - -}; - -function LoadingManager( onLoad, onProgress, onError ) { - - const scope = this; - - let isLoading = false; - let itemsLoaded = 0; - let itemsTotal = 0; - let urlModifier = undefined; - const handlers = []; - - // Refer to #5689 for the reason why we don't set .onStart - // in the constructor - - this.onStart = undefined; - this.onLoad = onLoad; - this.onProgress = onProgress; - this.onError = onError; - - this.itemStart = function ( url ) { - - itemsTotal ++; - - if ( isLoading === false ) { - - if ( scope.onStart !== undefined ) { - - scope.onStart( url, itemsLoaded, itemsTotal ); - - } - - } - - isLoading = true; - - }; - - this.itemEnd = function ( url ) { - - itemsLoaded ++; - - if ( scope.onProgress !== undefined ) { - - scope.onProgress( url, itemsLoaded, itemsTotal ); - - } - - if ( itemsLoaded === itemsTotal ) { - - isLoading = false; - - if ( scope.onLoad !== undefined ) { - - scope.onLoad(); - - } - - } - - }; - - this.itemError = function ( url ) { - - if ( scope.onError !== undefined ) { - - scope.onError( url ); - - } - - }; - - this.resolveURL = function ( url ) { - - if ( urlModifier ) { - - return urlModifier( url ); - - } - - return url; - - }; - - this.setURLModifier = function ( transform ) { - - urlModifier = transform; - - return this; - - }; - - this.addHandler = function ( regex, loader ) { - - handlers.push( regex, loader ); - - return this; - - }; - - this.removeHandler = function ( regex ) { - - const index = handlers.indexOf( regex ); - - if ( index !== - 1 ) { - - handlers.splice( index, 2 ); - - } - - return this; - - }; - - this.getHandler = function ( file ) { - - for ( let i = 0, l = handlers.length; i < l; i += 2 ) { - - const regex = handlers[ i ]; - const loader = handlers[ i + 1 ]; - - if ( regex.global ) regex.lastIndex = 0; // see #17920 - - if ( regex.test( file ) ) { - - return loader; - - } - - } - - return null; - - }; - -} - -const DefaultLoadingManager = new LoadingManager(); - -function Loader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; - - this.crossOrigin = 'anonymous'; - this.withCredentials = false; - this.path = ''; - this.resourcePath = ''; - this.requestHeader = {}; - -} - -Object.assign( Loader.prototype, { - - load: function ( /* url, onLoad, onProgress, onError */ ) {}, - - loadAsync: function ( url, onProgress ) { - - const scope = this; - - return new Promise( function ( resolve, reject ) { - - scope.load( url, resolve, onProgress, reject ); - - } ); - - }, - - parse: function ( /* data */ ) {}, - - setCrossOrigin: function ( crossOrigin ) { - - this.crossOrigin = crossOrigin; - return this; - - }, - - setWithCredentials: function ( value ) { - - this.withCredentials = value; - return this; - - }, - - setPath: function ( path ) { - - this.path = path; - return this; - - }, - - setResourcePath: function ( resourcePath ) { - - this.resourcePath = resourcePath; - return this; - - }, - - setRequestHeader: function ( requestHeader ) { - - this.requestHeader = requestHeader; - return this; - - } - -} ); - -const loading = {}; - -function FileLoader( manager ) { - - Loader.call( this, manager ); - -} - -FileLoader.prototype = Object.assign( Object.create( Loader.prototype ), { - - constructor: FileLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - if ( url === undefined ) url = ''; - - if ( this.path !== undefined ) url = this.path + url; - - url = this.manager.resolveURL( url ); - - const scope = this; - - const cached = Cache.get( url ); - - if ( cached !== undefined ) { - - scope.manager.itemStart( url ); - - setTimeout( function () { - - if ( onLoad ) onLoad( cached ); - - scope.manager.itemEnd( url ); - - }, 0 ); - - return cached; - - } - - // Check if request is duplicate - - if ( loading[ url ] !== undefined ) { - - loading[ url ].push( { - - onLoad: onLoad, - onProgress: onProgress, - onError: onError - - } ); - - return; - - } - - // Check for data: URI - const dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/; - const dataUriRegexResult = url.match( dataUriRegex ); - let request; - - // Safari can not handle Data URIs through XMLHttpRequest so process manually - if ( dataUriRegexResult ) { - - const mimeType = dataUriRegexResult[ 1 ]; - const isBase64 = !! dataUriRegexResult[ 2 ]; - - let data = dataUriRegexResult[ 3 ]; - data = decodeURIComponent( data ); - - if ( isBase64 ) data = atob( data ); - - try { - - let response; - const responseType = ( this.responseType || '' ).toLowerCase(); - - switch ( responseType ) { - - case 'arraybuffer': - case 'blob': - - const view = new Uint8Array( data.length ); - - for ( let i = 0; i < data.length; i ++ ) { - - view[ i ] = data.charCodeAt( i ); - - } - - if ( responseType === 'blob' ) { - - response = new Blob( [ view.buffer ], { type: mimeType } ); - - } else { - - response = view.buffer; - - } - - break; - - case 'document': - - const parser = new DOMParser(); - response = parser.parseFromString( data, mimeType ); - - break; - - case 'json': - - response = JSON.parse( data ); - - break; - - default: // 'text' or other - - response = data; - - break; - - } - - // Wait for next browser tick like standard XMLHttpRequest event dispatching does - setTimeout( function () { - - if ( onLoad ) onLoad( response ); - - scope.manager.itemEnd( url ); - - }, 0 ); - - } catch ( error ) { - - // Wait for next browser tick like standard XMLHttpRequest event dispatching does - setTimeout( function () { - - if ( onError ) onError( error ); - - scope.manager.itemError( url ); - scope.manager.itemEnd( url ); - - }, 0 ); - - } - - } else { - - // Initialise array for duplicate requests - - loading[ url ] = []; - - loading[ url ].push( { - - onLoad: onLoad, - onProgress: onProgress, - onError: onError - - } ); - - request = new XMLHttpRequest(); - - request.open( 'GET', url, true ); - - request.addEventListener( 'load', function ( event ) { - - const response = this.response; - - const callbacks = loading[ url ]; - - delete loading[ url ]; - - if ( this.status === 200 || this.status === 0 ) { - - // Some browsers return HTTP Status 0 when using non-http protocol - // e.g. 'file://' or 'data://'. Handle as success. - - if ( this.status === 0 ) console.warn( 'THREE.FileLoader: HTTP Status 0 received.' ); - - // Add to cache only on HTTP success, so that we do not cache - // error response bodies as proper responses to requests. - Cache.add( url, response ); - - for ( let i = 0, il = callbacks.length; i < il; i ++ ) { - - const callback = callbacks[ i ]; - if ( callback.onLoad ) callback.onLoad( response ); - - } - - scope.manager.itemEnd( url ); - - } else { - - for ( let i = 0, il = callbacks.length; i < il; i ++ ) { - - const callback = callbacks[ i ]; - if ( callback.onError ) callback.onError( event ); - - } - - scope.manager.itemError( url ); - scope.manager.itemEnd( url ); - - } - - }, false ); - - request.addEventListener( 'progress', function ( event ) { - - const callbacks = loading[ url ]; - - for ( let i = 0, il = callbacks.length; i < il; i ++ ) { - - const callback = callbacks[ i ]; - if ( callback.onProgress ) callback.onProgress( event ); - - } - - }, false ); - - request.addEventListener( 'error', function ( event ) { - - const callbacks = loading[ url ]; - - delete loading[ url ]; - - for ( let i = 0, il = callbacks.length; i < il; i ++ ) { - - const callback = callbacks[ i ]; - if ( callback.onError ) callback.onError( event ); - - } - - scope.manager.itemError( url ); - scope.manager.itemEnd( url ); - - }, false ); - - request.addEventListener( 'abort', function ( event ) { - - const callbacks = loading[ url ]; - - delete loading[ url ]; - - for ( let i = 0, il = callbacks.length; i < il; i ++ ) { - - const callback = callbacks[ i ]; - if ( callback.onError ) callback.onError( event ); - - } - - scope.manager.itemError( url ); - scope.manager.itemEnd( url ); - - }, false ); - - if ( this.responseType !== undefined ) request.responseType = this.responseType; - if ( this.withCredentials !== undefined ) request.withCredentials = this.withCredentials; - - if ( request.overrideMimeType ) request.overrideMimeType( this.mimeType !== undefined ? this.mimeType : 'text/plain' ); - - for ( const header in this.requestHeader ) { - - request.setRequestHeader( header, this.requestHeader[ header ] ); - - } - - request.send( null ); - - } - - scope.manager.itemStart( url ); - - return request; - - }, - - setResponseType: function ( value ) { - - this.responseType = value; - return this; - - }, - - setMimeType: function ( value ) { - - this.mimeType = value; - return this; - - } - -} ); - -class AnimationLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - } - - load( url, onLoad, onProgress, onError ) { - - const scope = this; - - const loader = new FileLoader( this.manager ); - loader.setPath( this.path ); - loader.setRequestHeader( this.requestHeader ); - loader.setWithCredentials( this.withCredentials ); - loader.load( url, function ( text ) { - - try { - - onLoad( scope.parse( JSON.parse( text ) ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( json ) { - - const animations = []; - - for ( let i = 0; i < json.length; i ++ ) { - - const clip = AnimationClip.parse( json[ i ] ); - - animations.push( clip ); - - } - - return animations; - - } - -} - -/** - * Abstract Base class to block based textures loader (dds, pvr, ...) - * - * Sub classes have to implement the parse() method which will be used in load(). - */ - -function CompressedTextureLoader( manager ) { - - Loader.call( this, manager ); - -} - -CompressedTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), { - - constructor: CompressedTextureLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - const scope = this; - - const images = []; - - const texture = new CompressedTexture(); - - const loader = new FileLoader( this.manager ); - loader.setPath( this.path ); - loader.setResponseType( 'arraybuffer' ); - loader.setRequestHeader( this.requestHeader ); - loader.setWithCredentials( scope.withCredentials ); - - let loaded = 0; - - function loadTexture( i ) { - - loader.load( url[ i ], function ( buffer ) { - - const texDatas = scope.parse( buffer, true ); - - images[ i ] = { - width: texDatas.width, - height: texDatas.height, - format: texDatas.format, - mipmaps: texDatas.mipmaps - }; - - loaded += 1; - - if ( loaded === 6 ) { - - if ( texDatas.mipmapCount === 1 ) texture.minFilter = LinearFilter; - - texture.image = images; - texture.format = texDatas.format; - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - } - - }, onProgress, onError ); - - } - - if ( Array.isArray( url ) ) { - - for ( let i = 0, il = url.length; i < il; ++ i ) { - - loadTexture( i ); - - } - - } else { - - // compressed cubemap texture stored in a single DDS file - - loader.load( url, function ( buffer ) { - - const texDatas = scope.parse( buffer, true ); - - if ( texDatas.isCubemap ) { - - const faces = texDatas.mipmaps.length / texDatas.mipmapCount; - - for ( let f = 0; f < faces; f ++ ) { - - images[ f ] = { mipmaps: [] }; - - for ( let i = 0; i < texDatas.mipmapCount; i ++ ) { - - images[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] ); - images[ f ].format = texDatas.format; - images[ f ].width = texDatas.width; - images[ f ].height = texDatas.height; - - } - - } - - texture.image = images; - - } else { - - texture.image.width = texDatas.width; - texture.image.height = texDatas.height; - texture.mipmaps = texDatas.mipmaps; - - } - - if ( texDatas.mipmapCount === 1 ) { - - texture.minFilter = LinearFilter; - - } - - texture.format = texDatas.format; - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - }, onProgress, onError ); - - } - - return texture; - - } - -} ); - -class ImageLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - } - - load( url, onLoad, onProgress, onError ) { - - if ( this.path !== undefined ) url = this.path + url; - - url = this.manager.resolveURL( url ); - - const scope = this; - - const cached = Cache.get( url ); - - if ( cached !== undefined ) { - - scope.manager.itemStart( url ); - - setTimeout( function () { - - if ( onLoad ) onLoad( cached ); - - scope.manager.itemEnd( url ); - - }, 0 ); - - return cached; - - } - - const image = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'img' ); - - function onImageLoad() { - - image.removeEventListener( 'load', onImageLoad, false ); - image.removeEventListener( 'error', onImageError, false ); - - Cache.add( url, this ); - - if ( onLoad ) onLoad( this ); - - scope.manager.itemEnd( url ); - - } - - function onImageError( event ) { - - image.removeEventListener( 'load', onImageLoad, false ); - image.removeEventListener( 'error', onImageError, false ); - - if ( onError ) onError( event ); - - scope.manager.itemError( url ); - scope.manager.itemEnd( url ); - - } - - image.addEventListener( 'load', onImageLoad, false ); - image.addEventListener( 'error', onImageError, false ); - - if ( url.substr( 0, 5 ) !== 'data:' ) { - - if ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin; - - } - - scope.manager.itemStart( url ); - - image.src = url; - - return image; - - } - -} - -class CubeTextureLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - } - - load( urls, onLoad, onProgress, onError ) { - - const texture = new CubeTexture(); - - const loader = new ImageLoader( this.manager ); - loader.setCrossOrigin( this.crossOrigin ); - loader.setPath( this.path ); - - let loaded = 0; - - function loadTexture( i ) { - - loader.load( urls[ i ], function ( image ) { - - texture.images[ i ] = image; - - loaded ++; - - if ( loaded === 6 ) { - - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - } - - }, undefined, onError ); - - } - - for ( let i = 0; i < urls.length; ++ i ) { - - loadTexture( i ); - - } - - return texture; - - } - -} - -/** - * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...) - * - * Sub classes have to implement the parse() method which will be used in load(). - */ - -function DataTextureLoader( manager ) { - - Loader.call( this, manager ); - -} - -DataTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), { - - constructor: DataTextureLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - const scope = this; - - const texture = new DataTexture(); - - const loader = new FileLoader( this.manager ); - loader.setResponseType( 'arraybuffer' ); - loader.setRequestHeader( this.requestHeader ); - loader.setPath( this.path ); - loader.setWithCredentials( scope.withCredentials ); - loader.load( url, function ( buffer ) { - - const texData = scope.parse( buffer ); - - if ( ! texData ) return; - - if ( texData.image !== undefined ) { - - texture.image = texData.image; - - } else if ( texData.data !== undefined ) { - - texture.image.width = texData.width; - texture.image.height = texData.height; - texture.image.data = texData.data; - - } - - texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping; - texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping; - - texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter; - texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter; - - texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1; - - if ( texData.encoding !== undefined ) { - - texture.encoding = texData.encoding; - - } - - if ( texData.flipY !== undefined ) { - - texture.flipY = texData.flipY; - - } - - if ( texData.format !== undefined ) { - - texture.format = texData.format; - - } - - if ( texData.type !== undefined ) { - - texture.type = texData.type; - - } - - if ( texData.mipmaps !== undefined ) { - - texture.mipmaps = texData.mipmaps; - texture.minFilter = LinearMipmapLinearFilter; // presumably... - - } - - if ( texData.mipmapCount === 1 ) { - - texture.minFilter = LinearFilter; - - } - - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture, texData ); - - }, onProgress, onError ); - - - return texture; - - } - -} ); - -function TextureLoader( manager ) { - - Loader.call( this, manager ); - -} - -TextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), { - - constructor: TextureLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - const texture = new Texture(); - - const loader = new ImageLoader( this.manager ); - loader.setCrossOrigin( this.crossOrigin ); - loader.setPath( this.path ); - - loader.load( url, function ( image ) { - - texture.image = image; - - // JPEGs can't have an alpha channel, so memory can be saved by storing them as RGB. - const isJPEG = url.search( /\.jpe?g($|\?)/i ) > 0 || url.search( /^data\:image\/jpeg/ ) === 0; - - texture.format = isJPEG ? RGBFormat : RGBAFormat; - texture.needsUpdate = true; - - if ( onLoad !== undefined ) { - - onLoad( texture ); - - } - - }, onProgress, onError ); - - return texture; - - } - -} ); - -/** - * Extensible curve object. - * - * Some common of curve methods: - * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget ) - * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget ) - * .getPoints(), .getSpacedPoints() - * .getLength() - * .updateArcLengths() - * - * This following curves inherit from THREE.Curve: - * - * -- 2D curves -- - * THREE.ArcCurve - * THREE.CubicBezierCurve - * THREE.EllipseCurve - * THREE.LineCurve - * THREE.QuadraticBezierCurve - * THREE.SplineCurve - * - * -- 3D curves -- - * THREE.CatmullRomCurve3 - * THREE.CubicBezierCurve3 - * THREE.LineCurve3 - * THREE.QuadraticBezierCurve3 - * - * A series of curves can be represented as a THREE.CurvePath. - * - **/ - -function Curve() { - - this.type = 'Curve'; - - this.arcLengthDivisions = 200; - -} - -Object.assign( Curve.prototype, { - - // Virtual base class method to overwrite and implement in subclasses - // - t [0 .. 1] - - getPoint: function ( /* t, optionalTarget */ ) { - - console.warn( 'THREE.Curve: .getPoint() not implemented.' ); - return null; - - }, - - // Get point at relative position in curve according to arc length - // - u [0 .. 1] - - getPointAt: function ( u, optionalTarget ) { - - const t = this.getUtoTmapping( u ); - return this.getPoint( t, optionalTarget ); - - }, - - // Get sequence of points using getPoint( t ) - - getPoints: function ( divisions = 5 ) { - - const points = []; - - for ( let d = 0; d <= divisions; d ++ ) { - - points.push( this.getPoint( d / divisions ) ); - - } - - return points; - - }, - - // Get sequence of points using getPointAt( u ) - - getSpacedPoints: function ( divisions = 5 ) { - - const points = []; - - for ( let d = 0; d <= divisions; d ++ ) { - - points.push( this.getPointAt( d / divisions ) ); - - } - - return points; - - }, - - // Get total curve arc length - - getLength: function () { - - const lengths = this.getLengths(); - return lengths[ lengths.length - 1 ]; - - }, - - // Get list of cumulative segment lengths - - getLengths: function ( divisions ) { - - if ( divisions === undefined ) divisions = this.arcLengthDivisions; - - if ( this.cacheArcLengths && - ( this.cacheArcLengths.length === divisions + 1 ) && - ! this.needsUpdate ) { - - return this.cacheArcLengths; - - } - - this.needsUpdate = false; - - const cache = []; - let current, last = this.getPoint( 0 ); - let sum = 0; - - cache.push( 0 ); - - for ( let p = 1; p <= divisions; p ++ ) { - - current = this.getPoint( p / divisions ); - sum += current.distanceTo( last ); - cache.push( sum ); - last = current; - - } - - this.cacheArcLengths = cache; - - return cache; // { sums: cache, sum: sum }; Sum is in the last element. - - }, - - updateArcLengths: function () { - - this.needsUpdate = true; - this.getLengths(); - - }, - - // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant - - getUtoTmapping: function ( u, distance ) { - - const arcLengths = this.getLengths(); - - let i = 0; - const il = arcLengths.length; - - let targetArcLength; // The targeted u distance value to get - - if ( distance ) { - - targetArcLength = distance; - - } else { - - targetArcLength = u * arcLengths[ il - 1 ]; - - } - - // binary search for the index with largest value smaller than target u distance - - let low = 0, high = il - 1, comparison; - - while ( low <= high ) { - - i = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats - - comparison = arcLengths[ i ] - targetArcLength; - - if ( comparison < 0 ) { - - low = i + 1; - - } else if ( comparison > 0 ) { - - high = i - 1; - - } else { - - high = i; - break; - - // DONE - - } - - } - - i = high; - - if ( arcLengths[ i ] === targetArcLength ) { - - return i / ( il - 1 ); - - } - - // we could get finer grain at lengths, or use simple interpolation between two points - - const lengthBefore = arcLengths[ i ]; - const lengthAfter = arcLengths[ i + 1 ]; - - const segmentLength = lengthAfter - lengthBefore; - - // determine where we are between the 'before' and 'after' points - - const segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength; - - // add that fractional amount to t - - const t = ( i + segmentFraction ) / ( il - 1 ); - - return t; - - }, - - // Returns a unit vector tangent at t - // In case any sub curve does not implement its tangent derivation, - // 2 points a small delta apart will be used to find its gradient - // which seems to give a reasonable approximation - - getTangent: function ( t, optionalTarget ) { - - const delta = 0.0001; - let t1 = t - delta; - let t2 = t + delta; - - // Capping in case of danger - - if ( t1 < 0 ) t1 = 0; - if ( t2 > 1 ) t2 = 1; - - const pt1 = this.getPoint( t1 ); - const pt2 = this.getPoint( t2 ); - - const tangent = optionalTarget || ( ( pt1.isVector2 ) ? new Vector2() : new Vector3() ); - - tangent.copy( pt2 ).sub( pt1 ).normalize(); - - return tangent; - - }, - - getTangentAt: function ( u, optionalTarget ) { - - const t = this.getUtoTmapping( u ); - return this.getTangent( t, optionalTarget ); - - }, - - computeFrenetFrames: function ( segments, closed ) { - - // see http://www.cs.indiana.edu/pub/techreports/TR425.pdf - - const normal = new Vector3(); - - const tangents = []; - const normals = []; - const binormals = []; - - const vec = new Vector3(); - const mat = new Matrix4(); - - // compute the tangent vectors for each segment on the curve - - for ( let i = 0; i <= segments; i ++ ) { - - const u = i / segments; - - tangents[ i ] = this.getTangentAt( u, new Vector3() ); - tangents[ i ].normalize(); - - } - - // select an initial normal vector perpendicular to the first tangent vector, - // and in the direction of the minimum tangent xyz component - - normals[ 0 ] = new Vector3(); - binormals[ 0 ] = new Vector3(); - let min = Number.MAX_VALUE; - const tx = Math.abs( tangents[ 0 ].x ); - const ty = Math.abs( tangents[ 0 ].y ); - const tz = Math.abs( tangents[ 0 ].z ); - - if ( tx <= min ) { - - min = tx; - normal.set( 1, 0, 0 ); - - } - - if ( ty <= min ) { - - min = ty; - normal.set( 0, 1, 0 ); - - } - - if ( tz <= min ) { - - normal.set( 0, 0, 1 ); - - } - - vec.crossVectors( tangents[ 0 ], normal ).normalize(); - - normals[ 0 ].crossVectors( tangents[ 0 ], vec ); - binormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ); - - - // compute the slowly-varying normal and binormal vectors for each segment on the curve - - for ( let i = 1; i <= segments; i ++ ) { - - normals[ i ] = normals[ i - 1 ].clone(); - - binormals[ i ] = binormals[ i - 1 ].clone(); - - vec.crossVectors( tangents[ i - 1 ], tangents[ i ] ); - - if ( vec.length() > Number.EPSILON ) { - - vec.normalize(); - - const theta = Math.acos( MathUtils.clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors - - normals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) ); - - } - - binormals[ i ].crossVectors( tangents[ i ], normals[ i ] ); - - } - - // if the curve is closed, postprocess the vectors so the first and last normal vectors are the same - - if ( closed === true ) { - - let theta = Math.acos( MathUtils.clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) ); - theta /= segments; - - if ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) { - - theta = - theta; - - } - - for ( let i = 1; i <= segments; i ++ ) { - - // twist a little... - normals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) ); - binormals[ i ].crossVectors( tangents[ i ], normals[ i ] ); - - } - - } - - return { - tangents: tangents, - normals: normals, - binormals: binormals - }; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( source ) { - - this.arcLengthDivisions = source.arcLengthDivisions; - - return this; - - }, - - toJSON: function () { - - const data = { - metadata: { - version: 4.5, - type: 'Curve', - generator: 'Curve.toJSON' - } - }; - - data.arcLengthDivisions = this.arcLengthDivisions; - data.type = this.type; - - return data; - - }, - - fromJSON: function ( json ) { - - this.arcLengthDivisions = json.arcLengthDivisions; - - return this; - - } - -} ); - -class EllipseCurve extends Curve { - - constructor( aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0 ) { - - super(); - - this.type = 'EllipseCurve'; - - this.aX = aX; - this.aY = aY; - - this.xRadius = xRadius; - this.yRadius = yRadius; - - this.aStartAngle = aStartAngle; - this.aEndAngle = aEndAngle; - - this.aClockwise = aClockwise; - - this.aRotation = aRotation; - - } - - getPoint( t, optionalTarget ) { - - const point = optionalTarget || new Vector2(); - - const twoPi = Math.PI * 2; - let deltaAngle = this.aEndAngle - this.aStartAngle; - const samePoints = Math.abs( deltaAngle ) < Number.EPSILON; - - // ensures that deltaAngle is 0 .. 2 PI - while ( deltaAngle < 0 ) deltaAngle += twoPi; - while ( deltaAngle > twoPi ) deltaAngle -= twoPi; - - if ( deltaAngle < Number.EPSILON ) { - - if ( samePoints ) { - - deltaAngle = 0; - - } else { - - deltaAngle = twoPi; - - } - - } - - if ( this.aClockwise === true && ! samePoints ) { - - if ( deltaAngle === twoPi ) { - - deltaAngle = - twoPi; - - } else { - - deltaAngle = deltaAngle - twoPi; - - } - - } - - const angle = this.aStartAngle + t * deltaAngle; - let x = this.aX + this.xRadius * Math.cos( angle ); - let y = this.aY + this.yRadius * Math.sin( angle ); - - if ( this.aRotation !== 0 ) { - - const cos = Math.cos( this.aRotation ); - const sin = Math.sin( this.aRotation ); - - const tx = x - this.aX; - const ty = y - this.aY; - - // Rotate the point about the center of the ellipse. - x = tx * cos - ty * sin + this.aX; - y = tx * sin + ty * cos + this.aY; - - } - - return point.set( x, y ); - - } - - copy( source ) { - - super.copy( source ); - - this.aX = source.aX; - this.aY = source.aY; - - this.xRadius = source.xRadius; - this.yRadius = source.yRadius; - - this.aStartAngle = source.aStartAngle; - this.aEndAngle = source.aEndAngle; - - this.aClockwise = source.aClockwise; - - this.aRotation = source.aRotation; - - return this; - - } - - toJSON() { - - const data = super.toJSON(); - - data.aX = this.aX; - data.aY = this.aY; - - data.xRadius = this.xRadius; - data.yRadius = this.yRadius; - - data.aStartAngle = this.aStartAngle; - data.aEndAngle = this.aEndAngle; - - data.aClockwise = this.aClockwise; - - data.aRotation = this.aRotation; - - return data; - - } - - fromJSON( json ) { - - super.fromJSON( json ); - - this.aX = json.aX; - this.aY = json.aY; - - this.xRadius = json.xRadius; - this.yRadius = json.yRadius; - - this.aStartAngle = json.aStartAngle; - this.aEndAngle = json.aEndAngle; - - this.aClockwise = json.aClockwise; - - this.aRotation = json.aRotation; - - return this; - - } - -} - -EllipseCurve.prototype.isEllipseCurve = true; - -class ArcCurve extends EllipseCurve { - - constructor( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) { - - super( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise ); - - this.type = 'ArcCurve'; - - } - -} - -ArcCurve.prototype.isArcCurve = true; - -/** - * Centripetal CatmullRom Curve - which is useful for avoiding - * cusps and self-intersections in non-uniform catmull rom curves. - * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf - * - * curve.type accepts centripetal(default), chordal and catmullrom - * curve.tension is used for catmullrom which defaults to 0.5 - */ - - -/* -Based on an optimized c++ solution in - - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/ - - http://ideone.com/NoEbVM - -This CubicPoly class could be used for reusing some variables and calculations, -but for three.js curve use, it could be possible inlined and flatten into a single function call -which can be placed in CurveUtils. -*/ - -function CubicPoly() { - - let c0 = 0, c1 = 0, c2 = 0, c3 = 0; - - /* - * Compute coefficients for a cubic polynomial - * p(s) = c0 + c1*s + c2*s^2 + c3*s^3 - * such that - * p(0) = x0, p(1) = x1 - * and - * p'(0) = t0, p'(1) = t1. - */ - function init( x0, x1, t0, t1 ) { - - c0 = x0; - c1 = t0; - c2 = - 3 * x0 + 3 * x1 - 2 * t0 - t1; - c3 = 2 * x0 - 2 * x1 + t0 + t1; - - } - - return { - - initCatmullRom: function ( x0, x1, x2, x3, tension ) { - - init( x1, x2, tension * ( x2 - x0 ), tension * ( x3 - x1 ) ); - - }, - - initNonuniformCatmullRom: function ( x0, x1, x2, x3, dt0, dt1, dt2 ) { - - // compute tangents when parameterized in [t1,t2] - let t1 = ( x1 - x0 ) / dt0 - ( x2 - x0 ) / ( dt0 + dt1 ) + ( x2 - x1 ) / dt1; - let t2 = ( x2 - x1 ) / dt1 - ( x3 - x1 ) / ( dt1 + dt2 ) + ( x3 - x2 ) / dt2; - - // rescale tangents for parametrization in [0,1] - t1 *= dt1; - t2 *= dt1; - - init( x1, x2, t1, t2 ); - - }, - - calc: function ( t ) { - - const t2 = t * t; - const t3 = t2 * t; - return c0 + c1 * t + c2 * t2 + c3 * t3; - - } - - }; - -} - -// - -const tmp = new Vector3(); -const px = new CubicPoly(), py = new CubicPoly(), pz = new CubicPoly(); - -class CatmullRomCurve3 extends Curve { - - constructor( points = [], closed = false, curveType = 'centripetal', tension = 0.5 ) { - - super(); - - this.type = 'CatmullRomCurve3'; - - this.points = points; - this.closed = closed; - this.curveType = curveType; - this.tension = tension; - - } - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - const points = this.points; - const l = points.length; - - const p = ( l - ( this.closed ? 0 : 1 ) ) * t; - let intPoint = Math.floor( p ); - let weight = p - intPoint; - - if ( this.closed ) { - - intPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / l ) + 1 ) * l; - - } else if ( weight === 0 && intPoint === l - 1 ) { - - intPoint = l - 2; - weight = 1; - - } - - let p0, p3; // 4 points (p1 & p2 defined below) - - if ( this.closed || intPoint > 0 ) { - - p0 = points[ ( intPoint - 1 ) % l ]; - - } else { - - // extrapolate first point - tmp.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] ); - p0 = tmp; - - } - - const p1 = points[ intPoint % l ]; - const p2 = points[ ( intPoint + 1 ) % l ]; - - if ( this.closed || intPoint + 2 < l ) { - - p3 = points[ ( intPoint + 2 ) % l ]; - - } else { - - // extrapolate last point - tmp.subVectors( points[ l - 1 ], points[ l - 2 ] ).add( points[ l - 1 ] ); - p3 = tmp; - - } - - if ( this.curveType === 'centripetal' || this.curveType === 'chordal' ) { - - // init Centripetal / Chordal Catmull-Rom - const pow = this.curveType === 'chordal' ? 0.5 : 0.25; - let dt0 = Math.pow( p0.distanceToSquared( p1 ), pow ); - let dt1 = Math.pow( p1.distanceToSquared( p2 ), pow ); - let dt2 = Math.pow( p2.distanceToSquared( p3 ), pow ); - - // safety check for repeated points - if ( dt1 < 1e-4 ) dt1 = 1.0; - if ( dt0 < 1e-4 ) dt0 = dt1; - if ( dt2 < 1e-4 ) dt2 = dt1; - - px.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 ); - py.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 ); - pz.initNonuniformCatmullRom( p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2 ); - - } else if ( this.curveType === 'catmullrom' ) { - - px.initCatmullRom( p0.x, p1.x, p2.x, p3.x, this.tension ); - py.initCatmullRom( p0.y, p1.y, p2.y, p3.y, this.tension ); - pz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, this.tension ); - - } - - point.set( - px.calc( weight ), - py.calc( weight ), - pz.calc( weight ) - ); - - return point; - - } - - copy( source ) { - - super.copy( source ); - - this.points = []; - - for ( let i = 0, l = source.points.length; i < l; i ++ ) { - - const point = source.points[ i ]; - - this.points.push( point.clone() ); - - } - - this.closed = source.closed; - this.curveType = source.curveType; - this.tension = source.tension; - - return this; - - } - - toJSON() { - - const data = super.toJSON(); - - data.points = []; - - for ( let i = 0, l = this.points.length; i < l; i ++ ) { - - const point = this.points[ i ]; - data.points.push( point.toArray() ); - - } - - data.closed = this.closed; - data.curveType = this.curveType; - data.tension = this.tension; - - return data; - - } - - fromJSON( json ) { - - super.fromJSON( json ); - - this.points = []; - - for ( let i = 0, l = json.points.length; i < l; i ++ ) { - - const point = json.points[ i ]; - this.points.push( new Vector3().fromArray( point ) ); - - } - - this.closed = json.closed; - this.curveType = json.curveType; - this.tension = json.tension; - - return this; - - } - -} - -CatmullRomCurve3.prototype.isCatmullRomCurve3 = true; - -/** - * Bezier Curves formulas obtained from - * http://en.wikipedia.org/wiki/Bézier_curve - */ - -function CatmullRom( t, p0, p1, p2, p3 ) { - - const v0 = ( p2 - p0 ) * 0.5; - const v1 = ( p3 - p1 ) * 0.5; - const t2 = t * t; - const t3 = t * t2; - return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1; - -} - -// - -function QuadraticBezierP0( t, p ) { - - const k = 1 - t; - return k * k * p; - -} - -function QuadraticBezierP1( t, p ) { - - return 2 * ( 1 - t ) * t * p; - -} - -function QuadraticBezierP2( t, p ) { - - return t * t * p; - -} - -function QuadraticBezier( t, p0, p1, p2 ) { - - return QuadraticBezierP0( t, p0 ) + QuadraticBezierP1( t, p1 ) + - QuadraticBezierP2( t, p2 ); - -} - -// - -function CubicBezierP0( t, p ) { - - const k = 1 - t; - return k * k * k * p; - -} - -function CubicBezierP1( t, p ) { - - const k = 1 - t; - return 3 * k * k * t * p; - -} - -function CubicBezierP2( t, p ) { - - return 3 * ( 1 - t ) * t * t * p; - -} - -function CubicBezierP3( t, p ) { - - return t * t * t * p; - -} - -function CubicBezier( t, p0, p1, p2, p3 ) { - - return CubicBezierP0( t, p0 ) + CubicBezierP1( t, p1 ) + CubicBezierP2( t, p2 ) + - CubicBezierP3( t, p3 ); - -} - -class CubicBezierCurve extends Curve { - - constructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2() ) { - - super(); - - this.type = 'CubicBezierCurve'; - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - - } - - getPoint( t, optionalTarget = new Vector2() ) { - - const point = optionalTarget; - - const v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3; - - point.set( - CubicBezier( t, v0.x, v1.x, v2.x, v3.x ), - CubicBezier( t, v0.y, v1.y, v2.y, v3.y ) - ); - - return point; - - } - - copy( source ) { - - super.copy( source ); - - this.v0.copy( source.v0 ); - this.v1.copy( source.v1 ); - this.v2.copy( source.v2 ); - this.v3.copy( source.v3 ); - - return this; - - } - - toJSON() { - - const data = super.toJSON(); - - data.v0 = this.v0.toArray(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - data.v3 = this.v3.toArray(); - - return data; - - } - - fromJSON( json ) { - - super.fromJSON( json ); - - this.v0.fromArray( json.v0 ); - this.v1.fromArray( json.v1 ); - this.v2.fromArray( json.v2 ); - this.v3.fromArray( json.v3 ); - - return this; - - } - -} - -CubicBezierCurve.prototype.isCubicBezierCurve = true; - -class CubicBezierCurve3 extends Curve { - - constructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3() ) { - - super(); - - this.type = 'CubicBezierCurve3'; - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - - } - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - const v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3; - - point.set( - CubicBezier( t, v0.x, v1.x, v2.x, v3.x ), - CubicBezier( t, v0.y, v1.y, v2.y, v3.y ), - CubicBezier( t, v0.z, v1.z, v2.z, v3.z ) - ); - - return point; - - } - - copy( source ) { - - super.copy( source ); - - this.v0.copy( source.v0 ); - this.v1.copy( source.v1 ); - this.v2.copy( source.v2 ); - this.v3.copy( source.v3 ); - - return this; - - } - - toJSON() { - - const data = super.toJSON(); - - data.v0 = this.v0.toArray(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - data.v3 = this.v3.toArray(); - - return data; - - } - - fromJSON( json ) { - - super.fromJSON( json ); - - this.v0.fromArray( json.v0 ); - this.v1.fromArray( json.v1 ); - this.v2.fromArray( json.v2 ); - this.v3.fromArray( json.v3 ); - - return this; - - } - -} - -CubicBezierCurve3.prototype.isCubicBezierCurve3 = true; - -class LineCurve extends Curve { - - constructor( v1 = new Vector2(), v2 = new Vector2() ) { - - super(); - - this.type = 'LineCurve'; - - this.v1 = v1; - this.v2 = v2; - - } - - getPoint( t, optionalTarget = new Vector2() ) { - - const point = optionalTarget; - - if ( t === 1 ) { - - point.copy( this.v2 ); - - } else { - - point.copy( this.v2 ).sub( this.v1 ); - point.multiplyScalar( t ).add( this.v1 ); - - } - - return point; - - } - - // Line curve is linear, so we can overwrite default getPointAt - getPointAt( u, optionalTarget ) { - - return this.getPoint( u, optionalTarget ); - - } - - getTangent( t, optionalTarget ) { - - const tangent = optionalTarget || new Vector2(); - - tangent.copy( this.v2 ).sub( this.v1 ).normalize(); - - return tangent; - - } - - copy( source ) { - - super.copy( source ); - - this.v1.copy( source.v1 ); - this.v2.copy( source.v2 ); - - return this; - - } - - toJSON() { - - const data = super.toJSON(); - - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - - return data; - - } - - fromJSON( json ) { - - super.fromJSON( json ); - - this.v1.fromArray( json.v1 ); - this.v2.fromArray( json.v2 ); - - return this; - - } - -} - -LineCurve.prototype.isLineCurve = true; - -class LineCurve3 extends Curve { - - constructor( v1 = new Vector3(), v2 = new Vector3() ) { - - super(); - - this.type = 'LineCurve3'; - this.isLineCurve3 = true; - - this.v1 = v1; - this.v2 = v2; - - } - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - if ( t === 1 ) { - - point.copy( this.v2 ); - - } else { - - point.copy( this.v2 ).sub( this.v1 ); - point.multiplyScalar( t ).add( this.v1 ); - - } - - return point; - - } - // Line curve is linear, so we can overwrite default getPointAt - getPointAt( u, optionalTarget ) { - - return this.getPoint( u, optionalTarget ); - - } - copy( source ) { - - super.copy( source ); - - this.v1.copy( source.v1 ); - this.v2.copy( source.v2 ); - - return this; - - } - toJSON() { - - const data = super.toJSON(); - - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - - return data; - - } - fromJSON( json ) { - - super.fromJSON( json ); - - this.v1.fromArray( json.v1 ); - this.v2.fromArray( json.v2 ); - - return this; - - } - -} - -class QuadraticBezierCurve extends Curve { - - constructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2() ) { - - super(); - - this.type = 'QuadraticBezierCurve'; - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - - } - - getPoint( t, optionalTarget = new Vector2() ) { - - const point = optionalTarget; - - const v0 = this.v0, v1 = this.v1, v2 = this.v2; - - point.set( - QuadraticBezier( t, v0.x, v1.x, v2.x ), - QuadraticBezier( t, v0.y, v1.y, v2.y ) - ); - - return point; - - } - - copy( source ) { - - super.copy( source ); - - this.v0.copy( source.v0 ); - this.v1.copy( source.v1 ); - this.v2.copy( source.v2 ); - - return this; - - } - - toJSON() { - - const data = super.toJSON(); - - data.v0 = this.v0.toArray(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - - return data; - - } - - fromJSON( json ) { - - super.fromJSON( json ); - - this.v0.fromArray( json.v0 ); - this.v1.fromArray( json.v1 ); - this.v2.fromArray( json.v2 ); - - return this; - - } - -} - -QuadraticBezierCurve.prototype.isQuadraticBezierCurve = true; - -class QuadraticBezierCurve3 extends Curve { - - constructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3() ) { - - super(); - - this.type = 'QuadraticBezierCurve3'; - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - - } - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - const v0 = this.v0, v1 = this.v1, v2 = this.v2; - - point.set( - QuadraticBezier( t, v0.x, v1.x, v2.x ), - QuadraticBezier( t, v0.y, v1.y, v2.y ), - QuadraticBezier( t, v0.z, v1.z, v2.z ) - ); - - return point; - - } - - copy( source ) { - - super.copy( source ); - - this.v0.copy( source.v0 ); - this.v1.copy( source.v1 ); - this.v2.copy( source.v2 ); - - return this; - - } - - toJSON() { - - const data = super.toJSON(); - - data.v0 = this.v0.toArray(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - - return data; - - } - - fromJSON( json ) { - - super.fromJSON( json ); - - this.v0.fromArray( json.v0 ); - this.v1.fromArray( json.v1 ); - this.v2.fromArray( json.v2 ); - - return this; - - } - -} - -QuadraticBezierCurve3.prototype.isQuadraticBezierCurve3 = true; - -class SplineCurve extends Curve { - - constructor( points = [] ) { - - super(); - - this.type = 'SplineCurve'; - - this.points = points; - - } - - getPoint( t, optionalTarget = new Vector2() ) { - - const point = optionalTarget; - - const points = this.points; - const p = ( points.length - 1 ) * t; - - const intPoint = Math.floor( p ); - const weight = p - intPoint; - - const p0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ]; - const p1 = points[ intPoint ]; - const p2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ]; - const p3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ]; - - point.set( - CatmullRom( weight, p0.x, p1.x, p2.x, p3.x ), - CatmullRom( weight, p0.y, p1.y, p2.y, p3.y ) - ); - - return point; - - } - - copy( source ) { - - super.copy( source ); - - this.points = []; - - for ( let i = 0, l = source.points.length; i < l; i ++ ) { - - const point = source.points[ i ]; - - this.points.push( point.clone() ); - - } - - return this; - - } - - toJSON() { - - const data = super.toJSON(); - - data.points = []; - - for ( let i = 0, l = this.points.length; i < l; i ++ ) { - - const point = this.points[ i ]; - data.points.push( point.toArray() ); - - } - - return data; - - } - - fromJSON( json ) { - - super.fromJSON( json ); - - this.points = []; - - for ( let i = 0, l = json.points.length; i < l; i ++ ) { - - const point = json.points[ i ]; - this.points.push( new Vector2().fromArray( point ) ); - - } - - return this; - - } - -} - -SplineCurve.prototype.isSplineCurve = true; - -var Curves = /*#__PURE__*/Object.freeze({ - __proto__: null, - ArcCurve: ArcCurve, - CatmullRomCurve3: CatmullRomCurve3, - CubicBezierCurve: CubicBezierCurve, - CubicBezierCurve3: CubicBezierCurve3, - EllipseCurve: EllipseCurve, - LineCurve: LineCurve, - LineCurve3: LineCurve3, - QuadraticBezierCurve: QuadraticBezierCurve, - QuadraticBezierCurve3: QuadraticBezierCurve3, - SplineCurve: SplineCurve -}); - -/************************************************************** - * Curved Path - a curve path is simply a array of connected - * curves, but retains the api of a curve - **************************************************************/ - -class CurvePath extends Curve { - - constructor() { - - super(); - - this.type = 'CurvePath'; - - this.curves = []; - this.autoClose = false; // Automatically closes the path - - } - - add( curve ) { - - this.curves.push( curve ); - - } - - closePath() { - - // Add a line curve if start and end of lines are not connected - const startPoint = this.curves[ 0 ].getPoint( 0 ); - const endPoint = this.curves[ this.curves.length - 1 ].getPoint( 1 ); - - if ( ! startPoint.equals( endPoint ) ) { - - this.curves.push( new LineCurve( endPoint, startPoint ) ); - - } - - } - - // To get accurate point with reference to - // entire path distance at time t, - // following has to be done: - - // 1. Length of each sub path have to be known - // 2. Locate and identify type of curve - // 3. Get t for the curve - // 4. Return curve.getPointAt(t') - - getPoint( t ) { - - const d = t * this.getLength(); - const curveLengths = this.getCurveLengths(); - let i = 0; - - // To think about boundaries points. - - while ( i < curveLengths.length ) { - - if ( curveLengths[ i ] >= d ) { - - const diff = curveLengths[ i ] - d; - const curve = this.curves[ i ]; - - const segmentLength = curve.getLength(); - const u = segmentLength === 0 ? 0 : 1 - diff / segmentLength; - - return curve.getPointAt( u ); - - } - - i ++; - - } - - return null; - - // loop where sum != 0, sum > d , sum+1 1 && ! points[ points.length - 1 ].equals( points[ 0 ] ) ) { - - points.push( points[ 0 ] ); - - } - - return points; - - } - - copy( source ) { - - super.copy( source ); - - this.curves = []; - - for ( let i = 0, l = source.curves.length; i < l; i ++ ) { - - const curve = source.curves[ i ]; - - this.curves.push( curve.clone() ); - - } - - this.autoClose = source.autoClose; - - return this; - - } - - toJSON() { - - const data = super.toJSON(); - - data.autoClose = this.autoClose; - data.curves = []; - - for ( let i = 0, l = this.curves.length; i < l; i ++ ) { - - const curve = this.curves[ i ]; - data.curves.push( curve.toJSON() ); - - } - - return data; - - } - - fromJSON( json ) { - - super.fromJSON( json ); - - this.autoClose = json.autoClose; - this.curves = []; - - for ( let i = 0, l = json.curves.length; i < l; i ++ ) { - - const curve = json.curves[ i ]; - this.curves.push( new Curves[ curve.type ]().fromJSON( curve ) ); - - } - - return this; - - } - -} - -class Path extends CurvePath { - - constructor( points ) { - - super(); - this.type = 'Path'; - - this.currentPoint = new Vector2(); - - if ( points ) { - - this.setFromPoints( points ); - - } - - } - - setFromPoints( points ) { - - this.moveTo( points[ 0 ].x, points[ 0 ].y ); - - for ( let i = 1, l = points.length; i < l; i ++ ) { - - this.lineTo( points[ i ].x, points[ i ].y ); - - } - - return this; - - } - - moveTo( x, y ) { - - this.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying? - - return this; - - } - - lineTo( x, y ) { - - const curve = new LineCurve( this.currentPoint.clone(), new Vector2( x, y ) ); - this.curves.push( curve ); - - this.currentPoint.set( x, y ); - - return this; - - } - - quadraticCurveTo( aCPx, aCPy, aX, aY ) { - - const curve = new QuadraticBezierCurve( - this.currentPoint.clone(), - new Vector2( aCPx, aCPy ), - new Vector2( aX, aY ) - ); - - this.curves.push( curve ); - - this.currentPoint.set( aX, aY ); - - return this; - - } - - bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) { - - const curve = new CubicBezierCurve( - this.currentPoint.clone(), - new Vector2( aCP1x, aCP1y ), - new Vector2( aCP2x, aCP2y ), - new Vector2( aX, aY ) - ); - - this.curves.push( curve ); - - this.currentPoint.set( aX, aY ); - - return this; - - } - - splineThru( pts /*Array of Vector*/ ) { - - const npts = [ this.currentPoint.clone() ].concat( pts ); - - const curve = new SplineCurve( npts ); - this.curves.push( curve ); - - this.currentPoint.copy( pts[ pts.length - 1 ] ); - - return this; - - } - - arc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) { - - const x0 = this.currentPoint.x; - const y0 = this.currentPoint.y; - - this.absarc( aX + x0, aY + y0, aRadius, - aStartAngle, aEndAngle, aClockwise ); - - return this; - - } - - absarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) { - - this.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise ); - - return this; - - } - - ellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) { - - const x0 = this.currentPoint.x; - const y0 = this.currentPoint.y; - - this.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ); - - return this; - - } - - absellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) { - - const curve = new EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ); - - if ( this.curves.length > 0 ) { - - // if a previous curve is present, attempt to join - const firstPoint = curve.getPoint( 0 ); - - if ( ! firstPoint.equals( this.currentPoint ) ) { - - this.lineTo( firstPoint.x, firstPoint.y ); - - } - - } - - this.curves.push( curve ); - - const lastPoint = curve.getPoint( 1 ); - this.currentPoint.copy( lastPoint ); - - return this; - - } - - copy( source ) { - - super.copy( source ); - - this.currentPoint.copy( source.currentPoint ); - - return this; - - } - - toJSON() { - - const data = super.toJSON(); - - data.currentPoint = this.currentPoint.toArray(); - - return data; - - } - - fromJSON( json ) { - - super.fromJSON( json ); - - this.currentPoint.fromArray( json.currentPoint ); - - return this; - - } - -} - -class Shape extends Path { - - constructor( points ) { - - super( points ); - - this.uuid = MathUtils.generateUUID(); - - this.type = 'Shape'; - - this.holes = []; - - } - - getPointsHoles( divisions ) { - - const holesPts = []; - - for ( let i = 0, l = this.holes.length; i < l; i ++ ) { - - holesPts[ i ] = this.holes[ i ].getPoints( divisions ); - - } - - return holesPts; - - } - - // get points of shape and holes (keypoints based on segments parameter) - - extractPoints( divisions ) { - - return { - - shape: this.getPoints( divisions ), - holes: this.getPointsHoles( divisions ) - - }; - - } - - copy( source ) { - - super.copy( source ); - - this.holes = []; - - for ( let i = 0, l = source.holes.length; i < l; i ++ ) { - - const hole = source.holes[ i ]; - - this.holes.push( hole.clone() ); - - } - - return this; - - } - - toJSON() { - - const data = super.toJSON(); - - data.uuid = this.uuid; - data.holes = []; - - for ( let i = 0, l = this.holes.length; i < l; i ++ ) { - - const hole = this.holes[ i ]; - data.holes.push( hole.toJSON() ); - - } - - return data; - - } - - fromJSON( json ) { - - super.fromJSON( json ); - - this.uuid = json.uuid; - this.holes = []; - - for ( let i = 0, l = json.holes.length; i < l; i ++ ) { - - const hole = json.holes[ i ]; - this.holes.push( new Path().fromJSON( hole ) ); - - } - - return this; - - } - -} - -class Light extends Object3D { - - constructor( color, intensity = 1 ) { - - super(); - - this.type = 'Light'; - - this.color = new Color( color ); - this.intensity = intensity; - - } - - copy( source ) { - - super.copy( source ); - - this.color.copy( source.color ); - this.intensity = source.intensity; - - return this; - - } - - toJSON( meta ) { - - const data = super.toJSON( meta ); - - data.object.color = this.color.getHex(); - data.object.intensity = this.intensity; - - if ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex(); - - if ( this.distance !== undefined ) data.object.distance = this.distance; - if ( this.angle !== undefined ) data.object.angle = this.angle; - if ( this.decay !== undefined ) data.object.decay = this.decay; - if ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra; - - if ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON(); - - return data; - - } - -} - -Light.prototype.isLight = true; - -class HemisphereLight extends Light { - - constructor( skyColor, groundColor, intensity ) { - - super( skyColor, intensity ); - - this.type = 'HemisphereLight'; - - this.position.copy( Object3D.DefaultUp ); - this.updateMatrix(); - - this.groundColor = new Color( groundColor ); - - } - - copy( source ) { - - Light.prototype.copy.call( this, source ); - - this.groundColor.copy( source.groundColor ); - - return this; - - } - -} - -HemisphereLight.prototype.isHemisphereLight = true; - -const _projScreenMatrix = /*@__PURE__*/ new Matrix4(); -const _lightPositionWorld = /*@__PURE__*/ new Vector3(); -const _lookTarget = /*@__PURE__*/ new Vector3(); - -class LightShadow { - - constructor( camera ) { - - this.camera = camera; - - this.bias = 0; - this.normalBias = 0; - this.radius = 1; - - this.mapSize = new Vector2( 512, 512 ); - - this.map = null; - this.mapPass = null; - this.matrix = new Matrix4(); - - this.autoUpdate = true; - this.needsUpdate = false; - - this._frustum = new Frustum(); - this._frameExtents = new Vector2( 1, 1 ); - - this._viewportCount = 1; - - this._viewports = [ - - new Vector4( 0, 0, 1, 1 ) - - ]; - - } - - getViewportCount() { - - return this._viewportCount; - - } - - getFrustum() { - - return this._frustum; - - } - - updateMatrices( light ) { - - const shadowCamera = this.camera; - const shadowMatrix = this.matrix; - - _lightPositionWorld.setFromMatrixPosition( light.matrixWorld ); - shadowCamera.position.copy( _lightPositionWorld ); - - _lookTarget.setFromMatrixPosition( light.target.matrixWorld ); - shadowCamera.lookAt( _lookTarget ); - shadowCamera.updateMatrixWorld(); - - _projScreenMatrix.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse ); - this._frustum.setFromProjectionMatrix( _projScreenMatrix ); - - shadowMatrix.set( - 0.5, 0.0, 0.0, 0.5, - 0.0, 0.5, 0.0, 0.5, - 0.0, 0.0, 0.5, 0.5, - 0.0, 0.0, 0.0, 1.0 - ); - - shadowMatrix.multiply( shadowCamera.projectionMatrix ); - shadowMatrix.multiply( shadowCamera.matrixWorldInverse ); - - } - - getViewport( viewportIndex ) { - - return this._viewports[ viewportIndex ]; - - } - - getFrameExtents() { - - return this._frameExtents; - - } - - copy( source ) { - - this.camera = source.camera.clone(); - - this.bias = source.bias; - this.radius = source.radius; - - this.mapSize.copy( source.mapSize ); - - return this; - - } - - clone() { - - return new this.constructor().copy( this ); - - } - - toJSON() { - - const object = {}; - - if ( this.bias !== 0 ) object.bias = this.bias; - if ( this.normalBias !== 0 ) object.normalBias = this.normalBias; - if ( this.radius !== 1 ) object.radius = this.radius; - if ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray(); - - object.camera = this.camera.toJSON( false ).object; - delete object.camera.matrix; - - return object; - - } - -} - -class SpotLightShadow extends LightShadow { - - constructor() { - - super( new PerspectiveCamera( 50, 1, 0.5, 500 ) ); - - this.focus = 1; - - } - - updateMatrices( light ) { - - const camera = this.camera; - - const fov = MathUtils.RAD2DEG * 2 * light.angle * this.focus; - const aspect = this.mapSize.width / this.mapSize.height; - const far = light.distance || camera.far; - - if ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) { - - camera.fov = fov; - camera.aspect = aspect; - camera.far = far; - camera.updateProjectionMatrix(); - - } - - super.updateMatrices( light ); - - } - -} - -SpotLightShadow.prototype.isSpotLightShadow = true; - -class SpotLight extends Light { - - constructor( color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 1 ) { - - super( color, intensity ); - - this.type = 'SpotLight'; - - this.position.copy( Object3D.DefaultUp ); - this.updateMatrix(); - - this.target = new Object3D(); - - this.distance = distance; - this.angle = angle; - this.penumbra = penumbra; - this.decay = decay; // for physically correct lights, should be 2. - - this.shadow = new SpotLightShadow(); - - } - - get power() { - - // intensity = power per solid angle. - // ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf - return this.intensity * Math.PI; - - } - - set power( power ) { - - // intensity = power per solid angle. - // ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf - this.intensity = power / Math.PI; - - } - - copy( source ) { - - super.copy( source ); - - this.distance = source.distance; - this.angle = source.angle; - this.penumbra = source.penumbra; - this.decay = source.decay; - - this.target = source.target.clone(); - - this.shadow = source.shadow.clone(); - - return this; - - } - -} - -SpotLight.prototype.isSpotLight = true; - -const _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4(); -const _lightPositionWorld$1 = /*@__PURE__*/ new Vector3(); -const _lookTarget$1 = /*@__PURE__*/ new Vector3(); - -class PointLightShadow extends LightShadow { - - constructor() { - - super( new PerspectiveCamera( 90, 1, 0.5, 500 ) ); - - this._frameExtents = new Vector2( 4, 2 ); - - this._viewportCount = 6; - - this._viewports = [ - // These viewports map a cube-map onto a 2D texture with the - // following orientation: - // - // xzXZ - // y Y - // - // X - Positive x direction - // x - Negative x direction - // Y - Positive y direction - // y - Negative y direction - // Z - Positive z direction - // z - Negative z direction - - // positive X - new Vector4( 2, 1, 1, 1 ), - // negative X - new Vector4( 0, 1, 1, 1 ), - // positive Z - new Vector4( 3, 1, 1, 1 ), - // negative Z - new Vector4( 1, 1, 1, 1 ), - // positive Y - new Vector4( 3, 0, 1, 1 ), - // negative Y - new Vector4( 1, 0, 1, 1 ) - ]; - - this._cubeDirections = [ - new Vector3( 1, 0, 0 ), new Vector3( - 1, 0, 0 ), new Vector3( 0, 0, 1 ), - new Vector3( 0, 0, - 1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, - 1, 0 ) - ]; - - this._cubeUps = [ - new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), - new Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ), new Vector3( 0, 0, - 1 ) - ]; - - } - - updateMatrices( light, viewportIndex = 0 ) { - - const camera = this.camera; - const shadowMatrix = this.matrix; - - _lightPositionWorld$1.setFromMatrixPosition( light.matrixWorld ); - camera.position.copy( _lightPositionWorld$1 ); - - _lookTarget$1.copy( camera.position ); - _lookTarget$1.add( this._cubeDirections[ viewportIndex ] ); - camera.up.copy( this._cubeUps[ viewportIndex ] ); - camera.lookAt( _lookTarget$1 ); - camera.updateMatrixWorld(); - - shadowMatrix.makeTranslation( - _lightPositionWorld$1.x, - _lightPositionWorld$1.y, - _lightPositionWorld$1.z ); - - _projScreenMatrix$1.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse ); - this._frustum.setFromProjectionMatrix( _projScreenMatrix$1 ); - - } - -} - -PointLightShadow.prototype.isPointLightShadow = true; - -class PointLight extends Light { - - constructor( color, intensity, distance = 0, decay = 1 ) { - - super( color, intensity ); - - this.type = 'PointLight'; - - this.distance = distance; - this.decay = decay; // for physically correct lights, should be 2. - - this.shadow = new PointLightShadow(); - - } - - get power() { - - // intensity = power per solid angle. - // ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf - return this.intensity * 4 * Math.PI; - - } - - set power( power ) { - - // intensity = power per solid angle. - // ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf - this.intensity = power / ( 4 * Math.PI ); - - } - - copy( source ) { - - super.copy( source ); - - this.distance = source.distance; - this.decay = source.decay; - - this.shadow = source.shadow.clone(); - - return this; - - } - -} - -PointLight.prototype.isPointLight = true; - -class OrthographicCamera extends Camera { - - constructor( left = - 1, right = 1, top = 1, bottom = - 1, near = 0.1, far = 2000 ) { - - super(); - - this.type = 'OrthographicCamera'; - - this.zoom = 1; - this.view = null; - - this.left = left; - this.right = right; - this.top = top; - this.bottom = bottom; - - this.near = near; - this.far = far; - - this.updateProjectionMatrix(); - - } - - copy( source, recursive ) { - - super.copy( source, recursive ); - - this.left = source.left; - this.right = source.right; - this.top = source.top; - this.bottom = source.bottom; - this.near = source.near; - this.far = source.far; - - this.zoom = source.zoom; - this.view = source.view === null ? null : Object.assign( {}, source.view ); - - return this; - - } - - setViewOffset( fullWidth, fullHeight, x, y, width, height ) { - - if ( this.view === null ) { - - this.view = { - enabled: true, - fullWidth: 1, - fullHeight: 1, - offsetX: 0, - offsetY: 0, - width: 1, - height: 1 - }; - - } - - this.view.enabled = true; - this.view.fullWidth = fullWidth; - this.view.fullHeight = fullHeight; - this.view.offsetX = x; - this.view.offsetY = y; - this.view.width = width; - this.view.height = height; - - this.updateProjectionMatrix(); - - } - - clearViewOffset() { - - if ( this.view !== null ) { - - this.view.enabled = false; - - } - - this.updateProjectionMatrix(); - - } - - updateProjectionMatrix() { - - const dx = ( this.right - this.left ) / ( 2 * this.zoom ); - const dy = ( this.top - this.bottom ) / ( 2 * this.zoom ); - const cx = ( this.right + this.left ) / 2; - const cy = ( this.top + this.bottom ) / 2; - - let left = cx - dx; - let right = cx + dx; - let top = cy + dy; - let bottom = cy - dy; - - if ( this.view !== null && this.view.enabled ) { - - const scaleW = ( this.right - this.left ) / this.view.fullWidth / this.zoom; - const scaleH = ( this.top - this.bottom ) / this.view.fullHeight / this.zoom; - - left += scaleW * this.view.offsetX; - right = left + scaleW * this.view.width; - top -= scaleH * this.view.offsetY; - bottom = top - scaleH * this.view.height; - - } - - this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far ); - - this.projectionMatrixInverse.copy( this.projectionMatrix ).invert(); - - } - - toJSON( meta ) { - - const data = Object3D.prototype.toJSON.call( this, meta ); - - data.object.zoom = this.zoom; - data.object.left = this.left; - data.object.right = this.right; - data.object.top = this.top; - data.object.bottom = this.bottom; - data.object.near = this.near; - data.object.far = this.far; - - if ( this.view !== null ) data.object.view = Object.assign( {}, this.view ); - - return data; - - } - -} - -OrthographicCamera.prototype.isOrthographicCamera = true; - -class DirectionalLightShadow extends LightShadow { - - constructor() { - - super( new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) ); - - } - -} - -DirectionalLightShadow.prototype.isDirectionalLightShadow = true; - -class DirectionalLight extends Light { - - constructor( color, intensity ) { - - super( color, intensity ); - - this.type = 'DirectionalLight'; - - this.position.copy( Object3D.DefaultUp ); - this.updateMatrix(); - - this.target = new Object3D(); - - this.shadow = new DirectionalLightShadow(); - - } - - copy( source ) { - - super.copy( source ); - - this.target = source.target.clone(); - this.shadow = source.shadow.clone(); - - return this; - - } - -} - -DirectionalLight.prototype.isDirectionalLight = true; - -class AmbientLight extends Light { - - constructor( color, intensity ) { - - super( color, intensity ); - - this.type = 'AmbientLight'; - - } - -} - -AmbientLight.prototype.isAmbientLight = true; - -class RectAreaLight extends Light { - - constructor( color, intensity, width = 10, height = 10 ) { - - super( color, intensity ); - - this.type = 'RectAreaLight'; - - this.width = width; - this.height = height; - - } - - copy( source ) { - - super.copy( source ); - - this.width = source.width; - this.height = source.height; - - return this; - - } - - toJSON( meta ) { - - const data = super.toJSON( meta ); - - data.object.width = this.width; - data.object.height = this.height; - - return data; - - } - -} - -RectAreaLight.prototype.isRectAreaLight = true; - -/** - * Primary reference: - * https://graphics.stanford.edu/papers/envmap/envmap.pdf - * - * Secondary reference: - * https://www.ppsloan.org/publications/StupidSH36.pdf - */ - -// 3-band SH defined by 9 coefficients - -class SphericalHarmonics3 { - - constructor() { - - this.coefficients = []; - - for ( let i = 0; i < 9; i ++ ) { - - this.coefficients.push( new Vector3() ); - - } - - } - - set( coefficients ) { - - for ( let i = 0; i < 9; i ++ ) { - - this.coefficients[ i ].copy( coefficients[ i ] ); - - } - - return this; - - } - - zero() { - - for ( let i = 0; i < 9; i ++ ) { - - this.coefficients[ i ].set( 0, 0, 0 ); - - } - - return this; - - } - - // get the radiance in the direction of the normal - // target is a Vector3 - getAt( normal, target ) { - - // normal is assumed to be unit length - - const x = normal.x, y = normal.y, z = normal.z; - - const coeff = this.coefficients; - - // band 0 - target.copy( coeff[ 0 ] ).multiplyScalar( 0.282095 ); - - // band 1 - target.addScaledVector( coeff[ 1 ], 0.488603 * y ); - target.addScaledVector( coeff[ 2 ], 0.488603 * z ); - target.addScaledVector( coeff[ 3 ], 0.488603 * x ); - - // band 2 - target.addScaledVector( coeff[ 4 ], 1.092548 * ( x * y ) ); - target.addScaledVector( coeff[ 5 ], 1.092548 * ( y * z ) ); - target.addScaledVector( coeff[ 6 ], 0.315392 * ( 3.0 * z * z - 1.0 ) ); - target.addScaledVector( coeff[ 7 ], 1.092548 * ( x * z ) ); - target.addScaledVector( coeff[ 8 ], 0.546274 * ( x * x - y * y ) ); - - return target; - - } - - // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal - // target is a Vector3 - // https://graphics.stanford.edu/papers/envmap/envmap.pdf - getIrradianceAt( normal, target ) { - - // normal is assumed to be unit length - - const x = normal.x, y = normal.y, z = normal.z; - - const coeff = this.coefficients; - - // band 0 - target.copy( coeff[ 0 ] ).multiplyScalar( 0.886227 ); // π * 0.282095 - - // band 1 - target.addScaledVector( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * π / 3 ) * 0.488603 - target.addScaledVector( coeff[ 2 ], 2.0 * 0.511664 * z ); - target.addScaledVector( coeff[ 3 ], 2.0 * 0.511664 * x ); - - // band 2 - target.addScaledVector( coeff[ 4 ], 2.0 * 0.429043 * x * y ); // ( π / 4 ) * 1.092548 - target.addScaledVector( coeff[ 5 ], 2.0 * 0.429043 * y * z ); - target.addScaledVector( coeff[ 6 ], 0.743125 * z * z - 0.247708 ); // ( π / 4 ) * 0.315392 * 3 - target.addScaledVector( coeff[ 7 ], 2.0 * 0.429043 * x * z ); - target.addScaledVector( coeff[ 8 ], 0.429043 * ( x * x - y * y ) ); // ( π / 4 ) * 0.546274 - - return target; - - } - - add( sh ) { - - for ( let i = 0; i < 9; i ++ ) { - - this.coefficients[ i ].add( sh.coefficients[ i ] ); - - } - - return this; - - } - - addScaledSH( sh, s ) { - - for ( let i = 0; i < 9; i ++ ) { - - this.coefficients[ i ].addScaledVector( sh.coefficients[ i ], s ); - - } - - return this; - - } - - scale( s ) { - - for ( let i = 0; i < 9; i ++ ) { - - this.coefficients[ i ].multiplyScalar( s ); - - } - - return this; - - } - - lerp( sh, alpha ) { - - for ( let i = 0; i < 9; i ++ ) { - - this.coefficients[ i ].lerp( sh.coefficients[ i ], alpha ); - - } - - return this; - - } - - equals( sh ) { - - for ( let i = 0; i < 9; i ++ ) { - - if ( ! this.coefficients[ i ].equals( sh.coefficients[ i ] ) ) { - - return false; - - } - - } - - return true; - - } - - copy( sh ) { - - return this.set( sh.coefficients ); - - } - - clone() { - - return new this.constructor().copy( this ); - - } - - fromArray( array, offset = 0 ) { - - const coefficients = this.coefficients; - - for ( let i = 0; i < 9; i ++ ) { - - coefficients[ i ].fromArray( array, offset + ( i * 3 ) ); - - } - - return this; - - } - - toArray( array = [], offset = 0 ) { - - const coefficients = this.coefficients; - - for ( let i = 0; i < 9; i ++ ) { - - coefficients[ i ].toArray( array, offset + ( i * 3 ) ); - - } - - return array; - - } - - // evaluate the basis functions - // shBasis is an Array[ 9 ] - static getBasisAt( normal, shBasis ) { - - // normal is assumed to be unit length - - const x = normal.x, y = normal.y, z = normal.z; - - // band 0 - shBasis[ 0 ] = 0.282095; - - // band 1 - shBasis[ 1 ] = 0.488603 * y; - shBasis[ 2 ] = 0.488603 * z; - shBasis[ 3 ] = 0.488603 * x; - - // band 2 - shBasis[ 4 ] = 1.092548 * x * y; - shBasis[ 5 ] = 1.092548 * y * z; - shBasis[ 6 ] = 0.315392 * ( 3 * z * z - 1 ); - shBasis[ 7 ] = 1.092548 * x * z; - shBasis[ 8 ] = 0.546274 * ( x * x - y * y ); - - } - -} - -SphericalHarmonics3.prototype.isSphericalHarmonics3 = true; - -class LightProbe extends Light { - - constructor( sh = new SphericalHarmonics3(), intensity = 1 ) { - - super( undefined, intensity ); - - this.sh = sh; - - } - - copy( source ) { - - super.copy( source ); - - this.sh.copy( source.sh ); - - return this; - - } - - fromJSON( json ) { - - this.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON(); - this.sh.fromArray( json.sh ); - - return this; - - } - - toJSON( meta ) { - - const data = super.toJSON( meta ); - - data.object.sh = this.sh.toArray(); - - return data; - - } - -} - -LightProbe.prototype.isLightProbe = true; - -class MaterialLoader extends Loader { - - constructor( manager ) { - - super( manager ); - this.textures = {}; - - } - - load( url, onLoad, onProgress, onError ) { - - const scope = this; - - const loader = new FileLoader( scope.manager ); - loader.setPath( scope.path ); - loader.setRequestHeader( scope.requestHeader ); - loader.setWithCredentials( scope.withCredentials ); - loader.load( url, function ( text ) { - - try { - - onLoad( scope.parse( JSON.parse( text ) ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( json ) { - - const textures = this.textures; - - function getTexture( name ) { - - if ( textures[ name ] === undefined ) { - - console.warn( 'THREE.MaterialLoader: Undefined texture', name ); - - } - - return textures[ name ]; - - } - - const material = new Materials[ json.type ](); - - if ( json.uuid !== undefined ) material.uuid = json.uuid; - if ( json.name !== undefined ) material.name = json.name; - if ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color ); - if ( json.roughness !== undefined ) material.roughness = json.roughness; - if ( json.metalness !== undefined ) material.metalness = json.metalness; - if ( json.sheen !== undefined ) material.sheen = new Color().setHex( json.sheen ); - if ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive ); - if ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular ); - if ( json.shininess !== undefined ) material.shininess = json.shininess; - if ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat; - if ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness; - if ( json.fog !== undefined ) material.fog = json.fog; - if ( json.flatShading !== undefined ) material.flatShading = json.flatShading; - if ( json.blending !== undefined ) material.blending = json.blending; - if ( json.combine !== undefined ) material.combine = json.combine; - if ( json.side !== undefined ) material.side = json.side; - if ( json.opacity !== undefined ) material.opacity = json.opacity; - if ( json.transparent !== undefined ) material.transparent = json.transparent; - if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest; - if ( json.depthTest !== undefined ) material.depthTest = json.depthTest; - if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite; - if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite; - - if ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite; - if ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask; - if ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc; - if ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef; - if ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask; - if ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail; - if ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail; - if ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass; - - if ( json.wireframe !== undefined ) material.wireframe = json.wireframe; - if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth; - if ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap; - if ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin; - - if ( json.rotation !== undefined ) material.rotation = json.rotation; - - if ( json.linewidth !== 1 ) material.linewidth = json.linewidth; - if ( json.dashSize !== undefined ) material.dashSize = json.dashSize; - if ( json.gapSize !== undefined ) material.gapSize = json.gapSize; - if ( json.scale !== undefined ) material.scale = json.scale; - - if ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset; - if ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor; - if ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits; - - if ( json.skinning !== undefined ) material.skinning = json.skinning; - if ( json.morphTargets !== undefined ) material.morphTargets = json.morphTargets; - if ( json.morphNormals !== undefined ) material.morphNormals = json.morphNormals; - if ( json.dithering !== undefined ) material.dithering = json.dithering; - - if ( json.vertexTangents !== undefined ) material.vertexTangents = json.vertexTangents; - - if ( json.visible !== undefined ) material.visible = json.visible; - - if ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped; - - if ( json.userData !== undefined ) material.userData = json.userData; - - if ( json.vertexColors !== undefined ) { - - if ( typeof json.vertexColors === 'number' ) { - - material.vertexColors = ( json.vertexColors > 0 ) ? true : false; - - } else { - - material.vertexColors = json.vertexColors; - - } - - } - - // Shader Material - - if ( json.uniforms !== undefined ) { - - for ( const name in json.uniforms ) { - - const uniform = json.uniforms[ name ]; - - material.uniforms[ name ] = {}; - - switch ( uniform.type ) { - - case 't': - material.uniforms[ name ].value = getTexture( uniform.value ); - break; - - case 'c': - material.uniforms[ name ].value = new Color().setHex( uniform.value ); - break; - - case 'v2': - material.uniforms[ name ].value = new Vector2().fromArray( uniform.value ); - break; - - case 'v3': - material.uniforms[ name ].value = new Vector3().fromArray( uniform.value ); - break; - - case 'v4': - material.uniforms[ name ].value = new Vector4().fromArray( uniform.value ); - break; - - case 'm3': - material.uniforms[ name ].value = new Matrix3().fromArray( uniform.value ); - break; - - case 'm4': - material.uniforms[ name ].value = new Matrix4().fromArray( uniform.value ); - break; - - default: - material.uniforms[ name ].value = uniform.value; - - } - - } - - } - - if ( json.defines !== undefined ) material.defines = json.defines; - if ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader; - if ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader; - - if ( json.extensions !== undefined ) { - - for ( const key in json.extensions ) { - - material.extensions[ key ] = json.extensions[ key ]; - - } - - } - - // Deprecated - - if ( json.shading !== undefined ) material.flatShading = json.shading === 1; // THREE.FlatShading - - // for PointsMaterial - - if ( json.size !== undefined ) material.size = json.size; - if ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation; - - // maps - - if ( json.map !== undefined ) material.map = getTexture( json.map ); - if ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap ); - - if ( json.alphaMap !== undefined ) material.alphaMap = getTexture( json.alphaMap ); - - if ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap ); - if ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale; - - if ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap ); - if ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType; - if ( json.normalScale !== undefined ) { - - let normalScale = json.normalScale; - - if ( Array.isArray( normalScale ) === false ) { - - // Blender exporter used to export a scalar. See #7459 - - normalScale = [ normalScale, normalScale ]; - - } - - material.normalScale = new Vector2().fromArray( normalScale ); - - } - - if ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap ); - if ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale; - if ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias; - - if ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap ); - if ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap ); - - if ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap ); - if ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity; - - if ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap ); - - if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap ); - if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity; - - if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity; - if ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio; - - if ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap ); - if ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity; - - if ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap ); - if ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity; - - if ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap ); - - if ( json.clearcoatMap !== undefined ) material.clearcoatMap = getTexture( json.clearcoatMap ); - if ( json.clearcoatRoughnessMap !== undefined ) material.clearcoatRoughnessMap = getTexture( json.clearcoatRoughnessMap ); - if ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap ); - if ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale ); - - if ( json.transmission !== undefined ) material.transmission = json.transmission; - if ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap ); - - return material; - - } - - setTextures( value ) { - - this.textures = value; - return this; - - } - -} - -const LoaderUtils = { - - decodeText: function ( array ) { - - if ( typeof TextDecoder !== 'undefined' ) { - - return new TextDecoder().decode( array ); - - } - - // Avoid the String.fromCharCode.apply(null, array) shortcut, which - // throws a "maximum call stack size exceeded" error for large arrays. - - let s = ''; - - for ( let i = 0, il = array.length; i < il; i ++ ) { - - // Implicitly assumes little-endian. - s += String.fromCharCode( array[ i ] ); - - } - - try { - - // merges multi-byte utf-8 characters. - - return decodeURIComponent( escape( s ) ); - - } catch ( e ) { // see #16358 - - return s; - - } - - }, - - extractUrlBase: function ( url ) { - - const index = url.lastIndexOf( '/' ); - - if ( index === - 1 ) return './'; - - return url.substr( 0, index + 1 ); - - } - -}; - -function InstancedBufferGeometry() { - - BufferGeometry.call( this ); - - this.type = 'InstancedBufferGeometry'; - this.instanceCount = Infinity; - -} - -InstancedBufferGeometry.prototype = Object.assign( Object.create( BufferGeometry.prototype ), { - - constructor: InstancedBufferGeometry, - - isInstancedBufferGeometry: true, - - copy: function ( source ) { - - BufferGeometry.prototype.copy.call( this, source ); - - this.instanceCount = source.instanceCount; - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - toJSON: function () { - - const data = BufferGeometry.prototype.toJSON.call( this ); - - data.instanceCount = this.instanceCount; - - data.isInstancedBufferGeometry = true; - - return data; - - } - -} ); - -function InstancedBufferAttribute( array, itemSize, normalized, meshPerAttribute ) { - - if ( typeof ( normalized ) === 'number' ) { - - meshPerAttribute = normalized; - - normalized = false; - - console.error( 'THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.' ); - - } - - BufferAttribute.call( this, array, itemSize, normalized ); - - this.meshPerAttribute = meshPerAttribute || 1; - -} - -InstancedBufferAttribute.prototype = Object.assign( Object.create( BufferAttribute.prototype ), { - - constructor: InstancedBufferAttribute, - - isInstancedBufferAttribute: true, - - copy: function ( source ) { - - BufferAttribute.prototype.copy.call( this, source ); - - this.meshPerAttribute = source.meshPerAttribute; - - return this; - - }, - - toJSON: function () { - - const data = BufferAttribute.prototype.toJSON.call( this ); - - data.meshPerAttribute = this.meshPerAttribute; - - data.isInstancedBufferAttribute = true; - - return data; - - } - -} ); - -class BufferGeometryLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - } - - load( url, onLoad, onProgress, onError ) { - - const scope = this; - - const loader = new FileLoader( scope.manager ); - loader.setPath( scope.path ); - loader.setRequestHeader( scope.requestHeader ); - loader.setWithCredentials( scope.withCredentials ); - loader.load( url, function ( text ) { - - try { - - onLoad( scope.parse( JSON.parse( text ) ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( json ) { - - const interleavedBufferMap = {}; - const arrayBufferMap = {}; - - function getInterleavedBuffer( json, uuid ) { - - if ( interleavedBufferMap[ uuid ] !== undefined ) return interleavedBufferMap[ uuid ]; - - const interleavedBuffers = json.interleavedBuffers; - const interleavedBuffer = interleavedBuffers[ uuid ]; - - const buffer = getArrayBuffer( json, interleavedBuffer.buffer ); - - const array = getTypedArray( interleavedBuffer.type, buffer ); - const ib = new InterleavedBuffer( array, interleavedBuffer.stride ); - ib.uuid = interleavedBuffer.uuid; - - interleavedBufferMap[ uuid ] = ib; - - return ib; - - } - - function getArrayBuffer( json, uuid ) { - - if ( arrayBufferMap[ uuid ] !== undefined ) return arrayBufferMap[ uuid ]; - - const arrayBuffers = json.arrayBuffers; - const arrayBuffer = arrayBuffers[ uuid ]; - - const ab = new Uint32Array( arrayBuffer ).buffer; - - arrayBufferMap[ uuid ] = ab; - - return ab; - - } - - const geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry(); - - const index = json.data.index; - - if ( index !== undefined ) { - - const typedArray = getTypedArray( index.type, index.array ); - geometry.setIndex( new BufferAttribute( typedArray, 1 ) ); - - } - - const attributes = json.data.attributes; - - for ( const key in attributes ) { - - const attribute = attributes[ key ]; - let bufferAttribute; - - if ( attribute.isInterleavedBufferAttribute ) { - - const interleavedBuffer = getInterleavedBuffer( json.data, attribute.data ); - bufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized ); - - } else { - - const typedArray = getTypedArray( attribute.type, attribute.array ); - const bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute; - bufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized ); - - } - - if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name; - geometry.setAttribute( key, bufferAttribute ); - - } - - const morphAttributes = json.data.morphAttributes; - - if ( morphAttributes ) { - - for ( const key in morphAttributes ) { - - const attributeArray = morphAttributes[ key ]; - - const array = []; - - for ( let i = 0, il = attributeArray.length; i < il; i ++ ) { - - const attribute = attributeArray[ i ]; - let bufferAttribute; - - if ( attribute.isInterleavedBufferAttribute ) { - - const interleavedBuffer = getInterleavedBuffer( json.data, attribute.data ); - bufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized ); - - } else { - - const typedArray = getTypedArray( attribute.type, attribute.array ); - bufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized ); - - } - - if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name; - array.push( bufferAttribute ); - - } - - geometry.morphAttributes[ key ] = array; - - } - - } - - const morphTargetsRelative = json.data.morphTargetsRelative; - - if ( morphTargetsRelative ) { - - geometry.morphTargetsRelative = true; - - } - - const groups = json.data.groups || json.data.drawcalls || json.data.offsets; - - if ( groups !== undefined ) { - - for ( let i = 0, n = groups.length; i !== n; ++ i ) { - - const group = groups[ i ]; - - geometry.addGroup( group.start, group.count, group.materialIndex ); - - } - - } - - const boundingSphere = json.data.boundingSphere; - - if ( boundingSphere !== undefined ) { - - const center = new Vector3(); - - if ( boundingSphere.center !== undefined ) { - - center.fromArray( boundingSphere.center ); - - } - - geometry.boundingSphere = new Sphere( center, boundingSphere.radius ); - - } - - if ( json.name ) geometry.name = json.name; - if ( json.userData ) geometry.userData = json.userData; - - return geometry; - - } - -} - -class ObjectLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - } - - load( url, onLoad, onProgress, onError ) { - - const scope = this; - - const path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path; - this.resourcePath = this.resourcePath || path; - - const loader = new FileLoader( this.manager ); - loader.setPath( this.path ); - loader.setRequestHeader( this.requestHeader ); - loader.setWithCredentials( this.withCredentials ); - loader.load( url, function ( text ) { - - let json = null; - - try { - - json = JSON.parse( text ); - - } catch ( error ) { - - if ( onError !== undefined ) onError( error ); - - console.error( 'THREE:ObjectLoader: Can\'t parse ' + url + '.', error.message ); - - return; - - } - - const metadata = json.metadata; - - if ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) { - - console.error( 'THREE.ObjectLoader: Can\'t load ' + url ); - return; - - } - - scope.parse( json, onLoad ); - - }, onProgress, onError ); - - } - - parse( json, onLoad ) { - - const animations = this.parseAnimations( json.animations ); - const shapes = this.parseShapes( json.shapes ); - const geometries = this.parseGeometries( json.geometries, shapes ); - - const images = this.parseImages( json.images, function () { - - if ( onLoad !== undefined ) onLoad( object ); - - } ); - - const textures = this.parseTextures( json.textures, images ); - const materials = this.parseMaterials( json.materials, textures ); - - const object = this.parseObject( json.object, geometries, materials, animations ); - const skeletons = this.parseSkeletons( json.skeletons, object ); - - this.bindSkeletons( object, skeletons ); - - // - - if ( onLoad !== undefined ) { - - let hasImages = false; - - for ( const uuid in images ) { - - if ( images[ uuid ] instanceof HTMLImageElement ) { - - hasImages = true; - break; - - } - - } - - if ( hasImages === false ) onLoad( object ); - - } - - return object; - - } - - parseShapes( json ) { - - const shapes = {}; - - if ( json !== undefined ) { - - for ( let i = 0, l = json.length; i < l; i ++ ) { - - const shape = new Shape().fromJSON( json[ i ] ); - - shapes[ shape.uuid ] = shape; - - } - - } - - return shapes; - - } - - parseSkeletons( json, object ) { - - const skeletons = {}; - const bones = {}; - - // generate bone lookup table - - object.traverse( function ( child ) { - - if ( child.isBone ) bones[ child.uuid ] = child; - - } ); - - // create skeletons - - if ( json !== undefined ) { - - for ( let i = 0, l = json.length; i < l; i ++ ) { - - const skeleton = new Skeleton().fromJSON( json[ i ], bones ); - - skeletons[ skeleton.uuid ] = skeleton; - - } - - } - - return skeletons; - - } - - parseGeometries( json, shapes ) { - - const geometries = {}; - let geometryShapes; - - if ( json !== undefined ) { - - const bufferGeometryLoader = new BufferGeometryLoader(); - - for ( let i = 0, l = json.length; i < l; i ++ ) { - - let geometry; - const data = json[ i ]; - - switch ( data.type ) { - - case 'PlaneGeometry': - case 'PlaneBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.width, - data.height, - data.widthSegments, - data.heightSegments - ); - - break; - - case 'BoxGeometry': - case 'BoxBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.width, - data.height, - data.depth, - data.widthSegments, - data.heightSegments, - data.depthSegments - ); - - break; - - case 'CircleGeometry': - case 'CircleBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.segments, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'CylinderGeometry': - case 'CylinderBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radiusTop, - data.radiusBottom, - data.height, - data.radialSegments, - data.heightSegments, - data.openEnded, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'ConeGeometry': - case 'ConeBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.height, - data.radialSegments, - data.heightSegments, - data.openEnded, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'SphereGeometry': - case 'SphereBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.widthSegments, - data.heightSegments, - data.phiStart, - data.phiLength, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'DodecahedronGeometry': - case 'DodecahedronBufferGeometry': - case 'IcosahedronGeometry': - case 'IcosahedronBufferGeometry': - case 'OctahedronGeometry': - case 'OctahedronBufferGeometry': - case 'TetrahedronGeometry': - case 'TetrahedronBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.detail - ); - - break; - - case 'RingGeometry': - case 'RingBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.innerRadius, - data.outerRadius, - data.thetaSegments, - data.phiSegments, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'TorusGeometry': - case 'TorusBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.tube, - data.radialSegments, - data.tubularSegments, - data.arc - ); - - break; - - case 'TorusKnotGeometry': - case 'TorusKnotBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.tube, - data.tubularSegments, - data.radialSegments, - data.p, - data.q - ); - - break; - - case 'TubeGeometry': - case 'TubeBufferGeometry': - - // This only works for built-in curves (e.g. CatmullRomCurve3). - // User defined curves or instances of CurvePath will not be deserialized. - geometry = new Geometries[ data.type ]( - new Curves[ data.path.type ]().fromJSON( data.path ), - data.tubularSegments, - data.radius, - data.radialSegments, - data.closed - ); - - break; - - case 'LatheGeometry': - case 'LatheBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.points, - data.segments, - data.phiStart, - data.phiLength - ); - - break; - - case 'PolyhedronGeometry': - case 'PolyhedronBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.vertices, - data.indices, - data.radius, - data.details - ); - - break; - - case 'ShapeGeometry': - case 'ShapeBufferGeometry': - - geometryShapes = []; - - for ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) { - - const shape = shapes[ data.shapes[ j ] ]; - - geometryShapes.push( shape ); - - } - - geometry = new Geometries[ data.type ]( - geometryShapes, - data.curveSegments - ); - - break; - - - case 'ExtrudeGeometry': - case 'ExtrudeBufferGeometry': - - geometryShapes = []; - - for ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) { - - const shape = shapes[ data.shapes[ j ] ]; - - geometryShapes.push( shape ); - - } - - const extrudePath = data.options.extrudePath; - - if ( extrudePath !== undefined ) { - - data.options.extrudePath = new Curves[ extrudePath.type ]().fromJSON( extrudePath ); - - } - - geometry = new Geometries[ data.type ]( - geometryShapes, - data.options - ); - - break; - - case 'BufferGeometry': - case 'InstancedBufferGeometry': - - geometry = bufferGeometryLoader.parse( data ); - - break; - - case 'Geometry': - - console.error( 'THREE.ObjectLoader: Loading "Geometry" is not supported anymore.' ); - - break; - - default: - - console.warn( 'THREE.ObjectLoader: Unsupported geometry type "' + data.type + '"' ); - - continue; - - } - - geometry.uuid = data.uuid; - - if ( data.name !== undefined ) geometry.name = data.name; - if ( geometry.isBufferGeometry === true && data.userData !== undefined ) geometry.userData = data.userData; - - geometries[ data.uuid ] = geometry; - - } - - } - - return geometries; - - } - - parseMaterials( json, textures ) { - - const cache = {}; // MultiMaterial - const materials = {}; - - if ( json !== undefined ) { - - const loader = new MaterialLoader(); - loader.setTextures( textures ); - - for ( let i = 0, l = json.length; i < l; i ++ ) { - - const data = json[ i ]; - - if ( data.type === 'MultiMaterial' ) { - - // Deprecated - - const array = []; - - for ( let j = 0; j < data.materials.length; j ++ ) { - - const material = data.materials[ j ]; - - if ( cache[ material.uuid ] === undefined ) { - - cache[ material.uuid ] = loader.parse( material ); - - } - - array.push( cache[ material.uuid ] ); - - } - - materials[ data.uuid ] = array; - - } else { - - if ( cache[ data.uuid ] === undefined ) { - - cache[ data.uuid ] = loader.parse( data ); - - } - - materials[ data.uuid ] = cache[ data.uuid ]; - - } - - } - - } - - return materials; - - } - - parseAnimations( json ) { - - const animations = {}; - - if ( json !== undefined ) { - - for ( let i = 0; i < json.length; i ++ ) { - - const data = json[ i ]; - - const clip = AnimationClip.parse( data ); - - animations[ clip.uuid ] = clip; - - } - - } - - return animations; - - } - - parseImages( json, onLoad ) { - - const scope = this; - const images = {}; - - let loader; - - function loadImage( url ) { - - scope.manager.itemStart( url ); - - return loader.load( url, function () { - - scope.manager.itemEnd( url ); - - }, undefined, function () { - - scope.manager.itemError( url ); - scope.manager.itemEnd( url ); - - } ); - - } - - function deserializeImage( image ) { - - if ( typeof image === 'string' ) { - - const url = image; - - const path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( url ) ? url : scope.resourcePath + url; - - return loadImage( path ); - - } else { - - if ( image.data ) { - - return { - data: getTypedArray( image.type, image.data ), - width: image.width, - height: image.height - }; - - } else { - - return null; - - } - - } - - } - - if ( json !== undefined && json.length > 0 ) { - - const manager = new LoadingManager( onLoad ); - - loader = new ImageLoader( manager ); - loader.setCrossOrigin( this.crossOrigin ); - - for ( let i = 0, il = json.length; i < il; i ++ ) { - - const image = json[ i ]; - const url = image.url; - - if ( Array.isArray( url ) ) { - - // load array of images e.g CubeTexture - - images[ image.uuid ] = []; - - for ( let j = 0, jl = url.length; j < jl; j ++ ) { - - const currentUrl = url[ j ]; - - const deserializedImage = deserializeImage( currentUrl ); - - if ( deserializedImage !== null ) { - - if ( deserializedImage instanceof HTMLImageElement ) { - - images[ image.uuid ].push( deserializedImage ); - - } else { - - // special case: handle array of data textures for cube textures - - images[ image.uuid ].push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) ); - - } - - } - - } - - } else { - - // load single image - - const deserializedImage = deserializeImage( image.url ); - - if ( deserializedImage !== null ) { - - images[ image.uuid ] = deserializedImage; - - } - - } - - } - - } - - return images; - - } - - parseTextures( json, images ) { - - function parseConstant( value, type ) { - - if ( typeof value === 'number' ) return value; - - console.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value ); - - return type[ value ]; - - } - - const textures = {}; - - if ( json !== undefined ) { - - for ( let i = 0, l = json.length; i < l; i ++ ) { - - const data = json[ i ]; - - if ( data.image === undefined ) { - - console.warn( 'THREE.ObjectLoader: No "image" specified for', data.uuid ); - - } - - if ( images[ data.image ] === undefined ) { - - console.warn( 'THREE.ObjectLoader: Undefined image', data.image ); - - } - - let texture; - const image = images[ data.image ]; - - if ( Array.isArray( image ) ) { - - texture = new CubeTexture( image ); - - if ( image.length === 6 ) texture.needsUpdate = true; - - } else { - - if ( image && image.data ) { - - texture = new DataTexture( image.data, image.width, image.height ); - - } else { - - texture = new Texture( image ); - - } - - if ( image ) texture.needsUpdate = true; // textures can have undefined image data - - } - - texture.uuid = data.uuid; - - if ( data.name !== undefined ) texture.name = data.name; - - if ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping, TEXTURE_MAPPING ); - - if ( data.offset !== undefined ) texture.offset.fromArray( data.offset ); - if ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat ); - if ( data.center !== undefined ) texture.center.fromArray( data.center ); - if ( data.rotation !== undefined ) texture.rotation = data.rotation; - - if ( data.wrap !== undefined ) { - - texture.wrapS = parseConstant( data.wrap[ 0 ], TEXTURE_WRAPPING ); - texture.wrapT = parseConstant( data.wrap[ 1 ], TEXTURE_WRAPPING ); - - } - - if ( data.format !== undefined ) texture.format = data.format; - if ( data.type !== undefined ) texture.type = data.type; - if ( data.encoding !== undefined ) texture.encoding = data.encoding; - - if ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER ); - if ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER ); - if ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy; - - if ( data.flipY !== undefined ) texture.flipY = data.flipY; - - if ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha; - if ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment; - - textures[ data.uuid ] = texture; - - } - - } - - return textures; - - } - - parseObject( data, geometries, materials, animations ) { - - let object; - - function getGeometry( name ) { - - if ( geometries[ name ] === undefined ) { - - console.warn( 'THREE.ObjectLoader: Undefined geometry', name ); - - } - - return geometries[ name ]; - - } - - function getMaterial( name ) { - - if ( name === undefined ) return undefined; - - if ( Array.isArray( name ) ) { - - const array = []; - - for ( let i = 0, l = name.length; i < l; i ++ ) { - - const uuid = name[ i ]; - - if ( materials[ uuid ] === undefined ) { - - console.warn( 'THREE.ObjectLoader: Undefined material', uuid ); - - } - - array.push( materials[ uuid ] ); - - } - - return array; - - } - - if ( materials[ name ] === undefined ) { - - console.warn( 'THREE.ObjectLoader: Undefined material', name ); - - } - - return materials[ name ]; - - } - - let geometry, material; - - switch ( data.type ) { - - case 'Scene': - - object = new Scene(); - - if ( data.background !== undefined ) { - - if ( Number.isInteger( data.background ) ) { - - object.background = new Color( data.background ); - - } - - } - - if ( data.fog !== undefined ) { - - if ( data.fog.type === 'Fog' ) { - - object.fog = new Fog( data.fog.color, data.fog.near, data.fog.far ); - - } else if ( data.fog.type === 'FogExp2' ) { - - object.fog = new FogExp2( data.fog.color, data.fog.density ); - - } - - } - - break; - - case 'PerspectiveCamera': - - object = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far ); - - if ( data.focus !== undefined ) object.focus = data.focus; - if ( data.zoom !== undefined ) object.zoom = data.zoom; - if ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge; - if ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset; - if ( data.view !== undefined ) object.view = Object.assign( {}, data.view ); - - break; - - case 'OrthographicCamera': - - object = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far ); - - if ( data.zoom !== undefined ) object.zoom = data.zoom; - if ( data.view !== undefined ) object.view = Object.assign( {}, data.view ); - - break; - - case 'AmbientLight': - - object = new AmbientLight( data.color, data.intensity ); - - break; - - case 'DirectionalLight': - - object = new DirectionalLight( data.color, data.intensity ); - - break; - - case 'PointLight': - - object = new PointLight( data.color, data.intensity, data.distance, data.decay ); - - break; - - case 'RectAreaLight': - - object = new RectAreaLight( data.color, data.intensity, data.width, data.height ); - - break; - - case 'SpotLight': - - object = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay ); - - break; - - case 'HemisphereLight': - - object = new HemisphereLight( data.color, data.groundColor, data.intensity ); - - break; - - case 'LightProbe': - - object = new LightProbe().fromJSON( data ); - - break; - - case 'SkinnedMesh': - - geometry = getGeometry( data.geometry ); - material = getMaterial( data.material ); - - object = new SkinnedMesh( geometry, material ); - - if ( data.bindMode !== undefined ) object.bindMode = data.bindMode; - if ( data.bindMatrix !== undefined ) object.bindMatrix.fromArray( data.bindMatrix ); - if ( data.skeleton !== undefined ) object.skeleton = data.skeleton; - - break; - - case 'Mesh': - - geometry = getGeometry( data.geometry ); - material = getMaterial( data.material ); - - object = new Mesh( geometry, material ); - - break; - - case 'InstancedMesh': - - geometry = getGeometry( data.geometry ); - material = getMaterial( data.material ); - const count = data.count; - const instanceMatrix = data.instanceMatrix; - - object = new InstancedMesh( geometry, material, count ); - object.instanceMatrix = new BufferAttribute( new Float32Array( instanceMatrix.array ), 16 ); - - break; - - case 'LOD': - - object = new LOD(); - - break; - - case 'Line': - - object = new Line( getGeometry( data.geometry ), getMaterial( data.material ) ); - - break; - - case 'LineLoop': - - object = new LineLoop( getGeometry( data.geometry ), getMaterial( data.material ) ); - - break; - - case 'LineSegments': - - object = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) ); - - break; - - case 'PointCloud': - case 'Points': - - object = new Points( getGeometry( data.geometry ), getMaterial( data.material ) ); - - break; - - case 'Sprite': - - object = new Sprite( getMaterial( data.material ) ); - - break; - - case 'Group': - - object = new Group(); - - break; - - case 'Bone': - - object = new Bone(); - - break; - - default: - - object = new Object3D(); - - } - - object.uuid = data.uuid; - - if ( data.name !== undefined ) object.name = data.name; - - if ( data.matrix !== undefined ) { - - object.matrix.fromArray( data.matrix ); - - if ( data.matrixAutoUpdate !== undefined ) object.matrixAutoUpdate = data.matrixAutoUpdate; - if ( object.matrixAutoUpdate ) object.matrix.decompose( object.position, object.quaternion, object.scale ); - - } else { - - if ( data.position !== undefined ) object.position.fromArray( data.position ); - if ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation ); - if ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion ); - if ( data.scale !== undefined ) object.scale.fromArray( data.scale ); - - } - - if ( data.castShadow !== undefined ) object.castShadow = data.castShadow; - if ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow; - - if ( data.shadow ) { - - if ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias; - if ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias; - if ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius; - if ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize ); - if ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera ); - - } - - if ( data.visible !== undefined ) object.visible = data.visible; - if ( data.frustumCulled !== undefined ) object.frustumCulled = data.frustumCulled; - if ( data.renderOrder !== undefined ) object.renderOrder = data.renderOrder; - if ( data.userData !== undefined ) object.userData = data.userData; - if ( data.layers !== undefined ) object.layers.mask = data.layers; - - if ( data.children !== undefined ) { - - const children = data.children; - - for ( let i = 0; i < children.length; i ++ ) { - - object.add( this.parseObject( children[ i ], geometries, materials, animations ) ); - - } - - } - - if ( data.animations !== undefined ) { - - const objectAnimations = data.animations; - - for ( let i = 0; i < objectAnimations.length; i ++ ) { - - const uuid = objectAnimations[ i ]; - - object.animations.push( animations[ uuid ] ); - - } - - } - - if ( data.type === 'LOD' ) { - - if ( data.autoUpdate !== undefined ) object.autoUpdate = data.autoUpdate; - - const levels = data.levels; - - for ( let l = 0; l < levels.length; l ++ ) { - - const level = levels[ l ]; - const child = object.getObjectByProperty( 'uuid', level.object ); - - if ( child !== undefined ) { - - object.addLevel( child, level.distance ); - - } - - } - - } - - return object; - - } - - bindSkeletons( object, skeletons ) { - - if ( Object.keys( skeletons ).length === 0 ) return; - - object.traverse( function ( child ) { - - if ( child.isSkinnedMesh === true && child.skeleton !== undefined ) { - - const skeleton = skeletons[ child.skeleton ]; - - if ( skeleton === undefined ) { - - console.warn( 'THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton ); - - } else { - - child.bind( skeleton, child.bindMatrix ); - - } - - } - - } ); - - } - - /* DEPRECATED */ - - setTexturePath( value ) { - - console.warn( 'THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().' ); - return this.setResourcePath( value ); - - } - -} - -const TEXTURE_MAPPING = { - UVMapping: UVMapping, - CubeReflectionMapping: CubeReflectionMapping, - CubeRefractionMapping: CubeRefractionMapping, - EquirectangularReflectionMapping: EquirectangularReflectionMapping, - EquirectangularRefractionMapping: EquirectangularRefractionMapping, - CubeUVReflectionMapping: CubeUVReflectionMapping, - CubeUVRefractionMapping: CubeUVRefractionMapping -}; - -const TEXTURE_WRAPPING = { - RepeatWrapping: RepeatWrapping, - ClampToEdgeWrapping: ClampToEdgeWrapping, - MirroredRepeatWrapping: MirroredRepeatWrapping -}; - -const TEXTURE_FILTER = { - NearestFilter: NearestFilter, - NearestMipmapNearestFilter: NearestMipmapNearestFilter, - NearestMipmapLinearFilter: NearestMipmapLinearFilter, - LinearFilter: LinearFilter, - LinearMipmapNearestFilter: LinearMipmapNearestFilter, - LinearMipmapLinearFilter: LinearMipmapLinearFilter -}; - -function ImageBitmapLoader( manager ) { - - if ( typeof createImageBitmap === 'undefined' ) { - - console.warn( 'THREE.ImageBitmapLoader: createImageBitmap() not supported.' ); - - } - - if ( typeof fetch === 'undefined' ) { - - console.warn( 'THREE.ImageBitmapLoader: fetch() not supported.' ); - - } - - Loader.call( this, manager ); - - this.options = { premultiplyAlpha: 'none' }; - -} - -ImageBitmapLoader.prototype = Object.assign( Object.create( Loader.prototype ), { - - constructor: ImageBitmapLoader, - - isImageBitmapLoader: true, - - setOptions: function setOptions( options ) { - - this.options = options; - - return this; - - }, - - load: function ( url, onLoad, onProgress, onError ) { - - if ( url === undefined ) url = ''; - - if ( this.path !== undefined ) url = this.path + url; - - url = this.manager.resolveURL( url ); - - const scope = this; - - const cached = Cache.get( url ); - - if ( cached !== undefined ) { - - scope.manager.itemStart( url ); - - setTimeout( function () { - - if ( onLoad ) onLoad( cached ); - - scope.manager.itemEnd( url ); - - }, 0 ); - - return cached; - - } - - const fetchOptions = {}; - fetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include'; - fetchOptions.headers = this.requestHeader; - - fetch( url, fetchOptions ).then( function ( res ) { - - return res.blob(); - - } ).then( function ( blob ) { - - return createImageBitmap( blob, Object.assign( scope.options, { colorSpaceConversion: 'none' } ) ); - - } ).then( function ( imageBitmap ) { - - Cache.add( url, imageBitmap ); - - if ( onLoad ) onLoad( imageBitmap ); - - scope.manager.itemEnd( url ); - - } ).catch( function ( e ) { - - if ( onError ) onError( e ); - - scope.manager.itemError( url ); - scope.manager.itemEnd( url ); - - } ); - - scope.manager.itemStart( url ); - - } - -} ); - -class ShapePath { - - constructor() { - - this.type = 'ShapePath'; - - this.color = new Color(); - - this.subPaths = []; - this.currentPath = null; - - } - - moveTo( x, y ) { - - this.currentPath = new Path(); - this.subPaths.push( this.currentPath ); - this.currentPath.moveTo( x, y ); - - return this; - - } - - lineTo( x, y ) { - - this.currentPath.lineTo( x, y ); - - return this; - - } - - quadraticCurveTo( aCPx, aCPy, aX, aY ) { - - this.currentPath.quadraticCurveTo( aCPx, aCPy, aX, aY ); - - return this; - - } - - bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) { - - this.currentPath.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ); - - return this; - - } - - splineThru( pts ) { - - this.currentPath.splineThru( pts ); - - return this; - - } - - toShapes( isCCW, noHoles ) { - - function toShapesNoHoles( inSubpaths ) { - - const shapes = []; - - for ( let i = 0, l = inSubpaths.length; i < l; i ++ ) { - - const tmpPath = inSubpaths[ i ]; - - const tmpShape = new Shape(); - tmpShape.curves = tmpPath.curves; - - shapes.push( tmpShape ); - - } - - return shapes; - - } - - function isPointInsidePolygon( inPt, inPolygon ) { - - const polyLen = inPolygon.length; - - // inPt on polygon contour => immediate success or - // toggling of inside/outside at every single! intersection point of an edge - // with the horizontal line through inPt, left of inPt - // not counting lowerY endpoints of edges and whole edges on that line - let inside = false; - for ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) { - - let edgeLowPt = inPolygon[ p ]; - let edgeHighPt = inPolygon[ q ]; - - let edgeDx = edgeHighPt.x - edgeLowPt.x; - let edgeDy = edgeHighPt.y - edgeLowPt.y; - - if ( Math.abs( edgeDy ) > Number.EPSILON ) { - - // not parallel - if ( edgeDy < 0 ) { - - edgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx; - edgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy; - - } - - if ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) continue; - - if ( inPt.y === edgeLowPt.y ) { - - if ( inPt.x === edgeLowPt.x ) return true; // inPt is on contour ? - // continue; // no intersection or edgeLowPt => doesn't count !!! - - } else { - - const perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y ); - if ( perpEdge === 0 ) return true; // inPt is on contour ? - if ( perpEdge < 0 ) continue; - inside = ! inside; // true intersection left of inPt - - } - - } else { - - // parallel or collinear - if ( inPt.y !== edgeLowPt.y ) continue; // parallel - // edge lies on the same horizontal line as inPt - if ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) || - ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) ) return true; // inPt: Point on contour ! - // continue; - - } - - } - - return inside; - - } - - const isClockWise = ShapeUtils.isClockWise; - - const subPaths = this.subPaths; - if ( subPaths.length === 0 ) return []; - - if ( noHoles === true ) return toShapesNoHoles( subPaths ); - - - let solid, tmpPath, tmpShape; - const shapes = []; - - if ( subPaths.length === 1 ) { - - tmpPath = subPaths[ 0 ]; - tmpShape = new Shape(); - tmpShape.curves = tmpPath.curves; - shapes.push( tmpShape ); - return shapes; - - } - - let holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() ); - holesFirst = isCCW ? ! holesFirst : holesFirst; - - // console.log("Holes first", holesFirst); - - const betterShapeHoles = []; - const newShapes = []; - let newShapeHoles = []; - let mainIdx = 0; - let tmpPoints; - - newShapes[ mainIdx ] = undefined; - newShapeHoles[ mainIdx ] = []; - - for ( let i = 0, l = subPaths.length; i < l; i ++ ) { - - tmpPath = subPaths[ i ]; - tmpPoints = tmpPath.getPoints(); - solid = isClockWise( tmpPoints ); - solid = isCCW ? ! solid : solid; - - if ( solid ) { - - if ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) ) mainIdx ++; - - newShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints }; - newShapes[ mainIdx ].s.curves = tmpPath.curves; - - if ( holesFirst ) mainIdx ++; - newShapeHoles[ mainIdx ] = []; - - //console.log('cw', i); - - } else { - - newShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } ); - - //console.log('ccw', i); - - } - - } - - // only Holes? -> probably all Shapes with wrong orientation - if ( ! newShapes[ 0 ] ) return toShapesNoHoles( subPaths ); - - - if ( newShapes.length > 1 ) { - - let ambiguous = false; - const toChange = []; - - for ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) { - - betterShapeHoles[ sIdx ] = []; - - } - - for ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) { - - const sho = newShapeHoles[ sIdx ]; - - for ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) { - - const ho = sho[ hIdx ]; - let hole_unassigned = true; - - for ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) { - - if ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) { - - if ( sIdx !== s2Idx ) toChange.push( { froms: sIdx, tos: s2Idx, hole: hIdx } ); - if ( hole_unassigned ) { - - hole_unassigned = false; - betterShapeHoles[ s2Idx ].push( ho ); - - } else { - - ambiguous = true; - - } - - } - - } - - if ( hole_unassigned ) { - - betterShapeHoles[ sIdx ].push( ho ); - - } - - } - - } - // console.log("ambiguous: ", ambiguous); - - if ( toChange.length > 0 ) { - - // console.log("to change: ", toChange); - if ( ! ambiguous ) newShapeHoles = betterShapeHoles; - - } - - } - - let tmpHoles; - - for ( let i = 0, il = newShapes.length; i < il; i ++ ) { - - tmpShape = newShapes[ i ].s; - shapes.push( tmpShape ); - tmpHoles = newShapeHoles[ i ]; - - for ( let j = 0, jl = tmpHoles.length; j < jl; j ++ ) { - - tmpShape.holes.push( tmpHoles[ j ].h ); - - } - - } - - //console.log("shape", shapes); - - return shapes; - - } - -} - -class Font { - - constructor( data ) { - - this.type = 'Font'; - - this.data = data; - - } - - generateShapes( text, size = 100 ) { - - const shapes = []; - const paths = createPaths( text, size, this.data ); - - for ( let p = 0, pl = paths.length; p < pl; p ++ ) { - - Array.prototype.push.apply( shapes, paths[ p ].toShapes() ); - - } - - return shapes; - - } - -} - -function createPaths( text, size, data ) { - - const chars = Array.from( text ); - const scale = size / data.resolution; - const line_height = ( data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness ) * scale; - - const paths = []; - - let offsetX = 0, offsetY = 0; - - for ( let i = 0; i < chars.length; i ++ ) { - - const char = chars[ i ]; - - if ( char === '\n' ) { - - offsetX = 0; - offsetY -= line_height; - - } else { - - const ret = createPath( char, scale, offsetX, offsetY, data ); - offsetX += ret.offsetX; - paths.push( ret.path ); - - } - - } - - return paths; - -} - -function createPath( char, scale, offsetX, offsetY, data ) { - - const glyph = data.glyphs[ char ] || data.glyphs[ '?' ]; - - if ( ! glyph ) { - - console.error( 'THREE.Font: character "' + char + '" does not exists in font family ' + data.familyName + '.' ); - - return; - - } - - const path = new ShapePath(); - - let x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2; - - if ( glyph.o ) { - - const outline = glyph._cachedOutline || ( glyph._cachedOutline = glyph.o.split( ' ' ) ); - - for ( let i = 0, l = outline.length; i < l; ) { - - const action = outline[ i ++ ]; - - switch ( action ) { - - case 'm': // moveTo - - x = outline[ i ++ ] * scale + offsetX; - y = outline[ i ++ ] * scale + offsetY; - - path.moveTo( x, y ); - - break; - - case 'l': // lineTo - - x = outline[ i ++ ] * scale + offsetX; - y = outline[ i ++ ] * scale + offsetY; - - path.lineTo( x, y ); - - break; - - case 'q': // quadraticCurveTo - - cpx = outline[ i ++ ] * scale + offsetX; - cpy = outline[ i ++ ] * scale + offsetY; - cpx1 = outline[ i ++ ] * scale + offsetX; - cpy1 = outline[ i ++ ] * scale + offsetY; - - path.quadraticCurveTo( cpx1, cpy1, cpx, cpy ); - - break; - - case 'b': // bezierCurveTo - - cpx = outline[ i ++ ] * scale + offsetX; - cpy = outline[ i ++ ] * scale + offsetY; - cpx1 = outline[ i ++ ] * scale + offsetX; - cpy1 = outline[ i ++ ] * scale + offsetY; - cpx2 = outline[ i ++ ] * scale + offsetX; - cpy2 = outline[ i ++ ] * scale + offsetY; - - path.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy ); - - break; - - } - - } - - } - - return { offsetX: glyph.ha * scale, path: path }; - -} - -Font.prototype.isFont = true; - -class FontLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - } - - load( url, onLoad, onProgress, onError ) { - - const scope = this; - - const loader = new FileLoader( this.manager ); - loader.setPath( this.path ); - loader.setRequestHeader( this.requestHeader ); - loader.setWithCredentials( scope.withCredentials ); - loader.load( url, function ( text ) { - - let json; - - try { - - json = JSON.parse( text ); - - } catch ( e ) { - - console.warn( 'THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead.' ); - json = JSON.parse( text.substring( 65, text.length - 2 ) ); - - } - - const font = scope.parse( json ); - - if ( onLoad ) onLoad( font ); - - }, onProgress, onError ); - - } - - parse( json ) { - - return new Font( json ); - - } - -} - -let _context; - -const AudioContext = { - - getContext: function () { - - if ( _context === undefined ) { - - _context = new ( window.AudioContext || window.webkitAudioContext )(); - - } - - return _context; - - }, - - setContext: function ( value ) { - - _context = value; - - } - -}; - -class AudioLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - } - - load( url, onLoad, onProgress, onError ) { - - const scope = this; - - const loader = new FileLoader( this.manager ); - loader.setResponseType( 'arraybuffer' ); - loader.setPath( this.path ); - loader.setRequestHeader( this.requestHeader ); - loader.setWithCredentials( this.withCredentials ); - loader.load( url, function ( buffer ) { - - try { - - // Create a copy of the buffer. The `decodeAudioData` method - // detaches the buffer when complete, preventing reuse. - const bufferCopy = buffer.slice( 0 ); - - const context = AudioContext.getContext(); - context.decodeAudioData( bufferCopy, function ( audioBuffer ) { - - onLoad( audioBuffer ); - - } ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - -} - -class HemisphereLightProbe extends LightProbe { - - constructor( skyColor, groundColor, intensity = 1 ) { - - super( undefined, intensity ); - - const color1 = new Color().set( skyColor ); - const color2 = new Color().set( groundColor ); - - const sky = new Vector3( color1.r, color1.g, color1.b ); - const ground = new Vector3( color2.r, color2.g, color2.b ); - - // without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI ); - const c0 = Math.sqrt( Math.PI ); - const c1 = c0 * Math.sqrt( 0.75 ); - - this.sh.coefficients[ 0 ].copy( sky ).add( ground ).multiplyScalar( c0 ); - this.sh.coefficients[ 1 ].copy( sky ).sub( ground ).multiplyScalar( c1 ); - - } - -} - -HemisphereLightProbe.prototype.isHemisphereLightProbe = true; - -class AmbientLightProbe extends LightProbe { - - constructor( color, intensity = 1 ) { - - super( undefined, intensity ); - - const color1 = new Color().set( color ); - - // without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI ); - this.sh.coefficients[ 0 ].set( color1.r, color1.g, color1.b ).multiplyScalar( 2 * Math.sqrt( Math.PI ) ); - - } - -} - -AmbientLightProbe.prototype.isAmbientLightProbe = true; - -const _eyeRight = new Matrix4(); -const _eyeLeft = new Matrix4(); - -class StereoCamera { - - constructor() { - - this.type = 'StereoCamera'; - - this.aspect = 1; - - this.eyeSep = 0.064; - - this.cameraL = new PerspectiveCamera(); - this.cameraL.layers.enable( 1 ); - this.cameraL.matrixAutoUpdate = false; - - this.cameraR = new PerspectiveCamera(); - this.cameraR.layers.enable( 2 ); - this.cameraR.matrixAutoUpdate = false; - - this._cache = { - focus: null, - fov: null, - aspect: null, - near: null, - far: null, - zoom: null, - eyeSep: null - }; - - } - - update( camera ) { - - const cache = this._cache; - - const needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov || - cache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near || - cache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep; - - if ( needsUpdate ) { - - cache.focus = camera.focus; - cache.fov = camera.fov; - cache.aspect = camera.aspect * this.aspect; - cache.near = camera.near; - cache.far = camera.far; - cache.zoom = camera.zoom; - cache.eyeSep = this.eyeSep; - - // Off-axis stereoscopic effect based on - // http://paulbourke.net/stereographics/stereorender/ - - const projectionMatrix = camera.projectionMatrix.clone(); - const eyeSepHalf = cache.eyeSep / 2; - const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus; - const ymax = ( cache.near * Math.tan( MathUtils.DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom; - let xmin, xmax; - - // translate xOffset - - _eyeLeft.elements[ 12 ] = - eyeSepHalf; - _eyeRight.elements[ 12 ] = eyeSepHalf; - - // for left eye - - xmin = - ymax * cache.aspect + eyeSepOnProjection; - xmax = ymax * cache.aspect + eyeSepOnProjection; - - projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin ); - projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin ); - - this.cameraL.projectionMatrix.copy( projectionMatrix ); - - // for right eye - - xmin = - ymax * cache.aspect - eyeSepOnProjection; - xmax = ymax * cache.aspect - eyeSepOnProjection; - - projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin ); - projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin ); - - this.cameraR.projectionMatrix.copy( projectionMatrix ); - - } - - this.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeLeft ); - this.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeRight ); - - } - -} - -class Clock { - - constructor( autoStart ) { - - this.autoStart = ( autoStart !== undefined ) ? autoStart : true; - - this.startTime = 0; - this.oldTime = 0; - this.elapsedTime = 0; - - this.running = false; - - } - - start() { - - this.startTime = now(); - - this.oldTime = this.startTime; - this.elapsedTime = 0; - this.running = true; - - } - - stop() { - - this.getElapsedTime(); - this.running = false; - this.autoStart = false; - - } - - getElapsedTime() { - - this.getDelta(); - return this.elapsedTime; - - } - - getDelta() { - - let diff = 0; - - if ( this.autoStart && ! this.running ) { - - this.start(); - return 0; - - } - - if ( this.running ) { - - const newTime = now(); - - diff = ( newTime - this.oldTime ) / 1000; - this.oldTime = newTime; - - this.elapsedTime += diff; - - } - - return diff; - - } - -} - -function now() { - - return ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732 - -} - -const _position$2 = /*@__PURE__*/ new Vector3(); -const _quaternion$3 = /*@__PURE__*/ new Quaternion(); -const _scale$1 = /*@__PURE__*/ new Vector3(); -const _orientation = /*@__PURE__*/ new Vector3(); - -class AudioListener extends Object3D { - - constructor() { - - super(); - - this.type = 'AudioListener'; - - this.context = AudioContext.getContext(); - - this.gain = this.context.createGain(); - this.gain.connect( this.context.destination ); - - this.filter = null; - - this.timeDelta = 0; - - // private - - this._clock = new Clock(); - - } - - getInput() { - - return this.gain; - - } - - removeFilter() { - - if ( this.filter !== null ) { - - this.gain.disconnect( this.filter ); - this.filter.disconnect( this.context.destination ); - this.gain.connect( this.context.destination ); - this.filter = null; - - } - - return this; - - } - - getFilter() { - - return this.filter; - - } - - setFilter( value ) { - - if ( this.filter !== null ) { - - this.gain.disconnect( this.filter ); - this.filter.disconnect( this.context.destination ); - - } else { - - this.gain.disconnect( this.context.destination ); - - } - - this.filter = value; - this.gain.connect( this.filter ); - this.filter.connect( this.context.destination ); - - return this; - - } - - getMasterVolume() { - - return this.gain.gain.value; - - } - - setMasterVolume( value ) { - - this.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 ); - - return this; - - } - - updateMatrixWorld( force ) { - - super.updateMatrixWorld( force ); - - const listener = this.context.listener; - const up = this.up; - - this.timeDelta = this._clock.getDelta(); - - this.matrixWorld.decompose( _position$2, _quaternion$3, _scale$1 ); - - _orientation.set( 0, 0, - 1 ).applyQuaternion( _quaternion$3 ); - - if ( listener.positionX ) { - - // code path for Chrome (see #14393) - - const endTime = this.context.currentTime + this.timeDelta; - - listener.positionX.linearRampToValueAtTime( _position$2.x, endTime ); - listener.positionY.linearRampToValueAtTime( _position$2.y, endTime ); - listener.positionZ.linearRampToValueAtTime( _position$2.z, endTime ); - listener.forwardX.linearRampToValueAtTime( _orientation.x, endTime ); - listener.forwardY.linearRampToValueAtTime( _orientation.y, endTime ); - listener.forwardZ.linearRampToValueAtTime( _orientation.z, endTime ); - listener.upX.linearRampToValueAtTime( up.x, endTime ); - listener.upY.linearRampToValueAtTime( up.y, endTime ); - listener.upZ.linearRampToValueAtTime( up.z, endTime ); - - } else { - - listener.setPosition( _position$2.x, _position$2.y, _position$2.z ); - listener.setOrientation( _orientation.x, _orientation.y, _orientation.z, up.x, up.y, up.z ); - - } - - } - -} - -class Audio extends Object3D { - - constructor( listener ) { - - super(); - - this.type = 'Audio'; - - this.listener = listener; - this.context = listener.context; - - this.gain = this.context.createGain(); - this.gain.connect( listener.getInput() ); - - this.autoplay = false; - - this.buffer = null; - this.detune = 0; - this.loop = false; - this.loopStart = 0; - this.loopEnd = 0; - this.offset = 0; - this.duration = undefined; - this.playbackRate = 1; - this.isPlaying = false; - this.hasPlaybackControl = true; - this.source = null; - this.sourceType = 'empty'; - - this._startedAt = 0; - this._progress = 0; - this._connected = false; - - this.filters = []; - - } - - getOutput() { - - return this.gain; - - } - - setNodeSource( audioNode ) { - - this.hasPlaybackControl = false; - this.sourceType = 'audioNode'; - this.source = audioNode; - this.connect(); - - return this; - - } - - setMediaElementSource( mediaElement ) { - - this.hasPlaybackControl = false; - this.sourceType = 'mediaNode'; - this.source = this.context.createMediaElementSource( mediaElement ); - this.connect(); - - return this; - - } - - setMediaStreamSource( mediaStream ) { - - this.hasPlaybackControl = false; - this.sourceType = 'mediaStreamNode'; - this.source = this.context.createMediaStreamSource( mediaStream ); - this.connect(); - - return this; - - } - - setBuffer( audioBuffer ) { - - this.buffer = audioBuffer; - this.sourceType = 'buffer'; - - if ( this.autoplay ) this.play(); - - return this; - - } - - play( delay = 0 ) { - - if ( this.isPlaying === true ) { - - console.warn( 'THREE.Audio: Audio is already playing.' ); - return; - - } - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return; - - } - - this._startedAt = this.context.currentTime + delay; - - const source = this.context.createBufferSource(); - source.buffer = this.buffer; - source.loop = this.loop; - source.loopStart = this.loopStart; - source.loopEnd = this.loopEnd; - source.onended = this.onEnded.bind( this ); - source.start( this._startedAt, this._progress + this.offset, this.duration ); - - this.isPlaying = true; - - this.source = source; - - this.setDetune( this.detune ); - this.setPlaybackRate( this.playbackRate ); - - return this.connect(); - - } - - pause() { - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return; - - } - - if ( this.isPlaying === true ) { - - // update current progress - - this._progress += Math.max( this.context.currentTime - this._startedAt, 0 ) * this.playbackRate; - - if ( this.loop === true ) { - - // ensure _progress does not exceed duration with looped audios - - this._progress = this._progress % ( this.duration || this.buffer.duration ); - - } - - this.source.stop(); - this.source.onended = null; - - this.isPlaying = false; - - } - - return this; - - } - - stop() { - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return; - - } - - this._progress = 0; - - this.source.stop(); - this.source.onended = null; - this.isPlaying = false; - - return this; - - } - - connect() { - - if ( this.filters.length > 0 ) { - - this.source.connect( this.filters[ 0 ] ); - - for ( let i = 1, l = this.filters.length; i < l; i ++ ) { - - this.filters[ i - 1 ].connect( this.filters[ i ] ); - - } - - this.filters[ this.filters.length - 1 ].connect( this.getOutput() ); - - } else { - - this.source.connect( this.getOutput() ); - - } - - this._connected = true; - - return this; - - } - - disconnect() { - - if ( this.filters.length > 0 ) { - - this.source.disconnect( this.filters[ 0 ] ); - - for ( let i = 1, l = this.filters.length; i < l; i ++ ) { - - this.filters[ i - 1 ].disconnect( this.filters[ i ] ); - - } - - this.filters[ this.filters.length - 1 ].disconnect( this.getOutput() ); - - } else { - - this.source.disconnect( this.getOutput() ); - - } - - this._connected = false; - - return this; - - } - - getFilters() { - - return this.filters; - - } - - setFilters( value ) { - - if ( ! value ) value = []; - - if ( this._connected === true ) { - - this.disconnect(); - this.filters = value.slice(); - this.connect(); - - } else { - - this.filters = value.slice(); - - } - - return this; - - } - - setDetune( value ) { - - this.detune = value; - - if ( this.source.detune === undefined ) return; // only set detune when available - - if ( this.isPlaying === true ) { - - this.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 ); - - } - - return this; - - } - - getDetune() { - - return this.detune; - - } - - getFilter() { - - return this.getFilters()[ 0 ]; - - } - - setFilter( filter ) { - - return this.setFilters( filter ? [ filter ] : [] ); - - } - - setPlaybackRate( value ) { - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return; - - } - - this.playbackRate = value; - - if ( this.isPlaying === true ) { - - this.source.playbackRate.setTargetAtTime( this.playbackRate, this.context.currentTime, 0.01 ); - - } - - return this; - - } - - getPlaybackRate() { - - return this.playbackRate; - - } - - onEnded() { - - this.isPlaying = false; - - } - - getLoop() { - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return false; - - } - - return this.loop; - - } - - setLoop( value ) { - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return; - - } - - this.loop = value; - - if ( this.isPlaying === true ) { - - this.source.loop = this.loop; - - } - - return this; - - } - - setLoopStart( value ) { - - this.loopStart = value; - - return this; - - } - - setLoopEnd( value ) { - - this.loopEnd = value; - - return this; - - } - - getVolume() { - - return this.gain.gain.value; - - } - - setVolume( value ) { - - this.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 ); - - return this; - - } - -} - -const _position$3 = /*@__PURE__*/ new Vector3(); -const _quaternion$4 = /*@__PURE__*/ new Quaternion(); -const _scale$2 = /*@__PURE__*/ new Vector3(); -const _orientation$1 = /*@__PURE__*/ new Vector3(); - -class PositionalAudio extends Audio { - - constructor( listener ) { - - super( listener ); - - this.panner = this.context.createPanner(); - this.panner.panningModel = 'HRTF'; - this.panner.connect( this.gain ); - - } - - getOutput() { - - return this.panner; - - } - - getRefDistance() { - - return this.panner.refDistance; - - } - - setRefDistance( value ) { - - this.panner.refDistance = value; - - return this; - - } - - getRolloffFactor() { - - return this.panner.rolloffFactor; - - } - - setRolloffFactor( value ) { - - this.panner.rolloffFactor = value; - - return this; - - } - - getDistanceModel() { - - return this.panner.distanceModel; - - } - - setDistanceModel( value ) { - - this.panner.distanceModel = value; - - return this; - - } - - getMaxDistance() { - - return this.panner.maxDistance; - - } - - setMaxDistance( value ) { - - this.panner.maxDistance = value; - - return this; - - } - - setDirectionalCone( coneInnerAngle, coneOuterAngle, coneOuterGain ) { - - this.panner.coneInnerAngle = coneInnerAngle; - this.panner.coneOuterAngle = coneOuterAngle; - this.panner.coneOuterGain = coneOuterGain; - - return this; - - } - - updateMatrixWorld( force ) { - - super.updateMatrixWorld( force ); - - if ( this.hasPlaybackControl === true && this.isPlaying === false ) return; - - this.matrixWorld.decompose( _position$3, _quaternion$4, _scale$2 ); - - _orientation$1.set( 0, 0, 1 ).applyQuaternion( _quaternion$4 ); - - const panner = this.panner; - - if ( panner.positionX ) { - - // code path for Chrome and Firefox (see #14393) - - const endTime = this.context.currentTime + this.listener.timeDelta; - - panner.positionX.linearRampToValueAtTime( _position$3.x, endTime ); - panner.positionY.linearRampToValueAtTime( _position$3.y, endTime ); - panner.positionZ.linearRampToValueAtTime( _position$3.z, endTime ); - panner.orientationX.linearRampToValueAtTime( _orientation$1.x, endTime ); - panner.orientationY.linearRampToValueAtTime( _orientation$1.y, endTime ); - panner.orientationZ.linearRampToValueAtTime( _orientation$1.z, endTime ); - - } else { - - panner.setPosition( _position$3.x, _position$3.y, _position$3.z ); - panner.setOrientation( _orientation$1.x, _orientation$1.y, _orientation$1.z ); - - } - - } - -} - -class AudioAnalyser { - - constructor( audio, fftSize = 2048 ) { - - this.analyser = audio.context.createAnalyser(); - this.analyser.fftSize = fftSize; - - this.data = new Uint8Array( this.analyser.frequencyBinCount ); - - audio.getOutput().connect( this.analyser ); - - } - - - getFrequencyData() { - - this.analyser.getByteFrequencyData( this.data ); - - return this.data; - - } - - getAverageFrequency() { - - let value = 0; - const data = this.getFrequencyData(); - - for ( let i = 0; i < data.length; i ++ ) { - - value += data[ i ]; - - } - - return value / data.length; - - } - -} - -class PropertyMixer { - - constructor( binding, typeName, valueSize ) { - - this.binding = binding; - this.valueSize = valueSize; - - let mixFunction, - mixFunctionAdditive, - setIdentity; - - // buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ] - // - // interpolators can use .buffer as their .result - // the data then goes to 'incoming' - // - // 'accu0' and 'accu1' are used frame-interleaved for - // the cumulative result and are compared to detect - // changes - // - // 'orig' stores the original state of the property - // - // 'add' is used for additive cumulative results - // - // 'work' is optional and is only present for quaternion types. It is used - // to store intermediate quaternion multiplication results - - switch ( typeName ) { - - case 'quaternion': - mixFunction = this._slerp; - mixFunctionAdditive = this._slerpAdditive; - setIdentity = this._setAdditiveIdentityQuaternion; - - this.buffer = new Float64Array( valueSize * 6 ); - this._workIndex = 5; - break; - - case 'string': - case 'bool': - mixFunction = this._select; - - // Use the regular mix function and for additive on these types, - // additive is not relevant for non-numeric types - mixFunctionAdditive = this._select; - - setIdentity = this._setAdditiveIdentityOther; - - this.buffer = new Array( valueSize * 5 ); - break; - - default: - mixFunction = this._lerp; - mixFunctionAdditive = this._lerpAdditive; - setIdentity = this._setAdditiveIdentityNumeric; - - this.buffer = new Float64Array( valueSize * 5 ); - - } - - this._mixBufferRegion = mixFunction; - this._mixBufferRegionAdditive = mixFunctionAdditive; - this._setIdentity = setIdentity; - this._origIndex = 3; - this._addIndex = 4; - - this.cumulativeWeight = 0; - this.cumulativeWeightAdditive = 0; - - this.useCount = 0; - this.referenceCount = 0; - - } - - // accumulate data in the 'incoming' region into 'accu' - accumulate( accuIndex, weight ) { - - // note: happily accumulating nothing when weight = 0, the caller knows - // the weight and shouldn't have made the call in the first place - - const buffer = this.buffer, - stride = this.valueSize, - offset = accuIndex * stride + stride; - - let currentWeight = this.cumulativeWeight; - - if ( currentWeight === 0 ) { - - // accuN := incoming * weight - - for ( let i = 0; i !== stride; ++ i ) { - - buffer[ offset + i ] = buffer[ i ]; - - } - - currentWeight = weight; - - } else { - - // accuN := accuN + incoming * weight - - currentWeight += weight; - const mix = weight / currentWeight; - this._mixBufferRegion( buffer, offset, 0, mix, stride ); - - } - - this.cumulativeWeight = currentWeight; - - } - - // accumulate data in the 'incoming' region into 'add' - accumulateAdditive( weight ) { - - const buffer = this.buffer, - stride = this.valueSize, - offset = stride * this._addIndex; - - if ( this.cumulativeWeightAdditive === 0 ) { - - // add = identity - - this._setIdentity(); - - } - - // add := add + incoming * weight - - this._mixBufferRegionAdditive( buffer, offset, 0, weight, stride ); - this.cumulativeWeightAdditive += weight; - - } - - // apply the state of 'accu' to the binding when accus differ - apply( accuIndex ) { - - const stride = this.valueSize, - buffer = this.buffer, - offset = accuIndex * stride + stride, - - weight = this.cumulativeWeight, - weightAdditive = this.cumulativeWeightAdditive, - - binding = this.binding; - - this.cumulativeWeight = 0; - this.cumulativeWeightAdditive = 0; - - if ( weight < 1 ) { - - // accuN := accuN + original * ( 1 - cumulativeWeight ) - - const originalValueOffset = stride * this._origIndex; - - this._mixBufferRegion( - buffer, offset, originalValueOffset, 1 - weight, stride ); - - } - - if ( weightAdditive > 0 ) { - - // accuN := accuN + additive accuN - - this._mixBufferRegionAdditive( buffer, offset, this._addIndex * stride, 1, stride ); - - } - - for ( let i = stride, e = stride + stride; i !== e; ++ i ) { - - if ( buffer[ i ] !== buffer[ i + stride ] ) { - - // value has changed -> update scene graph - - binding.setValue( buffer, offset ); - break; - - } - - } - - } - - // remember the state of the bound property and copy it to both accus - saveOriginalState() { - - const binding = this.binding; - - const buffer = this.buffer, - stride = this.valueSize, - - originalValueOffset = stride * this._origIndex; - - binding.getValue( buffer, originalValueOffset ); - - // accu[0..1] := orig -- initially detect changes against the original - for ( let i = stride, e = originalValueOffset; i !== e; ++ i ) { - - buffer[ i ] = buffer[ originalValueOffset + ( i % stride ) ]; - - } - - // Add to identity for additive - this._setIdentity(); - - this.cumulativeWeight = 0; - this.cumulativeWeightAdditive = 0; - - } - - // apply the state previously taken via 'saveOriginalState' to the binding - restoreOriginalState() { - - const originalValueOffset = this.valueSize * 3; - this.binding.setValue( this.buffer, originalValueOffset ); - - } - - _setAdditiveIdentityNumeric() { - - const startIndex = this._addIndex * this.valueSize; - const endIndex = startIndex + this.valueSize; - - for ( let i = startIndex; i < endIndex; i ++ ) { - - this.buffer[ i ] = 0; - - } - - } - - _setAdditiveIdentityQuaternion() { - - this._setAdditiveIdentityNumeric(); - this.buffer[ this._addIndex * this.valueSize + 3 ] = 1; - - } - - _setAdditiveIdentityOther() { - - const startIndex = this._origIndex * this.valueSize; - const targetIndex = this._addIndex * this.valueSize; - - for ( let i = 0; i < this.valueSize; i ++ ) { - - this.buffer[ targetIndex + i ] = this.buffer[ startIndex + i ]; - - } - - } - - - // mix functions - - _select( buffer, dstOffset, srcOffset, t, stride ) { - - if ( t >= 0.5 ) { - - for ( let i = 0; i !== stride; ++ i ) { - - buffer[ dstOffset + i ] = buffer[ srcOffset + i ]; - - } - - } - - } - - _slerp( buffer, dstOffset, srcOffset, t ) { - - Quaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t ); - - } - - _slerpAdditive( buffer, dstOffset, srcOffset, t, stride ) { - - const workOffset = this._workIndex * stride; - - // Store result in intermediate buffer offset - Quaternion.multiplyQuaternionsFlat( buffer, workOffset, buffer, dstOffset, buffer, srcOffset ); - - // Slerp to the intermediate result - Quaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t ); - - } - - _lerp( buffer, dstOffset, srcOffset, t, stride ) { - - const s = 1 - t; - - for ( let i = 0; i !== stride; ++ i ) { - - const j = dstOffset + i; - - buffer[ j ] = buffer[ j ] * s + buffer[ srcOffset + i ] * t; - - } - - } - - _lerpAdditive( buffer, dstOffset, srcOffset, t, stride ) { - - for ( let i = 0; i !== stride; ++ i ) { - - const j = dstOffset + i; - - buffer[ j ] = buffer[ j ] + buffer[ srcOffset + i ] * t; - - } - - } - -} - -// Characters [].:/ are reserved for track binding syntax. -const _RESERVED_CHARS_RE = '\\[\\]\\.:\\/'; -const _reservedRe = new RegExp( '[' + _RESERVED_CHARS_RE + ']', 'g' ); - -// Attempts to allow node names from any language. ES5's `\w` regexp matches -// only latin characters, and the unicode \p{L} is not yet supported. So -// instead, we exclude reserved characters and match everything else. -const _wordChar = '[^' + _RESERVED_CHARS_RE + ']'; -const _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace( '\\.', '' ) + ']'; - -// Parent directories, delimited by '/' or ':'. Currently unused, but must -// be matched to parse the rest of the track name. -const _directoryRe = /((?:WC+[\/:])*)/.source.replace( 'WC', _wordChar ); - -// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'. -const _nodeRe = /(WCOD+)?/.source.replace( 'WCOD', _wordCharOrDot ); - -// Object on target node, and accessor. May not contain reserved -// characters. Accessor may contain any character except closing bracket. -const _objectRe = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace( 'WC', _wordChar ); - -// Property and accessor. May not contain reserved characters. Accessor may -// contain any non-bracket characters. -const _propertyRe = /\.(WC+)(?:\[(.+)\])?/.source.replace( 'WC', _wordChar ); - -const _trackRe = new RegExp( '' - + '^' - + _directoryRe - + _nodeRe - + _objectRe - + _propertyRe - + '$' -); - -const _supportedObjectNames = [ 'material', 'materials', 'bones' ]; - -function Composite( targetGroup, path, optionalParsedPath ) { - - const parsedPath = optionalParsedPath || PropertyBinding.parseTrackName( path ); - - this._targetGroup = targetGroup; - this._bindings = targetGroup.subscribe_( path, parsedPath ); - -} - -Object.assign( Composite.prototype, { - - getValue: function ( array, offset ) { - - this.bind(); // bind all binding - - const firstValidIndex = this._targetGroup.nCachedObjects_, - binding = this._bindings[ firstValidIndex ]; - - // and only call .getValue on the first - if ( binding !== undefined ) binding.getValue( array, offset ); - - }, - - setValue: function ( array, offset ) { - - const bindings = this._bindings; - - for ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) { - - bindings[ i ].setValue( array, offset ); - - } - - }, - - bind: function () { - - const bindings = this._bindings; - - for ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) { - - bindings[ i ].bind(); - - } - - }, - - unbind: function () { - - const bindings = this._bindings; - - for ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) { - - bindings[ i ].unbind(); - - } - - } - -} ); - - -function PropertyBinding( rootNode, path, parsedPath ) { - - this.path = path; - this.parsedPath = parsedPath || PropertyBinding.parseTrackName( path ); - - this.node = PropertyBinding.findNode( rootNode, this.parsedPath.nodeName ) || rootNode; - - this.rootNode = rootNode; - -} - -Object.assign( PropertyBinding, { - - Composite: Composite, - - create: function ( root, path, parsedPath ) { - - if ( ! ( root && root.isAnimationObjectGroup ) ) { - - return new PropertyBinding( root, path, parsedPath ); - - } else { - - return new PropertyBinding.Composite( root, path, parsedPath ); - - } - - }, - - /** - * Replaces spaces with underscores and removes unsupported characters from - * node names, to ensure compatibility with parseTrackName(). - * - * @param {string} name Node name to be sanitized. - * @return {string} - */ - sanitizeNodeName: function ( name ) { - - return name.replace( /\s/g, '_' ).replace( _reservedRe, '' ); - - }, - - parseTrackName: function ( trackName ) { - - const matches = _trackRe.exec( trackName ); - - if ( ! matches ) { - - throw new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName ); - - } - - const results = { - // directoryName: matches[ 1 ], // (tschw) currently unused - nodeName: matches[ 2 ], - objectName: matches[ 3 ], - objectIndex: matches[ 4 ], - propertyName: matches[ 5 ], // required - propertyIndex: matches[ 6 ] - }; - - const lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' ); - - if ( lastDot !== undefined && lastDot !== - 1 ) { - - const objectName = results.nodeName.substring( lastDot + 1 ); - - // Object names must be checked against an allowlist. Otherwise, there - // is no way to parse 'foo.bar.baz': 'baz' must be a property, but - // 'bar' could be the objectName, or part of a nodeName (which can - // include '.' characters). - if ( _supportedObjectNames.indexOf( objectName ) !== - 1 ) { - - results.nodeName = results.nodeName.substring( 0, lastDot ); - results.objectName = objectName; - - } - - } - - if ( results.propertyName === null || results.propertyName.length === 0 ) { - - throw new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName ); - - } - - return results; - - }, - - findNode: function ( root, nodeName ) { - - if ( ! nodeName || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) { - - return root; - - } - - // search into skeleton bones. - if ( root.skeleton ) { - - const bone = root.skeleton.getBoneByName( nodeName ); - - if ( bone !== undefined ) { - - return bone; - - } - - } - - // search into node subtree. - if ( root.children ) { - - const searchNodeSubtree = function ( children ) { - - for ( let i = 0; i < children.length; i ++ ) { - - const childNode = children[ i ]; - - if ( childNode.name === nodeName || childNode.uuid === nodeName ) { - - return childNode; - - } - - const result = searchNodeSubtree( childNode.children ); - - if ( result ) return result; - - } - - return null; - - }; - - const subTreeNode = searchNodeSubtree( root.children ); - - if ( subTreeNode ) { - - return subTreeNode; - - } - - } - - return null; - - } - -} ); - -Object.assign( PropertyBinding.prototype, { // prototype, continued - - // these are used to "bind" a nonexistent property - _getValue_unavailable: function () {}, - _setValue_unavailable: function () {}, - - BindingType: { - Direct: 0, - EntireArray: 1, - ArrayElement: 2, - HasFromToArray: 3 - }, - - Versioning: { - None: 0, - NeedsUpdate: 1, - MatrixWorldNeedsUpdate: 2 - }, - - GetterByBindingType: [ - - function getValue_direct( buffer, offset ) { - - buffer[ offset ] = this.node[ this.propertyName ]; - - }, - - function getValue_array( buffer, offset ) { - - const source = this.resolvedProperty; - - for ( let i = 0, n = source.length; i !== n; ++ i ) { - - buffer[ offset ++ ] = source[ i ]; - - } - - }, - - function getValue_arrayElement( buffer, offset ) { - - buffer[ offset ] = this.resolvedProperty[ this.propertyIndex ]; - - }, - - function getValue_toArray( buffer, offset ) { - - this.resolvedProperty.toArray( buffer, offset ); - - } - - ], - - SetterByBindingTypeAndVersioning: [ - - [ - // Direct - - function setValue_direct( buffer, offset ) { - - this.targetObject[ this.propertyName ] = buffer[ offset ]; - - }, - - function setValue_direct_setNeedsUpdate( buffer, offset ) { - - this.targetObject[ this.propertyName ] = buffer[ offset ]; - this.targetObject.needsUpdate = true; - - }, - - function setValue_direct_setMatrixWorldNeedsUpdate( buffer, offset ) { - - this.targetObject[ this.propertyName ] = buffer[ offset ]; - this.targetObject.matrixWorldNeedsUpdate = true; - - } - - ], [ - - // EntireArray - - function setValue_array( buffer, offset ) { - - const dest = this.resolvedProperty; - - for ( let i = 0, n = dest.length; i !== n; ++ i ) { - - dest[ i ] = buffer[ offset ++ ]; - - } - - }, - - function setValue_array_setNeedsUpdate( buffer, offset ) { - - const dest = this.resolvedProperty; - - for ( let i = 0, n = dest.length; i !== n; ++ i ) { - - dest[ i ] = buffer[ offset ++ ]; - - } - - this.targetObject.needsUpdate = true; - - }, - - function setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) { - - const dest = this.resolvedProperty; - - for ( let i = 0, n = dest.length; i !== n; ++ i ) { - - dest[ i ] = buffer[ offset ++ ]; - - } - - this.targetObject.matrixWorldNeedsUpdate = true; - - } - - ], [ - - // ArrayElement - - function setValue_arrayElement( buffer, offset ) { - - this.resolvedProperty[ this.propertyIndex ] = buffer[ offset ]; - - }, - - function setValue_arrayElement_setNeedsUpdate( buffer, offset ) { - - this.resolvedProperty[ this.propertyIndex ] = buffer[ offset ]; - this.targetObject.needsUpdate = true; - - }, - - function setValue_arrayElement_setMatrixWorldNeedsUpdate( buffer, offset ) { - - this.resolvedProperty[ this.propertyIndex ] = buffer[ offset ]; - this.targetObject.matrixWorldNeedsUpdate = true; - - } - - ], [ - - // HasToFromArray - - function setValue_fromArray( buffer, offset ) { - - this.resolvedProperty.fromArray( buffer, offset ); - - }, - - function setValue_fromArray_setNeedsUpdate( buffer, offset ) { - - this.resolvedProperty.fromArray( buffer, offset ); - this.targetObject.needsUpdate = true; - - }, - - function setValue_fromArray_setMatrixWorldNeedsUpdate( buffer, offset ) { - - this.resolvedProperty.fromArray( buffer, offset ); - this.targetObject.matrixWorldNeedsUpdate = true; - - } - - ] - - ], - - getValue: function getValue_unbound( targetArray, offset ) { - - this.bind(); - this.getValue( targetArray, offset ); - - // Note: This class uses a State pattern on a per-method basis: - // 'bind' sets 'this.getValue' / 'setValue' and shadows the - // prototype version of these methods with one that represents - // the bound state. When the property is not found, the methods - // become no-ops. - - }, - - setValue: function getValue_unbound( sourceArray, offset ) { - - this.bind(); - this.setValue( sourceArray, offset ); - - }, - - // create getter / setter pair for a property in the scene graph - bind: function () { - - let targetObject = this.node; - const parsedPath = this.parsedPath; - - const objectName = parsedPath.objectName; - const propertyName = parsedPath.propertyName; - let propertyIndex = parsedPath.propertyIndex; - - if ( ! targetObject ) { - - targetObject = PropertyBinding.findNode( this.rootNode, parsedPath.nodeName ) || this.rootNode; - - this.node = targetObject; - - } - - // set fail state so we can just 'return' on error - this.getValue = this._getValue_unavailable; - this.setValue = this._setValue_unavailable; - - // ensure there is a value node - if ( ! targetObject ) { - - console.error( 'THREE.PropertyBinding: Trying to update node for track: ' + this.path + ' but it wasn\'t found.' ); - return; - - } - - if ( objectName ) { - - let objectIndex = parsedPath.objectIndex; - - // special cases were we need to reach deeper into the hierarchy to get the face materials.... - switch ( objectName ) { - - case 'materials': - - if ( ! targetObject.material ) { - - console.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this ); - return; - - } - - if ( ! targetObject.material.materials ) { - - console.error( 'THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this ); - return; - - } - - targetObject = targetObject.material.materials; - - break; - - case 'bones': - - if ( ! targetObject.skeleton ) { - - console.error( 'THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this ); - return; - - } - - // potential future optimization: skip this if propertyIndex is already an integer - // and convert the integer string to a true integer. - - targetObject = targetObject.skeleton.bones; - - // support resolving morphTarget names into indices. - for ( let i = 0; i < targetObject.length; i ++ ) { - - if ( targetObject[ i ].name === objectIndex ) { - - objectIndex = i; - break; - - } - - } - - break; - - default: - - if ( targetObject[ objectName ] === undefined ) { - - console.error( 'THREE.PropertyBinding: Can not bind to objectName of node undefined.', this ); - return; - - } - - targetObject = targetObject[ objectName ]; - - } - - - if ( objectIndex !== undefined ) { - - if ( targetObject[ objectIndex ] === undefined ) { - - console.error( 'THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject ); - return; - - } - - targetObject = targetObject[ objectIndex ]; - - } - - } - - // resolve property - const nodeProperty = targetObject[ propertyName ]; - - if ( nodeProperty === undefined ) { - - const nodeName = parsedPath.nodeName; - - console.error( 'THREE.PropertyBinding: Trying to update property for track: ' + nodeName + - '.' + propertyName + ' but it wasn\'t found.', targetObject ); - return; - - } - - // determine versioning scheme - let versioning = this.Versioning.None; - - this.targetObject = targetObject; - - if ( targetObject.needsUpdate !== undefined ) { // material - - versioning = this.Versioning.NeedsUpdate; - - } else if ( targetObject.matrixWorldNeedsUpdate !== undefined ) { // node transform - - versioning = this.Versioning.MatrixWorldNeedsUpdate; - - } - - // determine how the property gets bound - let bindingType = this.BindingType.Direct; - - if ( propertyIndex !== undefined ) { - - // access a sub element of the property array (only primitives are supported right now) - - if ( propertyName === 'morphTargetInfluences' ) { - - // potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer. - - // support resolving morphTarget names into indices. - if ( ! targetObject.geometry ) { - - console.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this ); - return; - - } - - if ( targetObject.geometry.isBufferGeometry ) { - - if ( ! targetObject.geometry.morphAttributes ) { - - console.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this ); - return; - - } - - if ( targetObject.morphTargetDictionary[ propertyIndex ] !== undefined ) { - - propertyIndex = targetObject.morphTargetDictionary[ propertyIndex ]; - - } - - - } else { - - console.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.', this ); - return; - - } - - } - - bindingType = this.BindingType.ArrayElement; - - this.resolvedProperty = nodeProperty; - this.propertyIndex = propertyIndex; - - } else if ( nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined ) { - - // must use copy for Object3D.Euler/Quaternion - - bindingType = this.BindingType.HasFromToArray; - - this.resolvedProperty = nodeProperty; - - } else if ( Array.isArray( nodeProperty ) ) { - - bindingType = this.BindingType.EntireArray; - - this.resolvedProperty = nodeProperty; - - } else { - - this.propertyName = propertyName; - - } - - // select getter / setter - this.getValue = this.GetterByBindingType[ bindingType ]; - this.setValue = this.SetterByBindingTypeAndVersioning[ bindingType ][ versioning ]; - - }, - - unbind: function () { - - this.node = null; - - // back to the prototype version of getValue / setValue - // note: avoiding to mutate the shape of 'this' via 'delete' - this.getValue = this._getValue_unbound; - this.setValue = this._setValue_unbound; - - } - -} ); - -// DECLARE ALIAS AFTER assign prototype -Object.assign( PropertyBinding.prototype, { - - // initial state of these methods that calls 'bind' - _getValue_unbound: PropertyBinding.prototype.getValue, - _setValue_unbound: PropertyBinding.prototype.setValue, - -} ); - -/** - * - * A group of objects that receives a shared animation state. - * - * Usage: - * - * - Add objects you would otherwise pass as 'root' to the - * constructor or the .clipAction method of AnimationMixer. - * - * - Instead pass this object as 'root'. - * - * - You can also add and remove objects later when the mixer - * is running. - * - * Note: - * - * Objects of this class appear as one object to the mixer, - * so cache control of the individual objects must be done - * on the group. - * - * Limitation: - * - * - The animated properties must be compatible among the - * all objects in the group. - * - * - A single property can either be controlled through a - * target group or directly, but not both. - */ - -class AnimationObjectGroup { - - constructor() { - - this.uuid = MathUtils.generateUUID(); - - // cached objects followed by the active ones - this._objects = Array.prototype.slice.call( arguments ); - - this.nCachedObjects_ = 0; // threshold - // note: read by PropertyBinding.Composite - - const indices = {}; - this._indicesByUUID = indices; // for bookkeeping - - for ( let i = 0, n = arguments.length; i !== n; ++ i ) { - - indices[ arguments[ i ].uuid ] = i; - - } - - this._paths = []; // inside: string - this._parsedPaths = []; // inside: { we don't care, here } - this._bindings = []; // inside: Array< PropertyBinding > - this._bindingsIndicesByPath = {}; // inside: indices in these arrays - - const scope = this; - - this.stats = { - - objects: { - get total() { - - return scope._objects.length; - - }, - get inUse() { - - return this.total - scope.nCachedObjects_; - - } - }, - get bindingsPerObject() { - - return scope._bindings.length; - - } - - }; - - } - - add() { - - const objects = this._objects, - indicesByUUID = this._indicesByUUID, - paths = this._paths, - parsedPaths = this._parsedPaths, - bindings = this._bindings, - nBindings = bindings.length; - - let knownObject = undefined, - nObjects = objects.length, - nCachedObjects = this.nCachedObjects_; - - for ( let i = 0, n = arguments.length; i !== n; ++ i ) { - - const object = arguments[ i ], - uuid = object.uuid; - let index = indicesByUUID[ uuid ]; - - if ( index === undefined ) { - - // unknown object -> add it to the ACTIVE region - - index = nObjects ++; - indicesByUUID[ uuid ] = index; - objects.push( object ); - - // accounting is done, now do the same for all bindings - - for ( let j = 0, m = nBindings; j !== m; ++ j ) { - - bindings[ j ].push( new PropertyBinding( object, paths[ j ], parsedPaths[ j ] ) ); - - } - - } else if ( index < nCachedObjects ) { - - knownObject = objects[ index ]; - - // move existing object to the ACTIVE region - - const firstActiveIndex = -- nCachedObjects, - lastCachedObject = objects[ firstActiveIndex ]; - - indicesByUUID[ lastCachedObject.uuid ] = index; - objects[ index ] = lastCachedObject; - - indicesByUUID[ uuid ] = firstActiveIndex; - objects[ firstActiveIndex ] = object; - - // accounting is done, now do the same for all bindings - - for ( let j = 0, m = nBindings; j !== m; ++ j ) { - - const bindingsForPath = bindings[ j ], - lastCached = bindingsForPath[ firstActiveIndex ]; - - let binding = bindingsForPath[ index ]; - - bindingsForPath[ index ] = lastCached; - - if ( binding === undefined ) { - - // since we do not bother to create new bindings - // for objects that are cached, the binding may - // or may not exist - - binding = new PropertyBinding( object, paths[ j ], parsedPaths[ j ] ); - - } - - bindingsForPath[ firstActiveIndex ] = binding; - - } - - } else if ( objects[ index ] !== knownObject ) { - - console.error( 'THREE.AnimationObjectGroup: Different objects with the same UUID ' + - 'detected. Clean the caches or recreate your infrastructure when reloading scenes.' ); - - } // else the object is already where we want it to be - - } // for arguments - - this.nCachedObjects_ = nCachedObjects; - - } - - remove() { - - const objects = this._objects, - indicesByUUID = this._indicesByUUID, - bindings = this._bindings, - nBindings = bindings.length; - - let nCachedObjects = this.nCachedObjects_; - - for ( let i = 0, n = arguments.length; i !== n; ++ i ) { - - const object = arguments[ i ], - uuid = object.uuid, - index = indicesByUUID[ uuid ]; - - if ( index !== undefined && index >= nCachedObjects ) { - - // move existing object into the CACHED region - - const lastCachedIndex = nCachedObjects ++, - firstActiveObject = objects[ lastCachedIndex ]; - - indicesByUUID[ firstActiveObject.uuid ] = index; - objects[ index ] = firstActiveObject; - - indicesByUUID[ uuid ] = lastCachedIndex; - objects[ lastCachedIndex ] = object; - - // accounting is done, now do the same for all bindings - - for ( let j = 0, m = nBindings; j !== m; ++ j ) { - - const bindingsForPath = bindings[ j ], - firstActive = bindingsForPath[ lastCachedIndex ], - binding = bindingsForPath[ index ]; - - bindingsForPath[ index ] = firstActive; - bindingsForPath[ lastCachedIndex ] = binding; - - } - - } - - } // for arguments - - this.nCachedObjects_ = nCachedObjects; - - } - - // remove & forget - uncache() { - - const objects = this._objects, - indicesByUUID = this._indicesByUUID, - bindings = this._bindings, - nBindings = bindings.length; - - let nCachedObjects = this.nCachedObjects_, - nObjects = objects.length; - - for ( let i = 0, n = arguments.length; i !== n; ++ i ) { - - const object = arguments[ i ], - uuid = object.uuid, - index = indicesByUUID[ uuid ]; - - if ( index !== undefined ) { - - delete indicesByUUID[ uuid ]; - - if ( index < nCachedObjects ) { - - // object is cached, shrink the CACHED region - - const firstActiveIndex = -- nCachedObjects, - lastCachedObject = objects[ firstActiveIndex ], - lastIndex = -- nObjects, - lastObject = objects[ lastIndex ]; - - // last cached object takes this object's place - indicesByUUID[ lastCachedObject.uuid ] = index; - objects[ index ] = lastCachedObject; - - // last object goes to the activated slot and pop - indicesByUUID[ lastObject.uuid ] = firstActiveIndex; - objects[ firstActiveIndex ] = lastObject; - objects.pop(); - - // accounting is done, now do the same for all bindings - - for ( let j = 0, m = nBindings; j !== m; ++ j ) { - - const bindingsForPath = bindings[ j ], - lastCached = bindingsForPath[ firstActiveIndex ], - last = bindingsForPath[ lastIndex ]; - - bindingsForPath[ index ] = lastCached; - bindingsForPath[ firstActiveIndex ] = last; - bindingsForPath.pop(); - - } - - } else { - - // object is active, just swap with the last and pop - - const lastIndex = -- nObjects, - lastObject = objects[ lastIndex ]; - - if ( lastIndex > 0 ) { - - indicesByUUID[ lastObject.uuid ] = index; - - } - - objects[ index ] = lastObject; - objects.pop(); - - // accounting is done, now do the same for all bindings - - for ( let j = 0, m = nBindings; j !== m; ++ j ) { - - const bindingsForPath = bindings[ j ]; - - bindingsForPath[ index ] = bindingsForPath[ lastIndex ]; - bindingsForPath.pop(); - - } - - } // cached or active - - } // if object is known - - } // for arguments - - this.nCachedObjects_ = nCachedObjects; - - } - - // Internal interface used by befriended PropertyBinding.Composite: - - subscribe_( path, parsedPath ) { - - // returns an array of bindings for the given path that is changed - // according to the contained objects in the group - - const indicesByPath = this._bindingsIndicesByPath; - let index = indicesByPath[ path ]; - const bindings = this._bindings; - - if ( index !== undefined ) return bindings[ index ]; - - const paths = this._paths, - parsedPaths = this._parsedPaths, - objects = this._objects, - nObjects = objects.length, - nCachedObjects = this.nCachedObjects_, - bindingsForPath = new Array( nObjects ); - - index = bindings.length; - - indicesByPath[ path ] = index; - - paths.push( path ); - parsedPaths.push( parsedPath ); - bindings.push( bindingsForPath ); - - for ( let i = nCachedObjects, n = objects.length; i !== n; ++ i ) { - - const object = objects[ i ]; - bindingsForPath[ i ] = new PropertyBinding( object, path, parsedPath ); - - } - - return bindingsForPath; - - } - - unsubscribe_( path ) { - - // tells the group to forget about a property path and no longer - // update the array previously obtained with 'subscribe_' - - const indicesByPath = this._bindingsIndicesByPath, - index = indicesByPath[ path ]; - - if ( index !== undefined ) { - - const paths = this._paths, - parsedPaths = this._parsedPaths, - bindings = this._bindings, - lastBindingsIndex = bindings.length - 1, - lastBindings = bindings[ lastBindingsIndex ], - lastBindingsPath = path[ lastBindingsIndex ]; - - indicesByPath[ lastBindingsPath ] = index; - - bindings[ index ] = lastBindings; - bindings.pop(); - - parsedPaths[ index ] = parsedPaths[ lastBindingsIndex ]; - parsedPaths.pop(); - - paths[ index ] = paths[ lastBindingsIndex ]; - paths.pop(); - - } - - } - -} - -AnimationObjectGroup.prototype.isAnimationObjectGroup = true; - -class AnimationAction { - - constructor( mixer, clip, localRoot = null, blendMode = clip.blendMode ) { - - this._mixer = mixer; - this._clip = clip; - this._localRoot = localRoot; - this.blendMode = blendMode; - - const tracks = clip.tracks, - nTracks = tracks.length, - interpolants = new Array( nTracks ); - - const interpolantSettings = { - endingStart: ZeroCurvatureEnding, - endingEnd: ZeroCurvatureEnding - }; - - for ( let i = 0; i !== nTracks; ++ i ) { - - const interpolant = tracks[ i ].createInterpolant( null ); - interpolants[ i ] = interpolant; - interpolant.settings = interpolantSettings; - - } - - this._interpolantSettings = interpolantSettings; - - this._interpolants = interpolants; // bound by the mixer - - // inside: PropertyMixer (managed by the mixer) - this._propertyBindings = new Array( nTracks ); - - this._cacheIndex = null; // for the memory manager - this._byClipCacheIndex = null; // for the memory manager - - this._timeScaleInterpolant = null; - this._weightInterpolant = null; - - this.loop = LoopRepeat; - this._loopCount = - 1; - - // global mixer time when the action is to be started - // it's set back to 'null' upon start of the action - this._startTime = null; - - // scaled local time of the action - // gets clamped or wrapped to 0..clip.duration according to loop - this.time = 0; - - this.timeScale = 1; - this._effectiveTimeScale = 1; - - this.weight = 1; - this._effectiveWeight = 1; - - this.repetitions = Infinity; // no. of repetitions when looping - - this.paused = false; // true -> zero effective time scale - this.enabled = true; // false -> zero effective weight - - this.clampWhenFinished = false;// keep feeding the last frame? - - this.zeroSlopeAtStart = true;// for smooth interpolation w/o separate - this.zeroSlopeAtEnd = true;// clips for start, loop and end - - } - - // State & Scheduling - - play() { - - this._mixer._activateAction( this ); - - return this; - - } - - stop() { - - this._mixer._deactivateAction( this ); - - return this.reset(); - - } - - reset() { - - this.paused = false; - this.enabled = true; - - this.time = 0; // restart clip - this._loopCount = - 1;// forget previous loops - this._startTime = null;// forget scheduling - - return this.stopFading().stopWarping(); - - } - - isRunning() { - - return this.enabled && ! this.paused && this.timeScale !== 0 && - this._startTime === null && this._mixer._isActiveAction( this ); - - } - - // return true when play has been called - isScheduled() { - - return this._mixer._isActiveAction( this ); - - } - - startAt( time ) { - - this._startTime = time; - - return this; - - } - - setLoop( mode, repetitions ) { - - this.loop = mode; - this.repetitions = repetitions; - - return this; - - } - - // Weight - - // set the weight stopping any scheduled fading - // although .enabled = false yields an effective weight of zero, this - // method does *not* change .enabled, because it would be confusing - setEffectiveWeight( weight ) { - - this.weight = weight; - - // note: same logic as when updated at runtime - this._effectiveWeight = this.enabled ? weight : 0; - - return this.stopFading(); - - } - - // return the weight considering fading and .enabled - getEffectiveWeight() { - - return this._effectiveWeight; - - } - - fadeIn( duration ) { - - return this._scheduleFading( duration, 0, 1 ); - - } - - fadeOut( duration ) { - - return this._scheduleFading( duration, 1, 0 ); - - } - - crossFadeFrom( fadeOutAction, duration, warp ) { - - fadeOutAction.fadeOut( duration ); - this.fadeIn( duration ); - - if ( warp ) { - - const fadeInDuration = this._clip.duration, - fadeOutDuration = fadeOutAction._clip.duration, - - startEndRatio = fadeOutDuration / fadeInDuration, - endStartRatio = fadeInDuration / fadeOutDuration; - - fadeOutAction.warp( 1.0, startEndRatio, duration ); - this.warp( endStartRatio, 1.0, duration ); - - } - - return this; - - } - - crossFadeTo( fadeInAction, duration, warp ) { - - return fadeInAction.crossFadeFrom( this, duration, warp ); - - } - - stopFading() { - - const weightInterpolant = this._weightInterpolant; - - if ( weightInterpolant !== null ) { - - this._weightInterpolant = null; - this._mixer._takeBackControlInterpolant( weightInterpolant ); - - } - - return this; - - } - - // Time Scale Control - - // set the time scale stopping any scheduled warping - // although .paused = true yields an effective time scale of zero, this - // method does *not* change .paused, because it would be confusing - setEffectiveTimeScale( timeScale ) { - - this.timeScale = timeScale; - this._effectiveTimeScale = this.paused ? 0 : timeScale; - - return this.stopWarping(); - - } - - // return the time scale considering warping and .paused - getEffectiveTimeScale() { - - return this._effectiveTimeScale; - - } - - setDuration( duration ) { - - this.timeScale = this._clip.duration / duration; - - return this.stopWarping(); - - } - - syncWith( action ) { - - this.time = action.time; - this.timeScale = action.timeScale; - - return this.stopWarping(); - - } - - halt( duration ) { - - return this.warp( this._effectiveTimeScale, 0, duration ); - - } - - warp( startTimeScale, endTimeScale, duration ) { - - const mixer = this._mixer, - now = mixer.time, - timeScale = this.timeScale; - - let interpolant = this._timeScaleInterpolant; - - if ( interpolant === null ) { - - interpolant = mixer._lendControlInterpolant(); - this._timeScaleInterpolant = interpolant; - - } - - const times = interpolant.parameterPositions, - values = interpolant.sampleValues; - - times[ 0 ] = now; - times[ 1 ] = now + duration; - - values[ 0 ] = startTimeScale / timeScale; - values[ 1 ] = endTimeScale / timeScale; - - return this; - - } - - stopWarping() { - - const timeScaleInterpolant = this._timeScaleInterpolant; - - if ( timeScaleInterpolant !== null ) { - - this._timeScaleInterpolant = null; - this._mixer._takeBackControlInterpolant( timeScaleInterpolant ); - - } - - return this; - - } - - // Object Accessors - - getMixer() { - - return this._mixer; - - } - - getClip() { - - return this._clip; - - } - - getRoot() { - - return this._localRoot || this._mixer._root; - - } - - // Interna - - _update( time, deltaTime, timeDirection, accuIndex ) { - - // called by the mixer - - if ( ! this.enabled ) { - - // call ._updateWeight() to update ._effectiveWeight - - this._updateWeight( time ); - return; - - } - - const startTime = this._startTime; - - if ( startTime !== null ) { - - // check for scheduled start of action - - const timeRunning = ( time - startTime ) * timeDirection; - if ( timeRunning < 0 || timeDirection === 0 ) { - - return; // yet to come / don't decide when delta = 0 - - } - - // start - - this._startTime = null; // unschedule - deltaTime = timeDirection * timeRunning; - - } - - // apply time scale and advance time - - deltaTime *= this._updateTimeScale( time ); - const clipTime = this._updateTime( deltaTime ); - - // note: _updateTime may disable the action resulting in - // an effective weight of 0 - - const weight = this._updateWeight( time ); - - if ( weight > 0 ) { - - const interpolants = this._interpolants; - const propertyMixers = this._propertyBindings; - - switch ( this.blendMode ) { - - case AdditiveAnimationBlendMode: - - for ( let j = 0, m = interpolants.length; j !== m; ++ j ) { - - interpolants[ j ].evaluate( clipTime ); - propertyMixers[ j ].accumulateAdditive( weight ); - - } - - break; - - case NormalAnimationBlendMode: - default: - - for ( let j = 0, m = interpolants.length; j !== m; ++ j ) { - - interpolants[ j ].evaluate( clipTime ); - propertyMixers[ j ].accumulate( accuIndex, weight ); - - } - - } - - } - - } - - _updateWeight( time ) { - - let weight = 0; - - if ( this.enabled ) { - - weight = this.weight; - const interpolant = this._weightInterpolant; - - if ( interpolant !== null ) { - - const interpolantValue = interpolant.evaluate( time )[ 0 ]; - - weight *= interpolantValue; - - if ( time > interpolant.parameterPositions[ 1 ] ) { - - this.stopFading(); - - if ( interpolantValue === 0 ) { - - // faded out, disable - this.enabled = false; - - } - - } - - } - - } - - this._effectiveWeight = weight; - return weight; - - } - - _updateTimeScale( time ) { - - let timeScale = 0; - - if ( ! this.paused ) { - - timeScale = this.timeScale; - - const interpolant = this._timeScaleInterpolant; - - if ( interpolant !== null ) { - - const interpolantValue = interpolant.evaluate( time )[ 0 ]; - - timeScale *= interpolantValue; - - if ( time > interpolant.parameterPositions[ 1 ] ) { - - this.stopWarping(); - - if ( timeScale === 0 ) { - - // motion has halted, pause - this.paused = true; - - } else { - - // warp done - apply final time scale - this.timeScale = timeScale; - - } - - } - - } - - } - - this._effectiveTimeScale = timeScale; - return timeScale; - - } - - _updateTime( deltaTime ) { - - const duration = this._clip.duration; - const loop = this.loop; - - let time = this.time + deltaTime; - let loopCount = this._loopCount; - - const pingPong = ( loop === LoopPingPong ); - - if ( deltaTime === 0 ) { - - if ( loopCount === - 1 ) return time; - - return ( pingPong && ( loopCount & 1 ) === 1 ) ? duration - time : time; - - } - - if ( loop === LoopOnce ) { - - if ( loopCount === - 1 ) { - - // just started - - this._loopCount = 0; - this._setEndings( true, true, false ); - - } - - handle_stop: { - - if ( time >= duration ) { - - time = duration; - - } else if ( time < 0 ) { - - time = 0; - - } else { - - this.time = time; - - break handle_stop; - - } - - if ( this.clampWhenFinished ) this.paused = true; - else this.enabled = false; - - this.time = time; - - this._mixer.dispatchEvent( { - type: 'finished', action: this, - direction: deltaTime < 0 ? - 1 : 1 - } ); - - } - - } else { // repetitive Repeat or PingPong - - if ( loopCount === - 1 ) { - - // just started - - if ( deltaTime >= 0 ) { - - loopCount = 0; - - this._setEndings( true, this.repetitions === 0, pingPong ); - - } else { - - // when looping in reverse direction, the initial - // transition through zero counts as a repetition, - // so leave loopCount at -1 - - this._setEndings( this.repetitions === 0, true, pingPong ); - - } - - } - - if ( time >= duration || time < 0 ) { - - // wrap around - - const loopDelta = Math.floor( time / duration ); // signed - time -= duration * loopDelta; - - loopCount += Math.abs( loopDelta ); - - const pending = this.repetitions - loopCount; - - if ( pending <= 0 ) { - - // have to stop (switch state, clamp time, fire event) - - if ( this.clampWhenFinished ) this.paused = true; - else this.enabled = false; - - time = deltaTime > 0 ? duration : 0; - - this.time = time; - - this._mixer.dispatchEvent( { - type: 'finished', action: this, - direction: deltaTime > 0 ? 1 : - 1 - } ); - - } else { - - // keep running - - if ( pending === 1 ) { - - // entering the last round - - const atStart = deltaTime < 0; - this._setEndings( atStart, ! atStart, pingPong ); - - } else { - - this._setEndings( false, false, pingPong ); - - } - - this._loopCount = loopCount; - - this.time = time; - - this._mixer.dispatchEvent( { - type: 'loop', action: this, loopDelta: loopDelta - } ); - - } - - } else { - - this.time = time; - - } - - if ( pingPong && ( loopCount & 1 ) === 1 ) { - - // invert time for the "pong round" - - return duration - time; - - } - - } - - return time; - - } - - _setEndings( atStart, atEnd, pingPong ) { - - const settings = this._interpolantSettings; - - if ( pingPong ) { - - settings.endingStart = ZeroSlopeEnding; - settings.endingEnd = ZeroSlopeEnding; - - } else { - - // assuming for LoopOnce atStart == atEnd == true - - if ( atStart ) { - - settings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding; - - } else { - - settings.endingStart = WrapAroundEnding; - - } - - if ( atEnd ) { - - settings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding; - - } else { - - settings.endingEnd = WrapAroundEnding; - - } - - } - - } - - _scheduleFading( duration, weightNow, weightThen ) { - - const mixer = this._mixer, now = mixer.time; - let interpolant = this._weightInterpolant; - - if ( interpolant === null ) { - - interpolant = mixer._lendControlInterpolant(); - this._weightInterpolant = interpolant; - - } - - const times = interpolant.parameterPositions, - values = interpolant.sampleValues; - - times[ 0 ] = now; - values[ 0 ] = weightNow; - times[ 1 ] = now + duration; - values[ 1 ] = weightThen; - - return this; - - } - -} - -class AnimationMixer extends EventDispatcher { - - constructor( root ) { - - super(); - - this._root = root; - this._initMemoryManager(); - this._accuIndex = 0; - this.time = 0; - this.timeScale = 1.0; - - } - - _bindAction( action, prototypeAction ) { - - const root = action._localRoot || this._root, - tracks = action._clip.tracks, - nTracks = tracks.length, - bindings = action._propertyBindings, - interpolants = action._interpolants, - rootUuid = root.uuid, - bindingsByRoot = this._bindingsByRootAndName; - - let bindingsByName = bindingsByRoot[ rootUuid ]; - - if ( bindingsByName === undefined ) { - - bindingsByName = {}; - bindingsByRoot[ rootUuid ] = bindingsByName; - - } - - for ( let i = 0; i !== nTracks; ++ i ) { - - const track = tracks[ i ], - trackName = track.name; - - let binding = bindingsByName[ trackName ]; - - if ( binding !== undefined ) { - - bindings[ i ] = binding; - - } else { - - binding = bindings[ i ]; - - if ( binding !== undefined ) { - - // existing binding, make sure the cache knows - - if ( binding._cacheIndex === null ) { - - ++ binding.referenceCount; - this._addInactiveBinding( binding, rootUuid, trackName ); - - } - - continue; - - } - - const path = prototypeAction && prototypeAction. - _propertyBindings[ i ].binding.parsedPath; - - binding = new PropertyMixer( - PropertyBinding.create( root, trackName, path ), - track.ValueTypeName, track.getValueSize() ); - - ++ binding.referenceCount; - this._addInactiveBinding( binding, rootUuid, trackName ); - - bindings[ i ] = binding; - - } - - interpolants[ i ].resultBuffer = binding.buffer; - - } - - } - - _activateAction( action ) { - - if ( ! this._isActiveAction( action ) ) { - - if ( action._cacheIndex === null ) { - - // this action has been forgotten by the cache, but the user - // appears to be still using it -> rebind - - const rootUuid = ( action._localRoot || this._root ).uuid, - clipUuid = action._clip.uuid, - actionsForClip = this._actionsByClip[ clipUuid ]; - - this._bindAction( action, - actionsForClip && actionsForClip.knownActions[ 0 ] ); - - this._addInactiveAction( action, clipUuid, rootUuid ); - - } - - const bindings = action._propertyBindings; - - // increment reference counts / sort out state - for ( let i = 0, n = bindings.length; i !== n; ++ i ) { - - const binding = bindings[ i ]; - - if ( binding.useCount ++ === 0 ) { - - this._lendBinding( binding ); - binding.saveOriginalState(); - - } - - } - - this._lendAction( action ); - - } - - } - - _deactivateAction( action ) { - - if ( this._isActiveAction( action ) ) { - - const bindings = action._propertyBindings; - - // decrement reference counts / sort out state - for ( let i = 0, n = bindings.length; i !== n; ++ i ) { - - const binding = bindings[ i ]; - - if ( -- binding.useCount === 0 ) { - - binding.restoreOriginalState(); - this._takeBackBinding( binding ); - - } - - } - - this._takeBackAction( action ); - - } - - } - - // Memory manager - - _initMemoryManager() { - - this._actions = []; // 'nActiveActions' followed by inactive ones - this._nActiveActions = 0; - - this._actionsByClip = {}; - // inside: - // { - // knownActions: Array< AnimationAction > - used as prototypes - // actionByRoot: AnimationAction - lookup - // } - - - this._bindings = []; // 'nActiveBindings' followed by inactive ones - this._nActiveBindings = 0; - - this._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer > - - - this._controlInterpolants = []; // same game as above - this._nActiveControlInterpolants = 0; - - const scope = this; - - this.stats = { - - actions: { - get total() { - - return scope._actions.length; - - }, - get inUse() { - - return scope._nActiveActions; - - } - }, - bindings: { - get total() { - - return scope._bindings.length; - - }, - get inUse() { - - return scope._nActiveBindings; - - } - }, - controlInterpolants: { - get total() { - - return scope._controlInterpolants.length; - - }, - get inUse() { - - return scope._nActiveControlInterpolants; - - } - } - - }; - - } - - // Memory management for AnimationAction objects - - _isActiveAction( action ) { - - const index = action._cacheIndex; - return index !== null && index < this._nActiveActions; - - } - - _addInactiveAction( action, clipUuid, rootUuid ) { - - const actions = this._actions, - actionsByClip = this._actionsByClip; - - let actionsForClip = actionsByClip[ clipUuid ]; - - if ( actionsForClip === undefined ) { - - actionsForClip = { - - knownActions: [ action ], - actionByRoot: {} - - }; - - action._byClipCacheIndex = 0; - - actionsByClip[ clipUuid ] = actionsForClip; - - } else { - - const knownActions = actionsForClip.knownActions; - - action._byClipCacheIndex = knownActions.length; - knownActions.push( action ); - - } - - action._cacheIndex = actions.length; - actions.push( action ); - - actionsForClip.actionByRoot[ rootUuid ] = action; - - } - - _removeInactiveAction( action ) { - - const actions = this._actions, - lastInactiveAction = actions[ actions.length - 1 ], - cacheIndex = action._cacheIndex; - - lastInactiveAction._cacheIndex = cacheIndex; - actions[ cacheIndex ] = lastInactiveAction; - actions.pop(); - - action._cacheIndex = null; - - - const clipUuid = action._clip.uuid, - actionsByClip = this._actionsByClip, - actionsForClip = actionsByClip[ clipUuid ], - knownActionsForClip = actionsForClip.knownActions, - - lastKnownAction = - knownActionsForClip[ knownActionsForClip.length - 1 ], - - byClipCacheIndex = action._byClipCacheIndex; - - lastKnownAction._byClipCacheIndex = byClipCacheIndex; - knownActionsForClip[ byClipCacheIndex ] = lastKnownAction; - knownActionsForClip.pop(); - - action._byClipCacheIndex = null; - - - const actionByRoot = actionsForClip.actionByRoot, - rootUuid = ( action._localRoot || this._root ).uuid; - - delete actionByRoot[ rootUuid ]; - - if ( knownActionsForClip.length === 0 ) { - - delete actionsByClip[ clipUuid ]; - - } - - this._removeInactiveBindingsForAction( action ); - - } - - _removeInactiveBindingsForAction( action ) { - - const bindings = action._propertyBindings; - - for ( let i = 0, n = bindings.length; i !== n; ++ i ) { - - const binding = bindings[ i ]; - - if ( -- binding.referenceCount === 0 ) { - - this._removeInactiveBinding( binding ); - - } - - } - - } - - _lendAction( action ) { - - // [ active actions | inactive actions ] - // [ active actions >| inactive actions ] - // s a - // <-swap-> - // a s - - const actions = this._actions, - prevIndex = action._cacheIndex, - - lastActiveIndex = this._nActiveActions ++, - - firstInactiveAction = actions[ lastActiveIndex ]; - - action._cacheIndex = lastActiveIndex; - actions[ lastActiveIndex ] = action; - - firstInactiveAction._cacheIndex = prevIndex; - actions[ prevIndex ] = firstInactiveAction; - - } - - _takeBackAction( action ) { - - // [ active actions | inactive actions ] - // [ active actions |< inactive actions ] - // a s - // <-swap-> - // s a - - const actions = this._actions, - prevIndex = action._cacheIndex, - - firstInactiveIndex = -- this._nActiveActions, - - lastActiveAction = actions[ firstInactiveIndex ]; - - action._cacheIndex = firstInactiveIndex; - actions[ firstInactiveIndex ] = action; - - lastActiveAction._cacheIndex = prevIndex; - actions[ prevIndex ] = lastActiveAction; - - } - - // Memory management for PropertyMixer objects - - _addInactiveBinding( binding, rootUuid, trackName ) { - - const bindingsByRoot = this._bindingsByRootAndName, - bindings = this._bindings; - - let bindingByName = bindingsByRoot[ rootUuid ]; - - if ( bindingByName === undefined ) { - - bindingByName = {}; - bindingsByRoot[ rootUuid ] = bindingByName; - - } - - bindingByName[ trackName ] = binding; - - binding._cacheIndex = bindings.length; - bindings.push( binding ); - - } - - _removeInactiveBinding( binding ) { - - const bindings = this._bindings, - propBinding = binding.binding, - rootUuid = propBinding.rootNode.uuid, - trackName = propBinding.path, - bindingsByRoot = this._bindingsByRootAndName, - bindingByName = bindingsByRoot[ rootUuid ], - - lastInactiveBinding = bindings[ bindings.length - 1 ], - cacheIndex = binding._cacheIndex; - - lastInactiveBinding._cacheIndex = cacheIndex; - bindings[ cacheIndex ] = lastInactiveBinding; - bindings.pop(); - - delete bindingByName[ trackName ]; - - if ( Object.keys( bindingByName ).length === 0 ) { - - delete bindingsByRoot[ rootUuid ]; - - } - - } - - _lendBinding( binding ) { - - const bindings = this._bindings, - prevIndex = binding._cacheIndex, - - lastActiveIndex = this._nActiveBindings ++, - - firstInactiveBinding = bindings[ lastActiveIndex ]; - - binding._cacheIndex = lastActiveIndex; - bindings[ lastActiveIndex ] = binding; - - firstInactiveBinding._cacheIndex = prevIndex; - bindings[ prevIndex ] = firstInactiveBinding; - - } - - _takeBackBinding( binding ) { - - const bindings = this._bindings, - prevIndex = binding._cacheIndex, - - firstInactiveIndex = -- this._nActiveBindings, - - lastActiveBinding = bindings[ firstInactiveIndex ]; - - binding._cacheIndex = firstInactiveIndex; - bindings[ firstInactiveIndex ] = binding; - - lastActiveBinding._cacheIndex = prevIndex; - bindings[ prevIndex ] = lastActiveBinding; - - } - - - // Memory management of Interpolants for weight and time scale - - _lendControlInterpolant() { - - const interpolants = this._controlInterpolants, - lastActiveIndex = this._nActiveControlInterpolants ++; - - let interpolant = interpolants[ lastActiveIndex ]; - - if ( interpolant === undefined ) { - - interpolant = new LinearInterpolant( - new Float32Array( 2 ), new Float32Array( 2 ), - 1, this._controlInterpolantsResultBuffer ); - - interpolant.__cacheIndex = lastActiveIndex; - interpolants[ lastActiveIndex ] = interpolant; - - } - - return interpolant; - - } - - _takeBackControlInterpolant( interpolant ) { - - const interpolants = this._controlInterpolants, - prevIndex = interpolant.__cacheIndex, - - firstInactiveIndex = -- this._nActiveControlInterpolants, - - lastActiveInterpolant = interpolants[ firstInactiveIndex ]; - - interpolant.__cacheIndex = firstInactiveIndex; - interpolants[ firstInactiveIndex ] = interpolant; - - lastActiveInterpolant.__cacheIndex = prevIndex; - interpolants[ prevIndex ] = lastActiveInterpolant; - - } - - // return an action for a clip optionally using a custom root target - // object (this method allocates a lot of dynamic memory in case a - // previously unknown clip/root combination is specified) - clipAction( clip, optionalRoot, blendMode ) { - - const root = optionalRoot || this._root, - rootUuid = root.uuid; - - let clipObject = typeof clip === 'string' ? AnimationClip.findByName( root, clip ) : clip; - - const clipUuid = clipObject !== null ? clipObject.uuid : clip; - - const actionsForClip = this._actionsByClip[ clipUuid ]; - let prototypeAction = null; - - if ( blendMode === undefined ) { - - if ( clipObject !== null ) { - - blendMode = clipObject.blendMode; - - } else { - - blendMode = NormalAnimationBlendMode; - - } - - } - - if ( actionsForClip !== undefined ) { - - const existingAction = actionsForClip.actionByRoot[ rootUuid ]; - - if ( existingAction !== undefined && existingAction.blendMode === blendMode ) { - - return existingAction; - - } - - // we know the clip, so we don't have to parse all - // the bindings again but can just copy - prototypeAction = actionsForClip.knownActions[ 0 ]; - - // also, take the clip from the prototype action - if ( clipObject === null ) - clipObject = prototypeAction._clip; - - } - - // clip must be known when specified via string - if ( clipObject === null ) return null; - - // allocate all resources required to run it - const newAction = new AnimationAction( this, clipObject, optionalRoot, blendMode ); - - this._bindAction( newAction, prototypeAction ); - - // and make the action known to the memory manager - this._addInactiveAction( newAction, clipUuid, rootUuid ); - - return newAction; - - } - - // get an existing action - existingAction( clip, optionalRoot ) { - - const root = optionalRoot || this._root, - rootUuid = root.uuid, - - clipObject = typeof clip === 'string' ? - AnimationClip.findByName( root, clip ) : clip, - - clipUuid = clipObject ? clipObject.uuid : clip, - - actionsForClip = this._actionsByClip[ clipUuid ]; - - if ( actionsForClip !== undefined ) { - - return actionsForClip.actionByRoot[ rootUuid ] || null; - - } - - return null; - - } - - // deactivates all previously scheduled actions - stopAllAction() { - - const actions = this._actions, - nActions = this._nActiveActions; - - for ( let i = nActions - 1; i >= 0; -- i ) { - - actions[ i ].stop(); - - } - - return this; - - } - - // advance the time and update apply the animation - update( deltaTime ) { - - deltaTime *= this.timeScale; - - const actions = this._actions, - nActions = this._nActiveActions, - - time = this.time += deltaTime, - timeDirection = Math.sign( deltaTime ), - - accuIndex = this._accuIndex ^= 1; - - // run active actions - - for ( let i = 0; i !== nActions; ++ i ) { - - const action = actions[ i ]; - - action._update( time, deltaTime, timeDirection, accuIndex ); - - } - - // update scene graph - - const bindings = this._bindings, - nBindings = this._nActiveBindings; - - for ( let i = 0; i !== nBindings; ++ i ) { - - bindings[ i ].apply( accuIndex ); - - } - - return this; - - } - - // Allows you to seek to a specific time in an animation. - setTime( timeInSeconds ) { - - this.time = 0; // Zero out time attribute for AnimationMixer object; - for ( let i = 0; i < this._actions.length; i ++ ) { - - this._actions[ i ].time = 0; // Zero out time attribute for all associated AnimationAction objects. - - } - - return this.update( timeInSeconds ); // Update used to set exact time. Returns "this" AnimationMixer object. - - } - - // return this mixer's root target object - getRoot() { - - return this._root; - - } - - // free all resources specific to a particular clip - uncacheClip( clip ) { - - const actions = this._actions, - clipUuid = clip.uuid, - actionsByClip = this._actionsByClip, - actionsForClip = actionsByClip[ clipUuid ]; - - if ( actionsForClip !== undefined ) { - - // note: just calling _removeInactiveAction would mess up the - // iteration state and also require updating the state we can - // just throw away - - const actionsToRemove = actionsForClip.knownActions; - - for ( let i = 0, n = actionsToRemove.length; i !== n; ++ i ) { - - const action = actionsToRemove[ i ]; - - this._deactivateAction( action ); - - const cacheIndex = action._cacheIndex, - lastInactiveAction = actions[ actions.length - 1 ]; - - action._cacheIndex = null; - action._byClipCacheIndex = null; - - lastInactiveAction._cacheIndex = cacheIndex; - actions[ cacheIndex ] = lastInactiveAction; - actions.pop(); - - this._removeInactiveBindingsForAction( action ); - - } - - delete actionsByClip[ clipUuid ]; - - } - - } - - // free all resources specific to a particular root target object - uncacheRoot( root ) { - - const rootUuid = root.uuid, - actionsByClip = this._actionsByClip; - - for ( const clipUuid in actionsByClip ) { - - const actionByRoot = actionsByClip[ clipUuid ].actionByRoot, - action = actionByRoot[ rootUuid ]; - - if ( action !== undefined ) { - - this._deactivateAction( action ); - this._removeInactiveAction( action ); - - } - - } - - const bindingsByRoot = this._bindingsByRootAndName, - bindingByName = bindingsByRoot[ rootUuid ]; - - if ( bindingByName !== undefined ) { - - for ( const trackName in bindingByName ) { - - const binding = bindingByName[ trackName ]; - binding.restoreOriginalState(); - this._removeInactiveBinding( binding ); - - } - - } - - } - - // remove a targeted clip from the cache - uncacheAction( clip, optionalRoot ) { - - const action = this.existingAction( clip, optionalRoot ); - - if ( action !== null ) { - - this._deactivateAction( action ); - this._removeInactiveAction( action ); - - } - - } - -} - -AnimationMixer.prototype._controlInterpolantsResultBuffer = new Float32Array( 1 ); - -class Uniform { - - constructor( value ) { - - if ( typeof value === 'string' ) { - - console.warn( 'THREE.Uniform: Type parameter is no longer needed.' ); - value = arguments[ 1 ]; - - } - - this.value = value; - - } - - clone() { - - return new Uniform( this.value.clone === undefined ? this.value : this.value.clone() ); - - } - -} - -function InstancedInterleavedBuffer( array, stride, meshPerAttribute ) { - - InterleavedBuffer.call( this, array, stride ); - - this.meshPerAttribute = meshPerAttribute || 1; - -} - -InstancedInterleavedBuffer.prototype = Object.assign( Object.create( InterleavedBuffer.prototype ), { - - constructor: InstancedInterleavedBuffer, - - isInstancedInterleavedBuffer: true, - - copy: function ( source ) { - - InterleavedBuffer.prototype.copy.call( this, source ); - - this.meshPerAttribute = source.meshPerAttribute; - - return this; - - }, - - clone: function ( data ) { - - const ib = InterleavedBuffer.prototype.clone.call( this, data ); - - ib.meshPerAttribute = this.meshPerAttribute; - - return ib; - - }, - - toJSON: function ( data ) { - - const json = InterleavedBuffer.prototype.toJSON.call( this, data ); - - json.isInstancedInterleavedBuffer = true; - json.meshPerAttribute = this.meshPerAttribute; - - return json; - - } - -} ); - -function GLBufferAttribute( buffer, type, itemSize, elementSize, count ) { - - this.buffer = buffer; - this.type = type; - this.itemSize = itemSize; - this.elementSize = elementSize; - this.count = count; - - this.version = 0; - -} - -Object.defineProperty( GLBufferAttribute.prototype, 'needsUpdate', { - - set: function ( value ) { - - if ( value === true ) this.version ++; - - } - -} ); - -Object.assign( GLBufferAttribute.prototype, { - - isGLBufferAttribute: true, - - setBuffer: function ( buffer ) { - - this.buffer = buffer; - - return this; - - }, - - setType: function ( type, elementSize ) { - - this.type = type; - this.elementSize = elementSize; - - return this; - - }, - - setItemSize: function ( itemSize ) { - - this.itemSize = itemSize; - - return this; - - }, - - setCount: function ( count ) { - - this.count = count; - - return this; - - }, - -} ); - -function Raycaster( origin, direction, near = 0, far = Infinity ) { - - this.ray = new Ray( origin, direction ); - // direction is assumed to be normalized (for accurate distance calculations) - - this.near = near; - this.far = far; - this.camera = null; - this.layers = new Layers(); - - this.params = { - Mesh: {}, - Line: { threshold: 1 }, - LOD: {}, - Points: { threshold: 1 }, - Sprite: {} - }; - - Object.defineProperties( this.params, { - PointCloud: { - get: function () { - - console.warn( 'THREE.Raycaster: params.PointCloud has been renamed to params.Points.' ); - return this.Points; - - } - } - } ); - -} - -function ascSort( a, b ) { - - return a.distance - b.distance; - -} - -function intersectObject( object, raycaster, intersects, recursive ) { - - if ( object.layers.test( raycaster.layers ) ) { - - object.raycast( raycaster, intersects ); - - } - - if ( recursive === true ) { - - const children = object.children; - - for ( let i = 0, l = children.length; i < l; i ++ ) { - - intersectObject( children[ i ], raycaster, intersects, true ); - - } - - } - -} - -Object.assign( Raycaster.prototype, { - - set: function ( origin, direction ) { - - // direction is assumed to be normalized (for accurate distance calculations) - - this.ray.set( origin, direction ); - - }, - - setFromCamera: function ( coords, camera ) { - - if ( camera && camera.isPerspectiveCamera ) { - - this.ray.origin.setFromMatrixPosition( camera.matrixWorld ); - this.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize(); - this.camera = camera; - - } else if ( camera && camera.isOrthographicCamera ) { - - this.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera - this.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld ); - this.camera = camera; - - } else { - - console.error( 'THREE.Raycaster: Unsupported camera type: ' + camera.type ); - - } - - }, - - intersectObject: function ( object, recursive = false, intersects = [] ) { - - intersectObject( object, this, intersects, recursive ); - - intersects.sort( ascSort ); - - return intersects; - - }, - - intersectObjects: function ( objects, recursive = false, intersects = [] ) { - - for ( let i = 0, l = objects.length; i < l; i ++ ) { - - intersectObject( objects[ i ], this, intersects, recursive ); - - } - - intersects.sort( ascSort ); - - return intersects; - - } - -} ); - -/** - * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system - * - * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up. - * The azimuthal angle (theta) is measured from the positive z-axis. - */ - -class Spherical { - - constructor( radius = 1, phi = 0, theta = 0 ) { - - this.radius = radius; - this.phi = phi; // polar angle - this.theta = theta; // azimuthal angle - - return this; - - } - - set( radius, phi, theta ) { - - this.radius = radius; - this.phi = phi; - this.theta = theta; - - return this; - - } - - copy( other ) { - - this.radius = other.radius; - this.phi = other.phi; - this.theta = other.theta; - - return this; - - } - - // restrict phi to be betwee EPS and PI-EPS - makeSafe() { - - const EPS = 0.000001; - this.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) ); - - return this; - - } - - setFromVector3( v ) { - - return this.setFromCartesianCoords( v.x, v.y, v.z ); - - } - - setFromCartesianCoords( x, y, z ) { - - this.radius = Math.sqrt( x * x + y * y + z * z ); - - if ( this.radius === 0 ) { - - this.theta = 0; - this.phi = 0; - - } else { - - this.theta = Math.atan2( x, z ); - this.phi = Math.acos( MathUtils.clamp( y / this.radius, - 1, 1 ) ); - - } - - return this; - - } - - clone() { - - return new this.constructor().copy( this ); - - } - -} - -/** - * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system - */ - -class Cylindrical { - - constructor( radius = 1, theta = 0, y = 0 ) { - - this.radius = radius; // distance from the origin to a point in the x-z plane - this.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis - this.y = y; // height above the x-z plane - - return this; - - } - - set( radius, theta, y ) { - - this.radius = radius; - this.theta = theta; - this.y = y; - - return this; - - } - - copy( other ) { - - this.radius = other.radius; - this.theta = other.theta; - this.y = other.y; - - return this; - - } - - setFromVector3( v ) { - - return this.setFromCartesianCoords( v.x, v.y, v.z ); - - } - - setFromCartesianCoords( x, y, z ) { - - this.radius = Math.sqrt( x * x + z * z ); - this.theta = Math.atan2( x, z ); - this.y = y; - - return this; - - } - - clone() { - - return new this.constructor().copy( this ); - - } - -} - -const _vector$8 = /*@__PURE__*/ new Vector2(); - -class Box2 { - - constructor( min = new Vector2( + Infinity, + Infinity ), max = new Vector2( - Infinity, - Infinity ) ) { - - this.min = min; - this.max = max; - - } - - set( min, max ) { - - this.min.copy( min ); - this.max.copy( max ); - - return this; - - } - - setFromPoints( points ) { - - this.makeEmpty(); - - for ( let i = 0, il = points.length; i < il; i ++ ) { - - this.expandByPoint( points[ i ] ); - - } - - return this; - - } - - setFromCenterAndSize( center, size ) { - - const halfSize = _vector$8.copy( size ).multiplyScalar( 0.5 ); - this.min.copy( center ).sub( halfSize ); - this.max.copy( center ).add( halfSize ); - - return this; - - } - - clone() { - - return new this.constructor().copy( this ); - - } - - copy( box ) { - - this.min.copy( box.min ); - this.max.copy( box.max ); - - return this; - - } - - makeEmpty() { - - this.min.x = this.min.y = + Infinity; - this.max.x = this.max.y = - Infinity; - - return this; - - } - - isEmpty() { - - // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes - - return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ); - - } - - getCenter( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Box2: .getCenter() target is now required' ); - target = new Vector2(); - - } - - return this.isEmpty() ? target.set( 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 ); - - } - - getSize( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Box2: .getSize() target is now required' ); - target = new Vector2(); - - } - - return this.isEmpty() ? target.set( 0, 0 ) : target.subVectors( this.max, this.min ); - - } - - expandByPoint( point ) { - - this.min.min( point ); - this.max.max( point ); - - return this; - - } - - expandByVector( vector ) { - - this.min.sub( vector ); - this.max.add( vector ); - - return this; - - } - - expandByScalar( scalar ) { - - this.min.addScalar( - scalar ); - this.max.addScalar( scalar ); - - return this; - - } - - containsPoint( point ) { - - return point.x < this.min.x || point.x > this.max.x || - point.y < this.min.y || point.y > this.max.y ? false : true; - - } - - containsBox( box ) { - - return this.min.x <= box.min.x && box.max.x <= this.max.x && - this.min.y <= box.min.y && box.max.y <= this.max.y; - - } - - getParameter( point, target ) { - - // This can potentially have a divide by zero if the box - // has a size dimension of 0. - - if ( target === undefined ) { - - console.warn( 'THREE.Box2: .getParameter() target is now required' ); - target = new Vector2(); - - } - - return target.set( - ( point.x - this.min.x ) / ( this.max.x - this.min.x ), - ( point.y - this.min.y ) / ( this.max.y - this.min.y ) - ); - - } - - intersectsBox( box ) { - - // using 4 splitting planes to rule out intersections - - return box.max.x < this.min.x || box.min.x > this.max.x || - box.max.y < this.min.y || box.min.y > this.max.y ? false : true; - - } - - clampPoint( point, target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Box2: .clampPoint() target is now required' ); - target = new Vector2(); - - } - - return target.copy( point ).clamp( this.min, this.max ); - - } - - distanceToPoint( point ) { - - const clampedPoint = _vector$8.copy( point ).clamp( this.min, this.max ); - return clampedPoint.sub( point ).length(); - - } - - intersect( box ) { - - this.min.max( box.min ); - this.max.min( box.max ); - - return this; - - } - - union( box ) { - - this.min.min( box.min ); - this.max.max( box.max ); - - return this; - - } - - translate( offset ) { - - this.min.add( offset ); - this.max.add( offset ); - - return this; - - } - - equals( box ) { - - return box.min.equals( this.min ) && box.max.equals( this.max ); - - } - -} - -Box2.prototype.isBox2 = true; - -const _startP = /*@__PURE__*/ new Vector3(); -const _startEnd = /*@__PURE__*/ new Vector3(); - -class Line3 { - - constructor( start = new Vector3(), end = new Vector3() ) { - - this.start = start; - this.end = end; - - } - - set( start, end ) { - - this.start.copy( start ); - this.end.copy( end ); - - return this; - - } - - copy( line ) { - - this.start.copy( line.start ); - this.end.copy( line.end ); - - return this; - - } - - getCenter( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Line3: .getCenter() target is now required' ); - target = new Vector3(); - - } - - return target.addVectors( this.start, this.end ).multiplyScalar( 0.5 ); - - } - - delta( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Line3: .delta() target is now required' ); - target = new Vector3(); - - } - - return target.subVectors( this.end, this.start ); - - } - - distanceSq() { - - return this.start.distanceToSquared( this.end ); - - } - - distance() { - - return this.start.distanceTo( this.end ); - - } - - at( t, target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Line3: .at() target is now required' ); - target = new Vector3(); - - } - - return this.delta( target ).multiplyScalar( t ).add( this.start ); - - } - - closestPointToPointParameter( point, clampToLine ) { - - _startP.subVectors( point, this.start ); - _startEnd.subVectors( this.end, this.start ); - - const startEnd2 = _startEnd.dot( _startEnd ); - const startEnd_startP = _startEnd.dot( _startP ); - - let t = startEnd_startP / startEnd2; - - if ( clampToLine ) { - - t = MathUtils.clamp( t, 0, 1 ); - - } - - return t; - - } - - closestPointToPoint( point, clampToLine, target ) { - - const t = this.closestPointToPointParameter( point, clampToLine ); - - if ( target === undefined ) { - - console.warn( 'THREE.Line3: .closestPointToPoint() target is now required' ); - target = new Vector3(); - - } - - return this.delta( target ).multiplyScalar( t ).add( this.start ); - - } - - applyMatrix4( matrix ) { - - this.start.applyMatrix4( matrix ); - this.end.applyMatrix4( matrix ); - - return this; - - } - - equals( line ) { - - return line.start.equals( this.start ) && line.end.equals( this.end ); - - } - - clone() { - - return new this.constructor().copy( this ); - - } - -} - -function ImmediateRenderObject( material ) { - - Object3D.call( this ); - - this.material = material; - this.render = function ( /* renderCallback */ ) {}; - - this.hasPositions = false; - this.hasNormals = false; - this.hasColors = false; - this.hasUvs = false; - - this.positionArray = null; - this.normalArray = null; - this.colorArray = null; - this.uvArray = null; - - this.count = 0; - -} - -ImmediateRenderObject.prototype = Object.create( Object3D.prototype ); -ImmediateRenderObject.prototype.constructor = ImmediateRenderObject; - -ImmediateRenderObject.prototype.isImmediateRenderObject = true; - -const _vector$9 = /*@__PURE__*/ new Vector3(); - -class SpotLightHelper extends Object3D { - - constructor( light, color ) { - - super(); - this.light = light; - this.light.updateMatrixWorld(); - - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - - this.color = color; - - const geometry = new BufferGeometry(); - - const positions = [ - 0, 0, 0, 0, 0, 1, - 0, 0, 0, 1, 0, 1, - 0, 0, 0, - 1, 0, 1, - 0, 0, 0, 0, 1, 1, - 0, 0, 0, 0, - 1, 1 - ]; - - for ( let i = 0, j = 1, l = 32; i < l; i ++, j ++ ) { - - const p1 = ( i / l ) * Math.PI * 2; - const p2 = ( j / l ) * Math.PI * 2; - - positions.push( - Math.cos( p1 ), Math.sin( p1 ), 1, - Math.cos( p2 ), Math.sin( p2 ), 1 - ); - - } - - geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) ); - - const material = new LineBasicMaterial( { fog: false, toneMapped: false } ); - - this.cone = new LineSegments( geometry, material ); - this.add( this.cone ); - - this.update(); - - } - - dispose() { - - this.cone.geometry.dispose(); - this.cone.material.dispose(); - - } - - update() { - - this.light.updateMatrixWorld(); - - const coneLength = this.light.distance ? this.light.distance : 1000; - const coneWidth = coneLength * Math.tan( this.light.angle ); - - this.cone.scale.set( coneWidth, coneWidth, coneLength ); - - _vector$9.setFromMatrixPosition( this.light.target.matrixWorld ); - - this.cone.lookAt( _vector$9 ); - - if ( this.color !== undefined ) { - - this.cone.material.color.set( this.color ); - - } else { - - this.cone.material.color.copy( this.light.color ); - - } - - } - -} - -const _vector$a = /*@__PURE__*/ new Vector3(); -const _boneMatrix = /*@__PURE__*/ new Matrix4(); -const _matrixWorldInv = /*@__PURE__*/ new Matrix4(); - - -class SkeletonHelper extends LineSegments { - - constructor( object ) { - - const bones = getBoneList( object ); - - const geometry = new BufferGeometry(); - - const vertices = []; - const colors = []; - - const color1 = new Color( 0, 0, 1 ); - const color2 = new Color( 0, 1, 0 ); - - for ( let i = 0; i < bones.length; i ++ ) { - - const bone = bones[ i ]; - - if ( bone.parent && bone.parent.isBone ) { - - vertices.push( 0, 0, 0 ); - vertices.push( 0, 0, 0 ); - colors.push( color1.r, color1.g, color1.b ); - colors.push( color2.r, color2.g, color2.b ); - - } - - } - - geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) ); - - const material = new LineBasicMaterial( { vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true } ); - - super( geometry, material ); - - this.type = 'SkeletonHelper'; - this.isSkeletonHelper = true; - - this.root = object; - this.bones = bones; - - this.matrix = object.matrixWorld; - this.matrixAutoUpdate = false; - - } - - updateMatrixWorld( force ) { - - const bones = this.bones; - - const geometry = this.geometry; - const position = geometry.getAttribute( 'position' ); - - _matrixWorldInv.copy( this.root.matrixWorld ).invert(); - - for ( let i = 0, j = 0; i < bones.length; i ++ ) { - - const bone = bones[ i ]; - - if ( bone.parent && bone.parent.isBone ) { - - _boneMatrix.multiplyMatrices( _matrixWorldInv, bone.matrixWorld ); - _vector$a.setFromMatrixPosition( _boneMatrix ); - position.setXYZ( j, _vector$a.x, _vector$a.y, _vector$a.z ); - - _boneMatrix.multiplyMatrices( _matrixWorldInv, bone.parent.matrixWorld ); - _vector$a.setFromMatrixPosition( _boneMatrix ); - position.setXYZ( j + 1, _vector$a.x, _vector$a.y, _vector$a.z ); - - j += 2; - - } - - } - - geometry.getAttribute( 'position' ).needsUpdate = true; - - super.updateMatrixWorld( force ); - - } - -} - - -function getBoneList( object ) { - - const boneList = []; - - if ( object && object.isBone ) { - - boneList.push( object ); - - } - - for ( let i = 0; i < object.children.length; i ++ ) { - - boneList.push.apply( boneList, getBoneList( object.children[ i ] ) ); - - } - - return boneList; - -} - -class PointLightHelper extends Mesh { - - constructor( light, sphereSize, color ) { - - const geometry = new SphereGeometry( sphereSize, 4, 2 ); - const material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } ); - - super( geometry, material ); - - this.light = light; - this.light.updateMatrixWorld(); - - this.color = color; - - this.type = 'PointLightHelper'; - - this.matrix = this.light.matrixWorld; - this.matrixAutoUpdate = false; - - this.update(); - - - /* - // TODO: delete this comment? - const distanceGeometry = new THREE.IcosahedronBufferGeometry( 1, 2 ); - const distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } ); - - this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial ); - this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial ); - - const d = light.distance; - - if ( d === 0.0 ) { - - this.lightDistance.visible = false; - - } else { - - this.lightDistance.scale.set( d, d, d ); - - } - - this.add( this.lightDistance ); - */ - - } - - dispose() { - - this.geometry.dispose(); - this.material.dispose(); - - } - - update() { - - if ( this.color !== undefined ) { - - this.material.color.set( this.color ); - - } else { - - this.material.color.copy( this.light.color ); - - } - - /* - const d = this.light.distance; - - if ( d === 0.0 ) { - - this.lightDistance.visible = false; - - } else { - - this.lightDistance.visible = true; - this.lightDistance.scale.set( d, d, d ); - - } - */ - - } - -} - -const _vector$b = /*@__PURE__*/ new Vector3(); -const _color1 = /*@__PURE__*/ new Color(); -const _color2 = /*@__PURE__*/ new Color(); - -class HemisphereLightHelper extends Object3D { - - constructor( light, size, color ) { - - super(); - this.light = light; - this.light.updateMatrixWorld(); - - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - - this.color = color; - - const geometry = new OctahedronGeometry( size ); - geometry.rotateY( Math.PI * 0.5 ); - - this.material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } ); - if ( this.color === undefined ) this.material.vertexColors = true; - - const position = geometry.getAttribute( 'position' ); - const colors = new Float32Array( position.count * 3 ); - - geometry.setAttribute( 'color', new BufferAttribute( colors, 3 ) ); - - this.add( new Mesh( geometry, this.material ) ); - - this.update(); - - } - - dispose() { - - this.children[ 0 ].geometry.dispose(); - this.children[ 0 ].material.dispose(); - - } - - update() { - - const mesh = this.children[ 0 ]; - - if ( this.color !== undefined ) { - - this.material.color.set( this.color ); - - } else { - - const colors = mesh.geometry.getAttribute( 'color' ); - - _color1.copy( this.light.color ); - _color2.copy( this.light.groundColor ); - - for ( let i = 0, l = colors.count; i < l; i ++ ) { - - const color = ( i < ( l / 2 ) ) ? _color1 : _color2; - - colors.setXYZ( i, color.r, color.g, color.b ); - - } - - colors.needsUpdate = true; - - } - - mesh.lookAt( _vector$b.setFromMatrixPosition( this.light.matrixWorld ).negate() ); - - } - -} - -class GridHelper extends LineSegments { - - constructor( size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888 ) { - - color1 = new Color( color1 ); - color2 = new Color( color2 ); - - const center = divisions / 2; - const step = size / divisions; - const halfSize = size / 2; - - const vertices = [], colors = []; - - for ( let i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) { - - vertices.push( - halfSize, 0, k, halfSize, 0, k ); - vertices.push( k, 0, - halfSize, k, 0, halfSize ); - - const color = i === center ? color1 : color2; - - color.toArray( colors, j ); j += 3; - color.toArray( colors, j ); j += 3; - color.toArray( colors, j ); j += 3; - color.toArray( colors, j ); j += 3; - - } - - const geometry = new BufferGeometry(); - geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) ); - - const material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } ); - - super( geometry, material ); - - this.type = 'GridHelper'; - - } - -} - -class PolarGridHelper extends LineSegments { - - constructor( radius = 10, radials = 16, circles = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888 ) { - - color1 = new Color( color1 ); - color2 = new Color( color2 ); - - const vertices = []; - const colors = []; - - // create the radials - - for ( let i = 0; i <= radials; i ++ ) { - - const v = ( i / radials ) * ( Math.PI * 2 ); - - const x = Math.sin( v ) * radius; - const z = Math.cos( v ) * radius; - - vertices.push( 0, 0, 0 ); - vertices.push( x, 0, z ); - - const color = ( i & 1 ) ? color1 : color2; - - colors.push( color.r, color.g, color.b ); - colors.push( color.r, color.g, color.b ); - - } - - // create the circles - - for ( let i = 0; i <= circles; i ++ ) { - - const color = ( i & 1 ) ? color1 : color2; - - const r = radius - ( radius / circles * i ); - - for ( let j = 0; j < divisions; j ++ ) { - - // first vertex - - let v = ( j / divisions ) * ( Math.PI * 2 ); - - let x = Math.sin( v ) * r; - let z = Math.cos( v ) * r; - - vertices.push( x, 0, z ); - colors.push( color.r, color.g, color.b ); - - // second vertex - - v = ( ( j + 1 ) / divisions ) * ( Math.PI * 2 ); - - x = Math.sin( v ) * r; - z = Math.cos( v ) * r; - - vertices.push( x, 0, z ); - colors.push( color.r, color.g, color.b ); - - } - - } - - const geometry = new BufferGeometry(); - geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) ); - - const material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } ); - - super( geometry, material ); - - this.type = 'PolarGridHelper'; - - } - -} - -const _v1$6 = /*@__PURE__*/ new Vector3(); -const _v2$3 = /*@__PURE__*/ new Vector3(); -const _v3$1 = /*@__PURE__*/ new Vector3(); - -class DirectionalLightHelper extends Object3D { - - constructor( light, size, color ) { - - super(); - this.light = light; - this.light.updateMatrixWorld(); - - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - - this.color = color; - - if ( size === undefined ) size = 1; - - let geometry = new BufferGeometry(); - geometry.setAttribute( 'position', new Float32BufferAttribute( [ - - size, size, 0, - size, size, 0, - size, - size, 0, - - size, - size, 0, - - size, size, 0 - ], 3 ) ); - - const material = new LineBasicMaterial( { fog: false, toneMapped: false } ); - - this.lightPlane = new Line( geometry, material ); - this.add( this.lightPlane ); - - geometry = new BufferGeometry(); - geometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 0, 1 ], 3 ) ); - - this.targetLine = new Line( geometry, material ); - this.add( this.targetLine ); - - this.update(); - - } - - dispose() { - - this.lightPlane.geometry.dispose(); - this.lightPlane.material.dispose(); - this.targetLine.geometry.dispose(); - this.targetLine.material.dispose(); - - } - - update() { - - _v1$6.setFromMatrixPosition( this.light.matrixWorld ); - _v2$3.setFromMatrixPosition( this.light.target.matrixWorld ); - _v3$1.subVectors( _v2$3, _v1$6 ); - - this.lightPlane.lookAt( _v2$3 ); - - if ( this.color !== undefined ) { - - this.lightPlane.material.color.set( this.color ); - this.targetLine.material.color.set( this.color ); - - } else { - - this.lightPlane.material.color.copy( this.light.color ); - this.targetLine.material.color.copy( this.light.color ); - - } - - this.targetLine.lookAt( _v2$3 ); - this.targetLine.scale.z = _v3$1.length(); - - } - -} - -const _vector$c = /*@__PURE__*/ new Vector3(); -const _camera = /*@__PURE__*/ new Camera(); - -/** - * - shows frustum, line of sight and up of the camera - * - suitable for fast updates - * - based on frustum visualization in lightgl.js shadowmap example - * http://evanw.github.com/lightgl.js/tests/shadowmap.html - */ - -class CameraHelper extends LineSegments { - - constructor( camera ) { - - const geometry = new BufferGeometry(); - const material = new LineBasicMaterial( { color: 0xffffff, vertexColors: true, toneMapped: false } ); - - const vertices = []; - const colors = []; - - const pointMap = {}; - - // colors - - const colorFrustum = new Color( 0xffaa00 ); - const colorCone = new Color( 0xff0000 ); - const colorUp = new Color( 0x00aaff ); - const colorTarget = new Color( 0xffffff ); - const colorCross = new Color( 0x333333 ); - - // near - - addLine( 'n1', 'n2', colorFrustum ); - addLine( 'n2', 'n4', colorFrustum ); - addLine( 'n4', 'n3', colorFrustum ); - addLine( 'n3', 'n1', colorFrustum ); - - // far - - addLine( 'f1', 'f2', colorFrustum ); - addLine( 'f2', 'f4', colorFrustum ); - addLine( 'f4', 'f3', colorFrustum ); - addLine( 'f3', 'f1', colorFrustum ); - - // sides - - addLine( 'n1', 'f1', colorFrustum ); - addLine( 'n2', 'f2', colorFrustum ); - addLine( 'n3', 'f3', colorFrustum ); - addLine( 'n4', 'f4', colorFrustum ); - - // cone - - addLine( 'p', 'n1', colorCone ); - addLine( 'p', 'n2', colorCone ); - addLine( 'p', 'n3', colorCone ); - addLine( 'p', 'n4', colorCone ); - - // up - - addLine( 'u1', 'u2', colorUp ); - addLine( 'u2', 'u3', colorUp ); - addLine( 'u3', 'u1', colorUp ); - - // target - - addLine( 'c', 't', colorTarget ); - addLine( 'p', 'c', colorCross ); - - // cross - - addLine( 'cn1', 'cn2', colorCross ); - addLine( 'cn3', 'cn4', colorCross ); - - addLine( 'cf1', 'cf2', colorCross ); - addLine( 'cf3', 'cf4', colorCross ); - - function addLine( a, b, color ) { - - addPoint( a, color ); - addPoint( b, color ); - - } - - function addPoint( id, color ) { - - vertices.push( 0, 0, 0 ); - colors.push( color.r, color.g, color.b ); - - if ( pointMap[ id ] === undefined ) { - - pointMap[ id ] = []; - - } - - pointMap[ id ].push( ( vertices.length / 3 ) - 1 ); - - } - - geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) ); - - super( geometry, material ); - - this.type = 'CameraHelper'; - - this.camera = camera; - if ( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix(); - - this.matrix = camera.matrixWorld; - this.matrixAutoUpdate = false; - - this.pointMap = pointMap; - - this.update(); - - } - - update() { - - const geometry = this.geometry; - const pointMap = this.pointMap; - - const w = 1, h = 1; - - // we need just camera projection matrix inverse - // world matrix must be identity - - _camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse ); - - // center / target - - setPoint( 'c', pointMap, geometry, _camera, 0, 0, - 1 ); - setPoint( 't', pointMap, geometry, _camera, 0, 0, 1 ); - - // near - - setPoint( 'n1', pointMap, geometry, _camera, - w, - h, - 1 ); - setPoint( 'n2', pointMap, geometry, _camera, w, - h, - 1 ); - setPoint( 'n3', pointMap, geometry, _camera, - w, h, - 1 ); - setPoint( 'n4', pointMap, geometry, _camera, w, h, - 1 ); - - // far - - setPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 ); - setPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 ); - setPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 ); - setPoint( 'f4', pointMap, geometry, _camera, w, h, 1 ); - - // up - - setPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, - 1 ); - setPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, - 1 ); - setPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, - 1 ); - - // cross - - setPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 ); - setPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 ); - setPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 ); - setPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 ); - - setPoint( 'cn1', pointMap, geometry, _camera, - w, 0, - 1 ); - setPoint( 'cn2', pointMap, geometry, _camera, w, 0, - 1 ); - setPoint( 'cn3', pointMap, geometry, _camera, 0, - h, - 1 ); - setPoint( 'cn4', pointMap, geometry, _camera, 0, h, - 1 ); - - geometry.getAttribute( 'position' ).needsUpdate = true; - - } - -} - - -function setPoint( point, pointMap, geometry, camera, x, y, z ) { - - _vector$c.set( x, y, z ).unproject( camera ); - - const points = pointMap[ point ]; - - if ( points !== undefined ) { - - const position = geometry.getAttribute( 'position' ); - - for ( let i = 0, l = points.length; i < l; i ++ ) { - - position.setXYZ( points[ i ], _vector$c.x, _vector$c.y, _vector$c.z ); - - } - - } - -} - -const _box$3 = /*@__PURE__*/ new Box3(); - -class BoxHelper extends LineSegments { - - constructor( object, color = 0xffff00 ) { - - const indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] ); - const positions = new Float32Array( 8 * 3 ); - - const geometry = new BufferGeometry(); - geometry.setIndex( new BufferAttribute( indices, 1 ) ); - geometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) ); - - super( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) ); - - this.object = object; - this.type = 'BoxHelper'; - - this.matrixAutoUpdate = false; - - this.update(); - - } - - update( object ) { - - if ( object !== undefined ) { - - console.warn( 'THREE.BoxHelper: .update() has no longer arguments.' ); - - } - - if ( this.object !== undefined ) { - - _box$3.setFromObject( this.object ); - - } - - if ( _box$3.isEmpty() ) return; - - const min = _box$3.min; - const max = _box$3.max; - - /* - 5____4 - 1/___0/| - | 6__|_7 - 2/___3/ - - 0: max.x, max.y, max.z - 1: min.x, max.y, max.z - 2: min.x, min.y, max.z - 3: max.x, min.y, max.z - 4: max.x, max.y, min.z - 5: min.x, max.y, min.z - 6: min.x, min.y, min.z - 7: max.x, min.y, min.z - */ - - const position = this.geometry.attributes.position; - const array = position.array; - - array[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z; - array[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z; - array[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z; - array[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z; - array[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z; - array[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z; - array[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z; - array[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z; - - position.needsUpdate = true; - - this.geometry.computeBoundingSphere(); - - - } - - setFromObject( object ) { - - this.object = object; - this.update(); - - return this; - - } - - copy( source ) { - - LineSegments.prototype.copy.call( this, source ); - - this.object = source.object; - - return this; - - } - -} - -class Box3Helper extends LineSegments { - - constructor( box, color = 0xffff00 ) { - - const indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] ); - - const positions = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 1, - 1, 1, - 1, - 1 ]; - - const geometry = new BufferGeometry(); - - geometry.setIndex( new BufferAttribute( indices, 1 ) ); - - geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) ); - - super( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) ); - - this.box = box; - - this.type = 'Box3Helper'; - - this.geometry.computeBoundingSphere(); - - } - - updateMatrixWorld( force ) { - - const box = this.box; - - if ( box.isEmpty() ) return; - - box.getCenter( this.position ); - - box.getSize( this.scale ); - - this.scale.multiplyScalar( 0.5 ); - - super.updateMatrixWorld( force ); - - } - -} - -class PlaneHelper extends Line { - - constructor( plane, size = 1, hex = 0xffff00 ) { - - const color = hex; - - const positions = [ 1, - 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0 ]; - - const geometry = new BufferGeometry(); - geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) ); - geometry.computeBoundingSphere(); - - super( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) ); - - this.type = 'PlaneHelper'; - - this.plane = plane; - - this.size = size; - - const positions2 = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, - 1, 1, 1, - 1, 1 ]; - - const geometry2 = new BufferGeometry(); - geometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) ); - geometry2.computeBoundingSphere(); - - this.add( new Mesh( geometry2, new MeshBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false } ) ) ); - - } - - updateMatrixWorld( force ) { - - let scale = - this.plane.constant; - - if ( Math.abs( scale ) < 1e-8 ) scale = 1e-8; // sign does not matter - - this.scale.set( 0.5 * this.size, 0.5 * this.size, scale ); - - this.children[ 0 ].material.side = ( scale < 0 ) ? BackSide : FrontSide; // renderer flips side when determinant < 0; flipping not wanted here - - this.lookAt( this.plane.normal ); - - super.updateMatrixWorld( force ); - - } - -} - -const _axis = /*@__PURE__*/ new Vector3(); -let _lineGeometry, _coneGeometry; - -class ArrowHelper extends Object3D { - - // dir is assumed to be normalized - - constructor( dir = new Vector3( 0, 0, 1 ), origin = new Vector3( 0, 0, 0 ), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2 ) { - - super(); - - this.type = 'ArrowHelper'; - - if ( _lineGeometry === undefined ) { - - _lineGeometry = new BufferGeometry(); - _lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) ); - - _coneGeometry = new CylinderGeometry( 0, 0.5, 1, 5, 1 ); - _coneGeometry.translate( 0, - 0.5, 0 ); - - } - - this.position.copy( origin ); - - this.line = new Line( _lineGeometry, new LineBasicMaterial( { color: color, toneMapped: false } ) ); - this.line.matrixAutoUpdate = false; - this.add( this.line ); - - this.cone = new Mesh( _coneGeometry, new MeshBasicMaterial( { color: color, toneMapped: false } ) ); - this.cone.matrixAutoUpdate = false; - this.add( this.cone ); - - this.setDirection( dir ); - this.setLength( length, headLength, headWidth ); - - } - - setDirection( dir ) { - - // dir is assumed to be normalized - - if ( dir.y > 0.99999 ) { - - this.quaternion.set( 0, 0, 0, 1 ); - - } else if ( dir.y < - 0.99999 ) { - - this.quaternion.set( 1, 0, 0, 0 ); - - } else { - - _axis.set( dir.z, 0, - dir.x ).normalize(); - - const radians = Math.acos( dir.y ); - - this.quaternion.setFromAxisAngle( _axis, radians ); - - } - - } - - setLength( length, headLength = length * 0.2, headWidth = headLength * 0.2 ) { - - this.line.scale.set( 1, Math.max( 0.0001, length - headLength ), 1 ); // see #17458 - this.line.updateMatrix(); - - this.cone.scale.set( headWidth, headLength, headWidth ); - this.cone.position.y = length; - this.cone.updateMatrix(); - - } - - setColor( color ) { - - this.line.material.color.set( color ); - this.cone.material.color.set( color ); - - } - - copy( source ) { - - super.copy( source, false ); - - this.line.copy( source.line ); - this.cone.copy( source.cone ); - - return this; - - } - -} - -class AxesHelper extends LineSegments { - - constructor( size = 1 ) { - - const vertices = [ - 0, 0, 0, size, 0, 0, - 0, 0, 0, 0, size, 0, - 0, 0, 0, 0, 0, size - ]; - - const colors = [ - 1, 0, 0, 1, 0.6, 0, - 0, 1, 0, 0.6, 1, 0, - 0, 0, 1, 0, 0.6, 1 - ]; - - const geometry = new BufferGeometry(); - geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) ); - - const material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } ); - - super( geometry, material ); - - this.type = 'AxesHelper'; - - } - -} - -const _floatView = new Float32Array( 1 ); -const _int32View = new Int32Array( _floatView.buffer ); - -const DataUtils = { - - // Converts float32 to float16 (stored as uint16 value). - - toHalfFloat: function ( val ) { - - // Source: http://gamedev.stackexchange.com/questions/17326/conversion-of-a-number-from-single-precision-floating-point-representation-to-a/17410#17410 - - /* This method is faster than the OpenEXR implementation (very often - * used, eg. in Ogre), with the additional benefit of rounding, inspired - * by James Tursa?s half-precision code. */ - - _floatView[ 0 ] = val; - const x = _int32View[ 0 ]; - - let bits = ( x >> 16 ) & 0x8000; /* Get the sign */ - let m = ( x >> 12 ) & 0x07ff; /* Keep one extra bit for rounding */ - const e = ( x >> 23 ) & 0xff; /* Using int is faster here */ - - /* If zero, or denormal, or exponent underflows too much for a denormal - * half, return signed zero. */ - if ( e < 103 ) return bits; - - /* If NaN, return NaN. If Inf or exponent overflow, return Inf. */ - if ( e > 142 ) { - - bits |= 0x7c00; - /* If exponent was 0xff and one mantissa bit was set, it means NaN, - * not Inf, so make sure we set one mantissa bit too. */ - bits |= ( ( e == 255 ) ? 0 : 1 ) && ( x & 0x007fffff ); - return bits; - - } - - /* If exponent underflows but not too much, return a denormal */ - if ( e < 113 ) { - - m |= 0x0800; - /* Extra rounding may overflow and set mantissa to 0 and exponent - * to 1, which is OK. */ - bits |= ( m >> ( 114 - e ) ) + ( ( m >> ( 113 - e ) ) & 1 ); - return bits; - - } - - bits |= ( ( e - 112 ) << 10 ) | ( m >> 1 ); - /* Extra rounding. An overflow will set mantissa to 0 and increment - * the exponent, which is OK. */ - bits += m & 1; - return bits; - - } - -}; - -const LOD_MIN = 4; -const LOD_MAX = 8; -const SIZE_MAX = Math.pow( 2, LOD_MAX ); - -// The standard deviations (radians) associated with the extra mips. These are -// chosen to approximate a Trowbridge-Reitz distribution function times the -// geometric shadowing function. These sigma values squared must match the -// variance #defines in cube_uv_reflection_fragment.glsl.js. -const EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ]; - -const TOTAL_LODS = LOD_MAX - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length; - -// The maximum length of the blur for loop. Smaller sigmas will use fewer -// samples and exit early, but not recompile the shader. -const MAX_SAMPLES = 20; - -const ENCODINGS = { - [ LinearEncoding ]: 0, - [ sRGBEncoding ]: 1, - [ RGBEEncoding ]: 2, - [ RGBM7Encoding ]: 3, - [ RGBM16Encoding ]: 4, - [ RGBDEncoding ]: 5, - [ GammaEncoding ]: 6 -}; - -const backgroundMaterial = new MeshBasicMaterial( { - side: BackSide, - depthWrite: false, - depthTest: false, -} ); -const backgroundBox = new Mesh( new BoxGeometry(), backgroundMaterial ); - -const _flatCamera = /*@__PURE__*/ new OrthographicCamera(); -const { _lodPlanes, _sizeLods, _sigmas } = /*@__PURE__*/ _createPlanes(); -const _clearColor = /*@__PURE__*/ new Color(); -let _oldTarget = null; - -// Golden Ratio -const PHI = ( 1 + Math.sqrt( 5 ) ) / 2; -const INV_PHI = 1 / PHI; - -// Vertices of a dodecahedron (except the opposites, which represent the -// same axis), used as axis directions evenly spread on a sphere. -const _axisDirections = [ - /*@__PURE__*/ new Vector3( 1, 1, 1 ), - /*@__PURE__*/ new Vector3( - 1, 1, 1 ), - /*@__PURE__*/ new Vector3( 1, 1, - 1 ), - /*@__PURE__*/ new Vector3( - 1, 1, - 1 ), - /*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ), - /*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ), - /*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ), - /*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ), - /*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ), - /*@__PURE__*/ new Vector3( - PHI, INV_PHI, 0 ) ]; - -/** - * This class generates a Prefiltered, Mipmapped Radiance Environment Map - * (PMREM) from a cubeMap environment texture. This allows different levels of - * blur to be quickly accessed based on material roughness. It is packed into a - * special CubeUV format that allows us to perform custom interpolation so that - * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap - * chain, it only goes down to the LOD_MIN level (above), and then creates extra - * even more filtered 'mips' at the same LOD_MIN resolution, associated with - * higher roughness levels. In this way we maintain resolution to smoothly - * interpolate diffuse lighting while limiting sampling computation. - */ - -function convertLinearToRGBE( color ) { - - const maxComponent = Math.max( color.r, color.g, color.b ); - const fExp = Math.min( Math.max( Math.ceil( Math.log2( maxComponent ) ), - 128.0 ), 127.0 ); - color.multiplyScalar( Math.pow( 2.0, - fExp ) ); - - const alpha = ( fExp + 128.0 ) / 255.0; - return alpha; - -} - -class PMREMGenerator { - - constructor( renderer ) { - - this._renderer = renderer; - this._pingPongRenderTarget = null; - - this._blurMaterial = _getBlurShader( MAX_SAMPLES ); - this._equirectShader = null; - this._cubemapShader = null; - - this._compileMaterial( this._blurMaterial ); - - } - - /** - * Generates a PMREM from a supplied Scene, which can be faster than using an - * image if networking bandwidth is low. Optional sigma specifies a blur radius - * in radians to be applied to the scene before PMREM generation. Optional near - * and far planes ensure the scene is rendered in its entirety (the cubeCamera - * is placed at the origin). - */ - fromScene( scene, sigma = 0, near = 0.1, far = 100 ) { - - _oldTarget = this._renderer.getRenderTarget(); - const cubeUVRenderTarget = this._allocateTargets(); - - this._sceneToCubeUV( scene, near, far, cubeUVRenderTarget ); - if ( sigma > 0 ) { - - this._blur( cubeUVRenderTarget, 0, 0, sigma ); - - } - - this._applyPMREM( cubeUVRenderTarget ); - this._cleanup( cubeUVRenderTarget ); - - return cubeUVRenderTarget; - - } - - /** - * Generates a PMREM from an equirectangular texture, which can be either LDR - * (RGBFormat) or HDR (RGBEFormat). The ideal input image size is 1k (1024 x 512), - * as this matches best with the 256 x 256 cubemap output. - */ - fromEquirectangular( equirectangular ) { - - return this._fromTexture( equirectangular ); - - } - - /** - * Generates a PMREM from an cubemap texture, which can be either LDR - * (RGBFormat) or HDR (RGBEFormat). The ideal input cube size is 256 x 256, - * as this matches best with the 256 x 256 cubemap output. - */ - fromCubemap( cubemap ) { - - return this._fromTexture( cubemap ); - - } - - /** - * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during - * your texture's network fetch for increased concurrency. - */ - compileCubemapShader() { - - if ( this._cubemapShader === null ) { - - this._cubemapShader = _getCubemapShader(); - this._compileMaterial( this._cubemapShader ); - - } - - } - - /** - * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during - * your texture's network fetch for increased concurrency. - */ - compileEquirectangularShader() { - - if ( this._equirectShader === null ) { - - this._equirectShader = _getEquirectShader(); - this._compileMaterial( this._equirectShader ); - - } - - } - - /** - * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, - * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on - * one of them will cause any others to also become unusable. - */ - dispose() { - - this._blurMaterial.dispose(); - - if ( this._cubemapShader !== null ) this._cubemapShader.dispose(); - if ( this._equirectShader !== null ) this._equirectShader.dispose(); - - for ( let i = 0; i < _lodPlanes.length; i ++ ) { - - _lodPlanes[ i ].dispose(); - - } - - } - - // private interface - - _cleanup( outputTarget ) { - - this._pingPongRenderTarget.dispose(); - this._renderer.setRenderTarget( _oldTarget ); - outputTarget.scissorTest = false; - _setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height ); - - } - - _fromTexture( texture ) { - - _oldTarget = this._renderer.getRenderTarget(); - const cubeUVRenderTarget = this._allocateTargets( texture ); - this._textureToCubeUV( texture, cubeUVRenderTarget ); - this._applyPMREM( cubeUVRenderTarget ); - this._cleanup( cubeUVRenderTarget ); - - return cubeUVRenderTarget; - - } - - _allocateTargets( texture ) { // warning: null texture is valid - - const params = { - magFilter: NearestFilter, - minFilter: NearestFilter, - generateMipmaps: false, - type: UnsignedByteType, - format: RGBEFormat, - encoding: _isLDR( texture ) ? texture.encoding : RGBEEncoding, - depthBuffer: false - }; - - const cubeUVRenderTarget = _createRenderTarget( params ); - cubeUVRenderTarget.depthBuffer = texture ? false : true; - this._pingPongRenderTarget = _createRenderTarget( params ); - return cubeUVRenderTarget; - - } - - _compileMaterial( material ) { - - const tmpMesh = new Mesh( _lodPlanes[ 0 ], material ); - this._renderer.compile( tmpMesh, _flatCamera ); - - } - - _sceneToCubeUV( scene, near, far, cubeUVRenderTarget ) { - - const fov = 90; - const aspect = 1; - const cubeCamera = new PerspectiveCamera( fov, aspect, near, far ); - const upSign = [ 1, - 1, 1, 1, 1, 1 ]; - const forwardSign = [ 1, 1, 1, - 1, - 1, - 1 ]; - const renderer = this._renderer; - - const originalAutoClear = renderer.autoClear; - const outputEncoding = renderer.outputEncoding; - const toneMapping = renderer.toneMapping; - renderer.getClearColor( _clearColor ); - - renderer.toneMapping = NoToneMapping; - renderer.outputEncoding = LinearEncoding; - renderer.autoClear = false; - - let useSolidColor = false; - const background = scene.background; - if ( background ) { - - if ( background.isColor ) { - - backgroundMaterial.color.copy( background ).convertSRGBToLinear(); - scene.background = null; - - const alpha = convertLinearToRGBE( backgroundMaterial.color ); - backgroundMaterial.opacity = alpha; - useSolidColor = true; - - } - - } else { - - backgroundMaterial.color.copy( _clearColor ).convertSRGBToLinear(); - - const alpha = convertLinearToRGBE( backgroundMaterial.color ); - backgroundMaterial.opacity = alpha; - useSolidColor = true; - - } - - - for ( let i = 0; i < 6; i ++ ) { - - const col = i % 3; - if ( col == 0 ) { - - cubeCamera.up.set( 0, upSign[ i ], 0 ); - cubeCamera.lookAt( forwardSign[ i ], 0, 0 ); - - } else if ( col == 1 ) { - - cubeCamera.up.set( 0, 0, upSign[ i ] ); - cubeCamera.lookAt( 0, forwardSign[ i ], 0 ); - - } else { - - cubeCamera.up.set( 0, upSign[ i ], 0 ); - cubeCamera.lookAt( 0, 0, forwardSign[ i ] ); - - } - - _setViewport( cubeUVRenderTarget, - col * SIZE_MAX, i > 2 ? SIZE_MAX : 0, SIZE_MAX, SIZE_MAX ); - renderer.setRenderTarget( cubeUVRenderTarget ); - - if ( useSolidColor ) { - - renderer.render( backgroundBox, cubeCamera ); - - } - - renderer.render( scene, cubeCamera ); - - } - - renderer.toneMapping = toneMapping; - renderer.outputEncoding = outputEncoding; - renderer.autoClear = originalAutoClear; - - } - - _textureToCubeUV( texture, cubeUVRenderTarget ) { - - const renderer = this._renderer; - - if ( texture.isCubeTexture ) { - - if ( this._cubemapShader == null ) { - - this._cubemapShader = _getCubemapShader(); - - } - - } else { - - if ( this._equirectShader == null ) { - - this._equirectShader = _getEquirectShader(); - - } - - } - - const material = texture.isCubeTexture ? this._cubemapShader : this._equirectShader; - const mesh = new Mesh( _lodPlanes[ 0 ], material ); - - const uniforms = material.uniforms; - - uniforms[ 'envMap' ].value = texture; - - if ( ! texture.isCubeTexture ) { - - uniforms[ 'texelSize' ].value.set( 1.0 / texture.image.width, 1.0 / texture.image.height ); - - } - - uniforms[ 'inputEncoding' ].value = ENCODINGS[ texture.encoding ]; - uniforms[ 'outputEncoding' ].value = ENCODINGS[ cubeUVRenderTarget.texture.encoding ]; - - _setViewport( cubeUVRenderTarget, 0, 0, 3 * SIZE_MAX, 2 * SIZE_MAX ); - - renderer.setRenderTarget( cubeUVRenderTarget ); - renderer.render( mesh, _flatCamera ); - - } - - _applyPMREM( cubeUVRenderTarget ) { - - const renderer = this._renderer; - const autoClear = renderer.autoClear; - renderer.autoClear = false; - - for ( let i = 1; i < TOTAL_LODS; i ++ ) { - - const sigma = Math.sqrt( _sigmas[ i ] * _sigmas[ i ] - _sigmas[ i - 1 ] * _sigmas[ i - 1 ] ); - - const poleAxis = _axisDirections[ ( i - 1 ) % _axisDirections.length ]; - - this._blur( cubeUVRenderTarget, i - 1, i, sigma, poleAxis ); - - } - - renderer.autoClear = autoClear; - - } - - /** - * This is a two-pass Gaussian blur for a cubemap. Normally this is done - * vertically and horizontally, but this breaks down on a cube. Here we apply - * the blur latitudinally (around the poles), and then longitudinally (towards - * the poles) to approximate the orthogonally-separable blur. It is least - * accurate at the poles, but still does a decent job. - */ - _blur( cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis ) { - - const pingPongRenderTarget = this._pingPongRenderTarget; - - this._halfBlur( - cubeUVRenderTarget, - pingPongRenderTarget, - lodIn, - lodOut, - sigma, - 'latitudinal', - poleAxis ); - - this._halfBlur( - pingPongRenderTarget, - cubeUVRenderTarget, - lodOut, - lodOut, - sigma, - 'longitudinal', - poleAxis ); - - } - - _halfBlur( targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis ) { - - const renderer = this._renderer; - const blurMaterial = this._blurMaterial; - - if ( direction !== 'latitudinal' && direction !== 'longitudinal' ) { - - console.error( - 'blur direction must be either latitudinal or longitudinal!' ); - - } - - // Number of standard deviations at which to cut off the discrete approximation. - const STANDARD_DEVIATIONS = 3; - - const blurMesh = new Mesh( _lodPlanes[ lodOut ], blurMaterial ); - const blurUniforms = blurMaterial.uniforms; - - const pixels = _sizeLods[ lodIn ] - 1; - const radiansPerPixel = isFinite( sigmaRadians ) ? Math.PI / ( 2 * pixels ) : 2 * Math.PI / ( 2 * MAX_SAMPLES - 1 ); - const sigmaPixels = sigmaRadians / radiansPerPixel; - const samples = isFinite( sigmaRadians ) ? 1 + Math.floor( STANDARD_DEVIATIONS * sigmaPixels ) : MAX_SAMPLES; - - if ( samples > MAX_SAMPLES ) { - - console.warn( `sigmaRadians, ${ - sigmaRadians}, is too large and will clip, as it requested ${ - samples} samples when the maximum is set to ${MAX_SAMPLES}` ); - - } - - const weights = []; - let sum = 0; - - for ( let i = 0; i < MAX_SAMPLES; ++ i ) { - - const x = i / sigmaPixels; - const weight = Math.exp( - x * x / 2 ); - weights.push( weight ); - - if ( i == 0 ) { - - sum += weight; - - } else if ( i < samples ) { - - sum += 2 * weight; - - } - - } - - for ( let i = 0; i < weights.length; i ++ ) { - - weights[ i ] = weights[ i ] / sum; - - } - - blurUniforms[ 'envMap' ].value = targetIn.texture; - blurUniforms[ 'samples' ].value = samples; - blurUniforms[ 'weights' ].value = weights; - blurUniforms[ 'latitudinal' ].value = direction === 'latitudinal'; - - if ( poleAxis ) { - - blurUniforms[ 'poleAxis' ].value = poleAxis; - - } - - blurUniforms[ 'dTheta' ].value = radiansPerPixel; - blurUniforms[ 'mipInt' ].value = LOD_MAX - lodIn; - blurUniforms[ 'inputEncoding' ].value = ENCODINGS[ targetIn.texture.encoding ]; - blurUniforms[ 'outputEncoding' ].value = ENCODINGS[ targetIn.texture.encoding ]; - - const outputSize = _sizeLods[ lodOut ]; - const x = 3 * Math.max( 0, SIZE_MAX - 2 * outputSize ); - const y = ( lodOut === 0 ? 0 : 2 * SIZE_MAX ) + 2 * outputSize * ( lodOut > LOD_MAX - LOD_MIN ? lodOut - LOD_MAX + LOD_MIN : 0 ); - - _setViewport( targetOut, x, y, 3 * outputSize, 2 * outputSize ); - renderer.setRenderTarget( targetOut ); - renderer.render( blurMesh, _flatCamera ); - - } - -} - -function _isLDR( texture ) { - - if ( texture === undefined || texture.type !== UnsignedByteType ) return false; - - return texture.encoding === LinearEncoding || texture.encoding === sRGBEncoding || texture.encoding === GammaEncoding; - -} - -function _createPlanes() { - - const _lodPlanes = []; - const _sizeLods = []; - const _sigmas = []; - - let lod = LOD_MAX; - - for ( let i = 0; i < TOTAL_LODS; i ++ ) { - - const sizeLod = Math.pow( 2, lod ); - _sizeLods.push( sizeLod ); - let sigma = 1.0 / sizeLod; - - if ( i > LOD_MAX - LOD_MIN ) { - - sigma = EXTRA_LOD_SIGMA[ i - LOD_MAX + LOD_MIN - 1 ]; - - } else if ( i == 0 ) { - - sigma = 0; - - } - - _sigmas.push( sigma ); - - const texelSize = 1.0 / ( sizeLod - 1 ); - const min = - texelSize / 2; - const max = 1 + texelSize / 2; - const uv1 = [ min, min, max, min, max, max, min, min, max, max, min, max ]; - - const cubeFaces = 6; - const vertices = 6; - const positionSize = 3; - const uvSize = 2; - const faceIndexSize = 1; - - const position = new Float32Array( positionSize * vertices * cubeFaces ); - const uv = new Float32Array( uvSize * vertices * cubeFaces ); - const faceIndex = new Float32Array( faceIndexSize * vertices * cubeFaces ); - - for ( let face = 0; face < cubeFaces; face ++ ) { - - const x = ( face % 3 ) * 2 / 3 - 1; - const y = face > 2 ? 0 : - 1; - const coordinates = [ - x, y, 0, - x + 2 / 3, y, 0, - x + 2 / 3, y + 1, 0, - x, y, 0, - x + 2 / 3, y + 1, 0, - x, y + 1, 0 - ]; - position.set( coordinates, positionSize * vertices * face ); - uv.set( uv1, uvSize * vertices * face ); - const fill = [ face, face, face, face, face, face ]; - faceIndex.set( fill, faceIndexSize * vertices * face ); - - } - - const planes = new BufferGeometry(); - planes.setAttribute( 'position', new BufferAttribute( position, positionSize ) ); - planes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) ); - planes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) ); - _lodPlanes.push( planes ); - - if ( lod > LOD_MIN ) { - - lod --; - - } - - } - - return { _lodPlanes, _sizeLods, _sigmas }; - -} - -function _createRenderTarget( params ) { - - const cubeUVRenderTarget = new WebGLRenderTarget( 3 * SIZE_MAX, 3 * SIZE_MAX, params ); - cubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping; - cubeUVRenderTarget.texture.name = 'PMREM.cubeUv'; - cubeUVRenderTarget.scissorTest = true; - return cubeUVRenderTarget; - -} - -function _setViewport( target, x, y, width, height ) { - - target.viewport.set( x, y, width, height ); - target.scissor.set( x, y, width, height ); - -} - -function _getBlurShader( maxSamples ) { - - const weights = new Float32Array( maxSamples ); - const poleAxis = new Vector3( 0, 1, 0 ); - const shaderMaterial = new RawShaderMaterial( { - - name: 'SphericalGaussianBlur', - - defines: { 'n': maxSamples }, - - uniforms: { - 'envMap': { value: null }, - 'samples': { value: 1 }, - 'weights': { value: weights }, - 'latitudinal': { value: false }, - 'dTheta': { value: 0 }, - 'mipInt': { value: 0 }, - 'poleAxis': { value: poleAxis }, - 'inputEncoding': { value: ENCODINGS[ LinearEncoding ] }, - 'outputEncoding': { value: ENCODINGS[ LinearEncoding ] } - }, - - vertexShader: _getCommonVertexShader(), - - fragmentShader: /* glsl */` + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,Yp=`#ifdef USE_TRANSMISSIONMAP + totalTransmission *= texture2D( transmissionMap, vUv ).r; +#endif`,Zp=`#ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; +#endif`,Jp=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) + varying vec2 vUv; +#endif`,jp=`#ifdef USE_UV + #ifdef UVS_VERTEX_ONLY + vec2 vUv; + #else + varying vec2 vUv; + #endif + uniform mat3 uvTransform; +#endif`,$p=`#ifdef USE_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; +#endif`,Qp=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) + varying vec2 vUv2; +#endif`,Kp=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) + attribute vec2 uv2; + varying vec2 vUv2; + uniform mat3 uv2Transform; +#endif`,em=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) + vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; +#endif`,tm=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`,nm=`uniform sampler2D t2D; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + gl_FragColor = mapTexelToLinear( texColor ); + #include + #include +}`,im=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,rm=`#include +uniform float opacity; +varying vec3 vWorldDirection; +#include +void main() { + vec3 vReflect = vWorldDirection; + #include + gl_FragColor = envColor; + gl_FragColor.a *= opacity; + #include + #include +}`,sm=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,om=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + vec4 diffuseColor = vec4( 1.0 ); + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #endif +}`,am=`#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,lm=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +void main () { + #include + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,cm=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,hm=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + vec4 texColor = texture2D( tEquirect, sampleUV ); + gl_FragColor = mapTexelToLinear( texColor ); + #include + #include +}`,um=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,dm=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +void main() { + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + outgoingLight = diffuseColor.rgb; + gl_FragColor = vec4( outgoingLight, diffuseColor.a ); + #include + #include + #include + #include +}`,fm=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include +}`,pm=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + + vec4 lightMapTexel= texture2D( lightMap, vUv2 ); + reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + gl_FragColor = vec4( outgoingLight, diffuseColor.a ); + #include + #include + #include + #include + #include +}`,mm=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_ENVMAP + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,gm=`uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +varying vec3 vLightFront; +varying vec3 vIndirectFront; +#ifdef DOUBLE_SIDED + varying vec3 vLightBack; + varying vec3 vIndirectBack; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #ifdef DOUBLE_SIDED + reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack; + #else + reflectedLight.indirectDiffuse += vIndirectFront; + #endif + #include + reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ); + #ifdef DOUBLE_SIDED + reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack; + #else + reflectedLight.directDiffuse = vLightFront; + #endif + reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask(); + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + gl_FragColor = vec4( outgoingLight, diffuseColor.a ); + #include + #include + #include + #include + #include +}`,xm=`#define LAMBERT +varying vec3 vLightFront; +varying vec3 vIndirectFront; +#ifdef DOUBLE_SIDED + varying vec3 vLightBack; + varying vec3 vIndirectBack; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,ym=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + matcapColor = matcapTexelToLinear( matcapColor ); + #else + vec4 matcapColor = vec4( 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + gl_FragColor = vec4( outgoingLight, diffuseColor.a ); + #include + #include + #include + #include + #include +}`,vm=`#define MATCAP +varying vec3 vViewPosition; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #endif + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,_m=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + gl_FragColor = vec4( outgoingLight, diffuseColor.a ); + #include + #include + #include + #include + #include +}`,wm=`#define TOON +varying vec3 vViewPosition; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include +#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); +#endif + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,bm=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + gl_FragColor = vec4( outgoingLight, diffuseColor.a ); + #include + #include + #include + #include + #include +}`,Mm=`#define PHONG +varying vec3 vViewPosition; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include +#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); +#endif + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,Sm=`#define STANDARD +#ifdef PHYSICAL + #define REFLECTIVITY + #define CLEARCOAT + #define TRANSMISSION +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef TRANSMISSION + uniform float transmission; +#endif +#ifdef REFLECTIVITY + uniform float reflectivity; +#endif +#ifdef CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_SHEEN + uniform vec3 sheen; +#endif +varying vec3 vViewPosition; +#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #ifdef TRANSMISSION + float totalTransmission = transmission; + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #ifdef TRANSMISSION + diffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness ); + #endif + gl_FragColor = vec4( outgoingLight, diffuseColor.a ); + #include + #include + #include + #include + #include +}`,Tm=`#define STANDARD +varying vec3 vViewPosition; +#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include +#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,Em=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) + varying vec3 vViewPosition; +#endif +#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); +}`,Am=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) + varying vec3 vViewPosition; +#endif +#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include +#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) + vViewPosition = - mvPosition.xyz; +#endif +}`,Lm=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +void main() { + #include + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + gl_FragColor = vec4( outgoingLight, diffuseColor.a ); + #include + #include + #include + #include +}`,Rm=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,Cm=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`,Pm=`#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,Im=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + gl_FragColor = vec4( outgoingLight, diffuseColor.a ); + #include + #include + #include +}`,Dm=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); + vec2 scale; + scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); + scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,Ee={alphamap_fragment:ff,alphamap_pars_fragment:pf,alphatest_fragment:mf,aomap_fragment:gf,aomap_pars_fragment:xf,begin_vertex:yf,beginnormal_vertex:vf,bsdfs:_f,bumpmap_pars_fragment:wf,clipping_planes_fragment:bf,clipping_planes_pars_fragment:Mf,clipping_planes_pars_vertex:Sf,clipping_planes_vertex:Tf,color_fragment:Ef,color_pars_fragment:Af,color_pars_vertex:Lf,color_vertex:Rf,common:Cf,cube_uv_reflection_fragment:Pf,defaultnormal_vertex:If,displacementmap_pars_vertex:Df,displacementmap_vertex:Ff,emissivemap_fragment:Nf,emissivemap_pars_fragment:Bf,encodings_fragment:zf,encodings_pars_fragment:Of,envmap_fragment:Uf,envmap_common_pars_fragment:Hf,envmap_pars_fragment:Gf,envmap_pars_vertex:kf,envmap_physical_pars_fragment:Kf,envmap_vertex:Vf,fog_vertex:Wf,fog_pars_vertex:qf,fog_fragment:Xf,fog_pars_fragment:Yf,gradientmap_pars_fragment:Zf,lightmap_fragment:Jf,lightmap_pars_fragment:jf,lights_lambert_vertex:$f,lights_pars_begin:Qf,lights_toon_fragment:ep,lights_toon_pars_fragment:tp,lights_phong_fragment:np,lights_phong_pars_fragment:ip,lights_physical_fragment:rp,lights_physical_pars_fragment:sp,lights_fragment_begin:op,lights_fragment_maps:ap,lights_fragment_end:lp,logdepthbuf_fragment:cp,logdepthbuf_pars_fragment:hp,logdepthbuf_pars_vertex:up,logdepthbuf_vertex:dp,map_fragment:fp,map_pars_fragment:pp,map_particle_fragment:mp,map_particle_pars_fragment:gp,metalnessmap_fragment:xp,metalnessmap_pars_fragment:yp,morphnormal_vertex:vp,morphtarget_pars_vertex:_p,morphtarget_vertex:wp,normal_fragment_begin:bp,normal_fragment_maps:Mp,normalmap_pars_fragment:Sp,clearcoat_normal_fragment_begin:Tp,clearcoat_normal_fragment_maps:Ep,clearcoat_pars_fragment:Ap,packing:Lp,premultiplied_alpha_fragment:Rp,project_vertex:Cp,dithering_fragment:Pp,dithering_pars_fragment:Ip,roughnessmap_fragment:Dp,roughnessmap_pars_fragment:Fp,shadowmap_pars_fragment:Np,shadowmap_pars_vertex:Bp,shadowmap_vertex:zp,shadowmask_pars_fragment:Op,skinbase_vertex:Up,skinning_pars_vertex:Hp,skinning_vertex:Gp,skinnormal_vertex:kp,specularmap_fragment:Vp,specularmap_pars_fragment:Wp,tonemapping_fragment:qp,tonemapping_pars_fragment:Xp,transmissionmap_fragment:Yp,transmissionmap_pars_fragment:Zp,uv_pars_fragment:Jp,uv_pars_vertex:jp,uv_vertex:$p,uv2_pars_fragment:Qp,uv2_pars_vertex:Kp,uv2_vertex:em,worldpos_vertex:tm,background_frag:nm,background_vert:im,cube_frag:rm,cube_vert:sm,depth_frag:om,depth_vert:am,distanceRGBA_frag:lm,distanceRGBA_vert:cm,equirect_frag:hm,equirect_vert:um,linedashed_frag:dm,linedashed_vert:fm,meshbasic_frag:pm,meshbasic_vert:mm,meshlambert_frag:gm,meshlambert_vert:xm,meshmatcap_frag:ym,meshmatcap_vert:vm,meshtoon_frag:_m,meshtoon_vert:wm,meshphong_frag:bm,meshphong_vert:Mm,meshphysical_frag:Sm,meshphysical_vert:Tm,normal_frag:Em,normal_vert:Am,points_frag:Lm,points_vert:Rm,shadow_frag:Cm,shadow_vert:Pm,sprite_frag:Im,sprite_vert:Dm},K={common:{diffuse:{value:new se(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ke},uv2Transform:{value:new Ke},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new W(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new se(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new se(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Ke}},sprite:{diffuse:{value:new se(15658734)},opacity:{value:1},center:{value:new W(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Ke}}},Bt={basic:{uniforms:ht([K.common,K.specularmap,K.envmap,K.aomap,K.lightmap,K.fog]),vertexShader:Ee.meshbasic_vert,fragmentShader:Ee.meshbasic_frag},lambert:{uniforms:ht([K.common,K.specularmap,K.envmap,K.aomap,K.lightmap,K.emissivemap,K.fog,K.lights,{emissive:{value:new se(0)}}]),vertexShader:Ee.meshlambert_vert,fragmentShader:Ee.meshlambert_frag},phong:{uniforms:ht([K.common,K.specularmap,K.envmap,K.aomap,K.lightmap,K.emissivemap,K.bumpmap,K.normalmap,K.displacementmap,K.fog,K.lights,{emissive:{value:new se(0)},specular:{value:new se(1118481)},shininess:{value:30}}]),vertexShader:Ee.meshphong_vert,fragmentShader:Ee.meshphong_frag},standard:{uniforms:ht([K.common,K.envmap,K.aomap,K.lightmap,K.emissivemap,K.bumpmap,K.normalmap,K.displacementmap,K.roughnessmap,K.metalnessmap,K.fog,K.lights,{emissive:{value:new se(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ee.meshphysical_vert,fragmentShader:Ee.meshphysical_frag},toon:{uniforms:ht([K.common,K.aomap,K.lightmap,K.emissivemap,K.bumpmap,K.normalmap,K.displacementmap,K.gradientmap,K.fog,K.lights,{emissive:{value:new se(0)}}]),vertexShader:Ee.meshtoon_vert,fragmentShader:Ee.meshtoon_frag},matcap:{uniforms:ht([K.common,K.bumpmap,K.normalmap,K.displacementmap,K.fog,{matcap:{value:null}}]),vertexShader:Ee.meshmatcap_vert,fragmentShader:Ee.meshmatcap_frag},points:{uniforms:ht([K.points,K.fog]),vertexShader:Ee.points_vert,fragmentShader:Ee.points_frag},dashed:{uniforms:ht([K.common,K.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ee.linedashed_vert,fragmentShader:Ee.linedashed_frag},depth:{uniforms:ht([K.common,K.displacementmap]),vertexShader:Ee.depth_vert,fragmentShader:Ee.depth_frag},normal:{uniforms:ht([K.common,K.bumpmap,K.normalmap,K.displacementmap,{opacity:{value:1}}]),vertexShader:Ee.normal_vert,fragmentShader:Ee.normal_frag},sprite:{uniforms:ht([K.sprite,K.fog]),vertexShader:Ee.sprite_vert,fragmentShader:Ee.sprite_frag},background:{uniforms:{uvTransform:{value:new Ke},t2D:{value:null}},vertexShader:Ee.background_vert,fragmentShader:Ee.background_frag},cube:{uniforms:ht([K.envmap,{opacity:{value:1}}]),vertexShader:Ee.cube_vert,fragmentShader:Ee.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ee.equirect_vert,fragmentShader:Ee.equirect_frag},distanceRGBA:{uniforms:ht([K.common,K.displacementmap,{referencePosition:{value:new _},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ee.distanceRGBA_vert,fragmentShader:Ee.distanceRGBA_frag},shadow:{uniforms:ht([K.lights,K.fog,{color:{value:new se(0)},opacity:{value:1}}]),vertexShader:Ee.shadow_vert,fragmentShader:Ee.shadow_frag}};Bt.physical={uniforms:ht([Bt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new W(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new se(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:Ee.meshphysical_vert,fragmentShader:Ee.meshphysical_frag};function Fm(s,e,t,n,i){let r=new se(0),o=0,a,c,l=null,h=0,u=null;function d(m,x,y,g){let p=x.isScene===!0?x.background:null;p&&p.isTexture&&(p=e.get(p));let w=s.xr,b=w.getSession&&w.getSession();b&&b.environmentBlendMode==="additive"&&(p=null),p===null?f(r,o):p&&p.isColor&&(f(p,1),g=!0),(s.autoClear||g)&&s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil),p&&(p.isCubeTexture||p.mapping===Ei)?(c===void 0&&(c=new je(new ii(1,1,1),new jt({name:"BackgroundCubeMaterial",uniforms:ri(Bt.cube.uniforms),vertexShader:Bt.cube.vertexShader,fragmentShader:Bt.cube.fragmentShader,side:Qe,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(T,v,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=p,c.material.uniforms.flipEnvMap.value=p.isCubeTexture&&p._needsFlipEnvMap?-1:1,(l!==p||h!==p.version||u!==s.toneMapping)&&(c.material.needsUpdate=!0,l=p,h=p.version,u=s.toneMapping),m.unshift(c,c.geometry,c.material,0,0,null)):p&&p.isTexture&&(a===void 0&&(a=new je(new Jr(2,2),new jt({name:"BackgroundMaterial",uniforms:ri(Bt.background.uniforms),vertexShader:Bt.background.vertexShader,fragmentShader:Bt.background.fragmentShader,side:Si,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(a)),a.material.uniforms.t2D.value=p,p.matrixAutoUpdate===!0&&p.updateMatrix(),a.material.uniforms.uvTransform.value.copy(p.matrix),(l!==p||h!==p.version||u!==s.toneMapping)&&(a.material.needsUpdate=!0,l=p,h=p.version,u=s.toneMapping),m.unshift(a,a.geometry,a.material,0,0,null))}function f(m,x){t.buffers.color.setClear(m.r,m.g,m.b,x,i)}return{getClearColor:function(){return r},setClearColor:function(m,x=1){r.set(m),o=x,f(r,o)},getClearAlpha:function(){return o},setClearAlpha:function(m){o=m,f(r,o)},render:d}}function Nm(s,e,t,n){let i=s.getParameter(34921),r=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||r!==null,a={},c=x(null),l=c;function h(R,D,F,P,X){let $=!1;if(o){let Z=m(P,F,D);l!==Z&&(l=Z,d(l.object)),$=y(P,X),$&&g(P,X)}else{let Z=D.wireframe===!0;(l.geometry!==P.id||l.program!==F.id||l.wireframe!==Z)&&(l.geometry=P.id,l.program=F.id,l.wireframe=Z,$=!0)}R.isInstancedMesh===!0&&($=!0),X!==null&&t.update(X,34963),$&&(A(R,D,F,P),X!==null&&s.bindBuffer(34963,t.get(X).buffer))}function u(){return n.isWebGL2?s.createVertexArray():r.createVertexArrayOES()}function d(R){return n.isWebGL2?s.bindVertexArray(R):r.bindVertexArrayOES(R)}function f(R){return n.isWebGL2?s.deleteVertexArray(R):r.deleteVertexArrayOES(R)}function m(R,D,F){let P=F.wireframe===!0,X=a[R.id];X===void 0&&(X={},a[R.id]=X);let $=X[D.id];$===void 0&&($={},X[D.id]=$);let Z=$[P];return Z===void 0&&(Z=x(u()),$[P]=Z),Z}function x(R){let D=[],F=[],P=[];for(let X=0;X=0){let fe=X[oe];if(fe!==void 0){let ve=fe.normalized,G=fe.itemSize,ze=t.get(fe);if(ze===void 0)continue;let Le=ze.buffer,_e=ze.type,pe=ze.bytesPerElement;if(fe.isInterleavedBufferAttribute){let Pe=fe.data,Me=Pe.stride,Ae=fe.offset;Pe&&Pe.isInstancedInterleavedBuffer?(b(re,Pe.meshPerAttribute),P._maxInstanceCount===void 0&&(P._maxInstanceCount=Pe.meshPerAttribute*Pe.count)):w(re),s.bindBuffer(34962,Le),v(re,G,_e,ve,Me*pe,Ae*pe)}else fe.isInstancedBufferAttribute?(b(re,fe.meshPerAttribute),P._maxInstanceCount===void 0&&(P._maxInstanceCount=fe.meshPerAttribute*fe.count)):w(re),s.bindBuffer(34962,Le),v(re,G,_e,ve,0,0)}else if(oe==="instanceMatrix"){let ve=t.get(R.instanceMatrix);if(ve===void 0)continue;let G=ve.buffer,ze=ve.type;b(re+0,1),b(re+1,1),b(re+2,1),b(re+3,1),s.bindBuffer(34962,G),s.vertexAttribPointer(re+0,4,ze,!1,64,0),s.vertexAttribPointer(re+1,4,ze,!1,64,16),s.vertexAttribPointer(re+2,4,ze,!1,64,32),s.vertexAttribPointer(re+3,4,ze,!1,64,48)}else if(oe==="instanceColor"){let ve=t.get(R.instanceColor);if(ve===void 0)continue;let G=ve.buffer,ze=ve.type;b(re,1),s.bindBuffer(34962,G),s.vertexAttribPointer(re,3,ze,!1,12,0)}else if(Z!==void 0){let ve=Z[oe];if(ve!==void 0)switch(ve.length){case 2:s.vertexAttrib2fv(re,ve);break;case 3:s.vertexAttrib3fv(re,ve);break;case 4:s.vertexAttrib4fv(re,ve);break;default:s.vertexAttrib1fv(re,ve)}}}}T()}function L(){U();for(let R in a){let D=a[R];for(let F in D){let P=D[F];for(let X in P)f(P[X].object),delete P[X];delete D[F]}delete a[R]}}function I(R){if(a[R.id]===void 0)return;let D=a[R.id];for(let F in D){let P=D[F];for(let X in P)f(P[X].object),delete P[X];delete D[F]}delete a[R.id]}function N(R){for(let D in a){let F=a[D];if(F[R.id]===void 0)continue;let P=F[R.id];for(let X in P)f(P[X].object),delete P[X];delete F[R.id]}}function U(){z(),l!==c&&(l=c,d(l.object))}function z(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:h,reset:U,resetDefaultState:z,dispose:L,releaseStatesOfGeometry:I,releaseStatesOfProgram:N,initAttributes:p,enableAttribute:w,disableUnusedAttributes:T}}function Bm(s,e,t,n){let i=n.isWebGL2,r;function o(l){r=l}function a(l,h){s.drawArrays(r,l,h),t.update(h,r,1)}function c(l,h,u){if(u===0)return;let d,f;if(i)d=s,f="drawArraysInstanced";else if(d=e.get("ANGLE_instanced_arrays"),f="drawArraysInstancedANGLE",d===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}d[f](r,l,h,u),t.update(h,r,u)}this.setMode=o,this.render=a,this.renderInstances=c}function zm(s,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){let v=e.get("EXT_texture_filter_anisotropic");n=s.getParameter(v.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function r(v){if(v==="highp"){if(s.getShaderPrecisionFormat(35633,36338).precision>0&&s.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";v="mediump"}return v==="mediump"&&s.getShaderPrecisionFormat(35633,36337).precision>0&&s.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}let o=typeof WebGL2RenderingContext!="undefined"&&s instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext!="undefined"&&s instanceof WebGL2ComputeRenderingContext,a=t.precision!==void 0?t.precision:"highp",c=r(a);c!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",c,"instead."),a=c);let l=t.logarithmicDepthBuffer===!0,h=s.getParameter(34930),u=s.getParameter(35660),d=s.getParameter(3379),f=s.getParameter(34076),m=s.getParameter(34921),x=s.getParameter(36347),y=s.getParameter(36348),g=s.getParameter(36349),p=u>0,w=o||e.has("OES_texture_float"),b=p&&w,T=o?s.getParameter(36183):0;return{isWebGL2:o,getMaxAnisotropy:i,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:l,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:f,maxAttributes:m,maxVertexUniforms:x,maxVaryings:y,maxFragmentUniforms:g,vertexTextures:p,floatFragmentTextures:w,floatVertexTextures:b,maxSamples:T}}function Om(s){let e=this,t=null,n=0,i=!1,r=!1,o=new Lt,a=new Ke,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d,f){let m=u.length!==0||d||n!==0||i;return i=d,t=h(u,f,0),n=u.length,m},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1,l()},this.setState=function(u,d,f){let m=u.clippingPlanes,x=u.clipIntersection,y=u.clipShadows,g=s.get(u);if(!i||m===null||m.length===0||r&&!y)r?h(null):l();else{let p=r?0:n,w=p*4,b=g.clippingState||null;c.value=b,b=h(m,d,w,f);for(let T=0;T!==w;++T)b[T]=t[T];g.clippingState=b,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=p}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,f,m){let x=u!==null?u.length:0,y=null;if(x!==0){if(y=c.value,m!==!0||y===null){let g=f+x*4,p=d.matrixWorldInverse;a.getNormalMatrix(p),(y===null||y.length0){let l=s.getRenderTarget(),h=new Yr(c.height/2);return h.fromEquirectangularTexture(s,o),e.set(o,h),s.setRenderTarget(l),o.addEventListener("dispose",i),t(h.texture,o.mapping)}else return null}}return o}function i(o){let a=o.target;a.removeEventListener("dispose",i);let c=e.get(a);c!==void 0&&(e.delete(a),c.dispose())}function r(){e=new WeakMap}return{get:n,dispose:r}}function Hm(s){let e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=s.getExtension("WEBGL_depth_texture")||s.getExtension("MOZ_WEBGL_depth_texture")||s.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=s.getExtension("EXT_texture_filter_anisotropic")||s.getExtension("MOZ_EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=s.getExtension("WEBGL_compressed_texture_s3tc")||s.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=s.getExtension("WEBGL_compressed_texture_pvrtc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=s.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float")},get:function(n){let i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function Gm(s,e,t,n){let i={},r=new WeakMap;function o(u){let d=u.target;d.index!==null&&e.remove(d.index);for(let m in d.attributes)e.remove(d.attributes[m]);d.removeEventListener("dispose",o),delete i[d.id];let f=r.get(d);f&&(e.remove(f),r.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(u,d){return i[d.id]===!0||(d.addEventListener("dispose",o),i[d.id]=!0,t.memory.geometries++),d}function c(u){let d=u.attributes;for(let m in d)e.update(d[m],34962);let f=u.morphAttributes;for(let m in f){let x=f[m];for(let y=0,g=x.length;y65535?zr:Br)(d,1);y.version=x;let g=r.get(u);g&&e.remove(g),r.set(u,y)}function h(u){let d=r.get(u);if(d){let f=u.index;f!==null&&d.version0)return s;let i=e*t,r=jl[i];if(r===void 0&&(r=new Float32Array(i),jl[i]=r),e!==0){n.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,s[o].toArray(r,a)}return r}function pt(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t/gm;function Lo(s){return s.replace(Vg,Wg)}function Wg(s,e){let t=Ee[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return Lo(t)}var qg=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Xg=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function uc(s){return s.replace(Xg,hc).replace(qg,Yg)}function Yg(s,e,t,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),hc(s,e,t,n)}function hc(s,e,t,n){let i="";for(let r=parseInt(e);r0?s.gammaFactor:1,f=t.isWebGL2?"":Hg(t),m=Gg(r),x=i.createProgram(),y,g,p=t.glslVersion?"#version "+t.glslVersion+` +`:"";t.isRawShaderMaterial?(y=[m].filter(Vi).join(` +`),y.length>0&&(y+=` +`),g=[f,m].filter(Vi).join(` +`),g.length>0&&(g+=` +`)):(y=[dc(t),"#define SHADER_NAME "+t.shaderName,m,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+t.maxBones,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.useVertexTexture?"#define BONE_TEXTURE":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Vi).join(` +`),g=[f,dc(t),"#define SHADER_NAME "+t.shaderName,m,t.alphaTest?"#define ALPHATEST "+t.alphaTest+(t.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+d,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.sheen?"#define USE_SHEEN":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==kn?"#define TONE_MAPPING":"",t.toneMapping!==kn?Ee.tonemapping_pars_fragment:"",t.toneMapping!==kn?Ug("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",Ee.encodings_pars_fragment,t.map?ki("mapTexelToLinear",t.mapEncoding):"",t.matcap?ki("matcapTexelToLinear",t.matcapEncoding):"",t.envMap?ki("envMapTexelToLinear",t.envMapEncoding):"",t.emissiveMap?ki("emissiveMapTexelToLinear",t.emissiveMapEncoding):"",t.lightMap?ki("lightMapTexelToLinear",t.lightMapEncoding):"",Og("linearToOutputTexel",t.outputEncoding),t.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Vi).join(` +`)),o=Lo(o),o=lc(o,t),o=cc(o,t),a=Lo(a),a=lc(a,t),a=cc(a,t),o=uc(o),a=uc(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(p=`#version 300 es +`,y=["#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+y,g=["#define varying in",t.glslVersion===Ml?"":"out highp vec4 pc_fragColor;",t.glslVersion===Ml?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+g);let w=p+y+o,b=p+g+a,T=sc(i,35633,w),v=sc(i,35632,b);if(i.attachShader(x,T),i.attachShader(x,v),t.index0AttributeName!==void 0?i.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(x,0,"position"),i.linkProgram(x),s.debug.checkShaderErrors){let I=i.getProgramInfoLog(x).trim(),N=i.getShaderInfoLog(T).trim(),U=i.getShaderInfoLog(v).trim(),z=!0,R=!0;if(i.getProgramParameter(x,35714)===!1){z=!1;let D=ac(i,T,"vertex"),F=ac(i,v,"fragment");console.error("THREE.WebGLProgram: shader error: ",i.getError(),"35715",i.getProgramParameter(x,35715),"gl.getProgramInfoLog",I,D,F)}else I!==""?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",I):(N===""||U==="")&&(R=!1);R&&(this.diagnostics={runnable:z,programLog:I,vertexShader:{log:N,prefix:y},fragmentShader:{log:U,prefix:g}})}i.deleteShader(T),i.deleteShader(v);let A;this.getUniforms=function(){return A===void 0&&(A=new fn(i,x)),A};let L;return this.getAttributes=function(){return L===void 0&&(L=kg(i,x)),L},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(x),this.program=void 0},this.name=t.shaderName,this.id=Bg++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=T,this.fragmentShader=v,this}function Kg(s,e,t,n,i,r){let o=[],a=n.isWebGL2,c=n.logarithmicDepthBuffer,l=n.floatVertexTextures,h=n.maxVertexUniforms,u=n.vertexTextures,d=n.precision,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},m=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function x(v){let L=v.skeleton.bones;if(l)return 1024;{let N=Math.floor((h-20)/4),U=Math.min(N,L.length);return U0,maxBones:F,useVertexTexture:l,morphTargets:v.morphTargets,morphNormals:v.morphNormals,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:v.dithering,shadowMapEnabled:s.shadowMap.enabled&&L.length>0,shadowMapType:s.shadowMap.type,toneMapping:v.toneMapped?s.toneMapping:kn,physicallyCorrectLights:s.physicallyCorrectLights,premultipliedAlpha:v.premultipliedAlpha,alphaTest:v.alphaTest,doubleSided:v.side===fr,flipSided:v.side===Qe,depthPacking:v.depthPacking!==void 0?v.depthPacking:!1,index0AttributeName:v.index0AttributeName,extensionDerivatives:v.extensions&&v.extensions.derivatives,extensionFragDepth:v.extensions&&v.extensions.fragDepth,extensionDrawBuffers:v.extensions&&v.extensions.drawBuffers,extensionShaderTextureLOD:v.extensions&&v.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||t.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||t.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||t.has("EXT_shader_texture_lod"),customProgramCacheKey:v.customProgramCacheKey()}}function p(v){let A=[];if(v.shaderID?A.push(v.shaderID):(A.push(v.fragmentShader),A.push(v.vertexShader)),v.defines!==void 0)for(let L in v.defines)A.push(L),A.push(v.defines[L]);if(v.isRawShaderMaterial===!1){for(let L=0;L1&&n.sort(d||tx),i.length>1&&i.sort(f||nx)}function u(){for(let d=t,f=e.length;d=e.get(i).length?(o=new fc(s),e.get(i).push(o)):o=e.get(i)[r],o}function n(){e=new WeakMap}return{get:t,dispose:n}}function rx(){let s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new _,color:new se};break;case"SpotLight":t={position:new _,direction:new _,color:new se,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new _,color:new se,distance:0,decay:0};break;case"HemisphereLight":t={direction:new _,skyColor:new se,groundColor:new se};break;case"RectAreaLight":t={color:new se,position:new _,halfWidth:new _,halfHeight:new _};break}return s[e.id]=t,t}}}function sx(){let s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new W};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new W};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new W,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}var ox=0;function ax(s,e){return(e.castShadow?1:0)-(s.castShadow?1:0)}function lx(s,e){let t=new rx,n=sx(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let h=0;h<9;h++)i.probe.push(new _);let r=new _,o=new le,a=new le;function c(h){let u=0,d=0,f=0;for(let A=0;A<9;A++)i.probe[A].set(0,0,0);let m=0,x=0,y=0,g=0,p=0,w=0,b=0,T=0;h.sort(ax);for(let A=0,L=h.length;A0&&(e.isWebGL2||s.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=K.LTC_FLOAT_1,i.rectAreaLTC2=K.LTC_FLOAT_2):s.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=K.LTC_HALF_1,i.rectAreaLTC2=K.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=u,i.ambient[1]=d,i.ambient[2]=f;let v=i.hash;(v.directionalLength!==m||v.pointLength!==x||v.spotLength!==y||v.rectAreaLength!==g||v.hemiLength!==p||v.numDirectionalShadows!==w||v.numPointShadows!==b||v.numSpotShadows!==T)&&(i.directional.length=m,i.spot.length=y,i.rectArea.length=g,i.point.length=x,i.hemi.length=p,i.directionalShadow.length=w,i.directionalShadowMap.length=w,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=T,i.spotShadowMap.length=T,i.directionalShadowMatrix.length=w,i.pointShadowMatrix.length=b,i.spotShadowMatrix.length=T,v.directionalLength=m,v.pointLength=x,v.spotLength=y,v.rectAreaLength=g,v.hemiLength=p,v.numDirectionalShadows=w,v.numPointShadows=b,v.numSpotShadows=T,i.version=ox++)}function l(h,u){let d=0,f=0,m=0,x=0,y=0,g=u.matrixWorldInverse;for(let p=0,w=h.length;p=t.get(r).length?(a=new pc(s,e),t.get(r).push(a)):a=t.get(r)[o],a}function i(){t=new WeakMap}return{get:n,dispose:i}}var jr=class extends tt{constructor(e){super();this.type="MeshDepthMaterial",this.depthPacking=Pd,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}};jr.prototype.isMeshDepthMaterial=!0;var $r=class extends tt{constructor(e){super();this.type="MeshDistanceMaterial",this.referencePosition=new _,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};$r.prototype.isMeshDistanceMaterial=!0;var hx=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + float mean = 0.0; + float squared_mean = 0.0; + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) ); + for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) { + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean * HALF_SAMPLE_RATE; + squared_mean = squared_mean * HALF_SAMPLE_RATE; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`,ux=`void main() { + gl_Position = vec4( position, 1.0 ); +}`;function mc(s,e,t){let n=new Gi,i=new W,r=new W,o=new Fe,a=[],c=[],l={},h=t.maxTextureSize,u={0:Qe,1:Si,2:fr},d=new jt({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new W},radius:{value:4}},vertexShader:ux,fragmentShader:hx}),f=d.clone();f.defines.HORIZONTAL_PASS=1;let m=new ue;m.setAttribute("position",new Te(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let x=new je(m,d),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ka,this.render=function(v,A,L){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||v.length===0)return;let I=s.getRenderTarget(),N=s.getActiveCubeFace(),U=s.getActiveMipmapLevel(),z=s.state;z.setBlending(en),z.buffers.color.setClear(1,1,1,1),z.buffers.depth.setTest(!0),z.setScissorTest(!1);for(let R=0,D=v.length;Rh||i.y>h)&&(i.x>h&&(r.x=Math.floor(h/X.x),i.x=r.x*X.x,P.mapSize.x=r.x),i.y>h&&(r.y=Math.floor(h/X.y),i.y=r.y*X.y,P.mapSize.y=r.y)),P.map===null&&!P.isPointLightShadow&&this.type===Mi){let Z={minFilter:it,magFilter:it,format:Tt};P.map=new Vt(i.x,i.y,Z),P.map.texture.name=F.name+".shadowMap",P.mapPass=new Vt(i.x,i.y,Z),P.camera.updateProjectionMatrix()}if(P.map===null){let Z={minFilter:nt,magFilter:nt,format:Tt};P.map=new Vt(i.x,i.y,Z),P.map.texture.name=F.name+".shadowMap",P.camera.updateProjectionMatrix()}s.setRenderTarget(P.map),s.clear();let $=P.getViewportCount();for(let Z=0;Z<$;Z++){let oe=P.getViewport(Z);o.set(r.x*oe.x,r.y*oe.y,r.x*oe.z,r.y*oe.w),z.viewport(o),P.updateMatrices(F,Z),n=P.getFrustum(),T(A,L,P.camera,F,this.type)}!P.isPointLightShadow&&this.type===Mi&&g(P,L),P.needsUpdate=!1}y.needsUpdate=!1,s.setRenderTarget(I,N,U)};function g(v,A){let L=e.update(x);d.uniforms.shadow_pass.value=v.map.texture,d.uniforms.resolution.value=v.mapSize,d.uniforms.radius.value=v.radius,s.setRenderTarget(v.mapPass),s.clear(),s.renderBufferDirect(A,null,L,d,x,null),f.uniforms.shadow_pass.value=v.mapPass.texture,f.uniforms.resolution.value=v.mapSize,f.uniforms.radius.value=v.radius,s.setRenderTarget(v.map),s.clear(),s.renderBufferDirect(A,null,L,f,x,null)}function p(v,A,L){let I=v<<0|A<<1|L<<2,N=a[I];return N===void 0&&(N=new jr({depthPacking:Id,morphTargets:v,skinning:A}),a[I]=N),N}function w(v,A,L){let I=v<<0|A<<1|L<<2,N=c[I];return N===void 0&&(N=new $r({morphTargets:v,skinning:A}),c[I]=N),N}function b(v,A,L,I,N,U,z){let R=null,D=p,F=v.customDepthMaterial;if(I.isPointLight===!0&&(D=w,F=v.customDistanceMaterial),F===void 0){let P=!1;L.morphTargets===!0&&(P=A.morphAttributes&&A.morphAttributes.position&&A.morphAttributes.position.length>0);let X=!1;v.isSkinnedMesh===!0&&(L.skinning===!0?X=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",v));let $=v.isInstancedMesh===!0;R=D(P,X,$)}else R=F;if(s.localClippingEnabled&&L.clipShadows===!0&&L.clippingPlanes.length!==0){let P=R.uuid,X=L.uuid,$=l[P];$===void 0&&($={},l[P]=$);let Z=$[X];Z===void 0&&(Z=R.clone(),$[X]=Z),R=Z}return R.visible=L.visible,R.wireframe=L.wireframe,z===Mi?R.side=L.shadowSide!==null?L.shadowSide:L.side:R.side=L.shadowSide!==null?L.shadowSide:u[L.side],R.clipShadows=L.clipShadows,R.clippingPlanes=L.clippingPlanes,R.clipIntersection=L.clipIntersection,R.wireframeLinewidth=L.wireframeLinewidth,R.linewidth=L.linewidth,I.isPointLight===!0&&R.isMeshDistanceMaterial===!0&&(R.referencePosition.setFromMatrixPosition(I.matrixWorld),R.nearDistance=N,R.farDistance=U),R}function T(v,A,L,I,N){if(v.visible===!1)return;if(v.layers.test(A.layers)&&(v.isMesh||v.isLine||v.isPoints)&&(v.castShadow||v.receiveShadow&&N===Mi)&&(!v.frustumCulled||n.intersectsObject(v))){v.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse,v.matrixWorld);let R=e.update(v),D=v.material;if(Array.isArray(D)){let F=R.groups;for(let P=0,X=F.length;P=1):F.indexOf("OpenGL ES")!==-1&&(D=parseFloat(/^OpenGL ES (\d)/.exec(F)[1]),R=D>=2);let P=null,X={},$=new Fe(0,0,s.canvas.width,s.canvas.height),Z=new Fe(0,0,s.canvas.width,s.canvas.height);function oe(C,J,Q){let de=new Uint8Array(4),q=s.createTexture();s.bindTexture(C,q),s.texParameteri(C,10241,9728),s.texParameteri(C,10240,9728);for(let me=0;meV||E.height>V)&&(ie=V/Math.max(E.width,E.height)),ie<1||S===!0)if(typeof HTMLImageElement!="undefined"&&E instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&E instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&E instanceof ImageBitmap){let ce=S?Tl:Math.floor,Ie=ce(ie*E.width),ge=ce(ie*E.height);f===void 0&&(f=x(Ie,ge));let C=k?x(Ie,ge):f;return C.width=Ie,C.height=ge,C.getContext("2d").drawImage(E,0,0,Ie,ge),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+E.width+"x"+E.height+") to ("+Ie+"x"+ge+")."),C}else return"data"in E&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+E.width+"x"+E.height+")."),E;return E}function g(E){return Ks(E.width)&&Ks(E.height)}function p(E){return a?!1:E.wrapS!==xt||E.wrapT!==xt||E.minFilter!==nt&&E.minFilter!==it}function w(E,S){return E.generateMipmaps&&S&&E.minFilter!==nt&&E.minFilter!==it}function b(E,S,k,V){s.generateMipmap(E);let ie=n.get(S);ie.__maxMipLevel=Math.log2(Math.max(k,V))}function T(E,S,k){if(a===!1)return S;if(E!==null){if(s[E]!==void 0)return s[E];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+E+"'")}let V=S;return S===6403&&(k===5126&&(V=33326),k===5131&&(V=33325),k===5121&&(V=33321)),S===6407&&(k===5126&&(V=34837),k===5131&&(V=34843),k===5121&&(V=32849)),S===6408&&(k===5126&&(V=34836),k===5131&&(V=34842),k===5121&&(V=32856)),(V===33325||V===33326||V===34842||V===34836)&&e.get("EXT_color_buffer_float"),V}function v(E){return E===nt||E===qs||E===Xs?9728:9729}function A(E){let S=E.target;S.removeEventListener("dispose",A),I(S),S.isVideoTexture&&d.delete(S),o.memory.textures--}function L(E){let S=E.target;S.removeEventListener("dispose",L),N(S),o.memory.textures--}function I(E){let S=n.get(E);S.__webglInit!==void 0&&(s.deleteTexture(S.__webglTexture),n.remove(E))}function N(E){let S=E.texture,k=n.get(E),V=n.get(S);if(!!E){if(V.__webglTexture!==void 0&&s.deleteTexture(V.__webglTexture),E.depthTexture&&E.depthTexture.dispose(),E.isWebGLCubeRenderTarget)for(let ie=0;ie<6;ie++)s.deleteFramebuffer(k.__webglFramebuffer[ie]),k.__webglDepthbuffer&&s.deleteRenderbuffer(k.__webglDepthbuffer[ie]);else s.deleteFramebuffer(k.__webglFramebuffer),k.__webglDepthbuffer&&s.deleteRenderbuffer(k.__webglDepthbuffer),k.__webglMultisampledFramebuffer&&s.deleteFramebuffer(k.__webglMultisampledFramebuffer),k.__webglColorRenderbuffer&&s.deleteRenderbuffer(k.__webglColorRenderbuffer),k.__webglDepthRenderbuffer&&s.deleteRenderbuffer(k.__webglDepthRenderbuffer);n.remove(S),n.remove(E)}}let U=0;function z(){U=0}function R(){let E=U;return E>=c&&console.warn("THREE.WebGLTextures: Trying to use "+E+" texture units while this GPU supports only "+c),U+=1,E}function D(E,S){let k=n.get(E);if(E.isVideoTexture&&Y(E),E.version>0&&k.__version!==E.version){let V=E.image;if(V===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(V.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{fe(k,E,S);return}}t.activeTexture(33984+S),t.bindTexture(3553,k.__webglTexture)}function F(E,S){let k=n.get(E);if(E.version>0&&k.__version!==E.version){fe(k,E,S);return}t.activeTexture(33984+S),t.bindTexture(35866,k.__webglTexture)}function P(E,S){let k=n.get(E);if(E.version>0&&k.__version!==E.version){fe(k,E,S);return}t.activeTexture(33984+S),t.bindTexture(32879,k.__webglTexture)}function X(E,S){let k=n.get(E);if(E.version>0&&k.__version!==E.version){ve(k,E,S);return}t.activeTexture(33984+S),t.bindTexture(34067,k.__webglTexture)}let $={[yr]:10497,[xt]:33071,[vr]:33648},Z={[nt]:9728,[qs]:9984,[Xs]:9986,[it]:9729,[ll]:9985,[Ai]:9987};function oe(E,S,k){if(k?(s.texParameteri(E,10242,$[S.wrapS]),s.texParameteri(E,10243,$[S.wrapT]),(E===32879||E===35866)&&s.texParameteri(E,32882,$[S.wrapR]),s.texParameteri(E,10240,Z[S.magFilter]),s.texParameteri(E,10241,Z[S.minFilter])):(s.texParameteri(E,10242,33071),s.texParameteri(E,10243,33071),(E===32879||E===35866)&&s.texParameteri(E,32882,33071),(S.wrapS!==xt||S.wrapT!==xt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),s.texParameteri(E,10240,v(S.magFilter)),s.texParameteri(E,10241,v(S.minFilter)),S.minFilter!==nt&&S.minFilter!==it&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){let V=e.get("EXT_texture_filter_anisotropic");if(S.type===tn&&e.has("OES_texture_float_linear")===!1||a===!1&&S.type===br&&e.has("OES_texture_half_float_linear")===!1)return;(S.anisotropy>1||n.get(S).__currentAnisotropy)&&(s.texParameterf(E,V.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,i.getMaxAnisotropy())),n.get(S).__currentAnisotropy=S.anisotropy)}}function re(E,S){E.__webglInit===void 0&&(E.__webglInit=!0,S.addEventListener("dispose",A),E.__webglTexture=s.createTexture(),o.memory.textures++)}function fe(E,S,k){let V=3553;S.isDataTexture2DArray&&(V=35866),S.isDataTexture3D&&(V=32879),re(E,S),t.activeTexture(33984+k),t.bindTexture(V,E.__webglTexture),s.pixelStorei(37440,S.flipY),s.pixelStorei(37441,S.premultiplyAlpha),s.pixelStorei(3317,S.unpackAlignment),s.pixelStorei(37443,0);let ie=p(S)&&g(S.image)===!1,ce=y(S.image,ie,!1,h),Ie=g(ce)||a,ge=r.convert(S.format),C=r.convert(S.type),J=T(S.internalFormat,ge,C);oe(V,S,Ie);let Q,de=S.mipmaps;if(S.isDepthTexture)J=6402,a?S.type===tn?J=36012:S.type===wr?J=33190:S.type===Ri?J=35056:J=33189:S.type===tn&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),S.format===Vn&&J===6402&&S.type!==_r&&S.type!==wr&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),S.type=_r,C=r.convert(S.type)),S.format===Ci&&J===6402&&(J=34041,S.type!==Ri&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),S.type=Ri,C=r.convert(S.type))),t.texImage2D(3553,0,J,ce.width,ce.height,0,ge,C,null);else if(S.isDataTexture)if(de.length>0&&Ie){for(let q=0,me=de.length;q0&&Ie){for(let q=0,me=de.length;qf+m?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=f-m&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1));return a!==null&&(a.visible=i!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=o!==null),this}},gc=class extends nn{constructor(e,t){super();let n=this,i=e.state,r=null,o=1,a=null,c="local-floor",l=null,h=[],u=new Map,d=new ot;d.layers.enable(1),d.viewport=new Fe;let f=new ot;f.layers.enable(2),f.viewport=new Fe;let m=[d,f],x=new Ro;x.layers.enable(1),x.layers.enable(2);let y=null,g=null;this.enabled=!1,this.isPresenting=!1,this.getController=function(z){let R=h[z];return R===void 0&&(R=new Qr,h[z]=R),R.getTargetRaySpace()},this.getControllerGrip=function(z){let R=h[z];return R===void 0&&(R=new Qr,h[z]=R),R.getGripSpace()},this.getHand=function(z){let R=h[z];return R===void 0&&(R=new Qr,h[z]=R),R.getHandSpace()};function p(z){let R=u.get(z.inputSource);R&&R.dispatchEvent({type:z.type,data:z.inputSource})}function w(){u.forEach(function(z,R){z.disconnect(R)}),u.clear(),y=null,g=null,i.bindXRFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),U.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(z){o=z,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(z){c=z,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a},this.getSession=function(){return r},this.setSession=async function(z){if(r=z,r!==null){r.addEventListener("select",p),r.addEventListener("selectstart",p),r.addEventListener("selectend",p),r.addEventListener("squeeze",p),r.addEventListener("squeezestart",p),r.addEventListener("squeezeend",p),r.addEventListener("end",w),r.addEventListener("inputsourceschange",b);let R=t.getContextAttributes();R.xrCompatible!==!0&&await t.makeXRCompatible();let D={antialias:R.antialias,alpha:R.alpha,depth:R.depth,stencil:R.stencil,framebufferScaleFactor:o},F=new XRWebGLLayer(r,t,D);r.updateRenderState({baseLayer:F}),a=await r.requestReferenceSpace(c),U.setContext(r),U.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};function b(z){let R=r.inputSources;for(let D=0;D0&&Ya(Re,M,O),xe.length>0&&Ya(xe,M,O),w!==null&&(Ae.updateRenderTargetMipmap(w),Ae.updateMultisampleRenderTarget(w)),M.isScene===!0&&M.onAfterRender(x,M,O),pe.buffers.depth.setTest(!0),pe.buffers.depth.setMask(!0),pe.buffers.color.setMask(!0),pe.setPolygonOffset(!1),Q.resetDefaultState(),b=-1,T=null,m.pop(),m.length>0?d=m[m.length-1]:d=null,f.pop(),f.length>0?u=f[f.length-1]:u=null};function Xa(M,O,B,H){if(M.visible===!1)return;if(M.layers.test(O.layers)){if(M.isGroup)B=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(O);else if(M.isLight)d.pushLight(M),M.castShadow&&d.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||X.intersectsSprite(M)){H&&re.setFromMatrixPosition(M.matrixWorld).applyMatrix4(oe);let xe=he.update(M),be=M.material;be.visible&&u.push(M,xe,be,B,re.z,null)}}else if(M.isImmediateRenderObject)H&&re.setFromMatrixPosition(M.matrixWorld).applyMatrix4(oe),u.push(M,null,M.material,B,re.z,null);else if((M.isMesh||M.isLine||M.isPoints)&&(M.isSkinnedMesh&&M.skeleton.frame!==Pe.render.frame&&(M.skeleton.update(),M.skeleton.frame=Pe.render.frame),!M.frustumCulled||X.intersectsObject(M))){H&&re.setFromMatrixPosition(M.matrixWorld).applyMatrix4(oe);let xe=he.update(M),be=M.material;if(Array.isArray(be)){let Oe=xe.groups;for(let we=0,De=Oe.length;we=0&&O<=M.width-H&&B>=0&&B<=M.height-te&&G.readPixels(O,B,H,te,J.convert(we),J.convert(De),Re):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{let Oe=w!==null?Me.get(w).__webglFramebuffer:null;pe.bindFramebuffer(36160,Oe)}}},this.copyFramebufferToTexture=function(M,O,B=0){let H=Math.pow(2,-B),te=Math.floor(O.image.width*H),Re=Math.floor(O.image.height*H),xe=J.convert(O.format);Ae.setTexture2D(O,0),G.copyTexImage2D(3553,B,xe,M.x,M.y,te,Re,0),pe.unbindTexture()},this.copyTextureToTexture=function(M,O,B,H=0){let te=O.image.width,Re=O.image.height,xe=J.convert(B.format),be=J.convert(B.type);Ae.setTexture2D(B,0),G.pixelStorei(37440,B.flipY),G.pixelStorei(37441,B.premultiplyAlpha),G.pixelStorei(3317,B.unpackAlignment),O.isDataTexture?G.texSubImage2D(3553,H,M.x,M.y,te,Re,xe,be,O.image.data):O.isCompressedTexture?G.compressedTexSubImage2D(3553,H,M.x,M.y,O.mipmaps[0].width,O.mipmaps[0].height,xe,O.mipmaps[0].data):G.texSubImage2D(3553,H,M.x,M.y,xe,be,O.image),H===0&&B.generateMipmaps&&G.generateMipmap(3553),pe.unbindTexture()},this.copyTextureToTexture3D=function(M,O,B,H,te=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let{width:Re,height:xe,data:be}=B.image,Oe=J.convert(H.format),we=J.convert(H.type),De;if(H.isDataTexture3D)Ae.setTexture3D(H,0),De=32879;else if(H.isDataTexture2DArray)Ae.setTexture2DArray(H,0),De=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}G.pixelStorei(37440,H.flipY),G.pixelStorei(37441,H.premultiplyAlpha),G.pixelStorei(3317,H.unpackAlignment);let ye=G.getParameter(3314),Be=G.getParameter(32878),Ft=G.getParameter(3316),ft=G.getParameter(3315),bn=G.getParameter(32877);G.pixelStorei(3314,Re),G.pixelStorei(32878,xe),G.pixelStorei(3316,M.min.x),G.pixelStorei(3315,M.min.y),G.pixelStorei(32877,M.min.z),G.texSubImage3D(De,te,O.x,O.y,O.z,M.max.x-M.min.x+1,M.max.y-M.min.y+1,M.max.z-M.min.z+1,Oe,we,be),G.pixelStorei(3314,ye),G.pixelStorei(32878,Be),G.pixelStorei(3316,Ft),G.pixelStorei(3315,ft),G.pixelStorei(32877,bn),te===0&&H.generateMipmaps&&G.generateMipmap(De),pe.unbindTexture()},this.initTexture=function(M){Ae.setTexture2D(M,0),pe.unbindTexture()},this.resetState=function(){g=0,p=0,w=null,pe.reset(),Q.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}var xc=class extends Ue{};xc.prototype.isWebGL1Renderer=!0;var Wi=class{constructor(e,t=25e-5){this.name="",this.color=new se(e),this.density=t}clone(){return new Wi(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}};Wi.prototype.isFogExp2=!0;var qi=class{constructor(e,t=1,n=1e3){this.name="",this.color=new se(e),this.near=t,this.far=n}clone(){return new qi(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}};qi.prototype.isFog=!0;var Kr=class extends Se{constructor(){super();this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.background!==null&&(t.object.background=this.background.toJSON(e)),this.environment!==null&&(t.object.environment=this.environment.toJSON(e)),this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}};Kr.prototype.isScene=!0;var $t=class{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Pi,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=wt(),this.onUploadCallback=function(){}}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;ie.far||t.push({distance:c,point:Xi.clone(),uv:qe.getUV(Xi,ts,Zi,ns,vc,Co,_c,new W),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};is.prototype.isSprite=!0;function rs(s,e,t,n,i,r){pi.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(Yi.x=r*pi.x-i*pi.y,Yi.y=i*pi.x+r*pi.y):Yi.copy(pi),s.copy(e),s.x+=Yi.x,s.y+=Yi.y,s.applyMatrix4(yc)}var ss=new _,wc=new _,bc=class extends Se{constructor(){super();this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);let t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){ss.setFromMatrixPosition(this.matrixWorld);let i=e.ray.origin.distanceTo(ss);this.getObjectForDistance(i).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){ss.setFromMatrixPosition(e.matrixWorld),wc.setFromMatrixPosition(this.matrixWorld);let n=ss.distanceTo(wc)/e.zoom;t[0].object.visible=!0;let i,r;for(i=1,r=t.length;i=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;ic)continue;d.applyMatrix4(this.matrixWorld);let L=e.ray.origin.distanceTo(d);Le.far||t.push({distance:L,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}else{let g=Math.max(0,o.start),p=Math.min(y.count,o.start+o.count);for(let w=g,b=p-1;wc)continue;d.applyMatrix4(this.matrixWorld);let v=e.ray.origin.distanceTo(d);ve.far||t.push({distance:v,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};Qt.prototype.isLine=!0;var Dc=new _,Fc=new _,_t=class extends Qt{constructor(e,t){super(e,t);this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,n=[];for(let i=0,r=t.count;i0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};ji.prototype.isPoints=!0;function Bc(s,e,t,n,i,r,o){let a=Fo.distanceSqToPoint(s);if(ai.far)return;r.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,object:o})}}var zc=class extends et{constructor(e,t,n,i,r,o,a,c,l){super(e,t,n,i,r,o,a,c,l);this.format=a!==void 0?a:Sn,this.minFilter=o!==void 0?o:it,this.magFilter=r!==void 0?r:it,this.generateMipmaps=!1;let h=this;function u(){h.needsUpdate=!0,e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(u)}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}};zc.prototype.isVideoTexture=!0;var No=class extends et{constructor(e,t,n,i,r,o,a,c,l,h,u,d){super(null,o,a,c,l,h,i,r,u,d);this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};No.prototype.isCompressedTexture=!0;var Oc=class extends et{constructor(e,t,n,i,r,o,a,c,l){super(e,t,n,i,r,o,a,c,l);this.needsUpdate=!0}};Oc.prototype.isCanvasTexture=!0;var Uc=class extends et{constructor(e,t,n,i,r,o,a,c,l,h){if(h=h!==void 0?h:Vn,h!==Vn&&h!==Ci)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===Vn&&(n=_r),n===void 0&&h===Ci&&(n=Ri),super(null,i,r,o,a,c,h,n,l),this.image={width:e,height:t},this.magFilter=a!==void 0?a:nt,this.minFilter=c!==void 0?c:nt,this.flipY=!1,this.generateMipmaps=!1}};Uc.prototype.isDepthTexture=!0;var Bo=class extends ue{constructor(e=1,t=8,n=0,i=Math.PI*2){super();this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);let r=[],o=[],a=[],c=[],l=new _,h=new W;o.push(0,0,0),a.push(0,0,1),c.push(.5,.5);for(let u=0,d=3;u<=t;u++,d+=3){let f=n+u/t*i;l.x=e*Math.cos(f),l.y=e*Math.sin(f),o.push(l.x,l.y,l.z),a.push(0,0,1),h.x=(o[d]/e+1)/2,h.y=(o[d+1]/e+1)/2,c.push(h.x,h.y)}for(let u=1;u<=t;u++)r.push(u,u+1,0);this.setIndex(r),this.setAttribute("position",new ae(o,3)),this.setAttribute("normal",new ae(a,3)),this.setAttribute("uv",new ae(c,2))}},$i=class extends ue{constructor(e=1,t=1,n=1,i=8,r=1,o=!1,a=0,c=Math.PI*2){super();this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:c};let l=this;i=Math.floor(i),r=Math.floor(r);let h=[],u=[],d=[],f=[],m=0,x=[],y=n/2,g=0;p(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(h),this.setAttribute("position",new ae(u,3)),this.setAttribute("normal",new ae(d,3)),this.setAttribute("uv",new ae(f,2));function p(){let b=new _,T=new _,v=0,A=(t-e)/n;for(let L=0;L<=r;L++){let I=[],N=L/r,U=N*(t-e)+e;for(let z=0;z<=i;z++){let R=z/i,D=R*c+a,F=Math.sin(D),P=Math.cos(D);T.x=U*F,T.y=-N*n+y,T.z=U*P,u.push(T.x,T.y,T.z),b.set(F,A,P).normalize(),d.push(b.x,b.y,b.z),f.push(R,1-N),I.push(m++)}x.push(I)}for(let L=0;L.9&&A<.1&&(w<.2&&(o[p+0]+=1),b<.2&&(o[p+2]+=1),T<.2&&(o[p+4]+=1))}}function d(p){r.push(p.x,p.y,p.z)}function f(p,w){let b=p*3;w.x=e[b+0],w.y=e[b+1],w.z=e[b+2]}function m(){let p=new _,w=new _,b=new _,T=new _,v=new W,A=new W,L=new W;for(let I=0,N=0;I80*t){a=l=s[0],c=h=s[1];for(let m=t;ml&&(l=u),d>h&&(h=d);f=Math.max(l-a,h-c),f=f!==0?1/f:0}return Qi(r,o,t,a,c,f),o}};function Hc(s,e,t,n,i){let r,o;if(i===bx(s,e,t,n)>0)for(r=e;r=e;r-=n)o=Gc(r,s[r],s[r+1],o);return o&&gs(o,o.next)&&(Ki(o),o=o.next),o}function mn(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(gs(t,t.next)||ke(t.prev,t,t.next)===0)){if(Ki(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Qi(s,e,t,n,i,r,o){if(!s)return;!o&&r&&Ax(s,n,i,r);let a=s,c,l;for(;s.prev!==s.next;){if(c=s.prev,l=s.next,r?Sx(s,n,i,r):Mx(s)){e.push(c.i/t),e.push(s.i/t),e.push(l.i/t),Ki(s),s=l.next,a=l.next;continue}if(s=l,s===a){o?o===1?(s=Tx(mn(s),e,t),Qi(s,e,t,n,i,r,2)):o===2&&Ex(s,e,t,n,i,r):Qi(mn(s),e,t,n,i,r,1);break}}}function Mx(s){let e=s.prev,t=s,n=s.next;if(ke(e,t,n)>=0)return!1;let i=s.next.next;for(;i!==s.prev;){if(mi(e.x,e.y,t.x,t.y,n.x,n.y,i.x,i.y)&&ke(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Sx(s,e,t,n){let i=s.prev,r=s,o=s.next;if(ke(i,r,o)>=0)return!1;let a=i.xr.x?i.x>o.x?i.x:o.x:r.x>o.x?r.x:o.x,h=i.y>r.y?i.y>o.y?i.y:o.y:r.y>o.y?r.y:o.y,u=Go(a,c,e,t,n),d=Go(l,h,e,t,n),f=s.prevZ,m=s.nextZ;for(;f&&f.z>=u&&m&&m.z<=d;){if(f!==s.prev&&f!==s.next&&mi(i.x,i.y,r.x,r.y,o.x,o.y,f.x,f.y)&&ke(f.prev,f,f.next)>=0||(f=f.prevZ,m!==s.prev&&m!==s.next&&mi(i.x,i.y,r.x,r.y,o.x,o.y,m.x,m.y)&&ke(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;f&&f.z>=u;){if(f!==s.prev&&f!==s.next&&mi(i.x,i.y,r.x,r.y,o.x,o.y,f.x,f.y)&&ke(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;m&&m.z<=d;){if(m!==s.prev&&m!==s.next&&mi(i.x,i.y,r.x,r.y,o.x,o.y,m.x,m.y)&&ke(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function Tx(s,e,t){let n=s;do{let i=n.prev,r=n.next.next;!gs(i,r)&&kc(i,n,n.next,r)&&er(i,r)&&er(r,i)&&(e.push(i.i/t),e.push(n.i/t),e.push(r.i/t),Ki(n),Ki(n.next),n=s=r),n=n.next}while(n!==s);return mn(n)}function Ex(s,e,t,n,i,r){let o=s;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Lx(o,a)){let c=Vc(o,a);o=mn(o,o.next),c=mn(c,c.next),Qi(o,e,t,n,i,r),Qi(c,e,t,n,i,r);return}a=a.next}o=o.next}while(o!==s)}function _x(s,e,t,n){let i=[],r,o,a,c,l;for(r=0,o=e.length;r=t.next.y&&t.next.y!==t.y){let d=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=n&&d>r){if(r=d,d===n){if(i===t.y)return t;if(i===t.next.y)return t.next}o=t.x=t.x&&t.x>=c&&n!==t.x&&mi(io.x||t.x===o.x&&Dx(o,t)))&&(o=t,h=u)),t=t.next;while(t!==a);return o}function Dx(s,e){return ke(s.prev,s,e.prev)<0&&ke(e.next,s,s.next)<0}function Ax(s,e,t,n){let i=s;do i.z===null&&(i.z=Go(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,Fx(i)}function Fx(s){let e,t,n,i,r,o,a,c,l=1;do{for(t=s,s=null,r=null,o=0;t;){for(o++,n=t,a=0,e=0;e0||c>0&&n;)a!==0&&(c===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,c--),r?r.nextZ=i:s=i,i.prevZ=r,r=i;t=n}r.nextZ=null,l*=2}while(o>1);return s}function Go(s,e,t,n,i){return s=32767*(s-t)*i,e=32767*(e-n)*i,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function Px(s){let e=s,t=s;do(e.x=0&&(s-o)*(n-a)-(t-o)*(e-a)>=0&&(t-o)*(r-a)-(i-o)*(n-a)>=0}function Lx(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!Nx(s,e)&&(er(s,e)&&er(e,s)&&Bx(s,e)&&(ke(s.prev,s,e.prev)||ke(s,e.prev,e))||gs(s,e)&&ke(s.prev,s,s.next)>0&&ke(e.prev,e,e.next)>0)}function ke(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function gs(s,e){return s.x===e.x&&s.y===e.y}function kc(s,e,t,n){let i=ys(ke(s,e,t)),r=ys(ke(s,e,n)),o=ys(ke(t,n,s)),a=ys(ke(t,n,e));return!!(i!==r&&o!==a||i===0&&xs(s,t,e)||r===0&&xs(s,n,e)||o===0&&xs(t,s,n)||a===0&&xs(t,e,n))}function xs(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function ys(s){return s>0?1:s<0?-1:0}function Nx(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&kc(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function er(s,e){return ke(s.prev,s,s.next)<0?ke(s,e,s.next)>=0&&ke(s,s.prev,e)>=0:ke(s,e,s.prev)<0||ke(s,s.next,e)<0}function Bx(s,e){let t=s,n=!1,i=(s.x+e.x)/2,r=(s.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&i<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function Vc(s,e){let t=new ko(s.i,s.x,s.y),n=new ko(e.i,e.x,e.y),i=s.next,r=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function Gc(s,e,t,n){let i=new ko(s,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Ki(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function ko(s,e,t){this.i=s,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function bx(s,e,t,n){let i=0;for(let r=e,o=t-n;r2&&s[e-1].equals(s[0])&&s.pop()}function qc(s,e){for(let t=0;tNumber.EPSILON){let ge=Math.sqrt(ce),C=Math.sqrt(V*V+ie*ie),J=j.x-k/ge,Q=j.y+S/ge,de=ee.x-ie/C,q=ee.y+V/C,me=((de-J)*ie-(q-Q)*V)/(S*ie-k*V);he=J+S*me-Y.x,ne=Q+k*me-Y.y;let Ne=he*he+ne*ne;if(Ne<=2)return new W(he,ne);E=Math.sqrt(Ne/2)}else{let ge=!1;S>Number.EPSILON?V>Number.EPSILON&&(ge=!0):S<-Number.EPSILON?V<-Number.EPSILON&&(ge=!0):Math.sign(k)===Math.sign(ie)&&(ge=!0),ge?(he=-k,ne=S,E=Math.sqrt(ce)):(he=S,ne=k,E=Math.sqrt(ce/2))}return new W(he/E,ne/E)}let Z=[];for(let Y=0,j=D.length,ee=j-1,he=Y+1;Y=0;Y--){let j=Y/y,ee=f*Math.cos(j*Math.PI/2),he=m*Math.sin(j*Math.PI/2)+x;for(let ne=0,E=D.length;ne=0;){let he=ee,ne=ee-1;ne<0&&(ne=Y.length-1);for(let E=0,S=h+y*2;E=0?(e(p-c,y,u),d.subVectors(h,u)):(e(p+c,y,u),d.subVectors(u,h)),y-c>=0?(e(p,y-c,u),f.subVectors(h,u)):(e(p,y+c,u),f.subVectors(u,h)),l.crossVectors(d,f).normalize(),o.push(l.x,l.y,l.z),a.push(p,y)}}for(let x=0;x0)&&f.push(w,b,v),(g!==n-1||c=n)){u.push(l.times[f]);for(let x=0;xr.tracks[c].times[0]&&(a=r.tracks[c].times[0]);for(let c=0;c=a.times[m]){let g=m*u+h,p=g+u-h;x=Ge.arraySlice(a.values,g,p)}else{let g=a.createInterpolant(),p=h,w=u-h;g.evaluate(r),x=Ge.arraySlice(g.resultBuffer,p,w)}c==="quaternion"&&new rt().fromArray(x).normalize().conjugate().toArray(x);let y=l.times.length;for(let g=0;g=r)){let a=t[1];e=r)break t}o=n,n=0;break n}break e}for(;n>>1;et;)--o;if(++o,r!==0||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);let a=this.getValueSize();this.times=Ge.arraySlice(n,r,o),this.values=Ge.arraySlice(this.values,r*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){let c=n[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(i!==void 0&&Ge.isTypedArray(i))for(let a=0,c=i.length;a!==c;++a){let l=i[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){let e=Ge.arraySlice(this.times),t=Ge.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Ys,r=e.length-1,o=1;for(let a=1;a0){e[o]=e[r];for(let a=r*n,c=o*n,l=0;l!==n;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=Ge.arraySlice(e,0,o),this.values=Ge.arraySlice(t,0,o*n)):(this.times=e,this.values=t),this}clone(){let e=Ge.arraySlice(this.times,0),t=Ge.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};Pt.prototype.TimeBufferType=Float32Array;Pt.prototype.ValueBufferType=Float32Array;Pt.prototype.DefaultInterpolation=Sr;var Dn=class extends Pt{};Dn.prototype.ValueTypeName="bool";Dn.prototype.ValueBufferType=Array;Dn.prototype.DefaultInterpolation=Mr;Dn.prototype.InterpolantFactoryMethodLinear=void 0;Dn.prototype.InterpolantFactoryMethodSmooth=void 0;var la=class extends Pt{};la.prototype.ValueTypeName="color";var tr=class extends Pt{};tr.prototype.ValueTypeName="number";var Zc=class extends Kt{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(n-t)/(i-t),l=e*a;for(let h=l+a;l!==h;l+=4)rt.slerpFlat(r,0,o,l-a,o,l,c);return r}},xi=class extends Pt{InterpolantFactoryMethodLinear(e){return new Zc(this.times,this.values,this.getValueSize(),e)}};xi.prototype.ValueTypeName="quaternion";xi.prototype.DefaultInterpolation=Sr;xi.prototype.InterpolantFactoryMethodSmooth=void 0;var Fn=class extends Pt{};Fn.prototype.ValueTypeName="string";Fn.prototype.ValueBufferType=Array;Fn.prototype.DefaultInterpolation=Mr;Fn.prototype.InterpolantFactoryMethodLinear=void 0;Fn.prototype.InterpolantFactoryMethodSmooth=void 0;var nr=class extends Pt{};nr.prototype.ValueTypeName="vector";var ir=class{constructor(e,t=-1,n,i=Zs){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=wt(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(Gx(n[o]).scale(i));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=n.length;r!==o;++r)t.push(Pt.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let r=t.length,o=[];for(let a=0;a1){let u=h[1],d=i[u];d||(i[u]=d=[]),d.push(l)}}let o=[];for(let a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let n=function(u,d,f,m,x){if(f.length!==0){let y=[],g=[];Ge.flattenJSON(f,y,g,m),y.length!==0&&x.push(new u(d,y,g))}},i=[],r=e.name||"default",o=e.fps||30,a=e.blendMode,c=e.length||-1,l=e.hierarchy||[];for(let u=0;u0||e.search(/^data\:image\/jpeg/)===0;r.format=c?Sn:Tt,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}},St=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,i=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let n=this.getLengths(),i=0,r=n.length,o;t?o=t:o=e*n[r-1];let a=0,c=r-1,l;for(;a<=c;)if(i=Math.floor(a+(c-a)/2),l=n[i]-o,l<0)a=i+1;else if(l>0)c=i-1;else{c=i;break}if(i=c,n[i]===o)return i/(r-1);let h=n[i],d=n[i+1]-h,f=(o-h)/d;return(i+f)/(r-1)}getTangent(e,t){let n=1e-4,i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);let o=this.getPoint(i),a=this.getPoint(r),c=t||(o.isVector2?new W:new _);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){let n=new _,i=[],r=[],o=[],a=new _,c=new le;for(let f=0;f<=e;f++){let m=f/e;i[f]=this.getTangentAt(m,new _),i[f].normalize()}r[0]=new _,o[0]=new _;let l=Number.MAX_VALUE,h=Math.abs(i[0].x),u=Math.abs(i[0].y),d=Math.abs(i[0].z);h<=l&&(l=h,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),d<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),o[0].crossVectors(i[0],r[0]);for(let f=1;f<=e;f++){if(r[f]=r[f-1].clone(),o[f]=o[f-1].clone(),a.crossVectors(i[f-1],i[f]),a.length()>Number.EPSILON){a.normalize();let m=Math.acos(ct(i[f-1].dot(i[f]),-1,1));r[f].applyMatrix4(c.makeRotationAxis(a,m))}o[f].crossVectors(i[f],r[f])}if(t===!0){let f=Math.acos(ct(r[0].dot(r[e]),-1,1));f/=e,i[0].dot(a.crossVectors(r[0],r[e]))>0&&(f=-f);for(let m=1;m<=e;m++)r[m].applyMatrix4(c.makeRotationAxis(i[m],f*m)),o[m].crossVectors(i[m],r[m])}return{tangents:i,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},rr=class extends St{constructor(e=0,t=0,n=1,i=1,r=0,o=Math.PI*2,a=!1,c=0){super();this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t){let n=t||new W,i=Math.PI*2,r=this.aEndAngle-this.aStartAngle,o=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(a)/r)+1)*r:c===0&&a===r-1&&(a=r-2,c=1);let l,h;this.closed||a>0?l=i[(a-1)%r]:(Ss.subVectors(i[0],i[1]).add(i[0]),l=Ss);let u=i[a%r],d=i[(a+1)%r];if(this.closed||a+2i.length-2?i.length-1:o+1],u=i[o>i.length-3?i.length-1:o+2];return n.set(Qc(a,c.x,l.x,h.x,u.x),Qc(a,c.y,l.y,h.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=t){let r=n[i]-t,o=this.curves[i],a=o.getLength(),c=a===0?0:1-r/a;return o.getPointAt(c)}i++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){let u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);let h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},xn=class extends lr{constructor(e){super(e);this.uuid=wt(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,i=this.holes.length;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(let r in e.uniforms){let o=e.uniforms[r];switch(i.uniforms[r]={},o.type){case"t":i.uniforms[r].value=n(o.value);break;case"c":i.uniforms[r].value=new se().setHex(o.value);break;case"v2":i.uniforms[r].value=new W().fromArray(o.value);break;case"v3":i.uniforms[r].value=new _().fromArray(o.value);break;case"v4":i.uniforms[r].value=new Fe().fromArray(o.value);break;case"m3":i.uniforms[r].value=new Ke().fromArray(o.value);break;case"m4":i.uniforms[r].value=new le().fromArray(o.value);break;default:i.uniforms[r].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.extensions!==void 0)for(let r in e.extensions)i.extensions[r]=e.extensions[r];if(e.shading!==void 0&&(i.flatShading=e.shading===1),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),i.normalScale=new W().fromArray(r)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new W().fromArray(e.clearcoatNormalScale)),e.transmission!==void 0&&(i.transmission=e.transmission),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),i}setTextures(e){return this.textures=e,this}},Ca=class{static decodeText(e){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n0){let c=new ca(t);r=new Ms(c),r.setCrossOrigin(this.crossOrigin);for(let l=0,h=e.length;lNumber.EPSILON){if(U<0&&(L=w[A],N=-N,I=w[v],U=-U),p.yI.y)continue;if(p.y===L.y){if(p.x===L.x)return!0}else{let z=U*(p.x-L.x)-N*(p.y-L.y);if(z===0)return!0;if(z<0)continue;T=!T}}else{if(p.y!==L.y)continue;if(I.x<=p.x&&p.x<=L.x||L.x<=p.x&&p.x<=I.x)return!0}}return T}let r=zt.isClockWise,o=this.subPaths;if(o.length===0)return[];if(t===!0)return n(o);let a,c,l,h=[];if(o.length===1)return c=o[0],l=new xn,l.curves=c.curves,h.push(l),h;let u=!r(o[0].getPoints());u=e?!u:u;let d=[],f=[],m=[],x=0,y;f[x]=void 0,m[x]=[];for(let p=0,w=o.length;p1){let p=!1,w=[];for(let b=0,T=f.length;b0&&(p||(m=d))}let g;for(let p=0,w=f.length;p0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){a.setValue(n,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,o=i;r!==o;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let o=0;o!==r;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){rt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){let o=this._workIndex*r;rt.multiplyQuaternionsFlat(e,o,e,t,e,n),rt.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,r){let o=1-i;for(let a=0;a!==r;++a){let c=t+a;e[c]=e[c]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,r){for(let o=0;o!==r;++o){let a=t+o;e[a]=e[a]+e[n+o]*i}}},Na="\\[\\]\\.:\\/",cy=new RegExp("["+Na+"]","g"),Ba="[^"+Na+"]",hy="[^"+Na.replace("\\.","")+"]",uy=/((?:WC+[\/:])*)/.source.replace("WC",Ba),dy=/(WCOD+)?/.source.replace("WCOD",hy),fy=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ba),py=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ba),my=new RegExp("^"+uy+dy+fy+py+"$"),gy=["material","materials","bones"],Mh=class{constructor(e,t,n){let i=n||Ce.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Ce=class{constructor(e,t,n){this.path=t,this.parsedPath=n||Ce.parseTrackName(t),this.node=Ce.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ce.Composite(e,t,n):new Ce(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(cy,"")}static parseTrackName(e){let t=my.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let r=n.nodeName.substring(i+1);gy.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(!t||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(r){for(let o=0;o=r){let u=r++,d=e[u];t[d.uuid]=h,e[h]=d,t[l]=u,e[u]=c;for(let f=0,m=i;f!==m;++f){let x=n[f],y=x[u],g=x[h];x[h]=y,x[u]=g}}}this.nCachedObjects_=r}uncache(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length,r=this.nCachedObjects_,o=e.length;for(let a=0,c=arguments.length;a!==c;++a){let l=arguments[a],h=l.uuid,u=t[h];if(u!==void 0)if(delete t[h],u0&&(t[f.uuid]=u),e[u]=f,e.pop();for(let m=0,x=i;m!==x;++m){let y=n[m];y[u]=y[d],y.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){let n=this._bindingsIndicesByPath,i=n[e],r=this._bindings;if(i!==void 0)return r[i];let o=this._paths,a=this._parsedPaths,c=this._objects,l=c.length,h=this.nCachedObjects_,u=new Array(l);i=r.length,n[e]=i,o.push(e),a.push(t),r.push(u);for(let d=h,f=c.length;d!==f;++d){let m=c[d];u[d]=new Ce(m,e,t)}return u}unsubscribe_(e){let t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){let i=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,c=o[a],l=e[a];t[l]=n,o[n]=c,o.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}};Sh.prototype.isAnimationObjectGroup=!0;var Th=class{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;let r=t.tracks,o=r.length,a=new Array(o),c={endingStart:Wn,endingEnd:Wn};for(let l=0;l!==o;++l){let h=r[l].createInterpolant(null);a[l]=h,h.settings=c}this._interpolantSettings=c,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ad,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=Infinity,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){let i=this._clip.duration,r=e._clip.duration,o=r/i,a=i/r;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let i=this._mixer,r=i.time,o=this.timeScale,a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);let c=a.parameterPositions,l=a.sampleValues;return c[0]=r,c[1]=r+n,l[0]=e/o,l[1]=t/o,this}stopWarping(){let e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}let r=this._startTime;if(r!==null){let c=(e-r)*n;if(c<0||n===0)return;this._startTime=null,t=n*c}t*=this._updateTimeScale(e);let o=this._updateTime(t),a=this._updateWeight(e);if(a>0){let c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case vl:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(o),l[h].accumulateAdditive(a);break;case Zs:default:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(o),l[h].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(n!==null){let i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;n!==null&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,i=this.time+e,r=this._loopCount,o=n===Ld;if(e===0)return r===-1?i:o&&(r&1)==1?t-i:i;if(n===Ed){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){let a=Math.floor(i/t);i-=t*a,r+=Math.abs(a);let c=this.repetitions-r;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){let l=e<0;this._setEndings(l,!l,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(r&1)==1)return t-i}return i}_setEndings(e,t,n){let i=this._interpolantSettings;n?(i.endingStart=qn,i.endingEnd=qn):(e?i.endingStart=this.zeroSlopeAtStart?qn:Wn:i.endingStart=Tr,t?i.endingEnd=this.zeroSlopeAtEnd?qn:Wn:i.endingEnd=Tr)}_scheduleFading(e,t,n){let i=this._mixer,r=i.time,o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);let a=o.parameterPositions,c=o.sampleValues;return a[0]=r,c[0]=t,a[1]=r+e,c[1]=n,this}},Eh=class extends nn{constructor(e){super();this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,o=e._propertyBindings,a=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName,h=l[c];h===void 0&&(h={},l[c]=h);for(let u=0;u!==r;++u){let d=i[u],f=d.name,m=h[f];if(m!==void 0)o[u]=m;else{if(m=o[u],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,c,f));continue}let x=t&&t._propertyBindings[u].binding.parsedPath;m=new bh(Ce.create(n,f,x),d.ValueTypeName,d.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,c,f),o[u]=m}a[u].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];r.useCount++==0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];--r.useCount==0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,r,o);let a=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)a[l].apply(o);return this}setTime(e){this.time=0;for(let t=0;tthis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t===void 0&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new W),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t===void 0&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new W),t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Ch.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};vi.prototype.isBox2=!0;var Ph=new _,Ps=new _,Ih=class{constructor(e=new _,t=new _){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e===void 0&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new _),e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e===void 0&&(console.warn("THREE.Line3: .delta() target is now required"),e=new _),e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return t===void 0&&(console.warn("THREE.Line3: .at() target is now required"),t=new _),this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Ph.subVectors(e,this.start),Ps.subVectors(this.end,this.start);let n=Ps.dot(Ps),r=Ps.dot(Ph)/n;return t&&(r=ct(r,0,1)),r}closestPointToPoint(e,t,n){let i=this.closestPointToPointParameter(e,t);return n===void 0&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new _),this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}},Dh=class extends Se{constructor(e){super();this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}};Dh.prototype.isImmediateRenderObject=!0;var Fh=new _,_y=class extends Se{constructor(e,t){super();this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;let n=new ue,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,c=32;o.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Vh.set(e.z,0,-e.x).normalize();let t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Vh,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}},Wh=class extends _t{constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new ue;i.setAttribute("position",new ae(t,3)),i.setAttribute("color",new ae(n,3));let r=new at({vertexColors:!0,toneMapped:!1});super(i,r);this.type="AxesHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},qh=new Float32Array(1),Cy=new Int32Array(qh.buffer),Py=class{static toHalfFloat(e){qh[0]=e;let t=Cy[0],n=t>>16&32768,i=t>>12&2047,r=t>>23&255;return r<103?n:r>142?(n|=31744,n|=(r==255?0:1)&&t&8388607,n):r<113?(i|=2048,n|=(i>>114-r)+(i>>113-r&1),n):(n|=r-112<<10|i>>1,n+=i&1,n)}},_i=4,vn=8,Ut=Math.pow(2,vn),Xh=[.125,.215,.35,.446,.526,.582],Yh=vn-_i+1+Xh.length,wi=20,Ht={[yt]:0,[Er]:1,[js]:2,[_l]:3,[wl]:4,[bl]:5,[Js]:6},Un=new Jt({side:Qe,depthWrite:!1,depthTest:!1}),Iy=new je(new ii,Un),Ha=new hr,{_lodPlanes:dr,_sizeLods:Zh,_sigmas:zs}=Dy(),Jh=new se,Ga=null,Hn=(1+Math.sqrt(5))/2,bi=1/Hn,jh=[new _(1,1,1),new _(-1,1,1),new _(1,1,-1),new _(-1,1,-1),new _(0,Hn,bi),new _(0,Hn,-bi),new _(bi,0,Hn),new _(-bi,0,Hn),new _(Hn,bi,0),new _(-Hn,bi,0)];function $h(s){let e=Math.max(s.r,s.g,s.b),t=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);return s.multiplyScalar(Math.pow(2,-t)),(t+128)/255}var Fy=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=By(wi),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Ga=this._renderer.getRenderTarget();let r=this._allocateTargets();return this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e){return this._fromTexture(e)}fromCubemap(e){return this._fromTexture(e)}compileCubemapShader(){this._cubemapShader===null&&(this._cubemapShader=eu(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){this._equirectShader===null&&(this._equirectShader=Kh(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(let e=0;e2?Ut:0,Ut,Ut),h.setRenderTarget(i),m&&h.render(Iy,a),h.render(e,a)}h.toneMapping=f,h.outputEncoding=d,h.autoClear=u}_textureToCubeUV(e,t){let n=this._renderer;e.isCubeTexture?this._cubemapShader==null&&(this._cubemapShader=eu()):this._equirectShader==null&&(this._equirectShader=Kh());let i=e.isCubeTexture?this._cubemapShader:this._equirectShader,r=new je(dr[0],i),o=i.uniforms;o.envMap.value=e,e.isCubeTexture||o.texelSize.value.set(1/e.image.width,1/e.image.height),o.inputEncoding.value=Ht[e.encoding],o.outputEncoding.value=Ht[t.texture.encoding],Os(t,0,0,3*Ut,2*Ut),n.setRenderTarget(t),n.render(r,Ha)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;iwi&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${wi}`);let g=[],p=0;for(let v=0;vvn-_i?i-vn+_i:0);Os(t,b,T,3*w,2*w),c.setRenderTarget(t),c.render(u,Ha)}};function Ny(s){return s===void 0||s.type!==Li?!1:s.encoding===yt||s.encoding===Er||s.encoding===Js}function Dy(){let s=[],e=[],t=[],n=vn;for(let i=0;ivn-_i?o=Xh[i-vn+_i-1]:i==0&&(o=0),t.push(o);let a=1/(r-1),c=-a/2,l=1+a/2,h=[c,c,l,c,l,l,c,c,l,l,c,l],u=6,d=6,f=3,m=2,x=1,y=new Float32Array(f*d*u),g=new Float32Array(m*d*u),p=new Float32Array(x*d*u);for(let b=0;b2?0:-1,A=[T,v,0,T+2/3,v,0,T+2/3,v+1,0,T,v,0,T+2/3,v+1,0,T,v+1,0];y.set(A,f*d*b),g.set(h,m*d*b);let L=[b,b,b,b,b,b];p.set(L,x*d*b)}let w=new ue;w.setAttribute("position",new Te(y,f)),w.setAttribute("uv",new Te(g,m)),w.setAttribute("faceIndex",new Te(p,x)),s.push(w),n>_i&&n--}return{_lodPlanes:s,_sizeLods:e,_sigmas:t}}function Qh(s){let e=new Vt(3*Ut,3*Ut,s);return e.texture.mapping=Ei,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Os(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function By(s){let e=new Float32Array(s),t=new _(0,1,0);return new gi({name:"SphericalGaussianBlur",defines:{n:s},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:t},inputEncoding:{value:Ht[yt]},outputEncoding:{value:Ht[yt]}},vertexShader:ka(),fragmentShader:` precision mediump float; precision mediump int; @@ -46558,7 +2840,7 @@ function _getBlurShader( maxSamples ) { uniform float mipInt; uniform vec3 poleAxis; - ${ _getEncodings() } + ${Va()} #define ENVMAP_TYPE_CUBE_UV #include @@ -46607,35 +2889,7 @@ function _getBlurShader( maxSamples ) { gl_FragColor = linearToOutputTexel( gl_FragColor ); } - `, - - blending: NoBlending, - depthTest: false, - depthWrite: false - - } ); - - return shaderMaterial; - -} - -function _getEquirectShader() { - - const texelSize = new Vector2( 1, 1 ); - const shaderMaterial = new RawShaderMaterial( { - - name: 'EquirectangularToCubeUV', - - uniforms: { - 'envMap': { value: null }, - 'texelSize': { value: texelSize }, - 'inputEncoding': { value: ENCODINGS[ LinearEncoding ] }, - 'outputEncoding': { value: ENCODINGS[ LinearEncoding ] } - }, - - vertexShader: _getCommonVertexShader(), - - fragmentShader: /* glsl */` + `,blending:en,depthTest:!1,depthWrite:!1})}function Kh(){let s=new W(1,1);return new gi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:s},inputEncoding:{value:Ht[yt]},outputEncoding:{value:Ht[yt]}},vertexShader:ka(),fragmentShader:` precision mediump float; precision mediump int; @@ -46645,7 +2899,7 @@ function _getEquirectShader() { uniform sampler2D envMap; uniform vec2 texelSize; - ${ _getEncodings() } + ${Va()} #include @@ -46673,33 +2927,7 @@ function _getEquirectShader() { gl_FragColor = linearToOutputTexel( gl_FragColor ); } - `, - - blending: NoBlending, - depthTest: false, - depthWrite: false - - } ); - - return shaderMaterial; - -} - -function _getCubemapShader() { - - const shaderMaterial = new RawShaderMaterial( { - - name: 'CubemapToCubeUV', - - uniforms: { - 'envMap': { value: null }, - 'inputEncoding': { value: ENCODINGS[ LinearEncoding ] }, - 'outputEncoding': { value: ENCODINGS[ LinearEncoding ] } - }, - - vertexShader: _getCommonVertexShader(), - - fragmentShader: /* glsl */` + `,blending:en,depthTest:!1,depthWrite:!1})}function eu(){return new gi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Ht[yt]},outputEncoding:{value:Ht[yt]}},vertexShader:ka(),fragmentShader:` precision mediump float; precision mediump int; @@ -46708,7 +2936,7 @@ function _getCubemapShader() { uniform samplerCube envMap; - ${ _getEncodings() } + ${Va()} void main() { @@ -46717,21 +2945,7 @@ function _getCubemapShader() { gl_FragColor = linearToOutputTexel( gl_FragColor ); } - `, - - blending: NoBlending, - depthTest: false, - depthWrite: false - - } ); - - return shaderMaterial; - -} - -function _getCommonVertexShader() { - - return /* glsl */` + `,blending:en,depthTest:!1,depthWrite:!1})}function ka(){return` precision mediump float; precision mediump int; @@ -46788,13 +3002,7 @@ function _getCommonVertexShader() { gl_Position = vec4( position, 1.0 ); } - `; - -} - -function _getEncodings() { - - return /* glsl */` + `}function Va(){return` uniform int inputEncoding; uniform int outputEncoding; @@ -46874,2057 +3082,9 @@ function _getEncodings() { return inputTexelToLinear( color ); } - `; - -} - -const LineStrip = 0; -const LinePieces = 1; -const NoColors = 0; -const FaceColors = 1; -const VertexColors = 2; - -function MeshFaceMaterial( materials ) { - - console.warn( 'THREE.MeshFaceMaterial has been removed. Use an Array instead.' ); - return materials; - -} - -function MultiMaterial( materials = [] ) { - - console.warn( 'THREE.MultiMaterial has been removed. Use an Array instead.' ); - materials.isMultiMaterial = true; - materials.materials = materials; - materials.clone = function () { - - return materials.slice(); - - }; - - return materials; - -} - -function PointCloud( geometry, material ) { - - console.warn( 'THREE.PointCloud has been renamed to THREE.Points.' ); - return new Points( geometry, material ); - -} - -function Particle( material ) { - - console.warn( 'THREE.Particle has been renamed to THREE.Sprite.' ); - return new Sprite( material ); - -} - -function ParticleSystem( geometry, material ) { - - console.warn( 'THREE.ParticleSystem has been renamed to THREE.Points.' ); - return new Points( geometry, material ); - -} - -function PointCloudMaterial( parameters ) { - - console.warn( 'THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.' ); - return new PointsMaterial( parameters ); - -} - -function ParticleBasicMaterial( parameters ) { - - console.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.' ); - return new PointsMaterial( parameters ); - -} - -function ParticleSystemMaterial( parameters ) { - - console.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.' ); - return new PointsMaterial( parameters ); - -} - -function Vertex( x, y, z ) { - - console.warn( 'THREE.Vertex has been removed. Use THREE.Vector3 instead.' ); - return new Vector3( x, y, z ); - -} - -// - -function DynamicBufferAttribute( array, itemSize ) { - - console.warn( 'THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead.' ); - return new BufferAttribute( array, itemSize ).setUsage( DynamicDrawUsage ); - -} - -function Int8Attribute( array, itemSize ) { - - console.warn( 'THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.' ); - return new Int8BufferAttribute( array, itemSize ); - -} - -function Uint8Attribute( array, itemSize ) { - - console.warn( 'THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.' ); - return new Uint8BufferAttribute( array, itemSize ); - -} - -function Uint8ClampedAttribute( array, itemSize ) { - - console.warn( 'THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.' ); - return new Uint8ClampedBufferAttribute( array, itemSize ); - -} - -function Int16Attribute( array, itemSize ) { - - console.warn( 'THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.' ); - return new Int16BufferAttribute( array, itemSize ); - -} - -function Uint16Attribute( array, itemSize ) { - - console.warn( 'THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.' ); - return new Uint16BufferAttribute( array, itemSize ); - -} - -function Int32Attribute( array, itemSize ) { - - console.warn( 'THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.' ); - return new Int32BufferAttribute( array, itemSize ); - -} - -function Uint32Attribute( array, itemSize ) { - - console.warn( 'THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.' ); - return new Uint32BufferAttribute( array, itemSize ); - -} - -function Float32Attribute( array, itemSize ) { - - console.warn( 'THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.' ); - return new Float32BufferAttribute( array, itemSize ); - -} - -function Float64Attribute( array, itemSize ) { - - console.warn( 'THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.' ); - return new Float64BufferAttribute( array, itemSize ); - -} - -// - -Curve.create = function ( construct, getPoint ) { - - console.log( 'THREE.Curve.create() has been deprecated' ); - - construct.prototype = Object.create( Curve.prototype ); - construct.prototype.constructor = construct; - construct.prototype.getPoint = getPoint; - - return construct; - -}; - -// - -Path.prototype.fromPoints = function ( points ) { - - console.warn( 'THREE.Path: .fromPoints() has been renamed to .setFromPoints().' ); - return this.setFromPoints( points ); - -}; - -// - -function AxisHelper( size ) { - - console.warn( 'THREE.AxisHelper has been renamed to THREE.AxesHelper.' ); - return new AxesHelper( size ); - -} - -function BoundingBoxHelper( object, color ) { - - console.warn( 'THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead.' ); - return new BoxHelper( object, color ); - -} - -function EdgesHelper( object, hex ) { - - console.warn( 'THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.' ); - return new LineSegments( new EdgesGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) ); - -} - -GridHelper.prototype.setColors = function () { - - console.error( 'THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.' ); - -}; - -SkeletonHelper.prototype.update = function () { - - console.error( 'THREE.SkeletonHelper: update() no longer needs to be called.' ); - -}; - -function WireframeHelper( object, hex ) { - - console.warn( 'THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.' ); - return new LineSegments( new WireframeGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) ); - -} - -// - -Loader.prototype.extractUrlBase = function ( url ) { - - console.warn( 'THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.' ); - return LoaderUtils.extractUrlBase( url ); - -}; - -Loader.Handlers = { - - add: function ( /* regex, loader */ ) { - - console.error( 'THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.' ); - - }, - - get: function ( /* file */ ) { - - console.error( 'THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.' ); - - } - -}; - -function XHRLoader( manager ) { - - console.warn( 'THREE.XHRLoader has been renamed to THREE.FileLoader.' ); - return new FileLoader( manager ); - -} - -function BinaryTextureLoader( manager ) { - - console.warn( 'THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.' ); - return new DataTextureLoader( manager ); - -} - -// - -Box2.prototype.center = function ( optionalTarget ) { - - console.warn( 'THREE.Box2: .center() has been renamed to .getCenter().' ); - return this.getCenter( optionalTarget ); - -}; - -Box2.prototype.empty = function () { - - console.warn( 'THREE.Box2: .empty() has been renamed to .isEmpty().' ); - return this.isEmpty(); - -}; - -Box2.prototype.isIntersectionBox = function ( box ) { - - console.warn( 'THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().' ); - return this.intersectsBox( box ); - -}; - -Box2.prototype.size = function ( optionalTarget ) { - - console.warn( 'THREE.Box2: .size() has been renamed to .getSize().' ); - return this.getSize( optionalTarget ); - -}; - -// - -Box3.prototype.center = function ( optionalTarget ) { - - console.warn( 'THREE.Box3: .center() has been renamed to .getCenter().' ); - return this.getCenter( optionalTarget ); - -}; - -Box3.prototype.empty = function () { - - console.warn( 'THREE.Box3: .empty() has been renamed to .isEmpty().' ); - return this.isEmpty(); - -}; - -Box3.prototype.isIntersectionBox = function ( box ) { - - console.warn( 'THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().' ); - return this.intersectsBox( box ); - -}; - -Box3.prototype.isIntersectionSphere = function ( sphere ) { - - console.warn( 'THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().' ); - return this.intersectsSphere( sphere ); - -}; - -Box3.prototype.size = function ( optionalTarget ) { - - console.warn( 'THREE.Box3: .size() has been renamed to .getSize().' ); - return this.getSize( optionalTarget ); - -}; - -// - -Sphere.prototype.empty = function () { - - console.warn( 'THREE.Sphere: .empty() has been renamed to .isEmpty().' ); - return this.isEmpty(); - -}; - -// - -Frustum.prototype.setFromMatrix = function ( m ) { - - console.warn( 'THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix().' ); - return this.setFromProjectionMatrix( m ); - -}; - -// - -Line3.prototype.center = function ( optionalTarget ) { - - console.warn( 'THREE.Line3: .center() has been renamed to .getCenter().' ); - return this.getCenter( optionalTarget ); - -}; - -// - -MathUtils.random16 = function () { - - console.warn( 'THREE.Math: .random16() has been deprecated. Use Math.random() instead.' ); - return Math.random(); - -}; - -MathUtils.nearestPowerOfTwo = function ( value ) { - - console.warn( 'THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo().' ); - return MathUtils.floorPowerOfTwo( value ); - -}; - -MathUtils.nextPowerOfTwo = function ( value ) { - - console.warn( 'THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo().' ); - return MathUtils.ceilPowerOfTwo( value ); - -}; - -// - -Matrix3.prototype.flattenToArrayOffset = function ( array, offset ) { - - console.warn( 'THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.' ); - return this.toArray( array, offset ); - -}; - -Matrix3.prototype.multiplyVector3 = function ( vector ) { - - console.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' ); - return vector.applyMatrix3( this ); - -}; - -Matrix3.prototype.multiplyVector3Array = function ( /* a */ ) { - - console.error( 'THREE.Matrix3: .multiplyVector3Array() has been removed.' ); - -}; - -Matrix3.prototype.applyToBufferAttribute = function ( attribute ) { - - console.warn( 'THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead.' ); - return attribute.applyMatrix3( this ); - -}; - -Matrix3.prototype.applyToVector3Array = function ( /* array, offset, length */ ) { - - console.error( 'THREE.Matrix3: .applyToVector3Array() has been removed.' ); - -}; - -Matrix3.prototype.getInverse = function ( matrix ) { - - console.warn( 'THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead.' ); - return this.copy( matrix ).invert(); - -}; - -// - -Matrix4.prototype.extractPosition = function ( m ) { - - console.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' ); - return this.copyPosition( m ); - -}; - -Matrix4.prototype.flattenToArrayOffset = function ( array, offset ) { - - console.warn( 'THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.' ); - return this.toArray( array, offset ); - -}; - -Matrix4.prototype.getPosition = function () { - - console.warn( 'THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' ); - return new Vector3().setFromMatrixColumn( this, 3 ); - -}; - -Matrix4.prototype.setRotationFromQuaternion = function ( q ) { - - console.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' ); - return this.makeRotationFromQuaternion( q ); - -}; - -Matrix4.prototype.multiplyToArray = function () { - - console.warn( 'THREE.Matrix4: .multiplyToArray() has been removed.' ); - -}; - -Matrix4.prototype.multiplyVector3 = function ( vector ) { - - console.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.' ); - return vector.applyMatrix4( this ); - -}; - -Matrix4.prototype.multiplyVector4 = function ( vector ) { - - console.warn( 'THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.' ); - return vector.applyMatrix4( this ); - -}; - -Matrix4.prototype.multiplyVector3Array = function ( /* a */ ) { - - console.error( 'THREE.Matrix4: .multiplyVector3Array() has been removed.' ); - -}; - -Matrix4.prototype.rotateAxis = function ( v ) { - - console.warn( 'THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' ); - v.transformDirection( this ); - -}; - -Matrix4.prototype.crossVector = function ( vector ) { - - console.warn( 'THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' ); - return vector.applyMatrix4( this ); - -}; - -Matrix4.prototype.translate = function () { - - console.error( 'THREE.Matrix4: .translate() has been removed.' ); - -}; - -Matrix4.prototype.rotateX = function () { - - console.error( 'THREE.Matrix4: .rotateX() has been removed.' ); - -}; - -Matrix4.prototype.rotateY = function () { - - console.error( 'THREE.Matrix4: .rotateY() has been removed.' ); - -}; - -Matrix4.prototype.rotateZ = function () { - - console.error( 'THREE.Matrix4: .rotateZ() has been removed.' ); - -}; - -Matrix4.prototype.rotateByAxis = function () { - - console.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' ); - -}; - -Matrix4.prototype.applyToBufferAttribute = function ( attribute ) { - - console.warn( 'THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead.' ); - return attribute.applyMatrix4( this ); - -}; - -Matrix4.prototype.applyToVector3Array = function ( /* array, offset, length */ ) { - - console.error( 'THREE.Matrix4: .applyToVector3Array() has been removed.' ); - -}; - -Matrix4.prototype.makeFrustum = function ( left, right, bottom, top, near, far ) { - - console.warn( 'THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.' ); - return this.makePerspective( left, right, top, bottom, near, far ); - -}; - -Matrix4.prototype.getInverse = function ( matrix ) { - - console.warn( 'THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead.' ); - return this.copy( matrix ).invert(); - -}; - -// - -Plane.prototype.isIntersectionLine = function ( line ) { - - console.warn( 'THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().' ); - return this.intersectsLine( line ); - -}; - -// - -Quaternion.prototype.multiplyVector3 = function ( vector ) { - - console.warn( 'THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.' ); - return vector.applyQuaternion( this ); - -}; - -Quaternion.prototype.inverse = function ( ) { - - console.warn( 'THREE.Quaternion: .inverse() has been renamed to invert().' ); - return this.invert(); - -}; - -// - -Ray.prototype.isIntersectionBox = function ( box ) { - - console.warn( 'THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().' ); - return this.intersectsBox( box ); - -}; - -Ray.prototype.isIntersectionPlane = function ( plane ) { - - console.warn( 'THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().' ); - return this.intersectsPlane( plane ); - -}; - -Ray.prototype.isIntersectionSphere = function ( sphere ) { - - console.warn( 'THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().' ); - return this.intersectsSphere( sphere ); - -}; - -// - -Triangle.prototype.area = function () { - - console.warn( 'THREE.Triangle: .area() has been renamed to .getArea().' ); - return this.getArea(); - -}; - -Triangle.prototype.barycoordFromPoint = function ( point, target ) { - - console.warn( 'THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().' ); - return this.getBarycoord( point, target ); - -}; - -Triangle.prototype.midpoint = function ( target ) { - - console.warn( 'THREE.Triangle: .midpoint() has been renamed to .getMidpoint().' ); - return this.getMidpoint( target ); - -}; - -Triangle.prototypenormal = function ( target ) { - - console.warn( 'THREE.Triangle: .normal() has been renamed to .getNormal().' ); - return this.getNormal( target ); - -}; - -Triangle.prototype.plane = function ( target ) { - - console.warn( 'THREE.Triangle: .plane() has been renamed to .getPlane().' ); - return this.getPlane( target ); - -}; - -Triangle.barycoordFromPoint = function ( point, a, b, c, target ) { - - console.warn( 'THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().' ); - return Triangle.getBarycoord( point, a, b, c, target ); - -}; - -Triangle.normal = function ( a, b, c, target ) { - - console.warn( 'THREE.Triangle: .normal() has been renamed to .getNormal().' ); - return Triangle.getNormal( a, b, c, target ); - -}; - -// - -Shape.prototype.extractAllPoints = function ( divisions ) { - - console.warn( 'THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.' ); - return this.extractPoints( divisions ); - -}; - -Shape.prototype.extrude = function ( options ) { - - console.warn( 'THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.' ); - return new ExtrudeGeometry( this, options ); - -}; - -Shape.prototype.makeGeometry = function ( options ) { - - console.warn( 'THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.' ); - return new ShapeGeometry( this, options ); - -}; - -// - -Vector2.prototype.fromAttribute = function ( attribute, index, offset ) { - - console.warn( 'THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().' ); - return this.fromBufferAttribute( attribute, index, offset ); - -}; - -Vector2.prototype.distanceToManhattan = function ( v ) { - - console.warn( 'THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().' ); - return this.manhattanDistanceTo( v ); - -}; - -Vector2.prototype.lengthManhattan = function () { - - console.warn( 'THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().' ); - return this.manhattanLength(); - -}; - -// - -Vector3.prototype.setEulerFromRotationMatrix = function () { - - console.error( 'THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.' ); - -}; - -Vector3.prototype.setEulerFromQuaternion = function () { - - console.error( 'THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.' ); - -}; - -Vector3.prototype.getPositionFromMatrix = function ( m ) { - - console.warn( 'THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().' ); - return this.setFromMatrixPosition( m ); - -}; - -Vector3.prototype.getScaleFromMatrix = function ( m ) { - - console.warn( 'THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().' ); - return this.setFromMatrixScale( m ); - -}; - -Vector3.prototype.getColumnFromMatrix = function ( index, matrix ) { - - console.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' ); - return this.setFromMatrixColumn( matrix, index ); - -}; - -Vector3.prototype.applyProjection = function ( m ) { - - console.warn( 'THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.' ); - return this.applyMatrix4( m ); - -}; - -Vector3.prototype.fromAttribute = function ( attribute, index, offset ) { - - console.warn( 'THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().' ); - return this.fromBufferAttribute( attribute, index, offset ); - -}; - -Vector3.prototype.distanceToManhattan = function ( v ) { - - console.warn( 'THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().' ); - return this.manhattanDistanceTo( v ); - -}; - -Vector3.prototype.lengthManhattan = function () { - - console.warn( 'THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().' ); - return this.manhattanLength(); - -}; - -// - -Vector4.prototype.fromAttribute = function ( attribute, index, offset ) { - - console.warn( 'THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().' ); - return this.fromBufferAttribute( attribute, index, offset ); - -}; - -Vector4.prototype.lengthManhattan = function () { - - console.warn( 'THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().' ); - return this.manhattanLength(); - -}; - -// - -Object3D.prototype.getChildByName = function ( name ) { - - console.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' ); - return this.getObjectByName( name ); - -}; - -Object3D.prototype.renderDepth = function () { - - console.warn( 'THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.' ); - -}; - -Object3D.prototype.translate = function ( distance, axis ) { - - console.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' ); - return this.translateOnAxis( axis, distance ); - -}; - -Object3D.prototype.getWorldRotation = function () { - - console.error( 'THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.' ); - -}; - -Object3D.prototype.applyMatrix = function ( matrix ) { - - console.warn( 'THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4().' ); - return this.applyMatrix4( matrix ); - -}; - -Object.defineProperties( Object3D.prototype, { - - eulerOrder: { - get: function () { - - console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' ); - return this.rotation.order; - - }, - set: function ( value ) { - - console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' ); - this.rotation.order = value; - - } - }, - useQuaternion: { - get: function () { - - console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' ); - - }, - set: function () { - - console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' ); - - } - } - -} ); - -Mesh.prototype.setDrawMode = function () { - - console.error( 'THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.' ); - -}; - -Object.defineProperties( Mesh.prototype, { - - drawMode: { - get: function () { - - console.error( 'THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode.' ); - return TrianglesDrawMode; - - }, - set: function () { - - console.error( 'THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.' ); - - } - } - -} ); - -Object.defineProperties( LOD.prototype, { - - objects: { - get: function () { - - console.warn( 'THREE.LOD: .objects has been renamed to .levels.' ); - return this.levels; - - } - } - -} ); - -Object.defineProperty( Skeleton.prototype, 'useVertexTexture', { - - get: function () { - - console.warn( 'THREE.Skeleton: useVertexTexture has been removed.' ); - - }, - set: function () { - - console.warn( 'THREE.Skeleton: useVertexTexture has been removed.' ); - - } - -} ); - -SkinnedMesh.prototype.initBones = function () { - - console.error( 'THREE.SkinnedMesh: initBones() has been removed.' ); - -}; - -Object.defineProperty( Curve.prototype, '__arcLengthDivisions', { - - get: function () { - - console.warn( 'THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.' ); - return this.arcLengthDivisions; - - }, - set: function ( value ) { - - console.warn( 'THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.' ); - this.arcLengthDivisions = value; - - } - -} ); - -// - -PerspectiveCamera.prototype.setLens = function ( focalLength, filmGauge ) { - - console.warn( 'THREE.PerspectiveCamera.setLens is deprecated. ' + - 'Use .setFocalLength and .filmGauge for a photographic setup.' ); - - if ( filmGauge !== undefined ) this.filmGauge = filmGauge; - this.setFocalLength( focalLength ); - -}; - -// - -Object.defineProperties( Light.prototype, { - onlyShadow: { - set: function () { - - console.warn( 'THREE.Light: .onlyShadow has been removed.' ); - - } - }, - shadowCameraFov: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowCameraFov is now .shadow.camera.fov.' ); - this.shadow.camera.fov = value; - - } - }, - shadowCameraLeft: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowCameraLeft is now .shadow.camera.left.' ); - this.shadow.camera.left = value; - - } - }, - shadowCameraRight: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowCameraRight is now .shadow.camera.right.' ); - this.shadow.camera.right = value; - - } - }, - shadowCameraTop: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowCameraTop is now .shadow.camera.top.' ); - this.shadow.camera.top = value; - - } - }, - shadowCameraBottom: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.' ); - this.shadow.camera.bottom = value; - - } - }, - shadowCameraNear: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowCameraNear is now .shadow.camera.near.' ); - this.shadow.camera.near = value; - - } - }, - shadowCameraFar: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowCameraFar is now .shadow.camera.far.' ); - this.shadow.camera.far = value; - - } - }, - shadowCameraVisible: { - set: function () { - - console.warn( 'THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.' ); - - } - }, - shadowBias: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowBias is now .shadow.bias.' ); - this.shadow.bias = value; - - } - }, - shadowDarkness: { - set: function () { - - console.warn( 'THREE.Light: .shadowDarkness has been removed.' ); - - } - }, - shadowMapWidth: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.' ); - this.shadow.mapSize.width = value; - - } - }, - shadowMapHeight: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.' ); - this.shadow.mapSize.height = value; - - } - } -} ); - -// - -Object.defineProperties( BufferAttribute.prototype, { - - length: { - get: function () { - - console.warn( 'THREE.BufferAttribute: .length has been deprecated. Use .count instead.' ); - return this.array.length; - - } - }, - dynamic: { - get: function () { - - console.warn( 'THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.' ); - return this.usage === DynamicDrawUsage; - - }, - set: function ( /* value */ ) { - - console.warn( 'THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.' ); - this.setUsage( DynamicDrawUsage ); - - } - } - -} ); - -BufferAttribute.prototype.setDynamic = function ( value ) { - - console.warn( 'THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.' ); - this.setUsage( value === true ? DynamicDrawUsage : StaticDrawUsage ); - return this; - -}; - -BufferAttribute.prototype.copyIndicesArray = function ( /* indices */ ) { - - console.error( 'THREE.BufferAttribute: .copyIndicesArray() has been removed.' ); - -}, - -BufferAttribute.prototype.setArray = function ( /* array */ ) { - - console.error( 'THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers' ); - -}; - -// - -BufferGeometry.prototype.addIndex = function ( index ) { - - console.warn( 'THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().' ); - this.setIndex( index ); - -}; - -BufferGeometry.prototype.addAttribute = function ( name, attribute ) { - - console.warn( 'THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().' ); - - if ( ! ( attribute && attribute.isBufferAttribute ) && ! ( attribute && attribute.isInterleavedBufferAttribute ) ) { - - console.warn( 'THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).' ); - - return this.setAttribute( name, new BufferAttribute( arguments[ 1 ], arguments[ 2 ] ) ); - - } - - if ( name === 'index' ) { - - console.warn( 'THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.' ); - this.setIndex( attribute ); - - return this; - - } - - return this.setAttribute( name, attribute ); - -}; - -BufferGeometry.prototype.addDrawCall = function ( start, count, indexOffset ) { - - if ( indexOffset !== undefined ) { - - console.warn( 'THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.' ); - - } - - console.warn( 'THREE.BufferGeometry: .addDrawCall() is now .addGroup().' ); - this.addGroup( start, count ); - -}; - -BufferGeometry.prototype.clearDrawCalls = function () { - - console.warn( 'THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().' ); - this.clearGroups(); - -}; - -BufferGeometry.prototype.computeOffsets = function () { - - console.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.' ); - -}; - -BufferGeometry.prototype.removeAttribute = function ( name ) { - - console.warn( 'THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute().' ); - - return this.deleteAttribute( name ); - -}; - -BufferGeometry.prototype.applyMatrix = function ( matrix ) { - - console.warn( 'THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4().' ); - return this.applyMatrix4( matrix ); - -}; - -Object.defineProperties( BufferGeometry.prototype, { - - drawcalls: { - get: function () { - - console.error( 'THREE.BufferGeometry: .drawcalls has been renamed to .groups.' ); - return this.groups; - - } - }, - offsets: { - get: function () { - - console.warn( 'THREE.BufferGeometry: .offsets has been renamed to .groups.' ); - return this.groups; - - } - } - -} ); - -Object.defineProperties( InstancedBufferGeometry.prototype, { - - maxInstancedCount: { - get: function () { - - console.warn( 'THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.' ); - return this.instanceCount; - - }, - set: function ( value ) { - - console.warn( 'THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.' ); - this.instanceCount = value; - - } - } - -} ); - -Object.defineProperties( Raycaster.prototype, { - - linePrecision: { - get: function () { - - console.warn( 'THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.' ); - return this.params.Line.threshold; - - }, - set: function ( value ) { - - console.warn( 'THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.' ); - this.params.Line.threshold = value; - - } - } - -} ); - -Object.defineProperties( InterleavedBuffer.prototype, { - - dynamic: { - get: function () { - - console.warn( 'THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.' ); - return this.usage === DynamicDrawUsage; - - }, - set: function ( value ) { - - console.warn( 'THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.' ); - this.setUsage( value ); - - } - } - -} ); - -InterleavedBuffer.prototype.setDynamic = function ( value ) { - - console.warn( 'THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead.' ); - this.setUsage( value === true ? DynamicDrawUsage : StaticDrawUsage ); - return this; - -}; - -InterleavedBuffer.prototype.setArray = function ( /* array */ ) { - - console.error( 'THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers' ); - -}; - -// - -ExtrudeGeometry.prototype.getArrays = function () { - - console.error( 'THREE.ExtrudeGeometry: .getArrays() has been removed.' ); - -}; - -ExtrudeGeometry.prototype.addShapeList = function () { - - console.error( 'THREE.ExtrudeGeometry: .addShapeList() has been removed.' ); - -}; - -ExtrudeGeometry.prototype.addShape = function () { - - console.error( 'THREE.ExtrudeGeometry: .addShape() has been removed.' ); - -}; - -// - -Scene.prototype.dispose = function () { - - console.error( 'THREE.Scene: .dispose() has been removed.' ); - -}; - -// - -Object.defineProperties( Uniform.prototype, { - - dynamic: { - set: function () { - - console.warn( 'THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.' ); - - } - }, - onUpdate: { - value: function () { - - console.warn( 'THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.' ); - return this; - - } - } - -} ); - -// - -Object.defineProperties( Material.prototype, { - - wrapAround: { - get: function () { - - console.warn( 'THREE.Material: .wrapAround has been removed.' ); - - }, - set: function () { - - console.warn( 'THREE.Material: .wrapAround has been removed.' ); - - } - }, - - overdraw: { - get: function () { - - console.warn( 'THREE.Material: .overdraw has been removed.' ); - - }, - set: function () { - - console.warn( 'THREE.Material: .overdraw has been removed.' ); - - } - }, - - wrapRGB: { - get: function () { - - console.warn( 'THREE.Material: .wrapRGB has been removed.' ); - return new Color(); - - } - }, - - shading: { - get: function () { - - console.error( 'THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.' ); - - }, - set: function ( value ) { - - console.warn( 'THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.' ); - this.flatShading = ( value === FlatShading ); - - } - }, - - stencilMask: { - get: function () { - - console.warn( 'THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.' ); - return this.stencilFuncMask; - - }, - set: function ( value ) { - - console.warn( 'THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.' ); - this.stencilFuncMask = value; - - } - } - -} ); - -Object.defineProperties( MeshPhongMaterial.prototype, { - - metal: { - get: function () { - - console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.' ); - return false; - - }, - set: function () { - - console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead' ); - - } - } - -} ); - -Object.defineProperties( MeshPhysicalMaterial.prototype, { - - transparency: { - get: function () { - - console.warn( 'THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission.' ); - return this.transmission; - - }, - set: function ( value ) { - - console.warn( 'THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission.' ); - this.transmission = value; - - } - } - -} ); - -Object.defineProperties( ShaderMaterial.prototype, { - - derivatives: { - get: function () { - - console.warn( 'THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' ); - return this.extensions.derivatives; - - }, - set: function ( value ) { - - console.warn( 'THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' ); - this.extensions.derivatives = value; - - } - } - -} ); - -// - -WebGLRenderer.prototype.clearTarget = function ( renderTarget, color, depth, stencil ) { - - console.warn( 'THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.' ); - this.setRenderTarget( renderTarget ); - this.clear( color, depth, stencil ); - -}; - -WebGLRenderer.prototype.animate = function ( callback ) { - - console.warn( 'THREE.WebGLRenderer: .animate() is now .setAnimationLoop().' ); - this.setAnimationLoop( callback ); - -}; - -WebGLRenderer.prototype.getCurrentRenderTarget = function () { - - console.warn( 'THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().' ); - return this.getRenderTarget(); - -}; - -WebGLRenderer.prototype.getMaxAnisotropy = function () { - - console.warn( 'THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().' ); - return this.capabilities.getMaxAnisotropy(); - -}; - -WebGLRenderer.prototype.getPrecision = function () { - - console.warn( 'THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.' ); - return this.capabilities.precision; - -}; - -WebGLRenderer.prototype.resetGLState = function () { - - console.warn( 'THREE.WebGLRenderer: .resetGLState() is now .state.reset().' ); - return this.state.reset(); - -}; - -WebGLRenderer.prototype.supportsFloatTextures = function () { - - console.warn( 'THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).' ); - return this.extensions.get( 'OES_texture_float' ); - -}; - -WebGLRenderer.prototype.supportsHalfFloatTextures = function () { - - console.warn( 'THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).' ); - return this.extensions.get( 'OES_texture_half_float' ); - -}; - -WebGLRenderer.prototype.supportsStandardDerivatives = function () { - - console.warn( 'THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).' ); - return this.extensions.get( 'OES_standard_derivatives' ); - -}; - -WebGLRenderer.prototype.supportsCompressedTextureS3TC = function () { - - console.warn( 'THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).' ); - return this.extensions.get( 'WEBGL_compressed_texture_s3tc' ); - -}; - -WebGLRenderer.prototype.supportsCompressedTexturePVRTC = function () { - - console.warn( 'THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).' ); - return this.extensions.get( 'WEBGL_compressed_texture_pvrtc' ); - -}; - -WebGLRenderer.prototype.supportsBlendMinMax = function () { - - console.warn( 'THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).' ); - return this.extensions.get( 'EXT_blend_minmax' ); - -}; - -WebGLRenderer.prototype.supportsVertexTextures = function () { - - console.warn( 'THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.' ); - return this.capabilities.vertexTextures; - -}; - -WebGLRenderer.prototype.supportsInstancedArrays = function () { - - console.warn( 'THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).' ); - return this.extensions.get( 'ANGLE_instanced_arrays' ); - -}; - -WebGLRenderer.prototype.enableScissorTest = function ( boolean ) { - - console.warn( 'THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().' ); - this.setScissorTest( boolean ); - -}; - -WebGLRenderer.prototype.initMaterial = function () { - - console.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' ); - -}; - -WebGLRenderer.prototype.addPrePlugin = function () { - - console.warn( 'THREE.WebGLRenderer: .addPrePlugin() has been removed.' ); - -}; - -WebGLRenderer.prototype.addPostPlugin = function () { - - console.warn( 'THREE.WebGLRenderer: .addPostPlugin() has been removed.' ); - -}; - -WebGLRenderer.prototype.updateShadowMap = function () { - - console.warn( 'THREE.WebGLRenderer: .updateShadowMap() has been removed.' ); - -}; - -WebGLRenderer.prototype.setFaceCulling = function () { - - console.warn( 'THREE.WebGLRenderer: .setFaceCulling() has been removed.' ); - -}; - -WebGLRenderer.prototype.allocTextureUnit = function () { - - console.warn( 'THREE.WebGLRenderer: .allocTextureUnit() has been removed.' ); - -}; - -WebGLRenderer.prototype.setTexture = function () { - - console.warn( 'THREE.WebGLRenderer: .setTexture() has been removed.' ); - -}; - -WebGLRenderer.prototype.setTexture2D = function () { - - console.warn( 'THREE.WebGLRenderer: .setTexture2D() has been removed.' ); - -}; - -WebGLRenderer.prototype.setTextureCube = function () { - - console.warn( 'THREE.WebGLRenderer: .setTextureCube() has been removed.' ); - -}; - -WebGLRenderer.prototype.getActiveMipMapLevel = function () { - - console.warn( 'THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().' ); - return this.getActiveMipmapLevel(); - -}; - -Object.defineProperties( WebGLRenderer.prototype, { - - shadowMapEnabled: { - get: function () { - - return this.shadowMap.enabled; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.' ); - this.shadowMap.enabled = value; - - } - }, - shadowMapType: { - get: function () { - - return this.shadowMap.type; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.' ); - this.shadowMap.type = value; - - } - }, - shadowMapCullFace: { - get: function () { - - console.warn( 'THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.' ); - return undefined; - - }, - set: function ( /* value */ ) { - - console.warn( 'THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.' ); - - } - }, - context: { - get: function () { - - console.warn( 'THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.' ); - return this.getContext(); - - } - }, - vr: { - get: function () { - - console.warn( 'THREE.WebGLRenderer: .vr has been renamed to .xr' ); - return this.xr; - - } - }, - gammaInput: { - get: function () { - - console.warn( 'THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.' ); - return false; - - }, - set: function () { - - console.warn( 'THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.' ); - - } - }, - gammaOutput: { - get: function () { - - console.warn( 'THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.' ); - return false; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.' ); - this.outputEncoding = ( value === true ) ? sRGBEncoding : LinearEncoding; - - } - }, - toneMappingWhitePoint: { - get: function () { - - console.warn( 'THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.' ); - return 1.0; - - }, - set: function () { - - console.warn( 'THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.' ); - - } - }, - -} ); - -Object.defineProperties( WebGLShadowMap.prototype, { - - cullFace: { - get: function () { - - console.warn( 'THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.' ); - return undefined; - - }, - set: function ( /* cullFace */ ) { - - console.warn( 'THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.' ); - - } - }, - renderReverseSided: { - get: function () { - - console.warn( 'THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.' ); - return undefined; - - }, - set: function () { - - console.warn( 'THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.' ); - - } - }, - renderSingleSided: { - get: function () { - - console.warn( 'THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.' ); - return undefined; - - }, - set: function () { - - console.warn( 'THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.' ); - - } - } - -} ); - -function WebGLRenderTargetCube( width, height, options ) { - - console.warn( 'THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options ).' ); - return new WebGLCubeRenderTarget( width, options ); - -} - -// - -Object.defineProperties( WebGLRenderTarget.prototype, { - - wrapS: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' ); - return this.texture.wrapS; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' ); - this.texture.wrapS = value; - - } - }, - wrapT: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' ); - return this.texture.wrapT; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' ); - this.texture.wrapT = value; - - } - }, - magFilter: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' ); - return this.texture.magFilter; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' ); - this.texture.magFilter = value; - - } - }, - minFilter: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' ); - return this.texture.minFilter; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' ); - this.texture.minFilter = value; - - } - }, - anisotropy: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' ); - return this.texture.anisotropy; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' ); - this.texture.anisotropy = value; - - } - }, - offset: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' ); - return this.texture.offset; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' ); - this.texture.offset = value; - - } - }, - repeat: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' ); - return this.texture.repeat; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' ); - this.texture.repeat = value; - - } - }, - format: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' ); - return this.texture.format; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' ); - this.texture.format = value; - - } - }, - type: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' ); - return this.texture.type; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' ); - this.texture.type = value; - - } - }, - generateMipmaps: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' ); - return this.texture.generateMipmaps; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' ); - this.texture.generateMipmaps = value; - - } - } - -} ); - -// - -Object.defineProperties( Audio.prototype, { - - load: { - value: function ( file ) { - - console.warn( 'THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.' ); - const scope = this; - const audioLoader = new AudioLoader(); - audioLoader.load( file, function ( buffer ) { - - scope.setBuffer( buffer ); - - } ); - return this; - - } - }, - startTime: { - set: function () { - - console.warn( 'THREE.Audio: .startTime is now .play( delay ).' ); - - } - } - -} ); - -AudioAnalyser.prototype.getData = function () { - - console.warn( 'THREE.AudioAnalyser: .getData() is now .getFrequencyData().' ); - return this.getFrequencyData(); - -}; - -// - -CubeCamera.prototype.updateCubeMap = function ( renderer, scene ) { - - console.warn( 'THREE.CubeCamera: .updateCubeMap() is now .update().' ); - return this.update( renderer, scene ); - -}; - -CubeCamera.prototype.clear = function ( renderer, color, depth, stencil ) { - - console.warn( 'THREE.CubeCamera: .clear() is now .renderTarget.clear().' ); - return this.renderTarget.clear( renderer, color, depth, stencil ); - -}; - -ImageUtils.crossOrigin = undefined; - -ImageUtils.loadTexture = function ( url, mapping, onLoad, onError ) { - - console.warn( 'THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.' ); - - const loader = new TextureLoader(); - loader.setCrossOrigin( this.crossOrigin ); - - const texture = loader.load( url, onLoad, undefined, onError ); - - if ( mapping ) texture.mapping = mapping; - - return texture; - -}; - -ImageUtils.loadTextureCube = function ( urls, mapping, onLoad, onError ) { - - console.warn( 'THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.' ); - - const loader = new CubeTextureLoader(); - loader.setCrossOrigin( this.crossOrigin ); - - const texture = loader.load( urls, onLoad, undefined, onError ); - - if ( mapping ) texture.mapping = mapping; - - return texture; - -}; - -ImageUtils.loadCompressedTexture = function () { - - console.error( 'THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.' ); - -}; - -ImageUtils.loadCompressedTextureCube = function () { - - console.error( 'THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.' ); - -}; - -// - -function CanvasRenderer() { - - console.error( 'THREE.CanvasRenderer has been removed' ); - -} - -// - -function JSONLoader() { - - console.error( 'THREE.JSONLoader has been removed.' ); - -} - -// - -const SceneUtils = { - - createMultiMaterialObject: function ( /* geometry, materials */ ) { - - console.error( 'THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js' ); - - }, - - detach: function ( /* child, parent, scene */ ) { - - console.error( 'THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js' ); - - }, - - attach: function ( /* child, scene, parent */ ) { - - console.error( 'THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js' ); - - } - -}; - -// - -function LensFlare() { - - console.error( 'THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js' ); - -} - -if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) { - - /* eslint-disable no-undef */ - __THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: { - revision: REVISION, - } } ) ); - /* eslint-enable no-undef */ - -} - -if ( typeof window !== 'undefined' ) { - - if ( window.__THREE__ ) { - - console.warn( 'WARNING: Multiple instances of Three.js being imported.' ); - - } else { - - window.__THREE__ = REVISION; - - } - -} - -export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AlphaFormat, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightProbe, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, AxisHelper, BackSide, BasicDepthPacking, BasicShadowMap, BinaryTextureLoader, Bone, BooleanKeyframeTrack, BoundingBoxHelper, Box2, Box3, Box3Helper, BoxGeometry as BoxBufferGeometry, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasRenderer, CanvasTexture, CatmullRomCurve3, CineonToneMapping, CircleGeometry as CircleBufferGeometry, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, CompressedTexture, CompressedTextureLoader, ConeGeometry as ConeBufferGeometry, ConeGeometry, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubeUVRefractionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry as CylinderBufferGeometry, CylinderGeometry, Cylindrical, DataTexture, DataTexture2DArray, DataTexture3D, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry as DodecahedronBufferGeometry, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicBufferAttribute, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EdgesHelper, EllipseCurve, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry as ExtrudeBufferGeometry, ExtrudeGeometry, FaceColors, FileLoader, FlatShading, Float16BufferAttribute, Float32Attribute, Float32BufferAttribute, Float64Attribute, Float64BufferAttribute, FloatType, Fog, FogExp2, Font, FontLoader, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GammaEncoding, GreaterDepth, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, HemisphereLightProbe, IcosahedronGeometry as IcosahedronBufferGeometry, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, ImmediateRenderObject, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16Attribute, Int16BufferAttribute, Int32Attribute, Int32BufferAttribute, Int8Attribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, JSONLoader, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry as LatheBufferGeometry, LatheGeometry, Layers, LensFlare, LessDepth, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LinePieces, LineSegments, LineStrip, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearToneMapping, Loader, LoaderUtils, LoadingManager, LogLuvEncoding, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils as Math, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshFaceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiMaterial, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverDepth, NeverStencilFunc, NoBlending, NoColors, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry as OctahedronBufferGeometry, OctahedronGeometry, OneFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, ParametricGeometry as ParametricBufferGeometry, ParametricGeometry, Particle, ParticleBasicMaterial, ParticleSystem, ParticleSystemMaterial, Path, PerspectiveCamera, Plane, PlaneGeometry as PlaneBufferGeometry, PlaneGeometry, PlaneHelper, PointCloud, PointCloudMaterial, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry as PolyhedronBufferGeometry, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDEncoding, RGBEEncoding, RGBEFormat, RGBFormat, RGBIntegerFormat, RGBM16Encoding, RGBM7Encoding, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry as RingBufferGeometry, RingGeometry, SRGB8_ALPHA8_ASTC_10x10_Format, SRGB8_ALPHA8_ASTC_10x5_Format, SRGB8_ALPHA8_ASTC_10x6_Format, SRGB8_ALPHA8_ASTC_10x8_Format, SRGB8_ALPHA8_ASTC_12x10_Format, SRGB8_ALPHA8_ASTC_12x12_Format, SRGB8_ALPHA8_ASTC_4x4_Format, SRGB8_ALPHA8_ASTC_5x4_Format, SRGB8_ALPHA8_ASTC_5x5_Format, SRGB8_ALPHA8_ASTC_6x5_Format, SRGB8_ALPHA8_ASTC_6x6_Format, SRGB8_ALPHA8_ASTC_8x5_Format, SRGB8_ALPHA8_ASTC_8x6_Format, SRGB8_ALPHA8_ASTC_8x8_Format, Scene, SceneUtils, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry as ShapeBufferGeometry, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, SmoothShading, Sphere, SphereGeometry as SphereBufferGeometry, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry as TetrahedronBufferGeometry, TetrahedronGeometry, TextGeometry as TextBufferGeometry, TextGeometry, Texture, TextureLoader, TorusGeometry as TorusBufferGeometry, TorusGeometry, TorusKnotGeometry as TorusKnotBufferGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry as TubeBufferGeometry, TubeGeometry, UVMapping, Uint16Attribute, Uint16BufferAttribute, Uint32Attribute, Uint32BufferAttribute, Uint8Attribute, Uint8BufferAttribute, Uint8ClampedAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShort565Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, Vertex, VertexColors, VideoTexture, WebGL1Renderer, WebGLCubeRenderTarget, WebGLMultisampleRenderTarget, WebGLRenderTarget, WebGLRenderTargetCube, WebGLRenderer, WebGLUtils, WireframeGeometry, WireframeHelper, WrapAroundEnding, XHRLoader, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, sRGBEncoding }; + `}var yv=0,vv=1,_v=0,wv=1,bv=2;function Mv(s){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),s}function Sv(s=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),s.isMultiMaterial=!0,s.materials=s,s.clone=function(){return s.slice()},s}function Tv(s,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new ji(s,e)}function Ev(s){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new is(s)}function Av(s,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new ji(s,e)}function Lv(s){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Pn(s)}function Rv(s){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Pn(s)}function Cv(s){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Pn(s)}function Pv(s,e,t){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new _(s,e,t)}function Iv(s,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Te(s,e).setUsage(Ii)}function Dv(s,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Ol(s,e)}function Fv(s,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Ul(s,e)}function Nv(s,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Hl(s,e)}function Bv(s,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Gl(s,e)}function zv(s,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Br(s,e)}function Ov(s,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new kl(s,e)}function Uv(s,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new zr(s,e)}function Hv(s,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new ae(s,e)}function Gv(s,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Wl(s,e)}St.create=function(s,e){return console.log("THREE.Curve.create() has been deprecated"),s.prototype=Object.create(St.prototype),s.prototype.constructor=s,s.prototype.getPoint=e,s};lr.prototype.fromPoints=function(s){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(s)};function kv(s){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Wh(s)}function Vv(s,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new kh(s,e)}function Wv(s,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new _t(new Ho(s.geometry),new at({color:e!==void 0?e:16777215}))}Uh.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Nh.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};function qv(s,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new _t(new Qo(s.geometry),new at({color:e!==void 0?e:16777215}))}dt.prototype.extractUrlBase=function(s){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Ca.extractUrlBase(s)};dt.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};function Xv(s){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Ot(s)}function Yv(s){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new jc(s)}vi.prototype.center=function(s){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(s)};vi.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};vi.prototype.isIntersectionBox=function(s){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(s)};vi.prototype.size=function(s){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(s)};vt.prototype.center=function(s){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(s)};vt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};vt.prototype.isIntersectionBox=function(s){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(s)};vt.prototype.isIntersectionSphere=function(s){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(s)};vt.prototype.size=function(s){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(s)};on.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Gi.prototype.setFromMatrix=function(s){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(s)};Ih.prototype.center=function(s){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(s)};Ke.prototype.flattenToArrayOffset=function(s,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(s,e)};Ke.prototype.multiplyVector3=function(s){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),s.applyMatrix3(this)};Ke.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Ke.prototype.applyToBufferAttribute=function(s){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),s.applyMatrix3(this)};Ke.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Ke.prototype.getInverse=function(s){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(s).invert()};le.prototype.extractPosition=function(s){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(s)};le.prototype.flattenToArrayOffset=function(s,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(s,e)};le.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new _().setFromMatrixColumn(this,3)};le.prototype.setRotationFromQuaternion=function(s){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(s)};le.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};le.prototype.multiplyVector3=function(s){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),s.applyMatrix4(this)};le.prototype.multiplyVector4=function(s){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),s.applyMatrix4(this)};le.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};le.prototype.rotateAxis=function(s){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),s.transformDirection(this)};le.prototype.crossVector=function(s){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),s.applyMatrix4(this)};le.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};le.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};le.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};le.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};le.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};le.prototype.applyToBufferAttribute=function(s){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),s.applyMatrix4(this)};le.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};le.prototype.makeFrustum=function(s,e,t,n,i,r){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(s,e,n,t,i,r)};le.prototype.getInverse=function(s){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(s).invert()};Lt.prototype.isIntersectionLine=function(s){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(s)};rt.prototype.multiplyVector3=function(s){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),s.applyQuaternion(this)};rt.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};ln.prototype.isIntersectionBox=function(s){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(s)};ln.prototype.isIntersectionPlane=function(s){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(s)};ln.prototype.isIntersectionSphere=function(s){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(s)};qe.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};qe.prototype.barycoordFromPoint=function(s,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(s,e)};qe.prototype.midpoint=function(s){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(s)};qe.prototypenormal=function(s){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(s)};qe.prototype.plane=function(s){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(s)};qe.barycoordFromPoint=function(s,e,t,n,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),qe.getBarycoord(s,e,t,n,i)};qe.normal=function(s,e,t,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),qe.getNormal(s,e,t,n)};xn.prototype.extractAllPoints=function(s){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(s)};xn.prototype.extrude=function(s){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new gn(this,s)};xn.prototype.makeGeometry=function(s){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new _s(this,s)};W.prototype.fromAttribute=function(s,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(s,e,t)};W.prototype.distanceToManhattan=function(s){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(s)};W.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};_.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};_.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};_.prototype.getPositionFromMatrix=function(s){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(s)};_.prototype.getScaleFromMatrix=function(s){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(s)};_.prototype.getColumnFromMatrix=function(s,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,s)};_.prototype.applyProjection=function(s){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(s)};_.prototype.fromAttribute=function(s,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(s,e,t)};_.prototype.distanceToManhattan=function(s){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(s)};_.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Fe.prototype.fromAttribute=function(s,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(s,e,t)};Fe.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Se.prototype.getChildByName=function(s){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(s)};Se.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};Se.prototype.translate=function(s,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,s)};Se.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};Se.prototype.applyMatrix=function(s){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(s)};Object.defineProperties(Se.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(s){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=s}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});je.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")};Object.defineProperties(je.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Rd},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}});os.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};ot.prototype.setLens=function(s,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(s)};Object.defineProperties(Dt.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(s){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=s}},shadowCameraLeft:{set:function(s){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=s}},shadowCameraRight:{set:function(s){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=s}},shadowCameraTop:{set:function(s){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=s}},shadowCameraBottom:{set:function(s){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=s}},shadowCameraNear:{set:function(s){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=s}},shadowCameraFar:{set:function(s){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=s}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(s){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=s}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(s){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=s}},shadowMapHeight:{set:function(s){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=s}}});Object.defineProperties(Te.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Ii},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Ii)}}});Te.prototype.setDynamic=function(s){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(s===!0?Ii:Pi),this};Te.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Te.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};ue.prototype.addIndex=function(s){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(s)};ue.prototype.addAttribute=function(s,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(s,new Te(arguments[1],arguments[2]))):s==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(s,e)};ue.prototype.addDrawCall=function(s,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(s,e)};ue.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};ue.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};ue.prototype.removeAttribute=function(s){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(s)};ue.prototype.applyMatrix=function(s){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(s)};Object.defineProperties(ue.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});$t.prototype.setDynamic=function(s){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(s===!0?Ii:Pi),this};$t.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};gn.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};gn.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};gn.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};Kr.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};Cs.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(tt.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new se}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(s){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=s===el}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(s){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=s}}});Object.defineProperties(jt.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(s){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=s}}});Ue.prototype.clearTarget=function(s,e,t,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(s),this.clear(e,t,n)};Ue.prototype.animate=function(s){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(s)};Ue.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};Ue.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};Ue.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};Ue.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};Ue.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};Ue.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};Ue.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};Ue.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};Ue.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};Ue.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};Ue.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};Ue.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};Ue.prototype.enableScissorTest=function(s){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(s)};Ue.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};Ue.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};Ue.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};Ue.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Ue.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};Ue.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};Ue.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};Ue.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};Ue.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};Ue.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(Ue.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(s){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=s}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(s){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=s}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(s){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=s===!0?Er:yt}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}});Object.defineProperties(mc.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});function Zv(s,e,t){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Yr(s,t)}Object.defineProperties(Vt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(s){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=s}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(s){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=s}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(s){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=s}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(s){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=s}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(s){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=s}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(s){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=s}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(s){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=s}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(s){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=s}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(s){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=s}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(s){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=s}}});Fa.prototype.load=function(s){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");let e=this;return new dh().load(s,function(n){e.setBuffer(n)}),this};wh.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Xr.prototype.updateCubeMap=function(s,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(s,e)};Xr.prototype.clear=function(s,e,t,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(s,e,t,n)};En.crossOrigin=void 0;En.loadTexture=function(s,e,t,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");let i=new $c;i.setCrossOrigin(this.crossOrigin);let r=i.load(s,t,void 0,n);return e&&(r.mapping=e),r};En.loadTextureCube=function(s,e,t,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");let i=new Jc;i.setCrossOrigin(this.crossOrigin);let r=i.load(s,t,void 0,n);return e&&(r.mapping=e),r};En.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};En.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};function Jv(){console.error("THREE.CanvasRenderer has been removed")}function jv(){console.error("THREE.JSONLoader has been removed.")}var $v={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function Qv(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:$a}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=$a);export{Iu as ACESFilmicToneMapping,Gn as AddEquation,Lu as AddOperation,vl as AdditiveAnimationBlendMode,tl as AdditiveBlending,Hu as AlphaFormat,wu as AlwaysDepth,Fd as AlwaysStencilFunc,Aa as AmbientLight,ph as AmbientLightProbe,ir as AnimationClip,Wx as AnimationLoader,Eh as AnimationMixer,Sh as AnimationObjectGroup,Ge as AnimationUtils,ha as ArcCurve,Ro as ArrayCamera,Ry as ArrowHelper,Fa as Audio,wh as AudioAnalyser,uh as AudioContext,oy as AudioListener,dh as AudioLoader,Wh as AxesHelper,kv as AxisHelper,Qe as BackSide,Pd as BasicDepthPacking,Gy as BasicShadowMap,Yv as BinaryTextureLoader,as as Bone,Dn as BooleanKeyframeTrack,Vv as BoundingBoxHelper,vi as Box2,vt as Box3,Ay as Box3Helper,ii as BoxBufferGeometry,ii as BoxGeometry,kh as BoxHelper,Te as BufferAttribute,ue as BufferGeometry,oh as BufferGeometryLoader,Fu as ByteType,yi as Cache,Hi as Camera,Ey as CameraHelper,Jv as CanvasRenderer,Oc as CanvasTexture,ma as CatmullRomCurve3,Pu as CineonToneMapping,Bo as CircleBufferGeometry,Bo as CircleGeometry,xt as ClampToEdgeWrapping,xh as Clock,se as Color,la as ColorKeyframeTrack,No as CompressedTexture,qx as CompressedTextureLoader,zo as ConeBufferGeometry,zo as ConeGeometry,Xr as CubeCamera,mr as CubeReflectionMapping,gr as CubeRefractionMapping,ai as CubeTexture,Jc as CubeTextureLoader,Ei as CubeUVReflectionMapping,xr as CubeUVRefractionMapping,Ts as CubicBezierCurve,ga as CubicBezierCurve3,Xc as CubicInterpolant,Qa as CullFaceBack,ou as CullFaceFront,Hy as CullFaceFrontBack,su as CullFaceNone,St as Curve,eh as CurvePath,lu as CustomBlending,Du as CustomToneMapping,$i as CylinderBufferGeometry,$i as CylinderGeometry,vy as Cylindrical,li as DataTexture,To as DataTexture2DArray,Eo as DataTexture3D,jc as DataTextureLoader,Py as DataUtils,Qy as DecrementStencilOp,ev as DecrementWrapStencilOp,Vx as DefaultLoadingManager,Vn as DepthFormat,Ci as DepthStencilFormat,Uc as DepthTexture,Ea as DirectionalLight,Ty as DirectionalLightHelper,Yc as DiscreteInterpolant,Oo as DodecahedronBufferGeometry,Oo as DodecahedronGeometry,fr as DoubleSide,mu as DstAlphaFactor,xu as DstColorFactor,Iv as DynamicBufferAttribute,pv as DynamicCopyUsage,Ii as DynamicDrawUsage,uv as DynamicReadUsage,Ho as EdgesGeometry,Wv as EdgesHelper,rr as EllipseCurve,Mu as EqualDepth,rv as EqualStencilFunc,Vs as EquirectangularReflectionMapping,Ws as EquirectangularRefractionMapping,Rn as Euler,nn as EventDispatcher,gn as ExtrudeBufferGeometry,gn as ExtrudeGeometry,wv as FaceColors,Ot as FileLoader,el as FlatShading,Vl as Float16BufferAttribute,Hv as Float32Attribute,ae as Float32BufferAttribute,Gv as Float64Attribute,Wl as Float64BufferAttribute,tn as FloatType,qi as Fog,Wi as FogExp2,Da as Font,iy as FontLoader,Si as FrontSide,Gi as Frustum,Lh as GLBufferAttribute,gv as GLSL1,Ml as GLSL3,Js as GammaEncoding,Tu as GreaterDepth,Su as GreaterEqualDepth,lv as GreaterEqualStencilFunc,ov as GreaterStencilFunc,Uh as GridHelper,Cn as Group,br as HalfFloatType,va as HemisphereLight,My as HemisphereLightHelper,fh as HemisphereLightProbe,Vo as IcosahedronBufferGeometry,Vo as IcosahedronGeometry,ch as ImageBitmapLoader,Ms as ImageLoader,En as ImageUtils,Dh as ImmediateRenderObject,$y as IncrementStencilOp,Ky as IncrementWrapStencilOp,Ia as InstancedBufferAttribute,Pa as InstancedBufferGeometry,Ah as InstancedInterleavedBuffer,Po as InstancedMesh,Bv as Int16Attribute,Gl as Int16BufferAttribute,Ov as Int32Attribute,kl as Int32BufferAttribute,Dv as Int8Attribute,Ol as Int8BufferAttribute,Bu as IntType,$t as InterleavedBuffer,pn as InterleavedBufferAttribute,Kt as Interpolant,Mr as InterpolateDiscrete,Sr as InterpolateLinear,Ys as InterpolateSmooth,tv as InvertStencilOp,jv as JSONLoader,$s as KeepStencilOp,Pt as KeyframeTrack,bc as LOD,Wo as LatheBufferGeometry,Wo as LatheGeometry,co as Layers,Qv as LensFlare,bu as LessDepth,Gs as LessEqualDepth,sv as LessEqualStencilFunc,iv as LessStencilFunc,Dt as Light,ur as LightProbe,Qt as Line,Ih as Line3,at as LineBasicMaterial,ar as LineCurve,Kc as LineCurve3,oa as LineDashedMaterial,Do as LineLoop,vv as LinePieces,_t as LineSegments,yv as LineStrip,yt as LinearEncoding,it as LinearFilter,aa as LinearInterpolant,Xy as LinearMipMapLinearFilter,qy as LinearMipMapNearestFilter,Ai as LinearMipmapLinearFilter,ll as LinearMipmapNearestFilter,Ru as LinearToneMapping,dt as Loader,Ca as LoaderUtils,ca as LoadingManager,Cd as LogLuvEncoding,Ed as LoopOnce,Ld as LoopPingPong,Ad as LoopRepeat,ku as LuminanceAlphaFormat,Gu as LuminanceFormat,Oy as MOUSE,tt as Material,sh as MaterialLoader,xv as Math,xv as MathUtils,Ke as Matrix3,le as Matrix4,sl as MaxEquation,je as Mesh,Jt as MeshBasicMaterial,jr as MeshDepthMaterial,$r as MeshDistanceMaterial,Mv as MeshFaceMaterial,ra as MeshLambertMaterial,sa as MeshMatcapMaterial,ia as MeshNormalMaterial,ta as MeshPhongMaterial,ea as MeshPhysicalMaterial,bs as MeshStandardMaterial,na as MeshToonMaterial,rl as MinEquation,vr as MirroredRepeatWrapping,Au as MixOperation,Sv as MultiMaterial,il as MultiplyBlending,pr as MultiplyOperation,nt as NearestFilter,Wy as NearestMipMapLinearFilter,Vy as NearestMipMapNearestFilter,Xs as NearestMipmapLinearFilter,qs as NearestMipmapNearestFilter,_u as NeverDepth,nv as NeverStencilFunc,en as NoBlending,_v as NoColors,kn as NoToneMapping,Zs as NormalAnimationBlendMode,Ti as NormalBlending,Eu as NotEqualDepth,av as NotEqualStencilFunc,tr as NumberKeyframeTrack,Se as Object3D,Kx as ObjectLoader,Dd as ObjectSpaceNormalMap,vs as OctahedronBufferGeometry,vs as OctahedronGeometry,du as OneFactor,gu as OneMinusDstAlphaFactor,yu as OneMinusDstColorFactor,al as OneMinusSrcAlphaFactor,pu as OneMinusSrcColorFactor,hr as OrthographicCamera,Ka as PCFShadowMap,au as PCFSoftShadowMap,Fy as PMREMGenerator,qo as ParametricBufferGeometry,qo as ParametricGeometry,Ev as Particle,Rv as ParticleBasicMaterial,Av as ParticleSystem,Cv as ParticleSystemMaterial,lr as Path,ot as PerspectiveCamera,Lt as Plane,Jr as PlaneBufferGeometry,Jr as PlaneGeometry,Ly as PlaneHelper,Tv as PointCloud,Lv as PointCloudMaterial,Sa as PointLight,wy as PointLightHelper,ji as Points,Pn as PointsMaterial,Sy as PolarGridHelper,In as PolyhedronBufferGeometry,In as PolyhedronGeometry,ly as PositionalAudio,Ce as PropertyBinding,bh as PropertyMixer,Es as QuadraticBezierCurve,xa as QuadraticBezierCurve3,rt as Quaternion,xi as QuaternionKeyframeTrack,Zc as QuaternionLinearInterpolant,$a as REVISION,Id as RGBADepthPacking,Tt as RGBAFormat,Ju as RGBAIntegerFormat,ld as RGBA_ASTC_10x10_Format,sd as RGBA_ASTC_10x5_Format,od as RGBA_ASTC_10x6_Format,ad as RGBA_ASTC_10x8_Format,cd as RGBA_ASTC_12x10_Format,hd as RGBA_ASTC_12x12_Format,$u as RGBA_ASTC_4x4_Format,Qu as RGBA_ASTC_5x4_Format,Ku as RGBA_ASTC_5x5_Format,ed as RGBA_ASTC_6x5_Format,td as RGBA_ASTC_6x6_Format,nd as RGBA_ASTC_8x5_Format,id as RGBA_ASTC_8x6_Format,rd as RGBA_ASTC_8x8_Format,ud as RGBA_BPTC_Format,yl as RGBA_ETC2_EAC_Format,gl as RGBA_PVRTC_2BPPV1_Format,ml as RGBA_PVRTC_4BPPV1_Format,hl as RGBA_S3TC_DXT1_Format,ul as RGBA_S3TC_DXT3_Format,dl as RGBA_S3TC_DXT5_Format,bl as RGBDEncoding,js as RGBEEncoding,Vu as RGBEFormat,Sn as RGBFormat,Zu as RGBIntegerFormat,wl as RGBM16Encoding,_l as RGBM7Encoding,ju as RGB_ETC1_Format,xl as RGB_ETC2_Format,pl as RGB_PVRTC_2BPPV1_Format,fl as RGB_PVRTC_4BPPV1_Format,cl as RGB_S3TC_DXT1_Format,Xu as RGFormat,Yu as RGIntegerFormat,gi as RawShaderMaterial,ln as Ray,xy as Raycaster,La as RectAreaLight,Wu as RedFormat,qu as RedIntegerFormat,Cu as ReinhardToneMapping,yr as RepeatWrapping,jy as ReplaceStencilOp,hu as ReverseSubtractEquation,Xo as RingBufferGeometry,Xo as RingGeometry,Md as SRGB8_ALPHA8_ASTC_10x10_Format,_d as SRGB8_ALPHA8_ASTC_10x5_Format,wd as SRGB8_ALPHA8_ASTC_10x6_Format,bd as SRGB8_ALPHA8_ASTC_10x8_Format,Sd as SRGB8_ALPHA8_ASTC_12x10_Format,Td as SRGB8_ALPHA8_ASTC_12x12_Format,dd as SRGB8_ALPHA8_ASTC_4x4_Format,fd as SRGB8_ALPHA8_ASTC_5x4_Format,pd as SRGB8_ALPHA8_ASTC_5x5_Format,md as SRGB8_ALPHA8_ASTC_6x5_Format,gd as SRGB8_ALPHA8_ASTC_6x6_Format,xd as SRGB8_ALPHA8_ASTC_8x5_Format,yd as SRGB8_ALPHA8_ASTC_8x6_Format,vd as SRGB8_ALPHA8_ASTC_8x8_Format,Kr as Scene,$v as SceneUtils,Ee as ShaderChunk,Bt as ShaderLib,jt as ShaderMaterial,Ko as ShadowMaterial,xn as Shape,_s as ShapeBufferGeometry,_s as ShapeGeometry,hh as ShapePath,zt as ShapeUtils,Nu as ShortType,ls as Skeleton,Nh as SkeletonHelper,os as SkinnedMesh,ky as SmoothShading,on as Sphere,ws as SphereBufferGeometry,ws as SphereGeometry,yy as Spherical,Ra as SphericalHarmonics3,As as SplineCurve,wa as SpotLight,_y as SpotLightHelper,is as Sprite,es as SpriteMaterial,ol as SrcAlphaFactor,vu as SrcAlphaSaturateFactor,fu as SrcColorFactor,fv as StaticCopyUsage,Pi as StaticDrawUsage,hv as StaticReadUsage,ry as StereoCamera,mv as StreamCopyUsage,cv as StreamDrawUsage,dv as StreamReadUsage,Fn as StringKeyframeTrack,cu as SubtractEquation,nl as SubtractiveBlending,Uy as TOUCH,Xn as TangentSpaceNormalMap,Yo as TetrahedronBufferGeometry,Yo as TetrahedronGeometry,Zo as TextBufferGeometry,Zo as TextGeometry,et as Texture,$c as TextureLoader,Jo as TorusBufferGeometry,Jo as TorusGeometry,jo as TorusKnotBufferGeometry,jo as TorusKnotGeometry,qe as Triangle,Zy as TriangleFanDrawMode,Yy as TriangleStripDrawMode,Rd as TrianglesDrawMode,$o as TubeBufferGeometry,$o as TubeGeometry,ks as UVMapping,zv as Uint16Attribute,Br as Uint16BufferAttribute,Uv as Uint32Attribute,zr as Uint32BufferAttribute,Fv as Uint8Attribute,Ul as Uint8BufferAttribute,Nv as Uint8ClampedAttribute,Hl as Uint8ClampedBufferAttribute,Cs as Uniform,K as UniformsLib,cf as UniformsUtils,Li as UnsignedByteType,Ri as UnsignedInt248Type,wr as UnsignedIntType,zu as UnsignedShort4444Type,Ou as UnsignedShort5551Type,Uu as UnsignedShort565Type,_r as UnsignedShortType,Mi as VSMShadowMap,W as Vector2,_ as Vector3,Fe as Vector4,nr as VectorKeyframeTrack,Pv as Vertex,bv as VertexColors,zc as VideoTexture,xc as WebGL1Renderer,Yr as WebGLCubeRenderTarget,El as WebGLMultisampleRenderTarget,Vt as WebGLRenderTarget,Zv as WebGLRenderTargetCube,Ue as WebGLRenderer,px as WebGLUtils,Qo as WireframeGeometry,qv as WireframeHelper,Tr as WrapAroundEnding,Xv as XHRLoader,Wn as ZeroCurvatureEnding,uu as ZeroFactor,qn as ZeroSlopeEnding,Jy as ZeroStencilOp,Er as sRGBEncoding}; +/** + * @license + * Copyright 2010-2021 Three.js Authors + * SPDX-License-Identifier: MIT + */ diff --git a/demo/index-worker.js b/demo/index-worker.js index b4eed0d1..b1d5a434 100644 --- a/demo/index-worker.js +++ b/demo/index-worker.js @@ -24,6 +24,7 @@ onmessage = async (msg) => { } // must strip canvas from return value as it cannot be transfered from worker thread if (result.canvas) result.canvas = null; + // @ts-ignore tslint wrong type matching for worker postMessage({ result }); busy = false; }; diff --git a/dist/human.esm-nobundle.js b/dist/human.esm-nobundle.js index 535ab37c..1ae90783 100644 --- a/dist/human.esm-nobundle.js +++ b/dist/human.esm-nobundle.js @@ -5,14 +5,14 @@ author: ' */ -var F5=Object.defineProperty;var JA=Object.prototype.hasOwnProperty,CA=Object.getOwnPropertyNames,KA=Object.getOwnPropertyDescriptor;var Y=(A,e)=>{for(var t in e)F5(A,t,{get:e[t],enumerable:!0})},f=(A,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of CA(e))!JA.call(A,s)&&s!=="default"&&F5(A,s,{get:()=>e[s],enumerable:!(t=KA(e,s))||t.enumerable});return A};var q5=(A,e,t)=>{if(!e.has(A))throw TypeError("Cannot "+t)};var q=(A,e,t)=>(q5(A,e,"read from private field"),t?t.call(A):e.get(A)),A0=(A,e,t,s)=>(q5(A,e,"write to private field"),s?s.call(A,t):e.set(A,t),t);function O(A,e){let t=A.endsWith("/")?"":"/",o=e.startsWith(".")||e.startsWith("/")||e.startsWith("http:")||e.startsWith("https:")||e.startsWith("file:")?`${e}`:`${A}${t}${e}`;if(!o.toLocaleLowerCase().includes(".json"))throw new Error(`Human: ModelPath Error: ${o} Expecting JSON file`);return o}function b(...A){let e=new Date,t=`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}.${e.getMilliseconds().toString().padStart(3,"0")}`;A&&console.log(t,"Human:",...A)}var S=()=>typeof performance!="undefined"?performance.now():parseInt((Number(process.hrtime.bigint())/1e3/1e3).toString());function X(...A){let e=t=>t&&typeof t=="object";return A.reduce((t,s)=>(Object.keys(s||{}).forEach(o=>{let i=t[o],n=s[o];Array.isArray(i)&&Array.isArray(n)?t[o]=i.concat(...n):e(i)&&e(n)?t[o]=X(i,n):t[o]=n}),t),{})}var B5={backend:"webgl",modelBasePath:"../models/",wasmPath:"../assets/",debug:!0,async:!0,videoOptimized:!0,warmup:"full",filter:{enabled:!0,width:0,height:0,flip:!1,return:!0,brightness:0,contrast:0,sharpness:0,blur:0,saturation:0,hue:0,negative:!1,sepia:!1,vintage:!1,kodachrome:!1,technicolor:!1,polaroid:!1,pixelate:0},gesture:{enabled:!0},face:{enabled:!0,detector:{modelPath:"blazeface.json",rotation:!1,maxDetected:10,skipFrames:21,skipInitial:!1,minConfidence:.2,iouThreshold:.1,return:!1},mesh:{enabled:!0,modelPath:"facemesh.json"},iris:{enabled:!0,modelPath:"iris.json"},description:{enabled:!0,modelPath:"faceres.json",skipFrames:31,minConfidence:.1},emotion:{enabled:!0,minConfidence:.1,skipFrames:32,modelPath:"emotion.json"}},body:{enabled:!0,modelPath:"posenet.json",maxDetected:1,minConfidence:.1},hand:{enabled:!0,rotation:!1,skipFrames:12,skipInitial:!1,minConfidence:.1,iouThreshold:.1,maxDetected:2,landmarks:!0,detector:{modelPath:"handdetect.json"},skeleton:{modelPath:"handskeleton.json"}},object:{enabled:!1,modelPath:"nanodet.json",minConfidence:.2,iouThreshold:.4,maxDetected:10,skipFrames:41}};function U5(){let A,e;if(typeof navigator!="undefined"){let t=navigator.userAgent.match(/\(([^()]+)\)/g);if(t&&t[0]){let s=t[0].match(/\(([^()]+)\)/g);A=s?s[0].replace(/\(|\)/g,""):"",e=navigator.userAgent.replace(t[0],""),A[1]&&(e=e.replace(t[1],"")),e=e.replace(/ /g," ")}}else typeof process!="undefined"&&(A=`${process.platform} ${process.arch}`,e=`NodeJS ${process.version}`);return{platform:A,agent:e}}var r={};Y(r,{data:()=>_A,version:()=>$A});f(r,k2);f(r,O2);f(r,Z2);f(r,L2);f(r,V2);f(r,H2);import*as Y5 from"@tensorflow/tfjs/package.json";import*as J5 from"@tensorflow/tfjs-core/package.json";import*as C5 from"@tensorflow/tfjs-data/package.json";import*as K5 from"@tensorflow/tfjs-layers/package.json";import*as D5 from"@tensorflow/tfjs-converter/package.json";import{version_cpu as DA}from"@tensorflow/tfjs-backend-cpu/dist/index.js";import{version_webgl as GA}from"@tensorflow/tfjs-backend-webgl/dist/index.js";import{version_wasm as QA}from"@tensorflow/tfjs-backend-wasm/dist/index.js";import*as k2 from"@tensorflow/tfjs-core/dist/index.js";import*as O2 from"@tensorflow/tfjs-layers/dist/index.js";import*as Z2 from"@tensorflow/tfjs-converter/dist/index.js";import*as _A from"@tensorflow/tfjs-data/dist/index.js";import*as L2 from"@tensorflow/tfjs-backend-cpu/dist/index.js";import*as V2 from"@tensorflow/tfjs-backend-webgl/dist/index.js";import*as H2 from"@tensorflow/tfjs-backend-wasm/dist/index.js";var $A={tfjs:(Y5==null?void 0:Y5.version)||void 0,"tfjs-core":(J5==null?void 0:J5.version)||void 0,"tfjs-data":(C5==null?void 0:C5.version)||void 0,"tfjs-layers":(K5==null?void 0:K5.version)||void 0,"tfjs-converter":(D5==null?void 0:D5.version)||void 0,"tfjs-backend-cpu":DA||void 0,"tfjs-backend-webgl":GA||void 0,"tfjs-backend-wasm":QA||void 0};var H={name:"humangl",priority:99,canvas:null,gl:null,width:1024,height:1024,webGLattr:{alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!1,desynchronized:!0}};function G5(){if(!r.findBackend(H.name)){b("backend registration:",H.name);try{H.canvas=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(H.width,H.height):document.createElement("canvas")}catch(A){b("error: cannot create canvas:",A);return}try{H.gl=H.canvas.getContext("webgl2",H.webGLattr)}catch(A){b("error: cannot get WebGL2 context:",A);return}try{r.setWebGLContext(2,H.gl)}catch(A){b("error: cannot set WebGL2 context:",A);return}try{let A=new r.GPGPUContext(H.gl);r.registerBackend(H.name,()=>new r.MathBackendWebGL(A),H.priority)}catch(A){b("error: cannot register WebGL backend:",A);return}try{r.getKernelsForBackend("webgl").forEach(e=>{let t={...e,backendName:H.name};r.registerKernel(t)})}catch(A){b("error: cannot update WebGL backend registration:",A);return}try{r.ENV.set("WEBGL_VERSION",2)}catch(A){b("error: cannot set WebGL backend flags:",A);return}b("backend registered:",H.name)}}var A5={};Y(A5,{load:()=>n5,predict:()=>t5,triangulation:()=>aA,uvmap:()=>xA});function Q5(A,e){let t=[A.startPoint[0]*e[0],A.startPoint[1]*e[1]],s=[A.endPoint[0]*e[0],A.endPoint[1]*e[1]];return{startPoint:t,endPoint:s}}function l0(A){return[Math.abs(A.endPoint[0]-A.startPoint[0]),Math.abs(A.endPoint[1]-A.startPoint[1])]}function s0(A){return[A.startPoint[0]+(A.endPoint[0]-A.startPoint[0])/2,A.startPoint[1]+(A.endPoint[1]-A.startPoint[1])/2]}function i0(A,e,t){let s=e.shape[1],o=e.shape[2],i=[[A.startPoint[1]/s,A.startPoint[0]/o,A.endPoint[1]/s,A.endPoint[0]/o]];return r.image.cropAndResize(e,i,[0],t)}function T0(A,e=1.5){let t=s0(A),s=l0(A),o=[e*s[0]/2,e*s[1]/2],i=[t[0]-o[0],t[1]-o[1]],n=[t[0]+o[0],t[1]+o[1]];return{startPoint:i,endPoint:n,landmarks:A.landmarks}}function P0(A){let e=s0(A),t=l0(A),o=Math.max(...t)/2,i=[Math.round(e[0]-o),Math.round(e[1]-o)],n=[Math.round(e[0]+o),Math.round(e[1]+o)];return{startPoint:i,endPoint:n,landmarks:A.landmarks}}function K0(A){let e=A.map(i=>i[0]),t=A.map(i=>i[1]),s=[Math.min(...e),Math.min(...t)],o=[Math.max(...e),Math.max(...t)];return{startPoint:s,endPoint:o,landmarks:A}}var _5=A=>({startPoint:r.slice(A,[0,0],[-1,2]),endPoint:r.slice(A,[0,2],[-1,2])});var z0=[[1,0,0],[0,1,0],[0,0,1]];function A2(A){return A-2*Math.PI*Math.floor((A+Math.PI)/(2*Math.PI))}function D0(A,e){let t=Math.PI/2-Math.atan2(-(e[1]-A[1]),e[0]-A[0]);return A2(t)}function $5(A,e){return[[1,0,A],[0,1,e],[0,0,1]]}function K(A,e){let t=0;for(let s=0;s{let l=e.resizeBilinear([this.inputSize,this.inputSize]).div(127.5).sub(.5),d=this.model.execute(l),y;if(Array.isArray(d)){let c=d.sort((R,j)=>R.size-j.size),u=r.concat([c[0],c[2]],2),z=r.concat([c[1],c[3]],2);y=r.concat([z,u],1).squeeze(0)}else y=d.squeeze();let h=t2(y,this.anchors,[this.inputSize,this.inputSize]),p=r.slice(y,[0,0],[-1,1]),M=r.sigmoid(p).squeeze().dataSync();return[y,h,M]}),i=await r.image.nonMaxSuppressionAsync(s,o,this.config.face.detector.maxDetected,this.config.face.detector.iouThreshold,this.config.face.detector.minConfidence),n=i.arraySync();i.dispose();let a=[];for(let x=0;xthis.config.face.detector.minConfidence){let d=r.slice(s,[n[x],0],[1,-1]),y=_5(d);d.dispose();let h=this.anchorsData[n[x]],p=r.tidy(()=>r.slice(t,[n[x],oA-1],[1,-1]).squeeze().reshape([oA,-1]));a.push({box:y,landmarks:p,anchor:h,confidence:l})}}return t.dispose(),s.dispose(),{boxes:a,scaleFactor:[e.shape[2]/this.inputSize,e.shape[1]/this.inputSize]}}};async function iA(A){let e=await r.loadGraphModel(O(A.modelBasePath,A.face.detector.modelPath),{fromTFHub:A.face.detector.modelPath.includes("tfhub.dev")}),t=new sA(e,A);return!e||!e.modelUrl?b("load model failed:",A.face.detector.modelPath):A.debug&&b("load model:",e.modelUrl),t}var J={silhouette:[10,338,297,332,284,251,389,356,454,323,361,288,397,365,379,378,400,377,152,148,176,149,150,136,172,58,132,93,234,127,162,21,54,103,67,109],lipsUpperOuter:[61,185,40,39,37,0,267,269,270,409,291],lipsLowerOuter:[146,91,181,84,17,314,405,321,375,291],lipsUpperInner:[78,191,80,81,82,13,312,311,310,415,308],lipsLowerInner:[78,95,88,178,87,14,317,402,318,324,308],rightEyeUpper0:[246,161,160,159,158,157,173],rightEyeLower0:[33,7,163,144,145,153,154,155,133],rightEyeUpper1:[247,30,29,27,28,56,190],rightEyeLower1:[130,25,110,24,23,22,26,112,243],rightEyeUpper2:[113,225,224,223,222,221,189],rightEyeLower2:[226,31,228,229,230,231,232,233,244],rightEyeLower3:[143,111,117,118,119,120,121,128,245],rightEyebrowUpper:[156,70,63,105,66,107,55,193],rightEyebrowLower:[35,124,46,53,52,65],rightEyeIris:[473,474,475,476,477],leftEyeUpper0:[466,388,387,386,385,384,398],leftEyeLower0:[263,249,390,373,374,380,381,382,362],leftEyeUpper1:[467,260,259,257,258,286,414],leftEyeLower1:[359,255,339,254,253,252,256,341,463],leftEyeUpper2:[342,445,444,443,442,441,413],leftEyeLower2:[446,261,448,449,450,451,452,453,464],leftEyeLower3:[372,340,346,347,348,349,350,357,465],leftEyebrowUpper:[383,300,293,334,296,336,285,417],leftEyebrowLower:[265,353,276,283,282,295],leftEyeIris:[468,469,470,471,472],midwayBetweenEyes:[168],noseTip:[1],noseBottom:[2],noseRightCorner:[98],noseLeftCorner:[327],rightCheek:[205],leftCheek:[425]},G0=[{key:"EyeUpper0",indices:[9,10,11,12,13,14,15]},{key:"EyeUpper1",indices:[25,26,27,28,29,30,31]},{key:"EyeUpper2",indices:[41,42,43,44,45,46,47]},{key:"EyeLower0",indices:[0,1,2,3,4,5,6,7,8]},{key:"EyeLower1",indices:[16,17,18,19,20,21,22,23,24]},{key:"EyeLower2",indices:[32,33,34,35,36,37,38,39,40]},{key:"EyeLower3",indices:[54,55,56,57,58,59,60,61,62]}],c0=[[.499976992607117,.652534008026123],[.500025987625122,.547487020492554],[.499974012374878,.602371990680695],[.482113003730774,.471979022026062],[.500150978565216,.527155995368958],[.499909996986389,.498252987861633],[.499523013830185,.40106201171875],[.289712011814117,.380764007568359],[.499954998493195,.312398016452789],[.499987006187439,.269918978214264],[.500023007392883,.107050001621246],[.500023007392883,.666234016418457],[.5000159740448,.679224014282227],[.500023007392883,.692348003387451],[.499976992607117,.695277988910675],[.499976992607117,.70593398809433],[.499976992607117,.719385027885437],[.499976992607117,.737019002437592],[.499967992305756,.781370997428894],[.499816000461578,.562981009483337],[.473773002624512,.573909997940063],[.104906998574734,.254140973091125],[.365929991006851,.409575998783112],[.338757991790771,.41302502155304],[.311120003461838,.409460008144379],[.274657994508743,.389131009578705],[.393361985683441,.403706014156342],[.345234006643295,.344011008739471],[.370094001293182,.346076011657715],[.319321990013123,.347265005111694],[.297903001308441,.353591024875641],[.24779200553894,.410809993743896],[.396889001131058,.842755019664764],[.280097991228104,.375599980354309],[.106310002505779,.399955987930298],[.2099249958992,.391353011131287],[.355807989835739,.534406006336212],[.471751004457474,.65040397644043],[.474155008792877,.680191993713379],[.439785003662109,.657229006290436],[.414617002010345,.66654098033905],[.450374007225037,.680860996246338],[.428770989179611,.682690978050232],[.374971002340317,.727805018424988],[.486716985702515,.547628998756409],[.485300987958908,.527395009994507],[.257764995098114,.314490020275116],[.401223003864288,.455172002315521],[.429818987846375,.548614978790283],[.421351999044418,.533740997314453],[.276895999908447,.532056987285614],[.483370006084442,.499586999416351],[.33721199631691,.282882988452911],[.296391993761063,.293242990970612],[.169294998049736,.193813979625702],[.447580009698868,.302609980106354],[.392390012741089,.353887975215912],[.354490011930466,.696784019470215],[.067304998636246,.730105042457581],[.442739009857178,.572826027870178],[.457098007202148,.584792017936707],[.381974011659622,.694710969924927],[.392388999462128,.694203019142151],[.277076005935669,.271932005882263],[.422551989555359,.563233017921448],[.385919004678726,.281364023685455],[.383103013038635,.255840003490448],[.331431001424789,.119714021682739],[.229923993349075,.232002973556519],[.364500999450684,.189113974571228],[.229622006416321,.299540996551514],[.173287004232407,.278747975826263],[.472878992557526,.666198015213013],[.446828007698059,.668527007102966],[.422762006521225,.673889994621277],[.445307999849319,.580065965652466],[.388103008270264,.693961024284363],[.403039008378983,.706539988517761],[.403629004955292,.693953037261963],[.460041999816895,.557139039039612],[.431158006191254,.692366003990173],[.452181994915009,.692366003990173],[.475387006998062,.692366003990173],[.465828001499176,.779190003871918],[.472328990697861,.736225962638855],[.473087012767792,.717857003211975],[.473122000694275,.704625964164734],[.473033010959625,.695277988910675],[.427942007780075,.695277988910675],[.426479011774063,.703539967536926],[.423162013292313,.711845993995667],[.4183090031147,.720062971115112],[.390094995498657,.639572978019714],[.013953999616206,.560034036636353],[.499913990497589,.58014702796936],[.413199990987778,.69539999961853],[.409626007080078,.701822996139526],[.468080013990402,.601534962654114],[.422728985548019,.585985004901886],[.463079988956451,.593783974647522],[.37211999297142,.47341400384903],[.334562003612518,.496073007583618],[.411671012639999,.546965003013611],[.242175996303558,.14767599105835],[.290776997804642,.201445996761322],[.327338010072708,.256527006626129],[.399509996175766,.748921036720276],[.441727995872498,.261676013469696],[.429764986038208,.187834024429321],[.412198007106781,.108901023864746],[.288955003023148,.398952007293701],[.218936994671822,.435410976409912],[.41278201341629,.398970007896423],[.257135003805161,.355440020561218],[.427684992551804,.437960982322693],[.448339998722076,.536936044692993],[.178560003638268,.45755398273468],[.247308000922203,.457193970680237],[.286267012357712,.467674970626831],[.332827985286713,.460712015628815],[.368755996227264,.447206974029541],[.398963987827301,.432654976844788],[.476410001516342,.405806005001068],[.189241006970406,.523923993110657],[.228962004184723,.348950982093811],[.490725994110107,.562400996685028],[.404670000076294,.485132992267609],[.019469000399113,.401564002037048],[.426243007183075,.420431017875671],[.396993011236191,.548797011375427],[.266469985246658,.376977026462555],[.439121007919312,.51895797252655],[.032313998788595,.644356966018677],[.419054001569748,.387154996395111],[.462783008813858,.505746960639954],[.238978996872902,.779744982719421],[.198220998048782,.831938028335571],[.107550002634525,.540755033493042],[.183610007166862,.740257024765015],[.134409993886948,.333683013916016],[.385764002799988,.883153975009918],[.490967005491257,.579378008842468],[.382384985685349,.508572995662689],[.174399003386497,.397670984268188],[.318785011768341,.39623498916626],[.343364000320435,.400596976280212],[.396100014448166,.710216999053955],[.187885001301765,.588537991046906],[.430987000465393,.944064974784851],[.318993002176285,.898285031318665],[.266247987747192,.869701027870178],[.500023007392883,.190576016902924],[.499976992607117,.954452991485596],[.366169989109039,.398822009563446],[.393207013607025,.39553701877594],[.410373002290726,.391080021858215],[.194993004202843,.342101991176605],[.388664990663528,.362284004688263],[.365961998701096,.355970978736877],[.343364000320435,.355356991291046],[.318785011768341,.35834002494812],[.301414996385574,.363156020641327],[.058132998645306,.319076001644135],[.301414996385574,.387449026107788],[.499987989664078,.618434011936188],[.415838003158569,.624195992946625],[.445681989192963,.566076993942261],[.465844005346298,.620640993118286],[.49992299079895,.351523995399475],[.288718998432159,.819945991039276],[.335278987884521,.852819979190826],[.440512001514435,.902418971061707],[.128294005990028,.791940987110138],[.408771991729736,.373893976211548],[.455606997013092,.451801002025604],[.499877005815506,.908990025520325],[.375436991453171,.924192011356354],[.11421000212431,.615022003650665],[.448662012815475,.695277988910675],[.4480200111866,.704632043838501],[.447111994028091,.715808033943176],[.444831997156143,.730794012546539],[.430011987686157,.766808986663818],[.406787008047104,.685672998428345],[.400738000869751,.681069016456604],[.392399996519089,.677703022956848],[.367855995893478,.663918972015381],[.247923001646996,.601333022117615],[.452769994735718,.420849978923798],[.43639200925827,.359887003898621],[.416164010763168,.368713974952698],[.413385987281799,.692366003990173],[.228018000721931,.683571994304657],[.468268007040024,.352671027183533],[.411361992359161,.804327011108398],[.499989002943039,.469825029373169],[.479153990745544,.442654013633728],[.499974012374878,.439637005329132],[.432112008333206,.493588984012604],[.499886006116867,.866917014122009],[.49991300702095,.821729004383087],[.456548988819122,.819200992584229],[.344549000263214,.745438992977142],[.37890899181366,.574010014533997],[.374292999505997,.780184984207153],[.319687992334366,.570737957954407],[.357154995203018,.604269981384277],[.295284003019333,.621580958366394],[.447750002145767,.862477004528046],[.410986006259918,.508723020553589],[.31395098567009,.775308012962341],[.354128003120422,.812552988529205],[.324548006057739,.703992962837219],[.189096003770828,.646299958229065],[.279776990413666,.71465802192688],[.1338230073452,.682700991630554],[.336768001317978,.644733011722565],[.429883986711502,.466521978378296],[.455527991056442,.548622965812683],[.437114000320435,.558896005153656],[.467287987470627,.529924988746643],[.414712011814117,.335219979286194],[.37704598903656,.322777986526489],[.344107985496521,.320150971412659],[.312875986099243,.32233202457428],[.283526003360748,.333190023899078],[.241245999932289,.382785975933075],[.102986000478268,.468762993812561],[.267612010240555,.424560010433197],[.297879010438919,.433175981044769],[.333433985710144,.433878004550934],[.366427004337311,.426115989685059],[.396012008190155,.416696012020111],[.420121014118195,.41022801399231],[.007561000064015,.480777025222778],[.432949006557465,.569517970085144],[.458638995885849,.479089021682739],[.473466008901596,.545744001865387],[.476087987422943,.563830018043518],[.468472003936768,.555056989192963],[.433990985155106,.582361996173859],[.483518004417419,.562983989715576],[.482482999563217,.57784903049469],[.42645001411438,.389798998832703],[.438998997211456,.39649498462677],[.450067013502121,.400434017181396],[.289712011814117,.368252992630005],[.276670008897781,.363372981548309],[.517862021923065,.471948027610779],[.710287988185883,.380764007568359],[.526226997375488,.573909997940063],[.895093023777008,.254140973091125],[.634069979190826,.409575998783112],[.661242008209229,.41302502155304],[.688880026340485,.409460008144379],[.725341975688934,.389131009578705],[.606630027294159,.40370500087738],[.654766023159027,.344011008739471],[.629905998706818,.346076011657715],[.680678009986877,.347265005111694],[.702096998691559,.353591024875641],[.75221198797226,.410804986953735],[.602918028831482,.842862963676453],[.719901978969574,.375599980354309],[.893692970275879,.399959981441498],[.790081977844238,.391354024410248],[.643998026847839,.534487962722778],[.528249025344849,.65040397644043],[.525849997997284,.680191040039062],[.560214996337891,.657229006290436],[.585384011268616,.66654098033905],[.549625992774963,.680860996246338],[.57122802734375,.682691991329193],[.624852001667023,.72809898853302],[.513050019741058,.547281980514526],[.51509702205658,.527251958847046],[.742246985435486,.314507007598877],[.598631024360657,.454979002475739],[.570338010787964,.548575043678284],[.578631997108459,.533622980117798],[.723087012767792,.532054007053375],[.516445994377136,.499638974666595],[.662801027297974,.282917976379395],[.70362401008606,.293271005153656],[.830704987049103,.193813979625702],[.552385985851288,.302568018436432],[.607609987258911,.353887975215912],[.645429015159607,.696707010269165],[.932694971561432,.730105042457581],[.557260990142822,.572826027870178],[.542901992797852,.584792017936707],[.6180260181427,.694710969924927],[.607590973377228,.694203019142151],[.722943007946014,.271963000297546],[.577413976192474,.563166975975037],[.614082992076874,.281386971473694],[.616907000541687,.255886018276215],[.668509006500244,.119913995265961],[.770092010498047,.232020974159241],[.635536015033722,.189248979091644],[.77039098739624,.299556016921997],[.826722025871277,.278755009174347],[.527121007442474,.666198015213013],[.553171992301941,.668527007102966],[.577238023281097,.673889994621277],[.554691970348358,.580065965652466],[.611896991729736,.693961024284363],[.59696102142334,.706539988517761],[.596370995044708,.693953037261963],[.539958000183105,.557139039039612],[.568841993808746,.692366003990173],[.547818005084991,.692366003990173],[.52461302280426,.692366003990173],[.534089982509613,.779141008853912],[.527670979499817,.736225962638855],[.526912987232208,.717857003211975],[.526877999305725,.704625964164734],[.526966989040375,.695277988910675],[.572058022022247,.695277988910675],[.573521018028259,.703539967536926],[.57683801651001,.711845993995667],[.581691026687622,.720062971115112],[.609944999217987,.639909982681274],[.986046016216278,.560034036636353],[.5867999792099,.69539999961853],[.590372025966644,.701822996139526],[.531915009021759,.601536989212036],[.577268004417419,.585934996604919],[.536915004253387,.593786001205444],[.627542972564697,.473352015018463],[.665585994720459,.495950996875763],[.588353991508484,.546862006187439],[.757824003696442,.14767599105835],[.709249973297119,.201507985591888],[.672684013843536,.256581008434296],[.600408971309662,.74900496006012],[.55826598405838,.261672019958496],[.570303976535797,.187870979309082],[.588165998458862,.109044015407562],[.711045026779175,.398952007293701],[.781069993972778,.435405015945435],[.587247014045715,.398931980133057],[.742869973182678,.355445981025696],[.572156012058258,.437651991844177],[.55186802148819,.536570012569427],[.821442008018494,.457556009292603],[.752701997756958,.457181990146637],[.71375697851181,.467626988887787],[.66711300611496,.460672974586487],[.631101012229919,.447153985500336],[.6008620262146,.432473003864288],[.523481011390686,.405627012252808],[.810747981071472,.523926019668579],[.771045982837677,.348959028720856],[.509127020835876,.562718033790588],[.595292985439301,.485023975372314],[.980530977249146,.401564002037048],[.573499977588654,.420000016689301],[.602994978427887,.548687994480133],[.733529984951019,.376977026462555],[.560611009597778,.519016981124878],[.967685997486115,.644356966018677],[.580985009670258,.387160003185272],[.537728011608124,.505385041236877],[.760966002941132,.779752969741821],[.801778972148895,.831938028335571],[.892440974712372,.54076099395752],[.816350996494293,.740260004997253],[.865594983100891,.333687007427216],[.614073991775513,.883246004581451],[.508952975273132,.579437971115112],[.617941975593567,.508316040039062],[.825608015060425,.397674977779388],[.681214988231659,.39623498916626],[.656635999679565,.400596976280212],[.603900015354156,.710216999053955],[.81208598613739,.588539004325867],[.56801301240921,.944564998149872],[.681007981300354,.898285031318665],[.733752012252808,.869701027870178],[.633830010890961,.398822009563446],[.606792986392975,.39553701877594],[.589659988880157,.391062021255493],[.805015981197357,.342108011245728],[.611334979534149,.362284004688263],[.634037971496582,.355970978736877],[.656635999679565,.355356991291046],[.681214988231659,.35834002494812],[.698584973812103,.363156020641327],[.941866993904114,.319076001644135],[.698584973812103,.387449026107788],[.584177017211914,.624107003211975],[.554318010807037,.566076993942261],[.534153997898102,.62064003944397],[.711217999458313,.819975018501282],[.664629995822906,.852871000766754],[.559099972248077,.902631998062134],[.871706008911133,.791940987110138],[.591234028339386,.373893976211548],[.544341027736664,.451583981513977],[.624562978744507,.924192011356354],[.88577002286911,.615028977394104],[.551338016986847,.695277988910675],[.551980018615723,.704632043838501],[.552887976169586,.715808033943176],[.555167973041534,.730794012546539],[.569944024085999,.767035007476807],[.593203008174896,.685675978660583],[.599261999130249,.681069016456604],[.607599973678589,.677703022956848],[.631937980651855,.663500010967255],[.752032995223999,.601315021514893],[.547226011753082,.420395016670227],[.563543975353241,.359827995300293],[.583841025829315,.368713974952698],[.586614012718201,.692366003990173],[.771915018558502,.683578014373779],[.531597018241882,.352482974529266],[.588370978832245,.804440975189209],[.52079701423645,.442565023899078],[.567984998226166,.493479013442993],[.543282985687256,.819254994392395],[.655317008495331,.745514988899231],[.621008992195129,.574018001556396],[.625559985637665,.78031200170517],[.680198013782501,.570719003677368],[.64276397228241,.604337990283966],[.704662978649139,.621529996395111],[.552012026309967,.862591981887817],[.589071989059448,.508637011051178],[.685944974422455,.775357007980347],[.645735025405884,.812640011310577],[.675342977046967,.703978002071381],[.810858011245728,.646304965019226],[.72012197971344,.714666962623596],[.866151988506317,.682704985141754],[.663187026977539,.644596993923187],[.570082008838654,.466325998306274],[.544561982154846,.548375964164734],[.562758982181549,.558784961700439],[.531987011432648,.530140042304993],[.585271000862122,.335177004337311],[.622952997684479,.32277899980545],[.655896008014679,.320163011550903],[.687132000923157,.322345972061157],[.716481983661652,.333200991153717],[.758756995201111,.382786989212036],[.897013008594513,.468769013881683],[.732392013072968,.424547016620636],[.70211398601532,.433162987232208],[.66652500629425,.433866024017334],[.633504986763,.426087975502014],[.603875994682312,.416586995124817],[.579657971858978,.409945011138916],[.992439985275269,.480777025222778],[.567192018032074,.569419980049133],[.54136598110199,.478899002075195],[.526564002037048,.546118021011353],[.523913025856018,.563830018043518],[.531529009342194,.555056989192963],[.566035985946655,.582329034805298],[.51631098985672,.563053965568542],[.5174720287323,.577877044677734],[.573594987392426,.389806985855103],[.560697972774506,.395331978797913],[.549755990505219,.399751007556915],[.710287988185883,.368252992630005],[.723330020904541,.363372981548309]],e0=[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];var n2=[127,234,132,58,172,150,149,148,152,377,378,379,397,288,361,454,356,70,63,105,66,107,336,296,334,293,300,168,6,195,4,98,97,2,326,327,33,160,158,133,153,144,362,385,387,263,373,380,57,40,37,0,267,270,287,321,314,17,84,91,78,81,13,311,308,402,14,178],o2=[33,133,362,263,1,62,308,159,145,386,374,6,102,331,2,13,14,70,105,107,336,334,300,54,10,284,50,280,234,454,58,288,152],s2=[33,133,362,263,1,78,308],_2=n2.map(A=>c0[A]),$2=o2.map(A=>c0[A]),Ae=s2.map(A=>c0[A]);var Q0=J.leftEyeLower0,_0=J.rightEyeLower0,r0={leftBounds:[Q0[0],Q0[Q0.length-1]],rightBounds:[_0[0],_0[_0.length-1]]},v0={count:468,mouth:13,symmetryLine:[13,J.midwayBetweenEyes[0]]},rA={leftEye:0,rightEye:1,nose:2,mouth:3,leftEar:4,rightEar:5,symmetryLine:[3,2]},a0={upperCenter:3,lowerCenter:4,index:71,numCoordinates:76};function E0(A,e,t,s){for(let o=0;o[i[0]/this.meshSize*(y[0]-this.meshSize/2),i[1]/this.meshSize*(y[1]-this.meshSize/2),y[2]]),a=s!==0?M0(s,[0,0]):z0,x=s!==0?n.map(y=>[...tA(y,a),y[2]]):n,l=s!==0?eA(o):z0,d=[...s0({startPoint:t.startPoint,endPoint:t.endPoint}),1];return x.map(y=>[Math.round(y[0]+K(d,l[0])),Math.round(y[1]+K(d,l[1])),Math.round(y[2])])}getLeftToRightEyeDepthDifference(e){let t=e[r0.leftBounds[0]][2],s=e[r0.rightBounds[0]][2];return t-s}getEyeBox(e,t,s,o,i=!1){let n=P0(T0(K0([e[s],e[o]]),this.irisEnlarge)),a=l0(n),x=r.image.cropAndResize(t,[[n.startPoint[1]/this.meshSize,n.startPoint[0]/this.meshSize,n.endPoint[1]/this.meshSize,n.endPoint[0]/this.meshSize]],[0],[this.irisSize,this.irisSize]);return i&&r.ENV.flags.IS_BROWSER&&(x=r.image.flipLeftRight(x)),{box:n,boxSize:a,crop:x}}getEyeCoords(e,t,s,o=!1){let i=[];for(let n=0;n{let l=n;return x===2?l=o:x===4&&(l=i),[a[0],a[1],l]})}async predict(e,t){let s=!1,o;if((this.skipped===0||this.skipped>t.face.detector.skipFrames||!t.face.mesh.enabled||!t.videoOptimized)&&(o=await this.boundingBoxDetector.getBoundingBoxes(e),this.skipped=0),t.videoOptimized&&this.skipped++,!t.videoOptimized||o&&o.boxes&&(!t.face.mesh.enabled||o.boxes.length!==this.detectedFaces&&this.detectedFaces!==t.face.detector.maxDetected)){this.storedBoxes=[],this.detectedFaces=0;for(let n of o.boxes)this.storedBoxes.push({startPoint:n.box.startPoint.dataSync(),endPoint:n.box.endPoint.dataSync(),landmarks:n.landmarks,confidence:n.confidence});this.storedBoxes.length>0&&(s=!0)}if(t.face.detector.skipInitial&&this.detectedFaces===0&&(this.skipped=0),s){if(!o||!o.boxes||o.boxes.length===0)return this.storedBoxes=[],this.detectedFaces=0,null;for(let n=0;n{n.box.startPoint.dispose(),n.box.endPoint.dispose(),n.landmarks.dispose()});let i=r.tidy(()=>this.storedBoxes.map((n,a)=>{let x,l=0,d;if(t.face.detector.rotation&&t.face.mesh.enabled&&r.ENV.flags.IS_BROWSER){let[j,g]=n.landmarks.length>=v0.count?v0.symmetryLine:rA.symmetryLine;l=D0(n.landmarks[j],n.landmarks[g]);let m=s0({startPoint:n.startPoint,endPoint:n.endPoint}),T=[m[0]/e.shape[2],m[1]/e.shape[1]],v=r.image.rotateWithOffset(e,l,0,T);d=M0(-l,m),t.face.mesh.enabled?x=i0({startPoint:n.startPoint,endPoint:n.endPoint},v,[this.meshSize,this.meshSize]).div(255):x=i0({startPoint:n.startPoint,endPoint:n.endPoint},v,[this.boxSize,this.boxSize]).div(255)}else{d=z0;let j=e.clone();t.face.mesh.enabled?x=i0({startPoint:n.startPoint,endPoint:n.endPoint},j,[this.meshSize,this.meshSize]).div(255):x=i0({startPoint:n.startPoint,endPoint:n.endPoint},j,[this.boxSize,this.boxSize]).div(255)}if(!t.face.mesh.enabled)return{mesh:[],box:n,faceConfidence:null,boxConfidence:n.confidence,confidence:n.confidence,image:x};let[,y,h]=this.meshDetector.execute(x),p=y.dataSync()[0];if(p=v0.count?v0.symmetryLine:rA.symmetryLine;l=D0(n.landmarks[j],n.landmarks[g]);let m=s0({startPoint:n.startPoint,endPoint:n.endPoint}),T=[m[0]/e.shape[2],m[1]/e.shape[1]],v=r.image.rotateWithOffset(e.toFloat(),l,0,T);d=M0(-l,m),x=i0({startPoint:n.startPoint,endPoint:n.endPoint},v,[this.meshSize,this.meshSize]).div(255)}let E={mesh:u,box:n,faceConfidence:p,boxConfidence:n.confidence,image:x},R=P0(n);return R.confidence=n.confidence,R.faceConfidence=p,this.storedBoxes[a]=R,E}));return t.face.mesh.enabled&&(this.storedBoxes=this.storedBoxes.filter(n=>n.confidence>t.face.detector.minConfidence)),this.detectedFaces=i.length,i}};var N=[null,null,null],e5;async function t5(A,e){let t=await e5.predict(A,e),s=[];for(let o of t||[]){if(!o||o.isDisposedInternal)continue;let i=o.mesh.map(l=>[l[0]/A.shape[2],l[1]/A.shape[1],l[2]/e5.meshSize]),n={};if(o.mesh&&o.mesh.length>0)for(let l of Object.keys(J))n[l]=J[l].map(d=>o.mesh[d]);let a=o.box?[Math.max(0,o.box.startPoint[0]),Math.max(0,o.box.startPoint[1]),Math.min(A.shape[2],o.box.endPoint[0])-Math.max(0,o.box.startPoint[0]),Math.min(A.shape[1],o.box.endPoint[1])-Math.max(0,o.box.startPoint[1])]:0,x=o.box?[o.box.startPoint[0]/A.shape[2],o.box.startPoint[1]/A.shape[1],(o.box.endPoint[0]-o.box.startPoint[0])/A.shape[2],(o.box.endPoint[1]-o.box.startPoint[1])/A.shape[1]]:[];s.push({confidence:Math.round(100*o.faceConfidence||100*o.boxConfidence||0)/100,boxConfidence:Math.round(100*o.boxConfidence)/100,faceConfidence:Math.round(100*o.faceConfidence)/100,box:a,boxRaw:x,mesh:o.mesh,meshRaw:i,annotations:n,image:o.image}),o.coords&&o.coords.dispose()}return s}async function n5(A){return!N[0]&&A.face.enabled||!N[1]&&A.face.mesh.enabled||!N[2]&&A.face.iris.enabled?(N=await Promise.all([!N[0]&&A.face.enabled?iA(A):null,!N[1]&&A.face.mesh.enabled?r.loadGraphModel(O(A.modelBasePath,A.face.mesh.modelPath),{fromTFHub:A.face.mesh.modelPath.includes("tfhub.dev")}):null,!N[2]&&A.face.iris.enabled?r.loadGraphModel(O(A.modelBasePath,A.face.iris.modelPath),{fromTFHub:A.face.iris.modelPath.includes("tfhub.dev")}):null]),A.face.mesh.enabled&&(!N[1]||!N[1].modelUrl?b("load model failed:",A.face.mesh.modelPath):A.debug&&b("load model:",N[1].modelUrl)),A.face.iris.enabled&&(!N[2]||!N[1].modelUrl?b("load model failed:",A.face.iris.modelPath):A.debug&&b("load model:",N[2].modelUrl))):A.debug&&(b("cached model:",N[0].model.modelUrl),b("cached model:",N[1].modelUrl),b("cached model:",N[2].modelUrl)),e5=new $0(N[0],N[1],N[2]),N}var aA=e0,xA=c0;var o5={};Y(o5,{load:()=>r5,predict:()=>j0});var i2=["angry","disgust","fear","happy","sad","surprise","neutral"],U,s5=[],R0=Number.MAX_SAFE_INTEGER,i5=[.2989,.587,.114];async function r5(A){return U?A.debug&&b("cached model:",U.modelUrl):(U=await r.loadGraphModel(O(A.modelBasePath,A.face.emotion.modelPath)),!U||!U.modelUrl?b("load model failed:",A.face.emotion.modelPath):A.debug&&b("load model:",U.modelUrl)),U}async function j0(A,e){return U?R00?(R0++,s5):(e.videoOptimized?R0=0:R0=Number.MAX_SAFE_INTEGER,new Promise(async t=>{let s=r.image.resizeBilinear(A,[U.inputs[0].shape[2],U.inputs[0].shape[1]],!1),[o,i,n]=r.split(s,3,3);s.dispose();let a=r.mul(o,i5[0]),x=r.mul(i,i5[1]),l=r.mul(n,i5[2]);o.dispose(),i.dispose(),n.dispose();let d=r.addN([a,x,l]);a.dispose(),x.dispose(),l.dispose();let y=r.tidy(()=>d.sub(.5).mul(2));d.dispose();let h=[];if(e.face.emotion.enabled){let p=await U.predict(y),M=p.dataSync();r.dispose(p);for(let c=0;ce.face.emotion.minConfidence&&h.push({score:Math.min(.99,Math.trunc(100*M[c])/100),emotion:i2[c]});h.sort((c,u)=>u.score-c.score)}y.dispose(),s5=h,t(h)})):null}var a5={};Y(a5,{enhance:()=>l5,load:()=>x5,match:()=>yA,predict:()=>W0,similarity:()=>y5});var F,S0={age:0},w0=Number.MAX_SAFE_INTEGER;async function x5(A){return F?A.debug&&b("cached model:",F.modelUrl):(F=await r.loadGraphModel(O(A.modelBasePath,A.face.description.modelPath)),!F||!F.modelUrl?b("load model failed:",A.face.description.modelPath):A.debug&&b("load model:",F.modelUrl)),F}function y5(A,e,t=2){if(!A||!e||(A==null?void 0:A.length)===0||(e==null?void 0:e.length)===0||(A==null?void 0:A.length)!==(e==null?void 0:e.length))return 0;let s=5*A.map((i,n)=>Math.abs(A[n]-e[n])**t).reduce((i,n)=>i+n,0)**(1/t);return Math.max(0,100-s)/100}function yA(A,e,t=0){let s={similarity:0,name:"",source:"",embedding:[]};if(!A||!e||!Array.isArray(A)||!Array.isArray(e))return s;for(let o of e)if(o.embedding&&o.name){let i=y5(A,o.embedding);i>t&&i>s.similarity&&(s={...o,similarity:i})}return s}function l5(A){return r.tidy(()=>{let t=A.image||A.tensor||A;if(!(t instanceof r.Tensor))return null;let s=[[.05,.15,.85,.85]];return(t.shape.length===3?r.image.cropAndResize(r.expandDims(t,0),s,[0],[F.inputs[0].shape[2],F.inputs[0].shape[1]]):r.image.cropAndResize(t,s,[0],[F.inputs[0].shape[2],F.inputs[0].shape[1]])).mul(255)})}async function W0(A,e){return F?w00?(w0++,S0):(e.videoOptimized?w0=0:w0=Number.MAX_SAFE_INTEGER,new Promise(async t=>{let s=l5(A),o,i={age:0,gender:"unknown",genderConfidence:0,descriptor:[]};e.face.description.enabled&&(o=await F.predict(s)),r.dispose(s),o&&(r.tidy(()=>{let n=o.find(y=>y.shape[1]===1).dataSync(),a=Math.trunc(200*Math.abs(n[0]-.5))/100;a>e.face.description.minConfidence&&(i.gender=n[0]<=.5?"female":"male",i.genderConfidence=Math.min(.99,a));let x=o.find(y=>y.shape[1]===100).argMax(1).dataSync()[0],l=o.find(y=>y.shape[1]===100).dataSync();i.age=Math.round(l[x-1]>l[x+1]?10*x-100*l[x-1]:10*x+100*l[x+1])/10;let d=o.find(y=>y.shape[1]===1024);i.descriptor=[...d.dataSync()]}),o.forEach(n=>r.dispose(n))),S0=i,t(i)})):null}var r2=(A,e)=>{let t=u=>u*180/Math.PI,s=u=>{let z=Math.sqrt(u[0]*u[0]+u[1]*u[1]+u[2]*u[2]);return u[0]/=z,u[1]/=z,u[2]/=z,u},o=(u,z)=>{let E=u[0]-z[0],R=u[1]-z[1],j=u[2]-z[2];return[E,R,j]},i=(u,z)=>{let E=u[1]*z[2]-u[2]*z[1],R=u[2]*z[0]-u[0]*z[2],j=u[0]*z[1]-u[1]*z[0];return[E,R,j]},n=u=>{let[z,E,R,j,g,m,T,v,w]=u,k,C,V;return j<1?j>-1?(V=Math.asin(j),C=Math.atan2(-T,z),k=Math.atan2(-m,g)):(V=-Math.PI/2,C=-Math.atan2(v,w),k=0):(V=Math.PI/2,C=Math.atan2(v,w),k=0),{pitch:2*-k,yaw:2*-C,roll:2*-V}},a=u=>{let z=(R,j,g,m)=>Math.atan2(m-j,g-R);return{pitch:z(u[10][1],u[10][2],u[152][1],u[152][2]),yaw:z(u[33][0],u[33][2],u[263][0],u[263][2]),roll:z(u[33][0],u[33][1],u[263][0],u[263][1])}},x=A.meshRaw;if(!x||x.length<300)return{angle:{pitch:0,yaw:0,roll:0},matrix:[1,0,0,0,1,0,0,0,1]};let l=Math.max(A.boxRaw[2]*e[0],A.boxRaw[3]*e[1])/1.5,d=[x[10],x[152],x[234],x[454]].map(u=>[u[0]*e[0]/l,u[1]*e[1]/l,u[2]]),y=s(o(d[1],d[0])),h=s(o(d[3],d[2])),p=s(i(h,y));h=i(y,p);let M=[h[0],h[1],h[2],y[0],y[1],y[2],p[0],p[1],p[2]];return{angle:n(M),matrix:M}},c5=async(A,e)=>{var d,y,h,p,M,c;let t,s,o,i,n,a,x=[];A.state="run:face",t=S();let l=await t5(e,A.config);if(A.perf.face=Math.trunc(S()-t),!l)return[];for(let u of l){if(A.analyze("Get Face"),!u.image||u.image.isDisposedInternal){b("Face object is disposed:",u.image);continue}let z=r2(u,[e.shape[2],e.shape[1]]);A.analyze("Start Emotion:"),A.config.async?i=A.config.face.emotion.enabled?j0(u.image,A.config):{}:(A.state="run:emotion",t=S(),i=A.config.face.emotion.enabled?await j0(u.image,A.config):{},A.perf.emotion=Math.trunc(S()-t)),A.analyze("End Emotion:"),A.analyze("Start Description:"),A.config.async?a=A.config.face.description.enabled?W0(u,A.config):[]:(A.state="run:description",t=S(),a=A.config.face.description.enabled?await W0(u.image,A.config):[],A.perf.embedding=Math.trunc(S()-t)),A.analyze("End Description:"),A.config.async&&([s,o,i,n,a]=await Promise.all([s,o,i,n,a])),A.analyze("Finish Face:"),!A.config.face.iris.enabled&&((d=u==null?void 0:u.annotations)==null?void 0:d.leftEyeIris)&&((y=u==null?void 0:u.annotations)==null?void 0:y.rightEyeIris)&&(delete u.annotations.leftEyeIris,delete u.annotations.rightEyeIris);let E=((h=u.annotations)==null?void 0:h.leftEyeIris)&&((p=u.annotations)==null?void 0:p.rightEyeIris)?11.7*Math.max(Math.abs(u.annotations.leftEyeIris[3][0]-u.annotations.leftEyeIris[1][0]),Math.abs(u.annotations.rightEyeIris[4][1]-u.annotations.rightEyeIris[2][1])):0;x.push({...u,age:a.age,gender:a.gender,genderConfidence:a.genderConfidence,embedding:a.descriptor,emotion:i,iris:E!==0?Math.trunc(E)/100:0,rotation:z,tensor:A.config.face.detector.return?(M=u.image)==null?void 0:M.squeeze():null}),(c=u.image)==null||c.dispose(),A.analyze("End Face")}return A.analyze("End FaceMesh:"),A.config.async&&(A.perf.face&&delete A.perf.face,A.perf.age&&delete A.perf.age,A.perf.gender&&delete A.perf.gender,A.perf.emotion&&delete A.perf.emotion),x};var p5={};Y(p5,{load:()=>g5,predict:()=>b5});var d0=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"],lA=d0.length,f0=d0.reduce((A,e,t)=>(A[e]=t,A),{}),a2=[["leftHip","leftShoulder"],["leftElbow","leftShoulder"],["leftElbow","leftWrist"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["rightHip","rightShoulder"],["rightElbow","rightShoulder"],["rightElbow","rightWrist"],["rightHip","rightKnee"],["rightKnee","rightAnkle"],["leftShoulder","rightShoulder"],["leftHip","rightHip"]],x2=a2.map(([A,e])=>[f0[A],f0[e]]),cA=[["nose","leftEye"],["leftEye","leftEar"],["nose","rightEye"],["rightEye","rightEar"],["nose","leftShoulder"],["leftShoulder","leftElbow"],["leftElbow","leftWrist"],["leftShoulder","leftHip"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["nose","rightShoulder"],["rightShoulder","rightElbow"],["rightElbow","rightWrist"],["rightShoulder","rightHip"],["rightHip","rightKnee"],["rightKnee","rightAnkle"]];function dA(A){let e=A.reduce(({maxX:t,maxY:s,minX:o,minY:i},{position:{x:n,y:a}})=>({maxX:Math.max(t,n),maxY:Math.max(s,a),minX:Math.min(o,n),minY:Math.min(i,a)}),{maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY});return[e.minX,e.minY,e.maxX-e.minX,e.maxY-e.minY]}function fA(A,[e,t],[s,o]){let i=(a,x,l)=>({score:a.score,box:[Math.trunc(a.box[0]*l),Math.trunc(a.box[1]*x),Math.trunc(a.box[2]*l),Math.trunc(a.box[3]*x)],keypoints:a.keypoints.map(({score:d,part:y,position:h})=>({score:d,part:y,position:{x:Math.trunc(h.x*l),y:Math.trunc(h.y*x)}}))});return A.map(a=>i(a,e/s,t/o))}var d5=class{constructor(e,t){this.priorityQueue=new Array(e),this.numberOfElements=-1,this.getElementValue=t}enqueue(e){this.priorityQueue[++this.numberOfElements]=e,this.swim(this.numberOfElements)}dequeue(){let e=this.priorityQueue[0];return this.exchange(0,this.numberOfElements--),this.sink(0),this.priorityQueue[this.numberOfElements+1]=null,e}empty(){return this.numberOfElements===-1}size(){return this.numberOfElements+1}all(){return this.priorityQueue.slice(0,this.numberOfElements+1)}max(){return this.priorityQueue[0]}swim(e){for(;e>0&&this.less(Math.floor(e/2),e);)this.exchange(e,Math.floor(e/2)),e=Math.floor(e/2)}sink(e){for(;2*e<=this.numberOfElements;){let t=2*e;if(tt?t:A}function mA(A,e,t,s){let o=t-A,i=s-e;return o*o+i*i}function u5(A,e){return{x:A.x+e.x,y:A.y+e.y}}var I0=1,x0=16,y2=50**2;function hA(A,e,t,s,o,i,n=2){let a=z=>({y:i.get(z.y,z.x,A),x:i.get(z.y,z.x,i.shape[2]/2+A)}),x=(z,E,R)=>({y:h5(Math.round(z.y/x0),0,E-1),x:h5(Math.round(z.x/x0),0,R-1)}),[l,d]=s.shape,y=x(e.position,l,d),h=a(y),M=u5(e.position,h);for(let z=0;z[f0[h],f0[p]]),n=i.map(([,h])=>h),a=i.map(([h])=>h),x=e.shape[2],l=n.length,d=new Array(x),y=m5(A.part,x0,t);d[A.part.id]={score:A.score,part:d0[A.part.id],position:y};for(let h=l-1;h>=0;--h){let p=n[h],M=a[h];d[p]&&!d[M]&&(d[M]=hA(h,d[p],M,e,t,o))}for(let h=0;he){a=!1;break}if(!a)break}return a}function d2(A,e){let[t,s,o]=e.shape,i=new d5(t*s*o,({score:n})=>n);for(let n=0;n{var n;let i=(n=o[s])==null?void 0:n.position;return i?mA(t,e,i.y,i.x)<=y2:!1})}function f2(A,e){return e.reduce((s,{position:o,score:i},n)=>(uA(A,o,n)||(s+=i),s),0)/e.length}function pA(A,e,t,s,o,i){let n=[],a=d2(i,e);for(;n.lengthp.score>i);let y=f2(n,d),h=dA(d);y>i&&n.push({keypoints:d,box:h,score:Math.round(100*y)/100})}return n}var B,m2=["MobilenetV1/offset_2/BiasAdd","MobilenetV1/heatmap_2/BiasAdd","MobilenetV1/displacement_fwd_2/BiasAdd","MobilenetV1/displacement_bwd_2/BiasAdd"];async function b5(A,e){let t=r.tidy(()=>{let a=A.resizeBilinear([B.inputs[0].shape[2],B.inputs[0].shape[1]]).toFloat().div(127.5).sub(1),l=B.execute(a,m2).map(d=>d.squeeze([0]));return l[1]=l[1].sigmoid(),l}),s=await Promise.all(t.map(n=>n.buffer()));for(let n of t)n.dispose();let o=await pA(s[0],s[1],s[2],s[3],e.body.maxDetected,e.body.minConfidence);return fA(o,[A.shape[1],A.shape[2]],[B.inputs[0].shape[2],B.inputs[0].shape[1]])}async function g5(A){return B?A.debug&&b("cached model:",B.modelUrl):(B=await r.loadGraphModel(O(A.modelBasePath,A.body.modelPath)),!B||!B.modelUrl?b("load model failed:",A.body.modelPath):A.debug&&b("load model:",B.modelUrl)),B}var v5={};Y(v5,{load:()=>R5,predict:()=>E5});function N0(A){return[Math.abs(A.endPoint[0]-A.startPoint[0]),Math.abs(A.endPoint[1]-A.startPoint[1])]}function m0(A){return[A.startPoint[0]+(A.endPoint[0]-A.startPoint[0])/2,A.startPoint[1]+(A.endPoint[1]-A.startPoint[1])/2]}function bA(A,e,t){let s=e.shape[1],o=e.shape[2],i=[[A.startPoint[1]/s,A.startPoint[0]/o,A.endPoint[1]/s,A.endPoint[0]/o]];return r.image.cropAndResize(e,i,[0],t)}function gA(A,e){let t=[A.startPoint[0]*e[0],A.startPoint[1]*e[1]],s=[A.endPoint[0]*e[0],A.endPoint[1]*e[1]],o=A.palmLandmarks.map(i=>[i[0]*e[0],i[1]*e[1]]);return{startPoint:t,endPoint:s,palmLandmarks:o,confidence:A.confidence}}function k0(A,e=1.5){let t=m0(A),s=N0(A),o=[e*s[0]/2,e*s[1]/2],i=[t[0]-o[0],t[1]-o[1]],n=[t[0]+o[0],t[1]+o[1]];return{startPoint:i,endPoint:n,palmLandmarks:A.palmLandmarks}}function O0(A){let e=m0(A),t=N0(A),o=Math.max(...t)/2,i=[e[0]-o,e[1]-o],n=[e[0]+o,e[1]+o];return{startPoint:i,endPoint:n,palmLandmarks:A.palmLandmarks}}var TA=[{x:.015625,y:.015625},{x:.015625,y:.015625},{x:.046875,y:.015625},{x:.046875,y:.015625},{x:.078125,y:.015625},{x:.078125,y:.015625},{x:.109375,y:.015625},{x:.109375,y:.015625},{x:.140625,y:.015625},{x:.140625,y:.015625},{x:.171875,y:.015625},{x:.171875,y:.015625},{x:.203125,y:.015625},{x:.203125,y:.015625},{x:.234375,y:.015625},{x:.234375,y:.015625},{x:.265625,y:.015625},{x:.265625,y:.015625},{x:.296875,y:.015625},{x:.296875,y:.015625},{x:.328125,y:.015625},{x:.328125,y:.015625},{x:.359375,y:.015625},{x:.359375,y:.015625},{x:.390625,y:.015625},{x:.390625,y:.015625},{x:.421875,y:.015625},{x:.421875,y:.015625},{x:.453125,y:.015625},{x:.453125,y:.015625},{x:.484375,y:.015625},{x:.484375,y:.015625},{x:.515625,y:.015625},{x:.515625,y:.015625},{x:.546875,y:.015625},{x:.546875,y:.015625},{x:.578125,y:.015625},{x:.578125,y:.015625},{x:.609375,y:.015625},{x:.609375,y:.015625},{x:.640625,y:.015625},{x:.640625,y:.015625},{x:.671875,y:.015625},{x:.671875,y:.015625},{x:.703125,y:.015625},{x:.703125,y:.015625},{x:.734375,y:.015625},{x:.734375,y:.015625},{x:.765625,y:.015625},{x:.765625,y:.015625},{x:.796875,y:.015625},{x:.796875,y:.015625},{x:.828125,y:.015625},{x:.828125,y:.015625},{x:.859375,y:.015625},{x:.859375,y:.015625},{x:.890625,y:.015625},{x:.890625,y:.015625},{x:.921875,y:.015625},{x:.921875,y:.015625},{x:.953125,y:.015625},{x:.953125,y:.015625},{x:.984375,y:.015625},{x:.984375,y:.015625},{x:.015625,y:.046875},{x:.015625,y:.046875},{x:.046875,y:.046875},{x:.046875,y:.046875},{x:.078125,y:.046875},{x:.078125,y:.046875},{x:.109375,y:.046875},{x:.109375,y:.046875},{x:.140625,y:.046875},{x:.140625,y:.046875},{x:.171875,y:.046875},{x:.171875,y:.046875},{x:.203125,y:.046875},{x:.203125,y:.046875},{x:.234375,y:.046875},{x:.234375,y:.046875},{x:.265625,y:.046875},{x:.265625,y:.046875},{x:.296875,y:.046875},{x:.296875,y:.046875},{x:.328125,y:.046875},{x:.328125,y:.046875},{x:.359375,y:.046875},{x:.359375,y:.046875},{x:.390625,y:.046875},{x:.390625,y:.046875},{x:.421875,y:.046875},{x:.421875,y:.046875},{x:.453125,y:.046875},{x:.453125,y:.046875},{x:.484375,y:.046875},{x:.484375,y:.046875},{x:.515625,y:.046875},{x:.515625,y:.046875},{x:.546875,y:.046875},{x:.546875,y:.046875},{x:.578125,y:.046875},{x:.578125,y:.046875},{x:.609375,y:.046875},{x:.609375,y:.046875},{x:.640625,y:.046875},{x:.640625,y:.046875},{x:.671875,y:.046875},{x:.671875,y:.046875},{x:.703125,y:.046875},{x:.703125,y:.046875},{x:.734375,y:.046875},{x:.734375,y:.046875},{x:.765625,y:.046875},{x:.765625,y:.046875},{x:.796875,y:.046875},{x:.796875,y:.046875},{x:.828125,y:.046875},{x:.828125,y:.046875},{x:.859375,y:.046875},{x:.859375,y:.046875},{x:.890625,y:.046875},{x:.890625,y:.046875},{x:.921875,y:.046875},{x:.921875,y:.046875},{x:.953125,y:.046875},{x:.953125,y:.046875},{x:.984375,y:.046875},{x:.984375,y:.046875},{x:.015625,y:.078125},{x:.015625,y:.078125},{x:.046875,y:.078125},{x:.046875,y:.078125},{x:.078125,y:.078125},{x:.078125,y:.078125},{x:.109375,y:.078125},{x:.109375,y:.078125},{x:.140625,y:.078125},{x:.140625,y:.078125},{x:.171875,y:.078125},{x:.171875,y:.078125},{x:.203125,y:.078125},{x:.203125,y:.078125},{x:.234375,y:.078125},{x:.234375,y:.078125},{x:.265625,y:.078125},{x:.265625,y:.078125},{x:.296875,y:.078125},{x:.296875,y:.078125},{x:.328125,y:.078125},{x:.328125,y:.078125},{x:.359375,y:.078125},{x:.359375,y:.078125},{x:.390625,y:.078125},{x:.390625,y:.078125},{x:.421875,y:.078125},{x:.421875,y:.078125},{x:.453125,y:.078125},{x:.453125,y:.078125},{x:.484375,y:.078125},{x:.484375,y:.078125},{x:.515625,y:.078125},{x:.515625,y:.078125},{x:.546875,y:.078125},{x:.546875,y:.078125},{x:.578125,y:.078125},{x:.578125,y:.078125},{x:.609375,y:.078125},{x:.609375,y:.078125},{x:.640625,y:.078125},{x:.640625,y:.078125},{x:.671875,y:.078125},{x:.671875,y:.078125},{x:.703125,y:.078125},{x:.703125,y:.078125},{x:.734375,y:.078125},{x:.734375,y:.078125},{x:.765625,y:.078125},{x:.765625,y:.078125},{x:.796875,y:.078125},{x:.796875,y:.078125},{x:.828125,y:.078125},{x:.828125,y:.078125},{x:.859375,y:.078125},{x:.859375,y:.078125},{x:.890625,y:.078125},{x:.890625,y:.078125},{x:.921875,y:.078125},{x:.921875,y:.078125},{x:.953125,y:.078125},{x:.953125,y:.078125},{x:.984375,y:.078125},{x:.984375,y:.078125},{x:.015625,y:.109375},{x:.015625,y:.109375},{x:.046875,y:.109375},{x:.046875,y:.109375},{x:.078125,y:.109375},{x:.078125,y:.109375},{x:.109375,y:.109375},{x:.109375,y:.109375},{x:.140625,y:.109375},{x:.140625,y:.109375},{x:.171875,y:.109375},{x:.171875,y:.109375},{x:.203125,y:.109375},{x:.203125,y:.109375},{x:.234375,y:.109375},{x:.234375,y:.109375},{x:.265625,y:.109375},{x:.265625,y:.109375},{x:.296875,y:.109375},{x:.296875,y:.109375},{x:.328125,y:.109375},{x:.328125,y:.109375},{x:.359375,y:.109375},{x:.359375,y:.109375},{x:.390625,y:.109375},{x:.390625,y:.109375},{x:.421875,y:.109375},{x:.421875,y:.109375},{x:.453125,y:.109375},{x:.453125,y:.109375},{x:.484375,y:.109375},{x:.484375,y:.109375},{x:.515625,y:.109375},{x:.515625,y:.109375},{x:.546875,y:.109375},{x:.546875,y:.109375},{x:.578125,y:.109375},{x:.578125,y:.109375},{x:.609375,y:.109375},{x:.609375,y:.109375},{x:.640625,y:.109375},{x:.640625,y:.109375},{x:.671875,y:.109375},{x:.671875,y:.109375},{x:.703125,y:.109375},{x:.703125,y:.109375},{x:.734375,y:.109375},{x:.734375,y:.109375},{x:.765625,y:.109375},{x:.765625,y:.109375},{x:.796875,y:.109375},{x:.796875,y:.109375},{x:.828125,y:.109375},{x:.828125,y:.109375},{x:.859375,y:.109375},{x:.859375,y:.109375},{x:.890625,y:.109375},{x:.890625,y:.109375},{x:.921875,y:.109375},{x:.921875,y:.109375},{x:.953125,y:.109375},{x:.953125,y:.109375},{x:.984375,y:.109375},{x:.984375,y:.109375},{x:.015625,y:.140625},{x:.015625,y:.140625},{x:.046875,y:.140625},{x:.046875,y:.140625},{x:.078125,y:.140625},{x:.078125,y:.140625},{x:.109375,y:.140625},{x:.109375,y:.140625},{x:.140625,y:.140625},{x:.140625,y:.140625},{x:.171875,y:.140625},{x:.171875,y:.140625},{x:.203125,y:.140625},{x:.203125,y:.140625},{x:.234375,y:.140625},{x:.234375,y:.140625},{x:.265625,y:.140625},{x:.265625,y:.140625},{x:.296875,y:.140625},{x:.296875,y:.140625},{x:.328125,y:.140625},{x:.328125,y:.140625},{x:.359375,y:.140625},{x:.359375,y:.140625},{x:.390625,y:.140625},{x:.390625,y:.140625},{x:.421875,y:.140625},{x:.421875,y:.140625},{x:.453125,y:.140625},{x:.453125,y:.140625},{x:.484375,y:.140625},{x:.484375,y:.140625},{x:.515625,y:.140625},{x:.515625,y:.140625},{x:.546875,y:.140625},{x:.546875,y:.140625},{x:.578125,y:.140625},{x:.578125,y:.140625},{x:.609375,y:.140625},{x:.609375,y:.140625},{x:.640625,y:.140625},{x:.640625,y:.140625},{x:.671875,y:.140625},{x:.671875,y:.140625},{x:.703125,y:.140625},{x:.703125,y:.140625},{x:.734375,y:.140625},{x:.734375,y:.140625},{x:.765625,y:.140625},{x:.765625,y:.140625},{x:.796875,y:.140625},{x:.796875,y:.140625},{x:.828125,y:.140625},{x:.828125,y:.140625},{x:.859375,y:.140625},{x:.859375,y:.140625},{x:.890625,y:.140625},{x:.890625,y:.140625},{x:.921875,y:.140625},{x:.921875,y:.140625},{x:.953125,y:.140625},{x:.953125,y:.140625},{x:.984375,y:.140625},{x:.984375,y:.140625},{x:.015625,y:.171875},{x:.015625,y:.171875},{x:.046875,y:.171875},{x:.046875,y:.171875},{x:.078125,y:.171875},{x:.078125,y:.171875},{x:.109375,y:.171875},{x:.109375,y:.171875},{x:.140625,y:.171875},{x:.140625,y:.171875},{x:.171875,y:.171875},{x:.171875,y:.171875},{x:.203125,y:.171875},{x:.203125,y:.171875},{x:.234375,y:.171875},{x:.234375,y:.171875},{x:.265625,y:.171875},{x:.265625,y:.171875},{x:.296875,y:.171875},{x:.296875,y:.171875},{x:.328125,y:.171875},{x:.328125,y:.171875},{x:.359375,y:.171875},{x:.359375,y:.171875},{x:.390625,y:.171875},{x:.390625,y:.171875},{x:.421875,y:.171875},{x:.421875,y:.171875},{x:.453125,y:.171875},{x:.453125,y:.171875},{x:.484375,y:.171875},{x:.484375,y:.171875},{x:.515625,y:.171875},{x:.515625,y:.171875},{x:.546875,y:.171875},{x:.546875,y:.171875},{x:.578125,y:.171875},{x:.578125,y:.171875},{x:.609375,y:.171875},{x:.609375,y:.171875},{x:.640625,y:.171875},{x:.640625,y:.171875},{x:.671875,y:.171875},{x:.671875,y:.171875},{x:.703125,y:.171875},{x:.703125,y:.171875},{x:.734375,y:.171875},{x:.734375,y:.171875},{x:.765625,y:.171875},{x:.765625,y:.171875},{x:.796875,y:.171875},{x:.796875,y:.171875},{x:.828125,y:.171875},{x:.828125,y:.171875},{x:.859375,y:.171875},{x:.859375,y:.171875},{x:.890625,y:.171875},{x:.890625,y:.171875},{x:.921875,y:.171875},{x:.921875,y:.171875},{x:.953125,y:.171875},{x:.953125,y:.171875},{x:.984375,y:.171875},{x:.984375,y:.171875},{x:.015625,y:.203125},{x:.015625,y:.203125},{x:.046875,y:.203125},{x:.046875,y:.203125},{x:.078125,y:.203125},{x:.078125,y:.203125},{x:.109375,y:.203125},{x:.109375,y:.203125},{x:.140625,y:.203125},{x:.140625,y:.203125},{x:.171875,y:.203125},{x:.171875,y:.203125},{x:.203125,y:.203125},{x:.203125,y:.203125},{x:.234375,y:.203125},{x:.234375,y:.203125},{x:.265625,y:.203125},{x:.265625,y:.203125},{x:.296875,y:.203125},{x:.296875,y:.203125},{x:.328125,y:.203125},{x:.328125,y:.203125},{x:.359375,y:.203125},{x:.359375,y:.203125},{x:.390625,y:.203125},{x:.390625,y:.203125},{x:.421875,y:.203125},{x:.421875,y:.203125},{x:.453125,y:.203125},{x:.453125,y:.203125},{x:.484375,y:.203125},{x:.484375,y:.203125},{x:.515625,y:.203125},{x:.515625,y:.203125},{x:.546875,y:.203125},{x:.546875,y:.203125},{x:.578125,y:.203125},{x:.578125,y:.203125},{x:.609375,y:.203125},{x:.609375,y:.203125},{x:.640625,y:.203125},{x:.640625,y:.203125},{x:.671875,y:.203125},{x:.671875,y:.203125},{x:.703125,y:.203125},{x:.703125,y:.203125},{x:.734375,y:.203125},{x:.734375,y:.203125},{x:.765625,y:.203125},{x:.765625,y:.203125},{x:.796875,y:.203125},{x:.796875,y:.203125},{x:.828125,y:.203125},{x:.828125,y:.203125},{x:.859375,y:.203125},{x:.859375,y:.203125},{x:.890625,y:.203125},{x:.890625,y:.203125},{x:.921875,y:.203125},{x:.921875,y:.203125},{x:.953125,y:.203125},{x:.953125,y:.203125},{x:.984375,y:.203125},{x:.984375,y:.203125},{x:.015625,y:.234375},{x:.015625,y:.234375},{x:.046875,y:.234375},{x:.046875,y:.234375},{x:.078125,y:.234375},{x:.078125,y:.234375},{x:.109375,y:.234375},{x:.109375,y:.234375},{x:.140625,y:.234375},{x:.140625,y:.234375},{x:.171875,y:.234375},{x:.171875,y:.234375},{x:.203125,y:.234375},{x:.203125,y:.234375},{x:.234375,y:.234375},{x:.234375,y:.234375},{x:.265625,y:.234375},{x:.265625,y:.234375},{x:.296875,y:.234375},{x:.296875,y:.234375},{x:.328125,y:.234375},{x:.328125,y:.234375},{x:.359375,y:.234375},{x:.359375,y:.234375},{x:.390625,y:.234375},{x:.390625,y:.234375},{x:.421875,y:.234375},{x:.421875,y:.234375},{x:.453125,y:.234375},{x:.453125,y:.234375},{x:.484375,y:.234375},{x:.484375,y:.234375},{x:.515625,y:.234375},{x:.515625,y:.234375},{x:.546875,y:.234375},{x:.546875,y:.234375},{x:.578125,y:.234375},{x:.578125,y:.234375},{x:.609375,y:.234375},{x:.609375,y:.234375},{x:.640625,y:.234375},{x:.640625,y:.234375},{x:.671875,y:.234375},{x:.671875,y:.234375},{x:.703125,y:.234375},{x:.703125,y:.234375},{x:.734375,y:.234375},{x:.734375,y:.234375},{x:.765625,y:.234375},{x:.765625,y:.234375},{x:.796875,y:.234375},{x:.796875,y:.234375},{x:.828125,y:.234375},{x:.828125,y:.234375},{x:.859375,y:.234375},{x:.859375,y:.234375},{x:.890625,y:.234375},{x:.890625,y:.234375},{x:.921875,y:.234375},{x:.921875,y:.234375},{x:.953125,y:.234375},{x:.953125,y:.234375},{x:.984375,y:.234375},{x:.984375,y:.234375},{x:.015625,y:.265625},{x:.015625,y:.265625},{x:.046875,y:.265625},{x:.046875,y:.265625},{x:.078125,y:.265625},{x:.078125,y:.265625},{x:.109375,y:.265625},{x:.109375,y:.265625},{x:.140625,y:.265625},{x:.140625,y:.265625},{x:.171875,y:.265625},{x:.171875,y:.265625},{x:.203125,y:.265625},{x:.203125,y:.265625},{x:.234375,y:.265625},{x:.234375,y:.265625},{x:.265625,y:.265625},{x:.265625,y:.265625},{x:.296875,y:.265625},{x:.296875,y:.265625},{x:.328125,y:.265625},{x:.328125,y:.265625},{x:.359375,y:.265625},{x:.359375,y:.265625},{x:.390625,y:.265625},{x:.390625,y:.265625},{x:.421875,y:.265625},{x:.421875,y:.265625},{x:.453125,y:.265625},{x:.453125,y:.265625},{x:.484375,y:.265625},{x:.484375,y:.265625},{x:.515625,y:.265625},{x:.515625,y:.265625},{x:.546875,y:.265625},{x:.546875,y:.265625},{x:.578125,y:.265625},{x:.578125,y:.265625},{x:.609375,y:.265625},{x:.609375,y:.265625},{x:.640625,y:.265625},{x:.640625,y:.265625},{x:.671875,y:.265625},{x:.671875,y:.265625},{x:.703125,y:.265625},{x:.703125,y:.265625},{x:.734375,y:.265625},{x:.734375,y:.265625},{x:.765625,y:.265625},{x:.765625,y:.265625},{x:.796875,y:.265625},{x:.796875,y:.265625},{x:.828125,y:.265625},{x:.828125,y:.265625},{x:.859375,y:.265625},{x:.859375,y:.265625},{x:.890625,y:.265625},{x:.890625,y:.265625},{x:.921875,y:.265625},{x:.921875,y:.265625},{x:.953125,y:.265625},{x:.953125,y:.265625},{x:.984375,y:.265625},{x:.984375,y:.265625},{x:.015625,y:.296875},{x:.015625,y:.296875},{x:.046875,y:.296875},{x:.046875,y:.296875},{x:.078125,y:.296875},{x:.078125,y:.296875},{x:.109375,y:.296875},{x:.109375,y:.296875},{x:.140625,y:.296875},{x:.140625,y:.296875},{x:.171875,y:.296875},{x:.171875,y:.296875},{x:.203125,y:.296875},{x:.203125,y:.296875},{x:.234375,y:.296875},{x:.234375,y:.296875},{x:.265625,y:.296875},{x:.265625,y:.296875},{x:.296875,y:.296875},{x:.296875,y:.296875},{x:.328125,y:.296875},{x:.328125,y:.296875},{x:.359375,y:.296875},{x:.359375,y:.296875},{x:.390625,y:.296875},{x:.390625,y:.296875},{x:.421875,y:.296875},{x:.421875,y:.296875},{x:.453125,y:.296875},{x:.453125,y:.296875},{x:.484375,y:.296875},{x:.484375,y:.296875},{x:.515625,y:.296875},{x:.515625,y:.296875},{x:.546875,y:.296875},{x:.546875,y:.296875},{x:.578125,y:.296875},{x:.578125,y:.296875},{x:.609375,y:.296875},{x:.609375,y:.296875},{x:.640625,y:.296875},{x:.640625,y:.296875},{x:.671875,y:.296875},{x:.671875,y:.296875},{x:.703125,y:.296875},{x:.703125,y:.296875},{x:.734375,y:.296875},{x:.734375,y:.296875},{x:.765625,y:.296875},{x:.765625,y:.296875},{x:.796875,y:.296875},{x:.796875,y:.296875},{x:.828125,y:.296875},{x:.828125,y:.296875},{x:.859375,y:.296875},{x:.859375,y:.296875},{x:.890625,y:.296875},{x:.890625,y:.296875},{x:.921875,y:.296875},{x:.921875,y:.296875},{x:.953125,y:.296875},{x:.953125,y:.296875},{x:.984375,y:.296875},{x:.984375,y:.296875},{x:.015625,y:.328125},{x:.015625,y:.328125},{x:.046875,y:.328125},{x:.046875,y:.328125},{x:.078125,y:.328125},{x:.078125,y:.328125},{x:.109375,y:.328125},{x:.109375,y:.328125},{x:.140625,y:.328125},{x:.140625,y:.328125},{x:.171875,y:.328125},{x:.171875,y:.328125},{x:.203125,y:.328125},{x:.203125,y:.328125},{x:.234375,y:.328125},{x:.234375,y:.328125},{x:.265625,y:.328125},{x:.265625,y:.328125},{x:.296875,y:.328125},{x:.296875,y:.328125},{x:.328125,y:.328125},{x:.328125,y:.328125},{x:.359375,y:.328125},{x:.359375,y:.328125},{x:.390625,y:.328125},{x:.390625,y:.328125},{x:.421875,y:.328125},{x:.421875,y:.328125},{x:.453125,y:.328125},{x:.453125,y:.328125},{x:.484375,y:.328125},{x:.484375,y:.328125},{x:.515625,y:.328125},{x:.515625,y:.328125},{x:.546875,y:.328125},{x:.546875,y:.328125},{x:.578125,y:.328125},{x:.578125,y:.328125},{x:.609375,y:.328125},{x:.609375,y:.328125},{x:.640625,y:.328125},{x:.640625,y:.328125},{x:.671875,y:.328125},{x:.671875,y:.328125},{x:.703125,y:.328125},{x:.703125,y:.328125},{x:.734375,y:.328125},{x:.734375,y:.328125},{x:.765625,y:.328125},{x:.765625,y:.328125},{x:.796875,y:.328125},{x:.796875,y:.328125},{x:.828125,y:.328125},{x:.828125,y:.328125},{x:.859375,y:.328125},{x:.859375,y:.328125},{x:.890625,y:.328125},{x:.890625,y:.328125},{x:.921875,y:.328125},{x:.921875,y:.328125},{x:.953125,y:.328125},{x:.953125,y:.328125},{x:.984375,y:.328125},{x:.984375,y:.328125},{x:.015625,y:.359375},{x:.015625,y:.359375},{x:.046875,y:.359375},{x:.046875,y:.359375},{x:.078125,y:.359375},{x:.078125,y:.359375},{x:.109375,y:.359375},{x:.109375,y:.359375},{x:.140625,y:.359375},{x:.140625,y:.359375},{x:.171875,y:.359375},{x:.171875,y:.359375},{x:.203125,y:.359375},{x:.203125,y:.359375},{x:.234375,y:.359375},{x:.234375,y:.359375},{x:.265625,y:.359375},{x:.265625,y:.359375},{x:.296875,y:.359375},{x:.296875,y:.359375},{x:.328125,y:.359375},{x:.328125,y:.359375},{x:.359375,y:.359375},{x:.359375,y:.359375},{x:.390625,y:.359375},{x:.390625,y:.359375},{x:.421875,y:.359375},{x:.421875,y:.359375},{x:.453125,y:.359375},{x:.453125,y:.359375},{x:.484375,y:.359375},{x:.484375,y:.359375},{x:.515625,y:.359375},{x:.515625,y:.359375},{x:.546875,y:.359375},{x:.546875,y:.359375},{x:.578125,y:.359375},{x:.578125,y:.359375},{x:.609375,y:.359375},{x:.609375,y:.359375},{x:.640625,y:.359375},{x:.640625,y:.359375},{x:.671875,y:.359375},{x:.671875,y:.359375},{x:.703125,y:.359375},{x:.703125,y:.359375},{x:.734375,y:.359375},{x:.734375,y:.359375},{x:.765625,y:.359375},{x:.765625,y:.359375},{x:.796875,y:.359375},{x:.796875,y:.359375},{x:.828125,y:.359375},{x:.828125,y:.359375},{x:.859375,y:.359375},{x:.859375,y:.359375},{x:.890625,y:.359375},{x:.890625,y:.359375},{x:.921875,y:.359375},{x:.921875,y:.359375},{x:.953125,y:.359375},{x:.953125,y:.359375},{x:.984375,y:.359375},{x:.984375,y:.359375},{x:.015625,y:.390625},{x:.015625,y:.390625},{x:.046875,y:.390625},{x:.046875,y:.390625},{x:.078125,y:.390625},{x:.078125,y:.390625},{x:.109375,y:.390625},{x:.109375,y:.390625},{x:.140625,y:.390625},{x:.140625,y:.390625},{x:.171875,y:.390625},{x:.171875,y:.390625},{x:.203125,y:.390625},{x:.203125,y:.390625},{x:.234375,y:.390625},{x:.234375,y:.390625},{x:.265625,y:.390625},{x:.265625,y:.390625},{x:.296875,y:.390625},{x:.296875,y:.390625},{x:.328125,y:.390625},{x:.328125,y:.390625},{x:.359375,y:.390625},{x:.359375,y:.390625},{x:.390625,y:.390625},{x:.390625,y:.390625},{x:.421875,y:.390625},{x:.421875,y:.390625},{x:.453125,y:.390625},{x:.453125,y:.390625},{x:.484375,y:.390625},{x:.484375,y:.390625},{x:.515625,y:.390625},{x:.515625,y:.390625},{x:.546875,y:.390625},{x:.546875,y:.390625},{x:.578125,y:.390625},{x:.578125,y:.390625},{x:.609375,y:.390625},{x:.609375,y:.390625},{x:.640625,y:.390625},{x:.640625,y:.390625},{x:.671875,y:.390625},{x:.671875,y:.390625},{x:.703125,y:.390625},{x:.703125,y:.390625},{x:.734375,y:.390625},{x:.734375,y:.390625},{x:.765625,y:.390625},{x:.765625,y:.390625},{x:.796875,y:.390625},{x:.796875,y:.390625},{x:.828125,y:.390625},{x:.828125,y:.390625},{x:.859375,y:.390625},{x:.859375,y:.390625},{x:.890625,y:.390625},{x:.890625,y:.390625},{x:.921875,y:.390625},{x:.921875,y:.390625},{x:.953125,y:.390625},{x:.953125,y:.390625},{x:.984375,y:.390625},{x:.984375,y:.390625},{x:.015625,y:.421875},{x:.015625,y:.421875},{x:.046875,y:.421875},{x:.046875,y:.421875},{x:.078125,y:.421875},{x:.078125,y:.421875},{x:.109375,y:.421875},{x:.109375,y:.421875},{x:.140625,y:.421875},{x:.140625,y:.421875},{x:.171875,y:.421875},{x:.171875,y:.421875},{x:.203125,y:.421875},{x:.203125,y:.421875},{x:.234375,y:.421875},{x:.234375,y:.421875},{x:.265625,y:.421875},{x:.265625,y:.421875},{x:.296875,y:.421875},{x:.296875,y:.421875},{x:.328125,y:.421875},{x:.328125,y:.421875},{x:.359375,y:.421875},{x:.359375,y:.421875},{x:.390625,y:.421875},{x:.390625,y:.421875},{x:.421875,y:.421875},{x:.421875,y:.421875},{x:.453125,y:.421875},{x:.453125,y:.421875},{x:.484375,y:.421875},{x:.484375,y:.421875},{x:.515625,y:.421875},{x:.515625,y:.421875},{x:.546875,y:.421875},{x:.546875,y:.421875},{x:.578125,y:.421875},{x:.578125,y:.421875},{x:.609375,y:.421875},{x:.609375,y:.421875},{x:.640625,y:.421875},{x:.640625,y:.421875},{x:.671875,y:.421875},{x:.671875,y:.421875},{x:.703125,y:.421875},{x:.703125,y:.421875},{x:.734375,y:.421875},{x:.734375,y:.421875},{x:.765625,y:.421875},{x:.765625,y:.421875},{x:.796875,y:.421875},{x:.796875,y:.421875},{x:.828125,y:.421875},{x:.828125,y:.421875},{x:.859375,y:.421875},{x:.859375,y:.421875},{x:.890625,y:.421875},{x:.890625,y:.421875},{x:.921875,y:.421875},{x:.921875,y:.421875},{x:.953125,y:.421875},{x:.953125,y:.421875},{x:.984375,y:.421875},{x:.984375,y:.421875},{x:.015625,y:.453125},{x:.015625,y:.453125},{x:.046875,y:.453125},{x:.046875,y:.453125},{x:.078125,y:.453125},{x:.078125,y:.453125},{x:.109375,y:.453125},{x:.109375,y:.453125},{x:.140625,y:.453125},{x:.140625,y:.453125},{x:.171875,y:.453125},{x:.171875,y:.453125},{x:.203125,y:.453125},{x:.203125,y:.453125},{x:.234375,y:.453125},{x:.234375,y:.453125},{x:.265625,y:.453125},{x:.265625,y:.453125},{x:.296875,y:.453125},{x:.296875,y:.453125},{x:.328125,y:.453125},{x:.328125,y:.453125},{x:.359375,y:.453125},{x:.359375,y:.453125},{x:.390625,y:.453125},{x:.390625,y:.453125},{x:.421875,y:.453125},{x:.421875,y:.453125},{x:.453125,y:.453125},{x:.453125,y:.453125},{x:.484375,y:.453125},{x:.484375,y:.453125},{x:.515625,y:.453125},{x:.515625,y:.453125},{x:.546875,y:.453125},{x:.546875,y:.453125},{x:.578125,y:.453125},{x:.578125,y:.453125},{x:.609375,y:.453125},{x:.609375,y:.453125},{x:.640625,y:.453125},{x:.640625,y:.453125},{x:.671875,y:.453125},{x:.671875,y:.453125},{x:.703125,y:.453125},{x:.703125,y:.453125},{x:.734375,y:.453125},{x:.734375,y:.453125},{x:.765625,y:.453125},{x:.765625,y:.453125},{x:.796875,y:.453125},{x:.796875,y:.453125},{x:.828125,y:.453125},{x:.828125,y:.453125},{x:.859375,y:.453125},{x:.859375,y:.453125},{x:.890625,y:.453125},{x:.890625,y:.453125},{x:.921875,y:.453125},{x:.921875,y:.453125},{x:.953125,y:.453125},{x:.953125,y:.453125},{x:.984375,y:.453125},{x:.984375,y:.453125},{x:.015625,y:.484375},{x:.015625,y:.484375},{x:.046875,y:.484375},{x:.046875,y:.484375},{x:.078125,y:.484375},{x:.078125,y:.484375},{x:.109375,y:.484375},{x:.109375,y:.484375},{x:.140625,y:.484375},{x:.140625,y:.484375},{x:.171875,y:.484375},{x:.171875,y:.484375},{x:.203125,y:.484375},{x:.203125,y:.484375},{x:.234375,y:.484375},{x:.234375,y:.484375},{x:.265625,y:.484375},{x:.265625,y:.484375},{x:.296875,y:.484375},{x:.296875,y:.484375},{x:.328125,y:.484375},{x:.328125,y:.484375},{x:.359375,y:.484375},{x:.359375,y:.484375},{x:.390625,y:.484375},{x:.390625,y:.484375},{x:.421875,y:.484375},{x:.421875,y:.484375},{x:.453125,y:.484375},{x:.453125,y:.484375},{x:.484375,y:.484375},{x:.484375,y:.484375},{x:.515625,y:.484375},{x:.515625,y:.484375},{x:.546875,y:.484375},{x:.546875,y:.484375},{x:.578125,y:.484375},{x:.578125,y:.484375},{x:.609375,y:.484375},{x:.609375,y:.484375},{x:.640625,y:.484375},{x:.640625,y:.484375},{x:.671875,y:.484375},{x:.671875,y:.484375},{x:.703125,y:.484375},{x:.703125,y:.484375},{x:.734375,y:.484375},{x:.734375,y:.484375},{x:.765625,y:.484375},{x:.765625,y:.484375},{x:.796875,y:.484375},{x:.796875,y:.484375},{x:.828125,y:.484375},{x:.828125,y:.484375},{x:.859375,y:.484375},{x:.859375,y:.484375},{x:.890625,y:.484375},{x:.890625,y:.484375},{x:.921875,y:.484375},{x:.921875,y:.484375},{x:.953125,y:.484375},{x:.953125,y:.484375},{x:.984375,y:.484375},{x:.984375,y:.484375},{x:.015625,y:.515625},{x:.015625,y:.515625},{x:.046875,y:.515625},{x:.046875,y:.515625},{x:.078125,y:.515625},{x:.078125,y:.515625},{x:.109375,y:.515625},{x:.109375,y:.515625},{x:.140625,y:.515625},{x:.140625,y:.515625},{x:.171875,y:.515625},{x:.171875,y:.515625},{x:.203125,y:.515625},{x:.203125,y:.515625},{x:.234375,y:.515625},{x:.234375,y:.515625},{x:.265625,y:.515625},{x:.265625,y:.515625},{x:.296875,y:.515625},{x:.296875,y:.515625},{x:.328125,y:.515625},{x:.328125,y:.515625},{x:.359375,y:.515625},{x:.359375,y:.515625},{x:.390625,y:.515625},{x:.390625,y:.515625},{x:.421875,y:.515625},{x:.421875,y:.515625},{x:.453125,y:.515625},{x:.453125,y:.515625},{x:.484375,y:.515625},{x:.484375,y:.515625},{x:.515625,y:.515625},{x:.515625,y:.515625},{x:.546875,y:.515625},{x:.546875,y:.515625},{x:.578125,y:.515625},{x:.578125,y:.515625},{x:.609375,y:.515625},{x:.609375,y:.515625},{x:.640625,y:.515625},{x:.640625,y:.515625},{x:.671875,y:.515625},{x:.671875,y:.515625},{x:.703125,y:.515625},{x:.703125,y:.515625},{x:.734375,y:.515625},{x:.734375,y:.515625},{x:.765625,y:.515625},{x:.765625,y:.515625},{x:.796875,y:.515625},{x:.796875,y:.515625},{x:.828125,y:.515625},{x:.828125,y:.515625},{x:.859375,y:.515625},{x:.859375,y:.515625},{x:.890625,y:.515625},{x:.890625,y:.515625},{x:.921875,y:.515625},{x:.921875,y:.515625},{x:.953125,y:.515625},{x:.953125,y:.515625},{x:.984375,y:.515625},{x:.984375,y:.515625},{x:.015625,y:.546875},{x:.015625,y:.546875},{x:.046875,y:.546875},{x:.046875,y:.546875},{x:.078125,y:.546875},{x:.078125,y:.546875},{x:.109375,y:.546875},{x:.109375,y:.546875},{x:.140625,y:.546875},{x:.140625,y:.546875},{x:.171875,y:.546875},{x:.171875,y:.546875},{x:.203125,y:.546875},{x:.203125,y:.546875},{x:.234375,y:.546875},{x:.234375,y:.546875},{x:.265625,y:.546875},{x:.265625,y:.546875},{x:.296875,y:.546875},{x:.296875,y:.546875},{x:.328125,y:.546875},{x:.328125,y:.546875},{x:.359375,y:.546875},{x:.359375,y:.546875},{x:.390625,y:.546875},{x:.390625,y:.546875},{x:.421875,y:.546875},{x:.421875,y:.546875},{x:.453125,y:.546875},{x:.453125,y:.546875},{x:.484375,y:.546875},{x:.484375,y:.546875},{x:.515625,y:.546875},{x:.515625,y:.546875},{x:.546875,y:.546875},{x:.546875,y:.546875},{x:.578125,y:.546875},{x:.578125,y:.546875},{x:.609375,y:.546875},{x:.609375,y:.546875},{x:.640625,y:.546875},{x:.640625,y:.546875},{x:.671875,y:.546875},{x:.671875,y:.546875},{x:.703125,y:.546875},{x:.703125,y:.546875},{x:.734375,y:.546875},{x:.734375,y:.546875},{x:.765625,y:.546875},{x:.765625,y:.546875},{x:.796875,y:.546875},{x:.796875,y:.546875},{x:.828125,y:.546875},{x:.828125,y:.546875},{x:.859375,y:.546875},{x:.859375,y:.546875},{x:.890625,y:.546875},{x:.890625,y:.546875},{x:.921875,y:.546875},{x:.921875,y:.546875},{x:.953125,y:.546875},{x:.953125,y:.546875},{x:.984375,y:.546875},{x:.984375,y:.546875},{x:.015625,y:.578125},{x:.015625,y:.578125},{x:.046875,y:.578125},{x:.046875,y:.578125},{x:.078125,y:.578125},{x:.078125,y:.578125},{x:.109375,y:.578125},{x:.109375,y:.578125},{x:.140625,y:.578125},{x:.140625,y:.578125},{x:.171875,y:.578125},{x:.171875,y:.578125},{x:.203125,y:.578125},{x:.203125,y:.578125},{x:.234375,y:.578125},{x:.234375,y:.578125},{x:.265625,y:.578125},{x:.265625,y:.578125},{x:.296875,y:.578125},{x:.296875,y:.578125},{x:.328125,y:.578125},{x:.328125,y:.578125},{x:.359375,y:.578125},{x:.359375,y:.578125},{x:.390625,y:.578125},{x:.390625,y:.578125},{x:.421875,y:.578125},{x:.421875,y:.578125},{x:.453125,y:.578125},{x:.453125,y:.578125},{x:.484375,y:.578125},{x:.484375,y:.578125},{x:.515625,y:.578125},{x:.515625,y:.578125},{x:.546875,y:.578125},{x:.546875,y:.578125},{x:.578125,y:.578125},{x:.578125,y:.578125},{x:.609375,y:.578125},{x:.609375,y:.578125},{x:.640625,y:.578125},{x:.640625,y:.578125},{x:.671875,y:.578125},{x:.671875,y:.578125},{x:.703125,y:.578125},{x:.703125,y:.578125},{x:.734375,y:.578125},{x:.734375,y:.578125},{x:.765625,y:.578125},{x:.765625,y:.578125},{x:.796875,y:.578125},{x:.796875,y:.578125},{x:.828125,y:.578125},{x:.828125,y:.578125},{x:.859375,y:.578125},{x:.859375,y:.578125},{x:.890625,y:.578125},{x:.890625,y:.578125},{x:.921875,y:.578125},{x:.921875,y:.578125},{x:.953125,y:.578125},{x:.953125,y:.578125},{x:.984375,y:.578125},{x:.984375,y:.578125},{x:.015625,y:.609375},{x:.015625,y:.609375},{x:.046875,y:.609375},{x:.046875,y:.609375},{x:.078125,y:.609375},{x:.078125,y:.609375},{x:.109375,y:.609375},{x:.109375,y:.609375},{x:.140625,y:.609375},{x:.140625,y:.609375},{x:.171875,y:.609375},{x:.171875,y:.609375},{x:.203125,y:.609375},{x:.203125,y:.609375},{x:.234375,y:.609375},{x:.234375,y:.609375},{x:.265625,y:.609375},{x:.265625,y:.609375},{x:.296875,y:.609375},{x:.296875,y:.609375},{x:.328125,y:.609375},{x:.328125,y:.609375},{x:.359375,y:.609375},{x:.359375,y:.609375},{x:.390625,y:.609375},{x:.390625,y:.609375},{x:.421875,y:.609375},{x:.421875,y:.609375},{x:.453125,y:.609375},{x:.453125,y:.609375},{x:.484375,y:.609375},{x:.484375,y:.609375},{x:.515625,y:.609375},{x:.515625,y:.609375},{x:.546875,y:.609375},{x:.546875,y:.609375},{x:.578125,y:.609375},{x:.578125,y:.609375},{x:.609375,y:.609375},{x:.609375,y:.609375},{x:.640625,y:.609375},{x:.640625,y:.609375},{x:.671875,y:.609375},{x:.671875,y:.609375},{x:.703125,y:.609375},{x:.703125,y:.609375},{x:.734375,y:.609375},{x:.734375,y:.609375},{x:.765625,y:.609375},{x:.765625,y:.609375},{x:.796875,y:.609375},{x:.796875,y:.609375},{x:.828125,y:.609375},{x:.828125,y:.609375},{x:.859375,y:.609375},{x:.859375,y:.609375},{x:.890625,y:.609375},{x:.890625,y:.609375},{x:.921875,y:.609375},{x:.921875,y:.609375},{x:.953125,y:.609375},{x:.953125,y:.609375},{x:.984375,y:.609375},{x:.984375,y:.609375},{x:.015625,y:.640625},{x:.015625,y:.640625},{x:.046875,y:.640625},{x:.046875,y:.640625},{x:.078125,y:.640625},{x:.078125,y:.640625},{x:.109375,y:.640625},{x:.109375,y:.640625},{x:.140625,y:.640625},{x:.140625,y:.640625},{x:.171875,y:.640625},{x:.171875,y:.640625},{x:.203125,y:.640625},{x:.203125,y:.640625},{x:.234375,y:.640625},{x:.234375,y:.640625},{x:.265625,y:.640625},{x:.265625,y:.640625},{x:.296875,y:.640625},{x:.296875,y:.640625},{x:.328125,y:.640625},{x:.328125,y:.640625},{x:.359375,y:.640625},{x:.359375,y:.640625},{x:.390625,y:.640625},{x:.390625,y:.640625},{x:.421875,y:.640625},{x:.421875,y:.640625},{x:.453125,y:.640625},{x:.453125,y:.640625},{x:.484375,y:.640625},{x:.484375,y:.640625},{x:.515625,y:.640625},{x:.515625,y:.640625},{x:.546875,y:.640625},{x:.546875,y:.640625},{x:.578125,y:.640625},{x:.578125,y:.640625},{x:.609375,y:.640625},{x:.609375,y:.640625},{x:.640625,y:.640625},{x:.640625,y:.640625},{x:.671875,y:.640625},{x:.671875,y:.640625},{x:.703125,y:.640625},{x:.703125,y:.640625},{x:.734375,y:.640625},{x:.734375,y:.640625},{x:.765625,y:.640625},{x:.765625,y:.640625},{x:.796875,y:.640625},{x:.796875,y:.640625},{x:.828125,y:.640625},{x:.828125,y:.640625},{x:.859375,y:.640625},{x:.859375,y:.640625},{x:.890625,y:.640625},{x:.890625,y:.640625},{x:.921875,y:.640625},{x:.921875,y:.640625},{x:.953125,y:.640625},{x:.953125,y:.640625},{x:.984375,y:.640625},{x:.984375,y:.640625},{x:.015625,y:.671875},{x:.015625,y:.671875},{x:.046875,y:.671875},{x:.046875,y:.671875},{x:.078125,y:.671875},{x:.078125,y:.671875},{x:.109375,y:.671875},{x:.109375,y:.671875},{x:.140625,y:.671875},{x:.140625,y:.671875},{x:.171875,y:.671875},{x:.171875,y:.671875},{x:.203125,y:.671875},{x:.203125,y:.671875},{x:.234375,y:.671875},{x:.234375,y:.671875},{x:.265625,y:.671875},{x:.265625,y:.671875},{x:.296875,y:.671875},{x:.296875,y:.671875},{x:.328125,y:.671875},{x:.328125,y:.671875},{x:.359375,y:.671875},{x:.359375,y:.671875},{x:.390625,y:.671875},{x:.390625,y:.671875},{x:.421875,y:.671875},{x:.421875,y:.671875},{x:.453125,y:.671875},{x:.453125,y:.671875},{x:.484375,y:.671875},{x:.484375,y:.671875},{x:.515625,y:.671875},{x:.515625,y:.671875},{x:.546875,y:.671875},{x:.546875,y:.671875},{x:.578125,y:.671875},{x:.578125,y:.671875},{x:.609375,y:.671875},{x:.609375,y:.671875},{x:.640625,y:.671875},{x:.640625,y:.671875},{x:.671875,y:.671875},{x:.671875,y:.671875},{x:.703125,y:.671875},{x:.703125,y:.671875},{x:.734375,y:.671875},{x:.734375,y:.671875},{x:.765625,y:.671875},{x:.765625,y:.671875},{x:.796875,y:.671875},{x:.796875,y:.671875},{x:.828125,y:.671875},{x:.828125,y:.671875},{x:.859375,y:.671875},{x:.859375,y:.671875},{x:.890625,y:.671875},{x:.890625,y:.671875},{x:.921875,y:.671875},{x:.921875,y:.671875},{x:.953125,y:.671875},{x:.953125,y:.671875},{x:.984375,y:.671875},{x:.984375,y:.671875},{x:.015625,y:.703125},{x:.015625,y:.703125},{x:.046875,y:.703125},{x:.046875,y:.703125},{x:.078125,y:.703125},{x:.078125,y:.703125},{x:.109375,y:.703125},{x:.109375,y:.703125},{x:.140625,y:.703125},{x:.140625,y:.703125},{x:.171875,y:.703125},{x:.171875,y:.703125},{x:.203125,y:.703125},{x:.203125,y:.703125},{x:.234375,y:.703125},{x:.234375,y:.703125},{x:.265625,y:.703125},{x:.265625,y:.703125},{x:.296875,y:.703125},{x:.296875,y:.703125},{x:.328125,y:.703125},{x:.328125,y:.703125},{x:.359375,y:.703125},{x:.359375,y:.703125},{x:.390625,y:.703125},{x:.390625,y:.703125},{x:.421875,y:.703125},{x:.421875,y:.703125},{x:.453125,y:.703125},{x:.453125,y:.703125},{x:.484375,y:.703125},{x:.484375,y:.703125},{x:.515625,y:.703125},{x:.515625,y:.703125},{x:.546875,y:.703125},{x:.546875,y:.703125},{x:.578125,y:.703125},{x:.578125,y:.703125},{x:.609375,y:.703125},{x:.609375,y:.703125},{x:.640625,y:.703125},{x:.640625,y:.703125},{x:.671875,y:.703125},{x:.671875,y:.703125},{x:.703125,y:.703125},{x:.703125,y:.703125},{x:.734375,y:.703125},{x:.734375,y:.703125},{x:.765625,y:.703125},{x:.765625,y:.703125},{x:.796875,y:.703125},{x:.796875,y:.703125},{x:.828125,y:.703125},{x:.828125,y:.703125},{x:.859375,y:.703125},{x:.859375,y:.703125},{x:.890625,y:.703125},{x:.890625,y:.703125},{x:.921875,y:.703125},{x:.921875,y:.703125},{x:.953125,y:.703125},{x:.953125,y:.703125},{x:.984375,y:.703125},{x:.984375,y:.703125},{x:.015625,y:.734375},{x:.015625,y:.734375},{x:.046875,y:.734375},{x:.046875,y:.734375},{x:.078125,y:.734375},{x:.078125,y:.734375},{x:.109375,y:.734375},{x:.109375,y:.734375},{x:.140625,y:.734375},{x:.140625,y:.734375},{x:.171875,y:.734375},{x:.171875,y:.734375},{x:.203125,y:.734375},{x:.203125,y:.734375},{x:.234375,y:.734375},{x:.234375,y:.734375},{x:.265625,y:.734375},{x:.265625,y:.734375},{x:.296875,y:.734375},{x:.296875,y:.734375},{x:.328125,y:.734375},{x:.328125,y:.734375},{x:.359375,y:.734375},{x:.359375,y:.734375},{x:.390625,y:.734375},{x:.390625,y:.734375},{x:.421875,y:.734375},{x:.421875,y:.734375},{x:.453125,y:.734375},{x:.453125,y:.734375},{x:.484375,y:.734375},{x:.484375,y:.734375},{x:.515625,y:.734375},{x:.515625,y:.734375},{x:.546875,y:.734375},{x:.546875,y:.734375},{x:.578125,y:.734375},{x:.578125,y:.734375},{x:.609375,y:.734375},{x:.609375,y:.734375},{x:.640625,y:.734375},{x:.640625,y:.734375},{x:.671875,y:.734375},{x:.671875,y:.734375},{x:.703125,y:.734375},{x:.703125,y:.734375},{x:.734375,y:.734375},{x:.734375,y:.734375},{x:.765625,y:.734375},{x:.765625,y:.734375},{x:.796875,y:.734375},{x:.796875,y:.734375},{x:.828125,y:.734375},{x:.828125,y:.734375},{x:.859375,y:.734375},{x:.859375,y:.734375},{x:.890625,y:.734375},{x:.890625,y:.734375},{x:.921875,y:.734375},{x:.921875,y:.734375},{x:.953125,y:.734375},{x:.953125,y:.734375},{x:.984375,y:.734375},{x:.984375,y:.734375},{x:.015625,y:.765625},{x:.015625,y:.765625},{x:.046875,y:.765625},{x:.046875,y:.765625},{x:.078125,y:.765625},{x:.078125,y:.765625},{x:.109375,y:.765625},{x:.109375,y:.765625},{x:.140625,y:.765625},{x:.140625,y:.765625},{x:.171875,y:.765625},{x:.171875,y:.765625},{x:.203125,y:.765625},{x:.203125,y:.765625},{x:.234375,y:.765625},{x:.234375,y:.765625},{x:.265625,y:.765625},{x:.265625,y:.765625},{x:.296875,y:.765625},{x:.296875,y:.765625},{x:.328125,y:.765625},{x:.328125,y:.765625},{x:.359375,y:.765625},{x:.359375,y:.765625},{x:.390625,y:.765625},{x:.390625,y:.765625},{x:.421875,y:.765625},{x:.421875,y:.765625},{x:.453125,y:.765625},{x:.453125,y:.765625},{x:.484375,y:.765625},{x:.484375,y:.765625},{x:.515625,y:.765625},{x:.515625,y:.765625},{x:.546875,y:.765625},{x:.546875,y:.765625},{x:.578125,y:.765625},{x:.578125,y:.765625},{x:.609375,y:.765625},{x:.609375,y:.765625},{x:.640625,y:.765625},{x:.640625,y:.765625},{x:.671875,y:.765625},{x:.671875,y:.765625},{x:.703125,y:.765625},{x:.703125,y:.765625},{x:.734375,y:.765625},{x:.734375,y:.765625},{x:.765625,y:.765625},{x:.765625,y:.765625},{x:.796875,y:.765625},{x:.796875,y:.765625},{x:.828125,y:.765625},{x:.828125,y:.765625},{x:.859375,y:.765625},{x:.859375,y:.765625},{x:.890625,y:.765625},{x:.890625,y:.765625},{x:.921875,y:.765625},{x:.921875,y:.765625},{x:.953125,y:.765625},{x:.953125,y:.765625},{x:.984375,y:.765625},{x:.984375,y:.765625},{x:.015625,y:.796875},{x:.015625,y:.796875},{x:.046875,y:.796875},{x:.046875,y:.796875},{x:.078125,y:.796875},{x:.078125,y:.796875},{x:.109375,y:.796875},{x:.109375,y:.796875},{x:.140625,y:.796875},{x:.140625,y:.796875},{x:.171875,y:.796875},{x:.171875,y:.796875},{x:.203125,y:.796875},{x:.203125,y:.796875},{x:.234375,y:.796875},{x:.234375,y:.796875},{x:.265625,y:.796875},{x:.265625,y:.796875},{x:.296875,y:.796875},{x:.296875,y:.796875},{x:.328125,y:.796875},{x:.328125,y:.796875},{x:.359375,y:.796875},{x:.359375,y:.796875},{x:.390625,y:.796875},{x:.390625,y:.796875},{x:.421875,y:.796875},{x:.421875,y:.796875},{x:.453125,y:.796875},{x:.453125,y:.796875},{x:.484375,y:.796875},{x:.484375,y:.796875},{x:.515625,y:.796875},{x:.515625,y:.796875},{x:.546875,y:.796875},{x:.546875,y:.796875},{x:.578125,y:.796875},{x:.578125,y:.796875},{x:.609375,y:.796875},{x:.609375,y:.796875},{x:.640625,y:.796875},{x:.640625,y:.796875},{x:.671875,y:.796875},{x:.671875,y:.796875},{x:.703125,y:.796875},{x:.703125,y:.796875},{x:.734375,y:.796875},{x:.734375,y:.796875},{x:.765625,y:.796875},{x:.765625,y:.796875},{x:.796875,y:.796875},{x:.796875,y:.796875},{x:.828125,y:.796875},{x:.828125,y:.796875},{x:.859375,y:.796875},{x:.859375,y:.796875},{x:.890625,y:.796875},{x:.890625,y:.796875},{x:.921875,y:.796875},{x:.921875,y:.796875},{x:.953125,y:.796875},{x:.953125,y:.796875},{x:.984375,y:.796875},{x:.984375,y:.796875},{x:.015625,y:.828125},{x:.015625,y:.828125},{x:.046875,y:.828125},{x:.046875,y:.828125},{x:.078125,y:.828125},{x:.078125,y:.828125},{x:.109375,y:.828125},{x:.109375,y:.828125},{x:.140625,y:.828125},{x:.140625,y:.828125},{x:.171875,y:.828125},{x:.171875,y:.828125},{x:.203125,y:.828125},{x:.203125,y:.828125},{x:.234375,y:.828125},{x:.234375,y:.828125},{x:.265625,y:.828125},{x:.265625,y:.828125},{x:.296875,y:.828125},{x:.296875,y:.828125},{x:.328125,y:.828125},{x:.328125,y:.828125},{x:.359375,y:.828125},{x:.359375,y:.828125},{x:.390625,y:.828125},{x:.390625,y:.828125},{x:.421875,y:.828125},{x:.421875,y:.828125},{x:.453125,y:.828125},{x:.453125,y:.828125},{x:.484375,y:.828125},{x:.484375,y:.828125},{x:.515625,y:.828125},{x:.515625,y:.828125},{x:.546875,y:.828125},{x:.546875,y:.828125},{x:.578125,y:.828125},{x:.578125,y:.828125},{x:.609375,y:.828125},{x:.609375,y:.828125},{x:.640625,y:.828125},{x:.640625,y:.828125},{x:.671875,y:.828125},{x:.671875,y:.828125},{x:.703125,y:.828125},{x:.703125,y:.828125},{x:.734375,y:.828125},{x:.734375,y:.828125},{x:.765625,y:.828125},{x:.765625,y:.828125},{x:.796875,y:.828125},{x:.796875,y:.828125},{x:.828125,y:.828125},{x:.828125,y:.828125},{x:.859375,y:.828125},{x:.859375,y:.828125},{x:.890625,y:.828125},{x:.890625,y:.828125},{x:.921875,y:.828125},{x:.921875,y:.828125},{x:.953125,y:.828125},{x:.953125,y:.828125},{x:.984375,y:.828125},{x:.984375,y:.828125},{x:.015625,y:.859375},{x:.015625,y:.859375},{x:.046875,y:.859375},{x:.046875,y:.859375},{x:.078125,y:.859375},{x:.078125,y:.859375},{x:.109375,y:.859375},{x:.109375,y:.859375},{x:.140625,y:.859375},{x:.140625,y:.859375},{x:.171875,y:.859375},{x:.171875,y:.859375},{x:.203125,y:.859375},{x:.203125,y:.859375},{x:.234375,y:.859375},{x:.234375,y:.859375},{x:.265625,y:.859375},{x:.265625,y:.859375},{x:.296875,y:.859375},{x:.296875,y:.859375},{x:.328125,y:.859375},{x:.328125,y:.859375},{x:.359375,y:.859375},{x:.359375,y:.859375},{x:.390625,y:.859375},{x:.390625,y:.859375},{x:.421875,y:.859375},{x:.421875,y:.859375},{x:.453125,y:.859375},{x:.453125,y:.859375},{x:.484375,y:.859375},{x:.484375,y:.859375},{x:.515625,y:.859375},{x:.515625,y:.859375},{x:.546875,y:.859375},{x:.546875,y:.859375},{x:.578125,y:.859375},{x:.578125,y:.859375},{x:.609375,y:.859375},{x:.609375,y:.859375},{x:.640625,y:.859375},{x:.640625,y:.859375},{x:.671875,y:.859375},{x:.671875,y:.859375},{x:.703125,y:.859375},{x:.703125,y:.859375},{x:.734375,y:.859375},{x:.734375,y:.859375},{x:.765625,y:.859375},{x:.765625,y:.859375},{x:.796875,y:.859375},{x:.796875,y:.859375},{x:.828125,y:.859375},{x:.828125,y:.859375},{x:.859375,y:.859375},{x:.859375,y:.859375},{x:.890625,y:.859375},{x:.890625,y:.859375},{x:.921875,y:.859375},{x:.921875,y:.859375},{x:.953125,y:.859375},{x:.953125,y:.859375},{x:.984375,y:.859375},{x:.984375,y:.859375},{x:.015625,y:.890625},{x:.015625,y:.890625},{x:.046875,y:.890625},{x:.046875,y:.890625},{x:.078125,y:.890625},{x:.078125,y:.890625},{x:.109375,y:.890625},{x:.109375,y:.890625},{x:.140625,y:.890625},{x:.140625,y:.890625},{x:.171875,y:.890625},{x:.171875,y:.890625},{x:.203125,y:.890625},{x:.203125,y:.890625},{x:.234375,y:.890625},{x:.234375,y:.890625},{x:.265625,y:.890625},{x:.265625,y:.890625},{x:.296875,y:.890625},{x:.296875,y:.890625},{x:.328125,y:.890625},{x:.328125,y:.890625},{x:.359375,y:.890625},{x:.359375,y:.890625},{x:.390625,y:.890625},{x:.390625,y:.890625},{x:.421875,y:.890625},{x:.421875,y:.890625},{x:.453125,y:.890625},{x:.453125,y:.890625},{x:.484375,y:.890625},{x:.484375,y:.890625},{x:.515625,y:.890625},{x:.515625,y:.890625},{x:.546875,y:.890625},{x:.546875,y:.890625},{x:.578125,y:.890625},{x:.578125,y:.890625},{x:.609375,y:.890625},{x:.609375,y:.890625},{x:.640625,y:.890625},{x:.640625,y:.890625},{x:.671875,y:.890625},{x:.671875,y:.890625},{x:.703125,y:.890625},{x:.703125,y:.890625},{x:.734375,y:.890625},{x:.734375,y:.890625},{x:.765625,y:.890625},{x:.765625,y:.890625},{x:.796875,y:.890625},{x:.796875,y:.890625},{x:.828125,y:.890625},{x:.828125,y:.890625},{x:.859375,y:.890625},{x:.859375,y:.890625},{x:.890625,y:.890625},{x:.890625,y:.890625},{x:.921875,y:.890625},{x:.921875,y:.890625},{x:.953125,y:.890625},{x:.953125,y:.890625},{x:.984375,y:.890625},{x:.984375,y:.890625},{x:.015625,y:.921875},{x:.015625,y:.921875},{x:.046875,y:.921875},{x:.046875,y:.921875},{x:.078125,y:.921875},{x:.078125,y:.921875},{x:.109375,y:.921875},{x:.109375,y:.921875},{x:.140625,y:.921875},{x:.140625,y:.921875},{x:.171875,y:.921875},{x:.171875,y:.921875},{x:.203125,y:.921875},{x:.203125,y:.921875},{x:.234375,y:.921875},{x:.234375,y:.921875},{x:.265625,y:.921875},{x:.265625,y:.921875},{x:.296875,y:.921875},{x:.296875,y:.921875},{x:.328125,y:.921875},{x:.328125,y:.921875},{x:.359375,y:.921875},{x:.359375,y:.921875},{x:.390625,y:.921875},{x:.390625,y:.921875},{x:.421875,y:.921875},{x:.421875,y:.921875},{x:.453125,y:.921875},{x:.453125,y:.921875},{x:.484375,y:.921875},{x:.484375,y:.921875},{x:.515625,y:.921875},{x:.515625,y:.921875},{x:.546875,y:.921875},{x:.546875,y:.921875},{x:.578125,y:.921875},{x:.578125,y:.921875},{x:.609375,y:.921875},{x:.609375,y:.921875},{x:.640625,y:.921875},{x:.640625,y:.921875},{x:.671875,y:.921875},{x:.671875,y:.921875},{x:.703125,y:.921875},{x:.703125,y:.921875},{x:.734375,y:.921875},{x:.734375,y:.921875},{x:.765625,y:.921875},{x:.765625,y:.921875},{x:.796875,y:.921875},{x:.796875,y:.921875},{x:.828125,y:.921875},{x:.828125,y:.921875},{x:.859375,y:.921875},{x:.859375,y:.921875},{x:.890625,y:.921875},{x:.890625,y:.921875},{x:.921875,y:.921875},{x:.921875,y:.921875},{x:.953125,y:.921875},{x:.953125,y:.921875},{x:.984375,y:.921875},{x:.984375,y:.921875},{x:.015625,y:.953125},{x:.015625,y:.953125},{x:.046875,y:.953125},{x:.046875,y:.953125},{x:.078125,y:.953125},{x:.078125,y:.953125},{x:.109375,y:.953125},{x:.109375,y:.953125},{x:.140625,y:.953125},{x:.140625,y:.953125},{x:.171875,y:.953125},{x:.171875,y:.953125},{x:.203125,y:.953125},{x:.203125,y:.953125},{x:.234375,y:.953125},{x:.234375,y:.953125},{x:.265625,y:.953125},{x:.265625,y:.953125},{x:.296875,y:.953125},{x:.296875,y:.953125},{x:.328125,y:.953125},{x:.328125,y:.953125},{x:.359375,y:.953125},{x:.359375,y:.953125},{x:.390625,y:.953125},{x:.390625,y:.953125},{x:.421875,y:.953125},{x:.421875,y:.953125},{x:.453125,y:.953125},{x:.453125,y:.953125},{x:.484375,y:.953125},{x:.484375,y:.953125},{x:.515625,y:.953125},{x:.515625,y:.953125},{x:.546875,y:.953125},{x:.546875,y:.953125},{x:.578125,y:.953125},{x:.578125,y:.953125},{x:.609375,y:.953125},{x:.609375,y:.953125},{x:.640625,y:.953125},{x:.640625,y:.953125},{x:.671875,y:.953125},{x:.671875,y:.953125},{x:.703125,y:.953125},{x:.703125,y:.953125},{x:.734375,y:.953125},{x:.734375,y:.953125},{x:.765625,y:.953125},{x:.765625,y:.953125},{x:.796875,y:.953125},{x:.796875,y:.953125},{x:.828125,y:.953125},{x:.828125,y:.953125},{x:.859375,y:.953125},{x:.859375,y:.953125},{x:.890625,y:.953125},{x:.890625,y:.953125},{x:.921875,y:.953125},{x:.921875,y:.953125},{x:.953125,y:.953125},{x:.953125,y:.953125},{x:.984375,y:.953125},{x:.984375,y:.953125},{x:.015625,y:.984375},{x:.015625,y:.984375},{x:.046875,y:.984375},{x:.046875,y:.984375},{x:.078125,y:.984375},{x:.078125,y:.984375},{x:.109375,y:.984375},{x:.109375,y:.984375},{x:.140625,y:.984375},{x:.140625,y:.984375},{x:.171875,y:.984375},{x:.171875,y:.984375},{x:.203125,y:.984375},{x:.203125,y:.984375},{x:.234375,y:.984375},{x:.234375,y:.984375},{x:.265625,y:.984375},{x:.265625,y:.984375},{x:.296875,y:.984375},{x:.296875,y:.984375},{x:.328125,y:.984375},{x:.328125,y:.984375},{x:.359375,y:.984375},{x:.359375,y:.984375},{x:.390625,y:.984375},{x:.390625,y:.984375},{x:.421875,y:.984375},{x:.421875,y:.984375},{x:.453125,y:.984375},{x:.453125,y:.984375},{x:.484375,y:.984375},{x:.484375,y:.984375},{x:.515625,y:.984375},{x:.515625,y:.984375},{x:.546875,y:.984375},{x:.546875,y:.984375},{x:.578125,y:.984375},{x:.578125,y:.984375},{x:.609375,y:.984375},{x:.609375,y:.984375},{x:.640625,y:.984375},{x:.640625,y:.984375},{x:.671875,y:.984375},{x:.671875,y:.984375},{x:.703125,y:.984375},{x:.703125,y:.984375},{x:.734375,y:.984375},{x:.734375,y:.984375},{x:.765625,y:.984375},{x:.765625,y:.984375},{x:.796875,y:.984375},{x:.796875,y:.984375},{x:.828125,y:.984375},{x:.828125,y:.984375},{x:.859375,y:.984375},{x:.859375,y:.984375},{x:.890625,y:.984375},{x:.890625,y:.984375},{x:.921875,y:.984375},{x:.921875,y:.984375},{x:.953125,y:.984375},{x:.953125,y:.984375},{x:.984375,y:.984375},{x:.984375,y:.984375},{x:.03125,y:.03125},{x:.03125,y:.03125},{x:.09375,y:.03125},{x:.09375,y:.03125},{x:.15625,y:.03125},{x:.15625,y:.03125},{x:.21875,y:.03125},{x:.21875,y:.03125},{x:.28125,y:.03125},{x:.28125,y:.03125},{x:.34375,y:.03125},{x:.34375,y:.03125},{x:.40625,y:.03125},{x:.40625,y:.03125},{x:.46875,y:.03125},{x:.46875,y:.03125},{x:.53125,y:.03125},{x:.53125,y:.03125},{x:.59375,y:.03125},{x:.59375,y:.03125},{x:.65625,y:.03125},{x:.65625,y:.03125},{x:.71875,y:.03125},{x:.71875,y:.03125},{x:.78125,y:.03125},{x:.78125,y:.03125},{x:.84375,y:.03125},{x:.84375,y:.03125},{x:.90625,y:.03125},{x:.90625,y:.03125},{x:.96875,y:.03125},{x:.96875,y:.03125},{x:.03125,y:.09375},{x:.03125,y:.09375},{x:.09375,y:.09375},{x:.09375,y:.09375},{x:.15625,y:.09375},{x:.15625,y:.09375},{x:.21875,y:.09375},{x:.21875,y:.09375},{x:.28125,y:.09375},{x:.28125,y:.09375},{x:.34375,y:.09375},{x:.34375,y:.09375},{x:.40625,y:.09375},{x:.40625,y:.09375},{x:.46875,y:.09375},{x:.46875,y:.09375},{x:.53125,y:.09375},{x:.53125,y:.09375},{x:.59375,y:.09375},{x:.59375,y:.09375},{x:.65625,y:.09375},{x:.65625,y:.09375},{x:.71875,y:.09375},{x:.71875,y:.09375},{x:.78125,y:.09375},{x:.78125,y:.09375},{x:.84375,y:.09375},{x:.84375,y:.09375},{x:.90625,y:.09375},{x:.90625,y:.09375},{x:.96875,y:.09375},{x:.96875,y:.09375},{x:.03125,y:.15625},{x:.03125,y:.15625},{x:.09375,y:.15625},{x:.09375,y:.15625},{x:.15625,y:.15625},{x:.15625,y:.15625},{x:.21875,y:.15625},{x:.21875,y:.15625},{x:.28125,y:.15625},{x:.28125,y:.15625},{x:.34375,y:.15625},{x:.34375,y:.15625},{x:.40625,y:.15625},{x:.40625,y:.15625},{x:.46875,y:.15625},{x:.46875,y:.15625},{x:.53125,y:.15625},{x:.53125,y:.15625},{x:.59375,y:.15625},{x:.59375,y:.15625},{x:.65625,y:.15625},{x:.65625,y:.15625},{x:.71875,y:.15625},{x:.71875,y:.15625},{x:.78125,y:.15625},{x:.78125,y:.15625},{x:.84375,y:.15625},{x:.84375,y:.15625},{x:.90625,y:.15625},{x:.90625,y:.15625},{x:.96875,y:.15625},{x:.96875,y:.15625},{x:.03125,y:.21875},{x:.03125,y:.21875},{x:.09375,y:.21875},{x:.09375,y:.21875},{x:.15625,y:.21875},{x:.15625,y:.21875},{x:.21875,y:.21875},{x:.21875,y:.21875},{x:.28125,y:.21875},{x:.28125,y:.21875},{x:.34375,y:.21875},{x:.34375,y:.21875},{x:.40625,y:.21875},{x:.40625,y:.21875},{x:.46875,y:.21875},{x:.46875,y:.21875},{x:.53125,y:.21875},{x:.53125,y:.21875},{x:.59375,y:.21875},{x:.59375,y:.21875},{x:.65625,y:.21875},{x:.65625,y:.21875},{x:.71875,y:.21875},{x:.71875,y:.21875},{x:.78125,y:.21875},{x:.78125,y:.21875},{x:.84375,y:.21875},{x:.84375,y:.21875},{x:.90625,y:.21875},{x:.90625,y:.21875},{x:.96875,y:.21875},{x:.96875,y:.21875},{x:.03125,y:.28125},{x:.03125,y:.28125},{x:.09375,y:.28125},{x:.09375,y:.28125},{x:.15625,y:.28125},{x:.15625,y:.28125},{x:.21875,y:.28125},{x:.21875,y:.28125},{x:.28125,y:.28125},{x:.28125,y:.28125},{x:.34375,y:.28125},{x:.34375,y:.28125},{x:.40625,y:.28125},{x:.40625,y:.28125},{x:.46875,y:.28125},{x:.46875,y:.28125},{x:.53125,y:.28125},{x:.53125,y:.28125},{x:.59375,y:.28125},{x:.59375,y:.28125},{x:.65625,y:.28125},{x:.65625,y:.28125},{x:.71875,y:.28125},{x:.71875,y:.28125},{x:.78125,y:.28125},{x:.78125,y:.28125},{x:.84375,y:.28125},{x:.84375,y:.28125},{x:.90625,y:.28125},{x:.90625,y:.28125},{x:.96875,y:.28125},{x:.96875,y:.28125},{x:.03125,y:.34375},{x:.03125,y:.34375},{x:.09375,y:.34375},{x:.09375,y:.34375},{x:.15625,y:.34375},{x:.15625,y:.34375},{x:.21875,y:.34375},{x:.21875,y:.34375},{x:.28125,y:.34375},{x:.28125,y:.34375},{x:.34375,y:.34375},{x:.34375,y:.34375},{x:.40625,y:.34375},{x:.40625,y:.34375},{x:.46875,y:.34375},{x:.46875,y:.34375},{x:.53125,y:.34375},{x:.53125,y:.34375},{x:.59375,y:.34375},{x:.59375,y:.34375},{x:.65625,y:.34375},{x:.65625,y:.34375},{x:.71875,y:.34375},{x:.71875,y:.34375},{x:.78125,y:.34375},{x:.78125,y:.34375},{x:.84375,y:.34375},{x:.84375,y:.34375},{x:.90625,y:.34375},{x:.90625,y:.34375},{x:.96875,y:.34375},{x:.96875,y:.34375},{x:.03125,y:.40625},{x:.03125,y:.40625},{x:.09375,y:.40625},{x:.09375,y:.40625},{x:.15625,y:.40625},{x:.15625,y:.40625},{x:.21875,y:.40625},{x:.21875,y:.40625},{x:.28125,y:.40625},{x:.28125,y:.40625},{x:.34375,y:.40625},{x:.34375,y:.40625},{x:.40625,y:.40625},{x:.40625,y:.40625},{x:.46875,y:.40625},{x:.46875,y:.40625},{x:.53125,y:.40625},{x:.53125,y:.40625},{x:.59375,y:.40625},{x:.59375,y:.40625},{x:.65625,y:.40625},{x:.65625,y:.40625},{x:.71875,y:.40625},{x:.71875,y:.40625},{x:.78125,y:.40625},{x:.78125,y:.40625},{x:.84375,y:.40625},{x:.84375,y:.40625},{x:.90625,y:.40625},{x:.90625,y:.40625},{x:.96875,y:.40625},{x:.96875,y:.40625},{x:.03125,y:.46875},{x:.03125,y:.46875},{x:.09375,y:.46875},{x:.09375,y:.46875},{x:.15625,y:.46875},{x:.15625,y:.46875},{x:.21875,y:.46875},{x:.21875,y:.46875},{x:.28125,y:.46875},{x:.28125,y:.46875},{x:.34375,y:.46875},{x:.34375,y:.46875},{x:.40625,y:.46875},{x:.40625,y:.46875},{x:.46875,y:.46875},{x:.46875,y:.46875},{x:.53125,y:.46875},{x:.53125,y:.46875},{x:.59375,y:.46875},{x:.59375,y:.46875},{x:.65625,y:.46875},{x:.65625,y:.46875},{x:.71875,y:.46875},{x:.71875,y:.46875},{x:.78125,y:.46875},{x:.78125,y:.46875},{x:.84375,y:.46875},{x:.84375,y:.46875},{x:.90625,y:.46875},{x:.90625,y:.46875},{x:.96875,y:.46875},{x:.96875,y:.46875},{x:.03125,y:.53125},{x:.03125,y:.53125},{x:.09375,y:.53125},{x:.09375,y:.53125},{x:.15625,y:.53125},{x:.15625,y:.53125},{x:.21875,y:.53125},{x:.21875,y:.53125},{x:.28125,y:.53125},{x:.28125,y:.53125},{x:.34375,y:.53125},{x:.34375,y:.53125},{x:.40625,y:.53125},{x:.40625,y:.53125},{x:.46875,y:.53125},{x:.46875,y:.53125},{x:.53125,y:.53125},{x:.53125,y:.53125},{x:.59375,y:.53125},{x:.59375,y:.53125},{x:.65625,y:.53125},{x:.65625,y:.53125},{x:.71875,y:.53125},{x:.71875,y:.53125},{x:.78125,y:.53125},{x:.78125,y:.53125},{x:.84375,y:.53125},{x:.84375,y:.53125},{x:.90625,y:.53125},{x:.90625,y:.53125},{x:.96875,y:.53125},{x:.96875,y:.53125},{x:.03125,y:.59375},{x:.03125,y:.59375},{x:.09375,y:.59375},{x:.09375,y:.59375},{x:.15625,y:.59375},{x:.15625,y:.59375},{x:.21875,y:.59375},{x:.21875,y:.59375},{x:.28125,y:.59375},{x:.28125,y:.59375},{x:.34375,y:.59375},{x:.34375,y:.59375},{x:.40625,y:.59375},{x:.40625,y:.59375},{x:.46875,y:.59375},{x:.46875,y:.59375},{x:.53125,y:.59375},{x:.53125,y:.59375},{x:.59375,y:.59375},{x:.59375,y:.59375},{x:.65625,y:.59375},{x:.65625,y:.59375},{x:.71875,y:.59375},{x:.71875,y:.59375},{x:.78125,y:.59375},{x:.78125,y:.59375},{x:.84375,y:.59375},{x:.84375,y:.59375},{x:.90625,y:.59375},{x:.90625,y:.59375},{x:.96875,y:.59375},{x:.96875,y:.59375},{x:.03125,y:.65625},{x:.03125,y:.65625},{x:.09375,y:.65625},{x:.09375,y:.65625},{x:.15625,y:.65625},{x:.15625,y:.65625},{x:.21875,y:.65625},{x:.21875,y:.65625},{x:.28125,y:.65625},{x:.28125,y:.65625},{x:.34375,y:.65625},{x:.34375,y:.65625},{x:.40625,y:.65625},{x:.40625,y:.65625},{x:.46875,y:.65625},{x:.46875,y:.65625},{x:.53125,y:.65625},{x:.53125,y:.65625},{x:.59375,y:.65625},{x:.59375,y:.65625},{x:.65625,y:.65625},{x:.65625,y:.65625},{x:.71875,y:.65625},{x:.71875,y:.65625},{x:.78125,y:.65625},{x:.78125,y:.65625},{x:.84375,y:.65625},{x:.84375,y:.65625},{x:.90625,y:.65625},{x:.90625,y:.65625},{x:.96875,y:.65625},{x:.96875,y:.65625},{x:.03125,y:.71875},{x:.03125,y:.71875},{x:.09375,y:.71875},{x:.09375,y:.71875},{x:.15625,y:.71875},{x:.15625,y:.71875},{x:.21875,y:.71875},{x:.21875,y:.71875},{x:.28125,y:.71875},{x:.28125,y:.71875},{x:.34375,y:.71875},{x:.34375,y:.71875},{x:.40625,y:.71875},{x:.40625,y:.71875},{x:.46875,y:.71875},{x:.46875,y:.71875},{x:.53125,y:.71875},{x:.53125,y:.71875},{x:.59375,y:.71875},{x:.59375,y:.71875},{x:.65625,y:.71875},{x:.65625,y:.71875},{x:.71875,y:.71875},{x:.71875,y:.71875},{x:.78125,y:.71875},{x:.78125,y:.71875},{x:.84375,y:.71875},{x:.84375,y:.71875},{x:.90625,y:.71875},{x:.90625,y:.71875},{x:.96875,y:.71875},{x:.96875,y:.71875},{x:.03125,y:.78125},{x:.03125,y:.78125},{x:.09375,y:.78125},{x:.09375,y:.78125},{x:.15625,y:.78125},{x:.15625,y:.78125},{x:.21875,y:.78125},{x:.21875,y:.78125},{x:.28125,y:.78125},{x:.28125,y:.78125},{x:.34375,y:.78125},{x:.34375,y:.78125},{x:.40625,y:.78125},{x:.40625,y:.78125},{x:.46875,y:.78125},{x:.46875,y:.78125},{x:.53125,y:.78125},{x:.53125,y:.78125},{x:.59375,y:.78125},{x:.59375,y:.78125},{x:.65625,y:.78125},{x:.65625,y:.78125},{x:.71875,y:.78125},{x:.71875,y:.78125},{x:.78125,y:.78125},{x:.78125,y:.78125},{x:.84375,y:.78125},{x:.84375,y:.78125},{x:.90625,y:.78125},{x:.90625,y:.78125},{x:.96875,y:.78125},{x:.96875,y:.78125},{x:.03125,y:.84375},{x:.03125,y:.84375},{x:.09375,y:.84375},{x:.09375,y:.84375},{x:.15625,y:.84375},{x:.15625,y:.84375},{x:.21875,y:.84375},{x:.21875,y:.84375},{x:.28125,y:.84375},{x:.28125,y:.84375},{x:.34375,y:.84375},{x:.34375,y:.84375},{x:.40625,y:.84375},{x:.40625,y:.84375},{x:.46875,y:.84375},{x:.46875,y:.84375},{x:.53125,y:.84375},{x:.53125,y:.84375},{x:.59375,y:.84375},{x:.59375,y:.84375},{x:.65625,y:.84375},{x:.65625,y:.84375},{x:.71875,y:.84375},{x:.71875,y:.84375},{x:.78125,y:.84375},{x:.78125,y:.84375},{x:.84375,y:.84375},{x:.84375,y:.84375},{x:.90625,y:.84375},{x:.90625,y:.84375},{x:.96875,y:.84375},{x:.96875,y:.84375},{x:.03125,y:.90625},{x:.03125,y:.90625},{x:.09375,y:.90625},{x:.09375,y:.90625},{x:.15625,y:.90625},{x:.15625,y:.90625},{x:.21875,y:.90625},{x:.21875,y:.90625},{x:.28125,y:.90625},{x:.28125,y:.90625},{x:.34375,y:.90625},{x:.34375,y:.90625},{x:.40625,y:.90625},{x:.40625,y:.90625},{x:.46875,y:.90625},{x:.46875,y:.90625},{x:.53125,y:.90625},{x:.53125,y:.90625},{x:.59375,y:.90625},{x:.59375,y:.90625},{x:.65625,y:.90625},{x:.65625,y:.90625},{x:.71875,y:.90625},{x:.71875,y:.90625},{x:.78125,y:.90625},{x:.78125,y:.90625},{x:.84375,y:.90625},{x:.84375,y:.90625},{x:.90625,y:.90625},{x:.90625,y:.90625},{x:.96875,y:.90625},{x:.96875,y:.90625},{x:.03125,y:.96875},{x:.03125,y:.96875},{x:.09375,y:.96875},{x:.09375,y:.96875},{x:.15625,y:.96875},{x:.15625,y:.96875},{x:.21875,y:.96875},{x:.21875,y:.96875},{x:.28125,y:.96875},{x:.28125,y:.96875},{x:.34375,y:.96875},{x:.34375,y:.96875},{x:.40625,y:.96875},{x:.40625,y:.96875},{x:.46875,y:.96875},{x:.46875,y:.96875},{x:.53125,y:.96875},{x:.53125,y:.96875},{x:.59375,y:.96875},{x:.59375,y:.96875},{x:.65625,y:.96875},{x:.65625,y:.96875},{x:.71875,y:.96875},{x:.71875,y:.96875},{x:.78125,y:.96875},{x:.78125,y:.96875},{x:.84375,y:.96875},{x:.84375,y:.96875},{x:.90625,y:.96875},{x:.90625,y:.96875},{x:.96875,y:.96875},{x:.96875,y:.96875},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375}];var T5=class{constructor(e){var t;this.model=e,this.anchors=TA.map(s=>[s.x,s.y]),this.anchorsTensor=r.tensor2d(this.anchors),this.inputSize=(t=this.model)==null?void 0:t.inputs[0].shape[2],this.inputSizeTensor=r.tensor1d([this.inputSize,this.inputSize]),this.doubleInputSizeTensor=r.tensor1d([this.inputSize*2,this.inputSize*2])}normalizeBoxes(e){return r.tidy(()=>{let t=r.slice(e,[0,0],[-1,2]),s=r.slice(e,[0,2],[-1,2]),o=r.add(r.div(t,this.inputSizeTensor),this.anchorsTensor),i=r.div(s,this.doubleInputSizeTensor),n=r.mul(r.sub(o,i),this.inputSizeTensor),a=r.mul(r.add(o,i),this.inputSizeTensor);return r.concat2d([n,a],1)})}normalizeLandmarks(e,t){return r.tidy(()=>{let s=r.add(r.div(e.reshape([-1,7,2]),this.inputSizeTensor),this.anchors[t]);return r.mul(s,this.inputSizeTensor)})}async getBoxes(e,t){let s=this.model.predict(e),o=s.squeeze();s.dispose();let i=r.tidy(()=>r.sigmoid(r.slice(o,[0,0],[-1,1])).squeeze()),n=i.dataSync(),a=r.slice(o,[0,1],[-1,4]),x=this.normalizeBoxes(a);a.dispose();let l=await r.image.nonMaxSuppressionAsync(x,n,t.hand.maxDetected,t.hand.iouThreshold,t.hand.minConfidence),d=l.arraySync();i.dispose(),l.dispose();let y=[];for(let h of d)if(n[h]>=t.hand.minConfidence){let p=r.slice(x,[h,0],[1,-1]),M=r.slice(o,[h,5],[1,14]),c=r.tidy(()=>this.normalizeLandmarks(M,h).reshape([-1,2]));M.dispose(),y.push({box:p,palmLandmarks:c,confidence:n[h]})}return o.dispose(),x.dispose(),y}async estimateHandBounds(e,t){let s=e.shape[1],o=e.shape[2],i=r.tidy(()=>e.resizeBilinear([this.inputSize,this.inputSize]).div(127.5).sub(1)),n=await this.getBoxes(i,t);i.dispose();let a=[];if(!n||n.length===0)return a;for(let x of n){let l=x.box.dataSync(),d=l.slice(0,2),y=l.slice(2,4),h=x.palmLandmarks.arraySync();x.box.dispose(),x.palmLandmarks.dispose(),a.push(gA({startPoint:d,endPoint:y,palmLandmarks:h,confidence:x.confidence},[o/this.inputSize,s/this.inputSize]))}return a}};function h2(A){return A-2*Math.PI*Math.floor((A+Math.PI)/(2*Math.PI))}function PA(A,e){let t=Math.PI/2-Math.atan2(-(e[1]-A[1]),e[0]-A[0]);return h2(t)}var zA=(A,e)=>[[1,0,A],[0,1,e],[0,0,1]];function D(A,e){let t=0;for(let s=0;sn[0]),s=e.map(n=>n[1]),o=[Math.min(...t),Math.min(...s)],i=[Math.max(...t),Math.max(...s)];return{startPoint:o,endPoint:i}}getBoxForPalmLandmarks(e,t){let s=e.map(i=>z5([...i,1],t)),o=this.calculateLandmarksBoundingBox(s);return k0(O0(o),p2)}getBoxForHandLandmarks(e){let t=this.calculateLandmarksBoundingBox(e),s=k0(O0(t),EA);s.palmLandmarks=[];for(let o=0;o[n[0]*(p[0]-this.inputSize/2),n[1]*(p[1]-this.inputSize/2),n[2]*p[2]]),x=P5(s,[0,0]),l=a.map(p=>[...z5(p,x),p[2]]),d=vA(o),y=[...m0(t),1],h=[D(y,d[0]),D(y,d[1])];return l.map(p=>[p[0]+h[0],p[1]+h[1],p[2]])}async estimateHands(e,t){let s=!1,o;(this.skipped===0||this.skipped>t.hand.skipFrames||!t.hand.landmarks||!t.videoOptimized)&&(o=await this.handDetector.estimateHandBounds(e,t),this.skipped=0),t.videoOptimized&&this.skipped++,o&&o.length>0&&(o.length!==this.detectedHands&&this.detectedHands!==t.hand.maxDetected||!t.hand.landmarks)&&(this.detectedHands=0,this.storedBoxes=[...o],this.storedBoxes.length>0&&(s=!0));let i=[];t.hand.skipInitial&&this.detectedHands===0&&(this.skipped=0);for(let n=0;n=t.hand.minConfidence){let R=r.reshape(z,[-1,3]),j=R.arraySync();z.dispose(),R.dispose();let g=this.transformRawCoords(j,p,x,h),m=this.getBoxForHandLandmarks(g);this.storedBoxes[n]=m;let T={landmarks:g,confidence:E,box:{topLeft:m.startPoint,bottomRight:m.endPoint}};i.push(T)}else this.storedBoxes[n]=null;z.dispose()}else{let x=k0(O0(a),EA),l={confidence:a.confidence,box:{topLeft:x.startPoint,bottomRight:x.endPoint}};i.push(l)}}return this.storedBoxes=this.storedBoxes.filter(n=>n!==null),this.detectedHands=i.length,i}};var jA={thumb:[1,2,3,4],indexFinger:[5,6,7,8],middleFinger:[9,10,11,12],ringFinger:[13,14,15,16],pinky:[17,18,19,20],palmBase:[0]},G,Q,SA;async function E5(A,e){let t=await SA.estimateHands(A,e);if(!t)return[];let s=[];for(let o of t){let i={};if(o.landmarks)for(let x of Object.keys(jA))i[x]=jA[x].map(l=>o.landmarks[l]);let n=o.box?[Math.max(0,o.box.topLeft[0]),Math.max(0,o.box.topLeft[1]),Math.min(A.shape[2],o.box.bottomRight[0])-Math.max(0,o.box.topLeft[0]),Math.min(A.shape[1],o.box.bottomRight[1])-Math.max(0,o.box.topLeft[1])]:[],a=[o.box.topLeft[0]/A.shape[2],o.box.topLeft[1]/A.shape[1],(o.box.bottomRight[0]-o.box.topLeft[0])/A.shape[2],(o.box.bottomRight[1]-o.box.topLeft[1])/A.shape[1]];s.push({confidence:Math.round(100*o.confidence)/100,box:n,boxRaw:a,landmarks:o.landmarks,annotations:i})}return s}async function R5(A){!G||!Q?([G,Q]=await Promise.all([A.hand.enabled?r.loadGraphModel(O(A.modelBasePath,A.hand.detector.modelPath),{fromTFHub:A.hand.detector.modelPath.includes("tfhub.dev")}):null,A.hand.landmarks?r.loadGraphModel(O(A.modelBasePath,A.hand.skeleton.modelPath),{fromTFHub:A.hand.skeleton.modelPath.includes("tfhub.dev")}):null]),A.hand.enabled&&(!G||!G.modelUrl?b("load model failed:",A.hand.detector.modelPath):A.debug&&b("load model:",G.modelUrl),!Q||!Q.modelUrl?b("load model failed:",A.hand.skeleton.modelPath):A.debug&&b("load model:",Q.modelUrl))):(A.debug&&b("cached model:",G.modelUrl),A.debug&&b("cached model:",Q.modelUrl));let e=new T5(G);return SA=new M5(e,Q),[G,Q]}var j5={};Y(j5,{load:()=>S5,predict:()=>w5});var wA=["nose","leftEyeInside","leftEye","leftEyeOutside","rightEyeInside","rightEye","rightEyeOutside","leftEar","rightEar","leftMouth","rightMouth","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftPalm","rightPalm","leftIndex","rightIndex","leftPinky","rightPinky","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle","leftHeel","rightHeel","leftFoot","rightFoot","midHip","forehead","leftThumb","leftHand","rightThumb","rightHand"],WA=["nose","leftEyeInside","leftEye","leftEyeOutside","rightEyeInside","rightEye","rightEyeOutside","leftEar","rightEar","leftMouth","rightMouth","leftShoulder","rightShoulder","leftElbow","rightElbow","left:15","right:16","left:17","right:18","left:19","right:20","left:21","right:22","leftChest","rightChest","neck","forehead","left:27","right:28","left:29","right:30"];var Z;async function S5(A){return Z?A.debug&&b("cached model:",Z.modelUrl):(Z=await r.loadGraphModel(O(A.modelBasePath,A.body.modelPath)),Z.width=parseInt(Z.signature.inputs["input_1:0"].tensorShape.dim[2].size),Z.height=parseInt(Z.signature.inputs["input_1:0"].tensorShape.dim[1].size),!Z||!Z.modelUrl?b("load model failed:",A.body.modelPath):A.debug&&b("load model:",Z.modelUrl)),Z}async function w5(A,e){if(!Z||!e.body.enabled)return null;let t={width:A.shape[2],height:A.shape[1]},s=r.image.resizeBilinear(A,[Z.width,Z.height],!1),o=r.div(s,[255]);s.dispose();let i=await Z.predict(o),n=i.find(y=>y.size===195||y.size===155).dataSync();i.forEach(y=>y.dispose()),o.dispose();let a=[],x=n.length===195?wA:WA,l=5;for(let y=0;yh.score>y?h.score:y,0),keypoints:a}]}var W5={};Y(W5,{load:()=>N5,predict:()=>k5});var Z0=[{class:1,label:"person"},{class:2,label:"bicycle"},{class:3,label:"car"},{class:4,label:"motorcycle"},{class:5,label:"airplane"},{class:6,label:"bus"},{class:7,label:"train"},{class:8,label:"truck"},{class:9,label:"boat"},{class:10,label:"traffic light"},{class:11,label:"fire hydrant"},{class:12,label:"stop sign"},{class:13,label:"parking meter"},{class:14,label:"bench"},{class:15,label:"bird"},{class:16,label:"cat"},{class:17,label:"dog"},{class:18,label:"horse"},{class:19,label:"sheep"},{class:20,label:"cow"},{class:21,label:"elephant"},{class:22,label:"bear"},{class:23,label:"zebra"},{class:24,label:"giraffe"},{class:25,label:"backpack"},{class:26,label:"umbrella"},{class:27,label:"handbag"},{class:28,label:"tie"},{class:29,label:"suitcase"},{class:30,label:"frisbee"},{class:31,label:"skis"},{class:32,label:"snowboard"},{class:33,label:"sports ball"},{class:34,label:"kite"},{class:35,label:"baseball bat"},{class:36,label:"baseball glove"},{class:37,label:"skateboard"},{class:38,label:"surfboard"},{class:39,label:"tennis racket"},{class:40,label:"bottle"},{class:41,label:"wine glass"},{class:42,label:"cup"},{class:43,label:"fork"},{class:44,label:"knife"},{class:45,label:"spoon"},{class:46,label:"bowl"},{class:47,label:"banana"},{class:48,label:"apple"},{class:49,label:"sandwich"},{class:50,label:"orange"},{class:51,label:"broccoli"},{class:52,label:"carrot"},{class:53,label:"hot dog"},{class:54,label:"pizza"},{class:55,label:"donut"},{class:56,label:"cake"},{class:57,label:"chair"},{class:58,label:"couch"},{class:59,label:"potted plant"},{class:60,label:"bed"},{class:61,label:"dining table"},{class:62,label:"toilet"},{class:63,label:"tv"},{class:64,label:"laptop"},{class:65,label:"mouse"},{class:66,label:"remote"},{class:67,label:"keyboard"},{class:68,label:"cell phone"},{class:69,label:"microwave"},{class:70,label:"oven"},{class:71,label:"toaster"},{class:72,label:"sink"},{class:73,label:"refrigerator"},{class:74,label:"book"},{class:75,label:"clock"},{class:76,label:"vase"},{class:77,label:"scissors"},{class:78,label:"teddy bear"},{class:79,label:"hair drier"},{class:80,label:"toothbrush"}];var L,I5=[],L0=Number.MAX_SAFE_INTEGER,V0=2.5;async function N5(A){if(L)A.debug&&b("cached model:",L.modelUrl);else{L=await r.loadGraphModel(O(A.modelBasePath,A.object.modelPath));let e=Object.values(L.modelSignature.inputs);if(L.inputSize=Array.isArray(e)?parseInt(e[0].tensorShape.dim[2].size):null,!L.inputSize)throw new Error(`Human: Cannot determine model inputSize: ${A.object.modelPath}`);!L||!L.modelUrl?b("load model failed:",A.object.modelPath):A.debug&&b("load model:",L.modelUrl)}return L}async function T2(A,e,t,s){let o=0,i=[];for(let l of[1,2,4])r.tidy(()=>{var u,z;let d=l*13,y=(u=A.find(E=>E.shape[1]===d**2&&E.shape[2]===Z0.length))==null?void 0:u.squeeze(),h=(z=A.find(E=>E.shape[1]===d**2&&E.shape[2]s.object.minConfidence&&R!==61){let g=(.5+Math.trunc(E%d))/d,m=(.5+Math.trunc(E/d))/d,T=M[E].map($=>$*(d/l/e)),[v,w]=[g-V0/l*T[0],m-V0/l*T[1]],[k,C]=[g+V0/l*T[2]-v,m+V0/l*T[3]-w],V=[v,w,k,C];V=V.map($=>Math.max(0,Math.min($,1)));let g0=[V[0]*t[0],V[1]*t[1],V[2]*t[0],V[3]*t[1]],C0={id:o++,strideSize:l,score:Math.round(100*j)/100,class:R+1,label:Z0[R].label,center:[Math.trunc(t[0]*g),Math.trunc(t[1]*m)],centerRaw:[g,m],box:g0.map($=>Math.trunc($)),boxRaw:V};i.push(C0)}}});A.forEach(l=>r.dispose(l));let n=i.map(l=>l.boxRaw),a=i.map(l=>l.score),x=[];if(n&&n.length>0){let l=await r.image.nonMaxSuppressionAsync(n,a,s.object.maxDetected,s.object.iouThreshold,s.object.minConfidence);x=l.dataSync(),r.dispose(l)}return i=i.filter((l,d)=>x.includes(d)).sort((l,d)=>d.score-l.score),i}async function k5(A,e){return L?L00?(L0++,I5):(e.videoOptimized?L0=0:L0=Number.MAX_SAFE_INTEGER,new Promise(async t=>{let s=[A.shape[2],A.shape[1]],o=r.image.resizeBilinear(A,[L.inputSize,L.inputSize],!1),i=o.div(255),n=i.transpose([0,3,1,2]);i.dispose(),o.dispose();let a;e.object.enabled&&(a=await L.predict(n)),n.dispose();let x=await T2(a,L.inputSize,s,e);I5=x,t(x)})):null}var IA=A=>{if(!A)return[];let e=[];for(let t=0;tx.part==="leftWrist"),o=A[t].keypoints.find(x=>x.part==="rightWrist"),i=A[t].keypoints.find(x=>x.part==="nose");i&&s&&o&&s.position.yx.part==="leftShoulder"),a=A[t].keypoints.find(x=>x.part==="rightShoulder");n&&a&&e.push({body:t,gesture:`leaning ${n.position.y>a.position.y?"left":"right"}`})}return e},NA=A=>{if(!A)return[];let e=[];for(let t=0;t0){let s=A[t].mesh[33][2]-A[t].mesh[263][2];Math.abs(s)<10?e.push({face:t,gesture:"facing center"}):e.push({face:t,gesture:`facing ${s<0?"left":"right"}`}),Math.abs(A[t].mesh[374][1]-A[t].mesh[386][1])/Math.abs(A[t].mesh[443][1]-A[t].mesh[450][1])<.2&&e.push({face:t,gesture:"blink left eye"}),Math.abs(A[t].mesh[145][1]-A[t].mesh[159][1])/Math.abs(A[t].mesh[223][1]-A[t].mesh[230][1])<.2&&e.push({face:t,gesture:"blink right eye"});let n=Math.min(100,500*Math.abs(A[t].mesh[13][1]-A[t].mesh[14][1])/Math.abs(A[t].mesh[10][1]-A[t].mesh[152][1]));n>10&&e.push({face:t,gesture:`mouth ${Math.trunc(n)}% open`});let a=A[t].mesh[152][2];Math.abs(a)>10&&e.push({face:t,gesture:`head ${a<0?"up":"down"}`})}return e},kA=A=>{if(!A)return[];let e=[];for(let t=0;t.033||y>.033)&&(l=!1),h>.033&&e.push({iris:t,gesture:"looking right"}),y>.033&&e.push({iris:t,gesture:"looking left"});let p=Math.abs(A[t].mesh[145][1]-A[t].annotations.rightEyeIris[0][1])/A[t].annotations.rightEyeIris[0][1],M=Math.abs(A[t].mesh[374][1]-A[t].annotations.leftEyeIris[0][1])/A[t].annotations.leftEyeIris[0][1];(M<.015||p<.015||M>.03||p>.03)&&(l=!1),(M<.015||p<.015)&&e.push({iris:t,gesture:"looking down"}),(M>.03||p>.03)&&e.push({iris:t,gesture:"looking up"}),l&&e.push({iris:t,gesture:"looking center"})}return e},OA=A=>{if(!A)return[];let e=[];for(let t=0;t0){let o=s.reduce((n,a)=>n.position[2]n.position[1]Z5});function P2(A,e,t){let s=function(a,x,l){let d=new RegExp("\\b"+x+" \\w+ (\\w+)","ig");a.replace(d,(y,h)=>(l[h]=0,y))},o=function(a,x){let l=A.createShader(x);if(A.shaderSource(l,a),A.compileShader(l),!A.getShaderParameter(l,A.COMPILE_STATUS))throw new Error("Filter: GL compile failed",A.getShaderInfoLog(l));return l};this.uniform={},this.attribute={};let i=o(e,A.VERTEX_SHADER),n=o(t,A.FRAGMENT_SHADER);if(this.id=A.createProgram(),A.attachShader(this.id,i),A.attachShader(this.id,n),A.linkProgram(this.id),!A.getProgramParameter(this.id,A.LINK_STATUS))throw new Error("Filter: GL link failed",A.getProgramInfoLog(this.id));A.useProgram(this.id),s(e,"attribute",this.attribute);for(let a in this.attribute)this.attribute[a]=A.getAttribLocation(this.id,a);s(e,"uniform",this.uniform),s(t,"uniform",this.uniform);for(let a in this.uniform)this.uniform[a]=A.getUniformLocation(this.id,a)}function ZA(A){A||(A={});let e=0,t=null,s=!1,o=-1,i=[null,null],n=[],a=-1,x=-1,l=null,d=null,y={},h=A.canvas||document.createElement("canvas"),p={},M={INTERMEDIATE:1},c=h.getContext("webgl");if(!c)throw new Error("Filter: getContext() failed");this.addFilter=function(g){let m=Array.prototype.slice.call(arguments,1),T=y[g];n.push({func:T,args:m})},this.reset=function(){n=[]};let u=function(g,m){if(!(g===a&&m===x)){if(h.width=g,a=g,h.height=m,x=m,!l){let T=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,-1,1,0,0,1,-1,1,1,1,1,1,0]);l=c.createBuffer(),c.bindBuffer(c.ARRAY_BUFFER,l),c.bufferData(c.ARRAY_BUFFER,T,c.STATIC_DRAW),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0)}c.viewport(0,0,a,x),i=[null,null]}},z=function(g,m){let T=c.createFramebuffer();c.bindFramebuffer(c.FRAMEBUFFER,T);let v=c.createRenderbuffer();c.bindRenderbuffer(c.RENDERBUFFER,v);let w=c.createTexture();return c.bindTexture(c.TEXTURE_2D,w),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,g,m,0,c.RGBA,c.UNSIGNED_BYTE,null),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,w,0),c.bindTexture(c.TEXTURE_2D,null),c.bindFramebuffer(c.FRAMEBUFFER,null),{fbo:T,texture:w}},E=function(g){return i[g]=i[g]||z(a,x),i[g]},R=function(g=null){var w,k;let m=null,T=null,v=!1;e===0?m=t:m=(w=E(o))==null?void 0:w.texture,e++,s&&!(g&M.INTERMEDIATE)?(T=null,v=e%2==0):(o=(o+1)%2,T=(k=E(o))==null?void 0:k.fbo),c.bindTexture(c.TEXTURE_2D,m),c.bindFramebuffer(c.FRAMEBUFFER,T),c.uniform1f(d.uniform.flipY,v?-1:1),c.drawArrays(c.TRIANGLES,0,6)};this.apply=function(g){if(u(g.width,g.height),e=0,t||(t=c.createTexture()),c.bindTexture(c.TEXTURE_2D,t),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,g),n.length===0)return R(),h;for(let m=0;m{for(var t in e)q5(A,t,{get:e[t],enumerable:!0})},f=(A,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of KA(e))!DA.call(A,s)&&s!=="default"&&q5(A,s,{get:()=>e[s],enumerable:!(t=CA(e,s))||t.enumerable});return A};var B5=(A,e,t)=>{if(!e.has(A))throw TypeError("Cannot "+t)};var q=(A,e,t)=>(B5(A,e,"read from private field"),t?t.call(A):e.get(A)),J=(A,e,t)=>{if(e.has(A))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(A):e.set(A,t)},e0=(A,e,t,s)=>(B5(A,e,"write to private field"),s?s.call(A,t):e.set(A,t),t);function O(A,e){let t=A.endsWith("/")?"":"/",o=e.startsWith(".")||e.startsWith("/")||e.startsWith("http:")||e.startsWith("https:")||e.startsWith("file:")?`${e}`:`${A}${t}${e}`;if(!o.toLocaleLowerCase().includes(".json"))throw new Error(`Human: ModelPath Error: ${o} Expecting JSON file`);return o}function b(...A){let e=new Date,t=`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}.${e.getMilliseconds().toString().padStart(3,"0")}`;A&&console.log(t,"Human:",...A)}var S=()=>typeof performance!="undefined"?performance.now():parseInt((Number(process.hrtime.bigint())/1e3/1e3).toString());function X(...A){let e=t=>t&&typeof t=="object";return A.reduce((t,s)=>(Object.keys(s||{}).forEach(o=>{let i=t[o],n=s[o];Array.isArray(i)&&Array.isArray(n)?t[o]=i.concat(...n):e(i)&&e(n)?t[o]=X(i,n):t[o]=n}),t),{})}var U5={backend:"webgl",modelBasePath:"../models/",wasmPath:"../node_modules/@tensorflow/tfjs-backend-wasm/dist//",debug:!0,async:!0,videoOptimized:!0,warmup:"full",filter:{enabled:!0,width:0,height:0,flip:!1,return:!0,brightness:0,contrast:0,sharpness:0,blur:0,saturation:0,hue:0,negative:!1,sepia:!1,vintage:!1,kodachrome:!1,technicolor:!1,polaroid:!1,pixelate:0},gesture:{enabled:!0},face:{enabled:!0,detector:{modelPath:"blazeface.json",rotation:!1,maxDetected:10,skipFrames:21,skipInitial:!1,minConfidence:.2,iouThreshold:.1,return:!1},mesh:{enabled:!0,modelPath:"facemesh.json"},iris:{enabled:!0,modelPath:"iris.json"},description:{enabled:!0,modelPath:"faceres.json",skipFrames:31,minConfidence:.1},emotion:{enabled:!0,minConfidence:.1,skipFrames:32,modelPath:"emotion.json"}},body:{enabled:!0,modelPath:"posenet.json",maxDetected:1,minConfidence:.1},hand:{enabled:!0,rotation:!1,skipFrames:12,skipInitial:!1,minConfidence:.1,iouThreshold:.1,maxDetected:2,landmarks:!0,detector:{modelPath:"handdetect.json"},skeleton:{modelPath:"handskeleton.json"}},object:{enabled:!1,modelPath:"nanodet.json",minConfidence:.2,iouThreshold:.4,maxDetected:10,skipFrames:41}};function Y5(){let A,e;if(typeof navigator!="undefined"){let t=navigator.userAgent.match(/\(([^()]+)\)/g);if(t&&t[0]){let s=t[0].match(/\(([^()]+)\)/g);A=s?s[0].replace(/\(|\)/g,""):"",e=navigator.userAgent.replace(t[0],""),A[1]&&(e=e.replace(t[1],"")),e=e.replace(/ /g," ")}}else typeof process!="undefined"&&(A=`${process.platform} ${process.arch}`,e=`NodeJS ${process.version}`);return{platform:A,agent:e}}var r={};Y(r,{data:()=>$A,version:()=>A2});f(r,O2);f(r,Z2);f(r,L2);f(r,V2);f(r,H2);f(r,X2);import*as J5 from"@tensorflow/tfjs/package.json";import*as C5 from"@tensorflow/tfjs-core/package.json";import*as K5 from"@tensorflow/tfjs-data/package.json";import*as D5 from"@tensorflow/tfjs-layers/package.json";import*as G5 from"@tensorflow/tfjs-converter/package.json";import{version_cpu as GA}from"@tensorflow/tfjs-backend-cpu/dist/index.js";import{version_webgl as QA}from"@tensorflow/tfjs-backend-webgl/dist/index.js";import{version_wasm as _A}from"@tensorflow/tfjs-backend-wasm/dist/index.js";import*as O2 from"@tensorflow/tfjs-core/dist/index.js";import*as Z2 from"@tensorflow/tfjs-layers/dist/index.js";import*as L2 from"@tensorflow/tfjs-converter/dist/index.js";import*as $A from"@tensorflow/tfjs-data/dist/index.js";import*as V2 from"@tensorflow/tfjs-backend-cpu/dist/index.js";import*as H2 from"@tensorflow/tfjs-backend-webgl/dist/index.js";import*as X2 from"@tensorflow/tfjs-backend-wasm/dist/index.js";var A2={tfjs:(J5==null?void 0:J5.version)||void 0,"tfjs-core":(C5==null?void 0:C5.version)||void 0,"tfjs-data":(K5==null?void 0:K5.version)||void 0,"tfjs-layers":(D5==null?void 0:D5.version)||void 0,"tfjs-converter":(G5==null?void 0:G5.version)||void 0,"tfjs-backend-cpu":GA||void 0,"tfjs-backend-webgl":QA||void 0,"tfjs-backend-wasm":_A||void 0};var H={name:"humangl",priority:99,canvas:null,gl:null,width:1024,height:1024,webGLattr:{alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!1,desynchronized:!0}};function Q5(){if(!r.findBackend(H.name)){b("backend registration:",H.name);try{H.canvas=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(H.width,H.height):document.createElement("canvas")}catch(A){b("error: cannot create canvas:",A);return}try{H.gl=H.canvas.getContext("webgl2",H.webGLattr)}catch(A){b("error: cannot get WebGL2 context:",A);return}try{r.setWebGLContext(2,H.gl)}catch(A){b("error: cannot set WebGL2 context:",A);return}try{let A=new r.GPGPUContext(H.gl);r.registerBackend(H.name,()=>new r.MathBackendWebGL(A),H.priority)}catch(A){b("error: cannot register WebGL backend:",A);return}try{r.getKernelsForBackend("webgl").forEach(e=>{let t={...e,backendName:H.name};r.registerKernel(t)})}catch(A){b("error: cannot update WebGL backend registration:",A);return}try{r.ENV.set("WEBGL_VERSION",2)}catch(A){b("error: cannot set WebGL backend flags:",A);return}b("backend registered:",H.name)}}var e5={};Y(e5,{load:()=>o5,predict:()=>n5,triangulation:()=>xA,uvmap:()=>yA});function _5(A,e){let t=[A.startPoint[0]*e[0],A.startPoint[1]*e[1]],s=[A.endPoint[0]*e[0],A.endPoint[1]*e[1]];return{startPoint:t,endPoint:s}}function c0(A){return[Math.abs(A.endPoint[0]-A.startPoint[0]),Math.abs(A.endPoint[1]-A.startPoint[1])]}function i0(A){return[A.startPoint[0]+(A.endPoint[0]-A.startPoint[0])/2,A.startPoint[1]+(A.endPoint[1]-A.startPoint[1])/2]}function r0(A,e,t){let s=e.shape[1],o=e.shape[2],i=[[A.startPoint[1]/s,A.startPoint[0]/o,A.endPoint[1]/s,A.endPoint[0]/o]];return r.image.cropAndResize(e,i,[0],t)}function P0(A,e=1.5){let t=i0(A),s=c0(A),o=[e*s[0]/2,e*s[1]/2],i=[t[0]-o[0],t[1]-o[1]],n=[t[0]+o[0],t[1]+o[1]];return{startPoint:i,endPoint:n,landmarks:A.landmarks}}function z0(A){let e=i0(A),t=c0(A),o=Math.max(...t)/2,i=[Math.round(e[0]-o),Math.round(e[1]-o)],n=[Math.round(e[0]+o),Math.round(e[1]+o)];return{startPoint:i,endPoint:n,landmarks:A.landmarks}}function D0(A){let e=A.map(i=>i[0]),t=A.map(i=>i[1]),s=[Math.min(...e),Math.min(...t)],o=[Math.max(...e),Math.max(...t)];return{startPoint:s,endPoint:o,landmarks:A}}var $5=A=>({startPoint:r.slice(A,[0,0],[-1,2]),endPoint:r.slice(A,[0,2],[-1,2])});var M0=[[1,0,0],[0,1,0],[0,0,1]];function e2(A){return A-2*Math.PI*Math.floor((A+Math.PI)/(2*Math.PI))}function G0(A,e){let t=Math.PI/2-Math.atan2(-(e[1]-A[1]),e[0]-A[0]);return e2(t)}function AA(A,e){return[[1,0,A],[0,1,e],[0,0,1]]}function D(A,e){let t=0;for(let s=0;s{let l=e.resizeBilinear([this.inputSize,this.inputSize]).div(127.5).sub(.5),d=this.model.execute(l),y;if(Array.isArray(d)){let c=d.sort((R,j)=>R.size-j.size),u=r.concat([c[0],c[2]],2),z=r.concat([c[1],c[3]],2);y=r.concat([z,u],1).squeeze(0)}else y=d.squeeze();let h=n2(y,this.anchors,[this.inputSize,this.inputSize]),p=r.slice(y,[0,0],[-1,1]),M=r.sigmoid(p).squeeze().dataSync();return[y,h,M]}),i=await r.image.nonMaxSuppressionAsync(s,o,this.config.face.detector.maxDetected,this.config.face.detector.iouThreshold,this.config.face.detector.minConfidence),n=i.arraySync();i.dispose();let a=[];for(let x=0;xthis.config.face.detector.minConfidence){let d=r.slice(s,[n[x],0],[1,-1]),y=$5(d);d.dispose();let h=this.anchorsData[n[x]],p=r.tidy(()=>r.slice(t,[n[x],sA-1],[1,-1]).squeeze().reshape([sA,-1]));a.push({box:y,landmarks:p,anchor:h,confidence:l})}}return t.dispose(),s.dispose(),{boxes:a,scaleFactor:[e.shape[2]/this.inputSize,e.shape[1]/this.inputSize]}}};async function rA(A){let e=await r.loadGraphModel(O(A.modelBasePath,A.face.detector.modelPath),{fromTFHub:A.face.detector.modelPath.includes("tfhub.dev")}),t=new iA(e,A);return!e||!e.modelUrl?b("load model failed:",A.face.detector.modelPath):A.debug&&b("load model:",e.modelUrl),t}var C={silhouette:[10,338,297,332,284,251,389,356,454,323,361,288,397,365,379,378,400,377,152,148,176,149,150,136,172,58,132,93,234,127,162,21,54,103,67,109],lipsUpperOuter:[61,185,40,39,37,0,267,269,270,409,291],lipsLowerOuter:[146,91,181,84,17,314,405,321,375,291],lipsUpperInner:[78,191,80,81,82,13,312,311,310,415,308],lipsLowerInner:[78,95,88,178,87,14,317,402,318,324,308],rightEyeUpper0:[246,161,160,159,158,157,173],rightEyeLower0:[33,7,163,144,145,153,154,155,133],rightEyeUpper1:[247,30,29,27,28,56,190],rightEyeLower1:[130,25,110,24,23,22,26,112,243],rightEyeUpper2:[113,225,224,223,222,221,189],rightEyeLower2:[226,31,228,229,230,231,232,233,244],rightEyeLower3:[143,111,117,118,119,120,121,128,245],rightEyebrowUpper:[156,70,63,105,66,107,55,193],rightEyebrowLower:[35,124,46,53,52,65],rightEyeIris:[473,474,475,476,477],leftEyeUpper0:[466,388,387,386,385,384,398],leftEyeLower0:[263,249,390,373,374,380,381,382,362],leftEyeUpper1:[467,260,259,257,258,286,414],leftEyeLower1:[359,255,339,254,253,252,256,341,463],leftEyeUpper2:[342,445,444,443,442,441,413],leftEyeLower2:[446,261,448,449,450,451,452,453,464],leftEyeLower3:[372,340,346,347,348,349,350,357,465],leftEyebrowUpper:[383,300,293,334,296,336,285,417],leftEyebrowLower:[265,353,276,283,282,295],leftEyeIris:[468,469,470,471,472],midwayBetweenEyes:[168],noseTip:[1],noseBottom:[2],noseRightCorner:[98],noseLeftCorner:[327],rightCheek:[205],leftCheek:[425]},Q0=[{key:"EyeUpper0",indices:[9,10,11,12,13,14,15]},{key:"EyeUpper1",indices:[25,26,27,28,29,30,31]},{key:"EyeUpper2",indices:[41,42,43,44,45,46,47]},{key:"EyeLower0",indices:[0,1,2,3,4,5,6,7,8]},{key:"EyeLower1",indices:[16,17,18,19,20,21,22,23,24]},{key:"EyeLower2",indices:[32,33,34,35,36,37,38,39,40]},{key:"EyeLower3",indices:[54,55,56,57,58,59,60,61,62]}],d0=[[.499976992607117,.652534008026123],[.500025987625122,.547487020492554],[.499974012374878,.602371990680695],[.482113003730774,.471979022026062],[.500150978565216,.527155995368958],[.499909996986389,.498252987861633],[.499523013830185,.40106201171875],[.289712011814117,.380764007568359],[.499954998493195,.312398016452789],[.499987006187439,.269918978214264],[.500023007392883,.107050001621246],[.500023007392883,.666234016418457],[.5000159740448,.679224014282227],[.500023007392883,.692348003387451],[.499976992607117,.695277988910675],[.499976992607117,.70593398809433],[.499976992607117,.719385027885437],[.499976992607117,.737019002437592],[.499967992305756,.781370997428894],[.499816000461578,.562981009483337],[.473773002624512,.573909997940063],[.104906998574734,.254140973091125],[.365929991006851,.409575998783112],[.338757991790771,.41302502155304],[.311120003461838,.409460008144379],[.274657994508743,.389131009578705],[.393361985683441,.403706014156342],[.345234006643295,.344011008739471],[.370094001293182,.346076011657715],[.319321990013123,.347265005111694],[.297903001308441,.353591024875641],[.24779200553894,.410809993743896],[.396889001131058,.842755019664764],[.280097991228104,.375599980354309],[.106310002505779,.399955987930298],[.2099249958992,.391353011131287],[.355807989835739,.534406006336212],[.471751004457474,.65040397644043],[.474155008792877,.680191993713379],[.439785003662109,.657229006290436],[.414617002010345,.66654098033905],[.450374007225037,.680860996246338],[.428770989179611,.682690978050232],[.374971002340317,.727805018424988],[.486716985702515,.547628998756409],[.485300987958908,.527395009994507],[.257764995098114,.314490020275116],[.401223003864288,.455172002315521],[.429818987846375,.548614978790283],[.421351999044418,.533740997314453],[.276895999908447,.532056987285614],[.483370006084442,.499586999416351],[.33721199631691,.282882988452911],[.296391993761063,.293242990970612],[.169294998049736,.193813979625702],[.447580009698868,.302609980106354],[.392390012741089,.353887975215912],[.354490011930466,.696784019470215],[.067304998636246,.730105042457581],[.442739009857178,.572826027870178],[.457098007202148,.584792017936707],[.381974011659622,.694710969924927],[.392388999462128,.694203019142151],[.277076005935669,.271932005882263],[.422551989555359,.563233017921448],[.385919004678726,.281364023685455],[.383103013038635,.255840003490448],[.331431001424789,.119714021682739],[.229923993349075,.232002973556519],[.364500999450684,.189113974571228],[.229622006416321,.299540996551514],[.173287004232407,.278747975826263],[.472878992557526,.666198015213013],[.446828007698059,.668527007102966],[.422762006521225,.673889994621277],[.445307999849319,.580065965652466],[.388103008270264,.693961024284363],[.403039008378983,.706539988517761],[.403629004955292,.693953037261963],[.460041999816895,.557139039039612],[.431158006191254,.692366003990173],[.452181994915009,.692366003990173],[.475387006998062,.692366003990173],[.465828001499176,.779190003871918],[.472328990697861,.736225962638855],[.473087012767792,.717857003211975],[.473122000694275,.704625964164734],[.473033010959625,.695277988910675],[.427942007780075,.695277988910675],[.426479011774063,.703539967536926],[.423162013292313,.711845993995667],[.4183090031147,.720062971115112],[.390094995498657,.639572978019714],[.013953999616206,.560034036636353],[.499913990497589,.58014702796936],[.413199990987778,.69539999961853],[.409626007080078,.701822996139526],[.468080013990402,.601534962654114],[.422728985548019,.585985004901886],[.463079988956451,.593783974647522],[.37211999297142,.47341400384903],[.334562003612518,.496073007583618],[.411671012639999,.546965003013611],[.242175996303558,.14767599105835],[.290776997804642,.201445996761322],[.327338010072708,.256527006626129],[.399509996175766,.748921036720276],[.441727995872498,.261676013469696],[.429764986038208,.187834024429321],[.412198007106781,.108901023864746],[.288955003023148,.398952007293701],[.218936994671822,.435410976409912],[.41278201341629,.398970007896423],[.257135003805161,.355440020561218],[.427684992551804,.437960982322693],[.448339998722076,.536936044692993],[.178560003638268,.45755398273468],[.247308000922203,.457193970680237],[.286267012357712,.467674970626831],[.332827985286713,.460712015628815],[.368755996227264,.447206974029541],[.398963987827301,.432654976844788],[.476410001516342,.405806005001068],[.189241006970406,.523923993110657],[.228962004184723,.348950982093811],[.490725994110107,.562400996685028],[.404670000076294,.485132992267609],[.019469000399113,.401564002037048],[.426243007183075,.420431017875671],[.396993011236191,.548797011375427],[.266469985246658,.376977026462555],[.439121007919312,.51895797252655],[.032313998788595,.644356966018677],[.419054001569748,.387154996395111],[.462783008813858,.505746960639954],[.238978996872902,.779744982719421],[.198220998048782,.831938028335571],[.107550002634525,.540755033493042],[.183610007166862,.740257024765015],[.134409993886948,.333683013916016],[.385764002799988,.883153975009918],[.490967005491257,.579378008842468],[.382384985685349,.508572995662689],[.174399003386497,.397670984268188],[.318785011768341,.39623498916626],[.343364000320435,.400596976280212],[.396100014448166,.710216999053955],[.187885001301765,.588537991046906],[.430987000465393,.944064974784851],[.318993002176285,.898285031318665],[.266247987747192,.869701027870178],[.500023007392883,.190576016902924],[.499976992607117,.954452991485596],[.366169989109039,.398822009563446],[.393207013607025,.39553701877594],[.410373002290726,.391080021858215],[.194993004202843,.342101991176605],[.388664990663528,.362284004688263],[.365961998701096,.355970978736877],[.343364000320435,.355356991291046],[.318785011768341,.35834002494812],[.301414996385574,.363156020641327],[.058132998645306,.319076001644135],[.301414996385574,.387449026107788],[.499987989664078,.618434011936188],[.415838003158569,.624195992946625],[.445681989192963,.566076993942261],[.465844005346298,.620640993118286],[.49992299079895,.351523995399475],[.288718998432159,.819945991039276],[.335278987884521,.852819979190826],[.440512001514435,.902418971061707],[.128294005990028,.791940987110138],[.408771991729736,.373893976211548],[.455606997013092,.451801002025604],[.499877005815506,.908990025520325],[.375436991453171,.924192011356354],[.11421000212431,.615022003650665],[.448662012815475,.695277988910675],[.4480200111866,.704632043838501],[.447111994028091,.715808033943176],[.444831997156143,.730794012546539],[.430011987686157,.766808986663818],[.406787008047104,.685672998428345],[.400738000869751,.681069016456604],[.392399996519089,.677703022956848],[.367855995893478,.663918972015381],[.247923001646996,.601333022117615],[.452769994735718,.420849978923798],[.43639200925827,.359887003898621],[.416164010763168,.368713974952698],[.413385987281799,.692366003990173],[.228018000721931,.683571994304657],[.468268007040024,.352671027183533],[.411361992359161,.804327011108398],[.499989002943039,.469825029373169],[.479153990745544,.442654013633728],[.499974012374878,.439637005329132],[.432112008333206,.493588984012604],[.499886006116867,.866917014122009],[.49991300702095,.821729004383087],[.456548988819122,.819200992584229],[.344549000263214,.745438992977142],[.37890899181366,.574010014533997],[.374292999505997,.780184984207153],[.319687992334366,.570737957954407],[.357154995203018,.604269981384277],[.295284003019333,.621580958366394],[.447750002145767,.862477004528046],[.410986006259918,.508723020553589],[.31395098567009,.775308012962341],[.354128003120422,.812552988529205],[.324548006057739,.703992962837219],[.189096003770828,.646299958229065],[.279776990413666,.71465802192688],[.1338230073452,.682700991630554],[.336768001317978,.644733011722565],[.429883986711502,.466521978378296],[.455527991056442,.548622965812683],[.437114000320435,.558896005153656],[.467287987470627,.529924988746643],[.414712011814117,.335219979286194],[.37704598903656,.322777986526489],[.344107985496521,.320150971412659],[.312875986099243,.32233202457428],[.283526003360748,.333190023899078],[.241245999932289,.382785975933075],[.102986000478268,.468762993812561],[.267612010240555,.424560010433197],[.297879010438919,.433175981044769],[.333433985710144,.433878004550934],[.366427004337311,.426115989685059],[.396012008190155,.416696012020111],[.420121014118195,.41022801399231],[.007561000064015,.480777025222778],[.432949006557465,.569517970085144],[.458638995885849,.479089021682739],[.473466008901596,.545744001865387],[.476087987422943,.563830018043518],[.468472003936768,.555056989192963],[.433990985155106,.582361996173859],[.483518004417419,.562983989715576],[.482482999563217,.57784903049469],[.42645001411438,.389798998832703],[.438998997211456,.39649498462677],[.450067013502121,.400434017181396],[.289712011814117,.368252992630005],[.276670008897781,.363372981548309],[.517862021923065,.471948027610779],[.710287988185883,.380764007568359],[.526226997375488,.573909997940063],[.895093023777008,.254140973091125],[.634069979190826,.409575998783112],[.661242008209229,.41302502155304],[.688880026340485,.409460008144379],[.725341975688934,.389131009578705],[.606630027294159,.40370500087738],[.654766023159027,.344011008739471],[.629905998706818,.346076011657715],[.680678009986877,.347265005111694],[.702096998691559,.353591024875641],[.75221198797226,.410804986953735],[.602918028831482,.842862963676453],[.719901978969574,.375599980354309],[.893692970275879,.399959981441498],[.790081977844238,.391354024410248],[.643998026847839,.534487962722778],[.528249025344849,.65040397644043],[.525849997997284,.680191040039062],[.560214996337891,.657229006290436],[.585384011268616,.66654098033905],[.549625992774963,.680860996246338],[.57122802734375,.682691991329193],[.624852001667023,.72809898853302],[.513050019741058,.547281980514526],[.51509702205658,.527251958847046],[.742246985435486,.314507007598877],[.598631024360657,.454979002475739],[.570338010787964,.548575043678284],[.578631997108459,.533622980117798],[.723087012767792,.532054007053375],[.516445994377136,.499638974666595],[.662801027297974,.282917976379395],[.70362401008606,.293271005153656],[.830704987049103,.193813979625702],[.552385985851288,.302568018436432],[.607609987258911,.353887975215912],[.645429015159607,.696707010269165],[.932694971561432,.730105042457581],[.557260990142822,.572826027870178],[.542901992797852,.584792017936707],[.6180260181427,.694710969924927],[.607590973377228,.694203019142151],[.722943007946014,.271963000297546],[.577413976192474,.563166975975037],[.614082992076874,.281386971473694],[.616907000541687,.255886018276215],[.668509006500244,.119913995265961],[.770092010498047,.232020974159241],[.635536015033722,.189248979091644],[.77039098739624,.299556016921997],[.826722025871277,.278755009174347],[.527121007442474,.666198015213013],[.553171992301941,.668527007102966],[.577238023281097,.673889994621277],[.554691970348358,.580065965652466],[.611896991729736,.693961024284363],[.59696102142334,.706539988517761],[.596370995044708,.693953037261963],[.539958000183105,.557139039039612],[.568841993808746,.692366003990173],[.547818005084991,.692366003990173],[.52461302280426,.692366003990173],[.534089982509613,.779141008853912],[.527670979499817,.736225962638855],[.526912987232208,.717857003211975],[.526877999305725,.704625964164734],[.526966989040375,.695277988910675],[.572058022022247,.695277988910675],[.573521018028259,.703539967536926],[.57683801651001,.711845993995667],[.581691026687622,.720062971115112],[.609944999217987,.639909982681274],[.986046016216278,.560034036636353],[.5867999792099,.69539999961853],[.590372025966644,.701822996139526],[.531915009021759,.601536989212036],[.577268004417419,.585934996604919],[.536915004253387,.593786001205444],[.627542972564697,.473352015018463],[.665585994720459,.495950996875763],[.588353991508484,.546862006187439],[.757824003696442,.14767599105835],[.709249973297119,.201507985591888],[.672684013843536,.256581008434296],[.600408971309662,.74900496006012],[.55826598405838,.261672019958496],[.570303976535797,.187870979309082],[.588165998458862,.109044015407562],[.711045026779175,.398952007293701],[.781069993972778,.435405015945435],[.587247014045715,.398931980133057],[.742869973182678,.355445981025696],[.572156012058258,.437651991844177],[.55186802148819,.536570012569427],[.821442008018494,.457556009292603],[.752701997756958,.457181990146637],[.71375697851181,.467626988887787],[.66711300611496,.460672974586487],[.631101012229919,.447153985500336],[.6008620262146,.432473003864288],[.523481011390686,.405627012252808],[.810747981071472,.523926019668579],[.771045982837677,.348959028720856],[.509127020835876,.562718033790588],[.595292985439301,.485023975372314],[.980530977249146,.401564002037048],[.573499977588654,.420000016689301],[.602994978427887,.548687994480133],[.733529984951019,.376977026462555],[.560611009597778,.519016981124878],[.967685997486115,.644356966018677],[.580985009670258,.387160003185272],[.537728011608124,.505385041236877],[.760966002941132,.779752969741821],[.801778972148895,.831938028335571],[.892440974712372,.54076099395752],[.816350996494293,.740260004997253],[.865594983100891,.333687007427216],[.614073991775513,.883246004581451],[.508952975273132,.579437971115112],[.617941975593567,.508316040039062],[.825608015060425,.397674977779388],[.681214988231659,.39623498916626],[.656635999679565,.400596976280212],[.603900015354156,.710216999053955],[.81208598613739,.588539004325867],[.56801301240921,.944564998149872],[.681007981300354,.898285031318665],[.733752012252808,.869701027870178],[.633830010890961,.398822009563446],[.606792986392975,.39553701877594],[.589659988880157,.391062021255493],[.805015981197357,.342108011245728],[.611334979534149,.362284004688263],[.634037971496582,.355970978736877],[.656635999679565,.355356991291046],[.681214988231659,.35834002494812],[.698584973812103,.363156020641327],[.941866993904114,.319076001644135],[.698584973812103,.387449026107788],[.584177017211914,.624107003211975],[.554318010807037,.566076993942261],[.534153997898102,.62064003944397],[.711217999458313,.819975018501282],[.664629995822906,.852871000766754],[.559099972248077,.902631998062134],[.871706008911133,.791940987110138],[.591234028339386,.373893976211548],[.544341027736664,.451583981513977],[.624562978744507,.924192011356354],[.88577002286911,.615028977394104],[.551338016986847,.695277988910675],[.551980018615723,.704632043838501],[.552887976169586,.715808033943176],[.555167973041534,.730794012546539],[.569944024085999,.767035007476807],[.593203008174896,.685675978660583],[.599261999130249,.681069016456604],[.607599973678589,.677703022956848],[.631937980651855,.663500010967255],[.752032995223999,.601315021514893],[.547226011753082,.420395016670227],[.563543975353241,.359827995300293],[.583841025829315,.368713974952698],[.586614012718201,.692366003990173],[.771915018558502,.683578014373779],[.531597018241882,.352482974529266],[.588370978832245,.804440975189209],[.52079701423645,.442565023899078],[.567984998226166,.493479013442993],[.543282985687256,.819254994392395],[.655317008495331,.745514988899231],[.621008992195129,.574018001556396],[.625559985637665,.78031200170517],[.680198013782501,.570719003677368],[.64276397228241,.604337990283966],[.704662978649139,.621529996395111],[.552012026309967,.862591981887817],[.589071989059448,.508637011051178],[.685944974422455,.775357007980347],[.645735025405884,.812640011310577],[.675342977046967,.703978002071381],[.810858011245728,.646304965019226],[.72012197971344,.714666962623596],[.866151988506317,.682704985141754],[.663187026977539,.644596993923187],[.570082008838654,.466325998306274],[.544561982154846,.548375964164734],[.562758982181549,.558784961700439],[.531987011432648,.530140042304993],[.585271000862122,.335177004337311],[.622952997684479,.32277899980545],[.655896008014679,.320163011550903],[.687132000923157,.322345972061157],[.716481983661652,.333200991153717],[.758756995201111,.382786989212036],[.897013008594513,.468769013881683],[.732392013072968,.424547016620636],[.70211398601532,.433162987232208],[.66652500629425,.433866024017334],[.633504986763,.426087975502014],[.603875994682312,.416586995124817],[.579657971858978,.409945011138916],[.992439985275269,.480777025222778],[.567192018032074,.569419980049133],[.54136598110199,.478899002075195],[.526564002037048,.546118021011353],[.523913025856018,.563830018043518],[.531529009342194,.555056989192963],[.566035985946655,.582329034805298],[.51631098985672,.563053965568542],[.5174720287323,.577877044677734],[.573594987392426,.389806985855103],[.560697972774506,.395331978797913],[.549755990505219,.399751007556915],[.710287988185883,.368252992630005],[.723330020904541,.363372981548309]],t0=[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];var o2=[127,234,132,58,172,150,149,148,152,377,378,379,397,288,361,454,356,70,63,105,66,107,336,296,334,293,300,168,6,195,4,98,97,2,326,327,33,160,158,133,153,144,362,385,387,263,373,380,57,40,37,0,267,270,287,321,314,17,84,91,78,81,13,311,308,402,14,178],s2=[33,133,362,263,1,62,308,159,145,386,374,6,102,331,2,13,14,70,105,107,336,334,300,54,10,284,50,280,234,454,58,288,152],i2=[33,133,362,263,1,78,308],$2=o2.map(A=>d0[A]),Ae=s2.map(A=>d0[A]),ee=i2.map(A=>d0[A]);var _0=C.leftEyeLower0,$0=C.rightEyeLower0,a0={leftBounds:[_0[0],_0[_0.length-1]],rightBounds:[$0[0],$0[$0.length-1]]},E0={count:468,mouth:13,symmetryLine:[13,C.midwayBetweenEyes[0]]},aA={leftEye:0,rightEye:1,nose:2,mouth:3,leftEar:4,rightEar:5,symmetryLine:[3,2]},x0={upperCenter:3,lowerCenter:4,index:71,numCoordinates:76};function R0(A,e,t,s){for(let o=0;o[i[0]/this.meshSize*(y[0]-this.meshSize/2),i[1]/this.meshSize*(y[1]-this.meshSize/2),y[2]]),a=s!==0?v0(s,[0,0]):M0,x=s!==0?n.map(y=>[...nA(y,a),y[2]]):n,l=s!==0?tA(o):M0,d=[...i0({startPoint:t.startPoint,endPoint:t.endPoint}),1];return x.map(y=>[Math.round(y[0]+D(d,l[0])),Math.round(y[1]+D(d,l[1])),Math.round(y[2])])}getLeftToRightEyeDepthDifference(e){let t=e[a0.leftBounds[0]][2],s=e[a0.rightBounds[0]][2];return t-s}getEyeBox(e,t,s,o,i=!1){let n=z0(P0(D0([e[s],e[o]]),this.irisEnlarge)),a=c0(n),x=r.image.cropAndResize(t,[[n.startPoint[1]/this.meshSize,n.startPoint[0]/this.meshSize,n.endPoint[1]/this.meshSize,n.endPoint[0]/this.meshSize]],[0],[this.irisSize,this.irisSize]);return i&&r.ENV.flags.IS_BROWSER&&(x=r.image.flipLeftRight(x)),{box:n,boxSize:a,crop:x}}getEyeCoords(e,t,s,o=!1){let i=[];for(let n=0;n{let l=n;return x===2?l=o:x===4&&(l=i),[a[0],a[1],l]})}async predict(e,t){let s=!1,o;if((this.skipped===0||this.skipped>t.face.detector.skipFrames||!t.face.mesh.enabled||!t.videoOptimized)&&(o=await this.boundingBoxDetector.getBoundingBoxes(e),this.skipped=0),t.videoOptimized&&this.skipped++,!t.videoOptimized||o&&o.boxes&&(!t.face.mesh.enabled||o.boxes.length!==this.detectedFaces&&this.detectedFaces!==t.face.detector.maxDetected)){this.storedBoxes=[],this.detectedFaces=0;for(let n of o.boxes)this.storedBoxes.push({startPoint:n.box.startPoint.dataSync(),endPoint:n.box.endPoint.dataSync(),landmarks:n.landmarks,confidence:n.confidence});this.storedBoxes.length>0&&(s=!0)}if(t.face.detector.skipInitial&&this.detectedFaces===0&&(this.skipped=0),s){if(!o||!o.boxes||o.boxes.length===0)return this.storedBoxes=[],this.detectedFaces=0,null;for(let n=0;n{n.box.startPoint.dispose(),n.box.endPoint.dispose(),n.landmarks.dispose()});let i=r.tidy(()=>this.storedBoxes.map((n,a)=>{let x,l=0,d;if(t.face.detector.rotation&&t.face.mesh.enabled&&r.ENV.flags.IS_BROWSER){let[j,g]=n.landmarks.length>=E0.count?E0.symmetryLine:aA.symmetryLine;l=G0(n.landmarks[j],n.landmarks[g]);let m=i0({startPoint:n.startPoint,endPoint:n.endPoint}),T=[m[0]/e.shape[2],m[1]/e.shape[1]],v=r.image.rotateWithOffset(e,l,0,T);d=v0(-l,m),t.face.mesh.enabled?x=r0({startPoint:n.startPoint,endPoint:n.endPoint},v,[this.meshSize,this.meshSize]).div(255):x=r0({startPoint:n.startPoint,endPoint:n.endPoint},v,[this.boxSize,this.boxSize]).div(255)}else{d=M0;let j=e.clone();t.face.mesh.enabled?x=r0({startPoint:n.startPoint,endPoint:n.endPoint},j,[this.meshSize,this.meshSize]).div(255):x=r0({startPoint:n.startPoint,endPoint:n.endPoint},j,[this.boxSize,this.boxSize]).div(255)}if(!t.face.mesh.enabled)return{mesh:[],box:n,faceConfidence:null,boxConfidence:n.confidence,confidence:n.confidence,image:x};let[,y,h]=this.meshDetector.execute(x),p=y.dataSync()[0];if(p=E0.count?E0.symmetryLine:aA.symmetryLine;l=G0(n.landmarks[j],n.landmarks[g]);let m=i0({startPoint:n.startPoint,endPoint:n.endPoint}),T=[m[0]/e.shape[2],m[1]/e.shape[1]],v=r.image.rotateWithOffset(e.toFloat(),l,0,T);d=v0(-l,m),x=r0({startPoint:n.startPoint,endPoint:n.endPoint},v,[this.meshSize,this.meshSize]).div(255)}let E={mesh:u,box:n,faceConfidence:p,boxConfidence:n.confidence,image:x},R=z0(n);return R.confidence=n.confidence,R.faceConfidence=p,this.storedBoxes[a]=R,E}));return t.face.mesh.enabled&&(this.storedBoxes=this.storedBoxes.filter(n=>n.confidence>t.face.detector.minConfidence)),this.detectedFaces=i.length,i}};var N=[null,null,null],t5;async function n5(A,e){let t=await t5.predict(A,e),s=[];for(let o of t||[]){if(!o||o.isDisposedInternal)continue;let i=o.mesh.map(l=>[l[0]/A.shape[2],l[1]/A.shape[1],l[2]/t5.meshSize]),n={};if(o.mesh&&o.mesh.length>0)for(let l of Object.keys(C))n[l]=C[l].map(d=>o.mesh[d]);let a=o.box?[Math.max(0,o.box.startPoint[0]),Math.max(0,o.box.startPoint[1]),Math.min(A.shape[2],o.box.endPoint[0])-Math.max(0,o.box.startPoint[0]),Math.min(A.shape[1],o.box.endPoint[1])-Math.max(0,o.box.startPoint[1])]:0,x=o.box?[o.box.startPoint[0]/A.shape[2],o.box.startPoint[1]/A.shape[1],(o.box.endPoint[0]-o.box.startPoint[0])/A.shape[2],(o.box.endPoint[1]-o.box.startPoint[1])/A.shape[1]]:[];s.push({confidence:Math.round(100*o.faceConfidence||100*o.boxConfidence||0)/100,boxConfidence:Math.round(100*o.boxConfidence)/100,faceConfidence:Math.round(100*o.faceConfidence)/100,box:a,boxRaw:x,mesh:o.mesh,meshRaw:i,annotations:n,image:o.image}),o.coords&&o.coords.dispose()}return s}async function o5(A){return!N[0]&&A.face.enabled||!N[1]&&A.face.mesh.enabled||!N[2]&&A.face.iris.enabled?(N=await Promise.all([!N[0]&&A.face.enabled?rA(A):null,!N[1]&&A.face.mesh.enabled?r.loadGraphModel(O(A.modelBasePath,A.face.mesh.modelPath),{fromTFHub:A.face.mesh.modelPath.includes("tfhub.dev")}):null,!N[2]&&A.face.iris.enabled?r.loadGraphModel(O(A.modelBasePath,A.face.iris.modelPath),{fromTFHub:A.face.iris.modelPath.includes("tfhub.dev")}):null]),A.face.mesh.enabled&&(!N[1]||!N[1].modelUrl?b("load model failed:",A.face.mesh.modelPath):A.debug&&b("load model:",N[1].modelUrl)),A.face.iris.enabled&&(!N[2]||!N[1].modelUrl?b("load model failed:",A.face.iris.modelPath):A.debug&&b("load model:",N[2].modelUrl))):A.debug&&(b("cached model:",N[0].model.modelUrl),b("cached model:",N[1].modelUrl),b("cached model:",N[2].modelUrl)),t5=new A5(N[0],N[1],N[2]),N}var xA=t0,yA=d0;var s5={};Y(s5,{load:()=>a5,predict:()=>S0});var r2=["angry","disgust","fear","happy","sad","surprise","neutral"],U,i5=[],j0=Number.MAX_SAFE_INTEGER,r5=[.2989,.587,.114];async function a5(A){return U?A.debug&&b("cached model:",U.modelUrl):(U=await r.loadGraphModel(O(A.modelBasePath,A.face.emotion.modelPath)),!U||!U.modelUrl?b("load model failed:",A.face.emotion.modelPath):A.debug&&b("load model:",U.modelUrl)),U}async function S0(A,e){return U?j00?(j0++,i5):(e.videoOptimized?j0=0:j0=Number.MAX_SAFE_INTEGER,new Promise(async t=>{let s=r.image.resizeBilinear(A,[U.inputs[0].shape[2],U.inputs[0].shape[1]],!1),[o,i,n]=r.split(s,3,3);s.dispose();let a=r.mul(o,r5[0]),x=r.mul(i,r5[1]),l=r.mul(n,r5[2]);o.dispose(),i.dispose(),n.dispose();let d=r.addN([a,x,l]);a.dispose(),x.dispose(),l.dispose();let y=r.tidy(()=>d.sub(.5).mul(2));d.dispose();let h=[];if(e.face.emotion.enabled){let p=await U.predict(y),M=p.dataSync();r.dispose(p);for(let c=0;ce.face.emotion.minConfidence&&h.push({score:Math.min(.99,Math.trunc(100*M[c])/100),emotion:r2[c]});h.sort((c,u)=>u.score-c.score)}y.dispose(),i5=h,t(h)})):null}var x5={};Y(x5,{enhance:()=>c5,load:()=>y5,match:()=>lA,predict:()=>I0,similarity:()=>l5});var F,w0={age:0},W0=Number.MAX_SAFE_INTEGER;async function y5(A){return F?A.debug&&b("cached model:",F.modelUrl):(F=await r.loadGraphModel(O(A.modelBasePath,A.face.description.modelPath)),!F||!F.modelUrl?b("load model failed:",A.face.description.modelPath):A.debug&&b("load model:",F.modelUrl)),F}function l5(A,e,t=2){if(!A||!e||(A==null?void 0:A.length)===0||(e==null?void 0:e.length)===0||(A==null?void 0:A.length)!==(e==null?void 0:e.length))return 0;let s=5*A.map((i,n)=>Math.abs(A[n]-e[n])**t).reduce((i,n)=>i+n,0)**(1/t);return Math.max(0,100-s)/100}function lA(A,e,t=0){let s={similarity:0,name:"",source:"",embedding:[]};if(!A||!e||!Array.isArray(A)||!Array.isArray(e))return s;for(let o of e)if(o.embedding&&o.name){let i=l5(A,o.embedding);i>t&&i>s.similarity&&(s={...o,similarity:i})}return s}function c5(A){return r.tidy(()=>{let t=A.image||A.tensor||A;if(!(t instanceof r.Tensor))return null;let s=[[.05,.15,.85,.85]];return(t.shape.length===3?r.image.cropAndResize(r.expandDims(t,0),s,[0],[F.inputs[0].shape[2],F.inputs[0].shape[1]]):r.image.cropAndResize(t,s,[0],[F.inputs[0].shape[2],F.inputs[0].shape[1]])).mul(255)})}async function I0(A,e){return F?W00?(W0++,w0):(e.videoOptimized?W0=0:W0=Number.MAX_SAFE_INTEGER,new Promise(async t=>{let s=c5(A),o,i={age:0,gender:"unknown",genderConfidence:0,descriptor:[]};e.face.description.enabled&&(o=await F.predict(s)),r.dispose(s),o&&(r.tidy(()=>{let n=o.find(y=>y.shape[1]===1).dataSync(),a=Math.trunc(200*Math.abs(n[0]-.5))/100;a>e.face.description.minConfidence&&(i.gender=n[0]<=.5?"female":"male",i.genderConfidence=Math.min(.99,a));let x=o.find(y=>y.shape[1]===100).argMax(1).dataSync()[0],l=o.find(y=>y.shape[1]===100).dataSync();i.age=Math.round(l[x-1]>l[x+1]?10*x-100*l[x-1]:10*x+100*l[x+1])/10;let d=o.find(y=>y.shape[1]===1024);i.descriptor=[...d.dataSync()]}),o.forEach(n=>r.dispose(n))),w0=i,t(i)})):null}var a2=(A,e)=>{let t=u=>u*180/Math.PI,s=u=>{let z=Math.sqrt(u[0]*u[0]+u[1]*u[1]+u[2]*u[2]);return u[0]/=z,u[1]/=z,u[2]/=z,u},o=(u,z)=>{let E=u[0]-z[0],R=u[1]-z[1],j=u[2]-z[2];return[E,R,j]},i=(u,z)=>{let E=u[1]*z[2]-u[2]*z[1],R=u[2]*z[0]-u[0]*z[2],j=u[0]*z[1]-u[1]*z[0];return[E,R,j]},n=u=>{let[z,E,R,j,g,m,T,v,w]=u,k,K,V;return j<1?j>-1?(V=Math.asin(j),K=Math.atan2(-T,z),k=Math.atan2(-m,g)):(V=-Math.PI/2,K=-Math.atan2(v,w),k=0):(V=Math.PI/2,K=Math.atan2(v,w),k=0),{pitch:2*-k,yaw:2*-K,roll:2*-V}},a=u=>{let z=(R,j,g,m)=>Math.atan2(m-j,g-R);return{pitch:z(u[10][1],u[10][2],u[152][1],u[152][2]),yaw:z(u[33][0],u[33][2],u[263][0],u[263][2]),roll:z(u[33][0],u[33][1],u[263][0],u[263][1])}},x=A.meshRaw;if(!x||x.length<300)return{angle:{pitch:0,yaw:0,roll:0},matrix:[1,0,0,0,1,0,0,0,1]};let l=Math.max(A.boxRaw[2]*e[0],A.boxRaw[3]*e[1])/1.5,d=[x[10],x[152],x[234],x[454]].map(u=>[u[0]*e[0]/l,u[1]*e[1]/l,u[2]]),y=s(o(d[1],d[0])),h=s(o(d[3],d[2])),p=s(i(h,y));h=i(y,p);let M=[h[0],h[1],h[2],y[0],y[1],y[2],p[0],p[1],p[2]];return{angle:n(M),matrix:M}},d5=async(A,e)=>{var d,y,h,p,M,c;let t,s,o,i,n,a,x=[];A.state="run:face",t=S();let l=await n5(e,A.config);if(A.perf.face=Math.trunc(S()-t),!l)return[];for(let u of l){if(A.analyze("Get Face"),!u.image||u.image.isDisposedInternal){b("Face object is disposed:",u.image);continue}let z=a2(u,[e.shape[2],e.shape[1]]);A.analyze("Start Emotion:"),A.config.async?i=A.config.face.emotion.enabled?S0(u.image,A.config):{}:(A.state="run:emotion",t=S(),i=A.config.face.emotion.enabled?await S0(u.image,A.config):{},A.perf.emotion=Math.trunc(S()-t)),A.analyze("End Emotion:"),A.analyze("Start Description:"),A.config.async?a=A.config.face.description.enabled?I0(u,A.config):[]:(A.state="run:description",t=S(),a=A.config.face.description.enabled?await I0(u.image,A.config):[],A.perf.embedding=Math.trunc(S()-t)),A.analyze("End Description:"),A.config.async&&([s,o,i,n,a]=await Promise.all([s,o,i,n,a])),A.analyze("Finish Face:"),!A.config.face.iris.enabled&&((d=u==null?void 0:u.annotations)==null?void 0:d.leftEyeIris)&&((y=u==null?void 0:u.annotations)==null?void 0:y.rightEyeIris)&&(delete u.annotations.leftEyeIris,delete u.annotations.rightEyeIris);let E=((h=u.annotations)==null?void 0:h.leftEyeIris)&&((p=u.annotations)==null?void 0:p.rightEyeIris)?11.7*Math.max(Math.abs(u.annotations.leftEyeIris[3][0]-u.annotations.leftEyeIris[1][0]),Math.abs(u.annotations.rightEyeIris[4][1]-u.annotations.rightEyeIris[2][1])):0;x.push({...u,age:a.age,gender:a.gender,genderConfidence:a.genderConfidence,embedding:a.descriptor,emotion:i,iris:E!==0?Math.trunc(E)/100:0,rotation:z,tensor:A.config.face.detector.return?(M=u.image)==null?void 0:M.squeeze():null}),(c=u.image)==null||c.dispose(),A.analyze("End Face")}return A.analyze("End FaceMesh:"),A.config.async&&(A.perf.face&&delete A.perf.face,A.perf.age&&delete A.perf.age,A.perf.gender&&delete A.perf.gender,A.perf.emotion&&delete A.perf.emotion),x};var b5={};Y(b5,{load:()=>T5,predict:()=>g5});var f0=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"],cA=f0.length,m0=f0.reduce((A,e,t)=>(A[e]=t,A),{}),x2=[["leftHip","leftShoulder"],["leftElbow","leftShoulder"],["leftElbow","leftWrist"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["rightHip","rightShoulder"],["rightElbow","rightShoulder"],["rightElbow","rightWrist"],["rightHip","rightKnee"],["rightKnee","rightAnkle"],["leftShoulder","rightShoulder"],["leftHip","rightHip"]],y2=x2.map(([A,e])=>[m0[A],m0[e]]),dA=[["nose","leftEye"],["leftEye","leftEar"],["nose","rightEye"],["rightEye","rightEar"],["nose","leftShoulder"],["leftShoulder","leftElbow"],["leftElbow","leftWrist"],["leftShoulder","leftHip"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["nose","rightShoulder"],["rightShoulder","rightElbow"],["rightElbow","rightWrist"],["rightShoulder","rightHip"],["rightHip","rightKnee"],["rightKnee","rightAnkle"]];function fA(A){let e=A.reduce(({maxX:t,maxY:s,minX:o,minY:i},{position:{x:n,y:a}})=>({maxX:Math.max(t,n),maxY:Math.max(s,a),minX:Math.min(o,n),minY:Math.min(i,a)}),{maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY});return[e.minX,e.minY,e.maxX-e.minX,e.maxY-e.minY]}function mA(A,[e,t],[s,o]){let i=(a,x,l)=>({score:a.score,box:[Math.trunc(a.box[0]*l),Math.trunc(a.box[1]*x),Math.trunc(a.box[2]*l),Math.trunc(a.box[3]*x)],keypoints:a.keypoints.map(({score:d,part:y,position:h})=>({score:d,part:y,position:{x:Math.trunc(h.x*l),y:Math.trunc(h.y*x)}}))});return A.map(a=>i(a,e/s,t/o))}var f5=class{constructor(e,t){this.priorityQueue=new Array(e),this.numberOfElements=-1,this.getElementValue=t}enqueue(e){this.priorityQueue[++this.numberOfElements]=e,this.swim(this.numberOfElements)}dequeue(){let e=this.priorityQueue[0];return this.exchange(0,this.numberOfElements--),this.sink(0),this.priorityQueue[this.numberOfElements+1]=null,e}empty(){return this.numberOfElements===-1}size(){return this.numberOfElements+1}all(){return this.priorityQueue.slice(0,this.numberOfElements+1)}max(){return this.priorityQueue[0]}swim(e){for(;e>0&&this.less(Math.floor(e/2),e);)this.exchange(e,Math.floor(e/2)),e=Math.floor(e/2)}sink(e){for(;2*e<=this.numberOfElements;){let t=2*e;if(tt?t:A}function hA(A,e,t,s){let o=t-A,i=s-e;return o*o+i*i}function p5(A,e){return{x:A.x+e.x,y:A.y+e.y}}var N0=1,y0=16,l2=50**2;function uA(A,e,t,s,o,i,n=2){let a=z=>({y:i.get(z.y,z.x,A),x:i.get(z.y,z.x,i.shape[2]/2+A)}),x=(z,E,R)=>({y:u5(Math.round(z.y/y0),0,E-1),x:u5(Math.round(z.x/y0),0,R-1)}),[l,d]=s.shape,y=x(e.position,l,d),h=a(y),M=p5(e.position,h);for(let z=0;z[m0[h],m0[p]]),n=i.map(([,h])=>h),a=i.map(([h])=>h),x=e.shape[2],l=n.length,d=new Array(x),y=h5(A.part,y0,t);d[A.part.id]={score:A.score,part:f0[A.part.id],position:y};for(let h=l-1;h>=0;--h){let p=n[h],M=a[h];d[p]&&!d[M]&&(d[M]=uA(h,d[p],M,e,t,o))}for(let h=0;he){a=!1;break}if(!a)break}return a}function f2(A,e){let[t,s,o]=e.shape,i=new f5(t*s*o,({score:n})=>n);for(let n=0;n{var n;let i=(n=o[s])==null?void 0:n.position;return i?hA(t,e,i.y,i.x)<=l2:!1})}function m2(A,e){return e.reduce((s,{position:o,score:i},n)=>(pA(A,o,n)||(s+=i),s),0)/e.length}function bA(A,e,t,s,o,i){let n=[],a=f2(i,e);for(;n.lengthp.score>i);let y=m2(n,d),h=fA(d);y>i&&n.push({keypoints:d,box:h,score:Math.round(100*y)/100})}return n}var B,h2=["MobilenetV1/offset_2/BiasAdd","MobilenetV1/heatmap_2/BiasAdd","MobilenetV1/displacement_fwd_2/BiasAdd","MobilenetV1/displacement_bwd_2/BiasAdd"];async function g5(A,e){let t=r.tidy(()=>{let a=A.resizeBilinear([B.inputs[0].shape[2],B.inputs[0].shape[1]]).toFloat().div(127.5).sub(1),l=B.execute(a,h2).map(d=>d.squeeze([0]));return l[1]=l[1].sigmoid(),l}),s=await Promise.all(t.map(n=>n.buffer()));for(let n of t)n.dispose();let o=await bA(s[0],s[1],s[2],s[3],e.body.maxDetected,e.body.minConfidence);return mA(o,[A.shape[1],A.shape[2]],[B.inputs[0].shape[2],B.inputs[0].shape[1]])}async function T5(A){return B?A.debug&&b("cached model:",B.modelUrl):(B=await r.loadGraphModel(O(A.modelBasePath,A.body.modelPath)),!B||!B.modelUrl?b("load model failed:",A.body.modelPath):A.debug&&b("load model:",B.modelUrl)),B}var E5={};Y(E5,{load:()=>j5,predict:()=>R5});function k0(A){return[Math.abs(A.endPoint[0]-A.startPoint[0]),Math.abs(A.endPoint[1]-A.startPoint[1])]}function h0(A){return[A.startPoint[0]+(A.endPoint[0]-A.startPoint[0])/2,A.startPoint[1]+(A.endPoint[1]-A.startPoint[1])/2]}function gA(A,e,t){let s=e.shape[1],o=e.shape[2],i=[[A.startPoint[1]/s,A.startPoint[0]/o,A.endPoint[1]/s,A.endPoint[0]/o]];return r.image.cropAndResize(e,i,[0],t)}function TA(A,e){let t=[A.startPoint[0]*e[0],A.startPoint[1]*e[1]],s=[A.endPoint[0]*e[0],A.endPoint[1]*e[1]],o=A.palmLandmarks.map(i=>[i[0]*e[0],i[1]*e[1]]);return{startPoint:t,endPoint:s,palmLandmarks:o,confidence:A.confidence}}function O0(A,e=1.5){let t=h0(A),s=k0(A),o=[e*s[0]/2,e*s[1]/2],i=[t[0]-o[0],t[1]-o[1]],n=[t[0]+o[0],t[1]+o[1]];return{startPoint:i,endPoint:n,palmLandmarks:A.palmLandmarks}}function Z0(A){let e=h0(A),t=k0(A),o=Math.max(...t)/2,i=[e[0]-o,e[1]-o],n=[e[0]+o,e[1]+o];return{startPoint:i,endPoint:n,palmLandmarks:A.palmLandmarks}}var PA=[{x:.015625,y:.015625},{x:.015625,y:.015625},{x:.046875,y:.015625},{x:.046875,y:.015625},{x:.078125,y:.015625},{x:.078125,y:.015625},{x:.109375,y:.015625},{x:.109375,y:.015625},{x:.140625,y:.015625},{x:.140625,y:.015625},{x:.171875,y:.015625},{x:.171875,y:.015625},{x:.203125,y:.015625},{x:.203125,y:.015625},{x:.234375,y:.015625},{x:.234375,y:.015625},{x:.265625,y:.015625},{x:.265625,y:.015625},{x:.296875,y:.015625},{x:.296875,y:.015625},{x:.328125,y:.015625},{x:.328125,y:.015625},{x:.359375,y:.015625},{x:.359375,y:.015625},{x:.390625,y:.015625},{x:.390625,y:.015625},{x:.421875,y:.015625},{x:.421875,y:.015625},{x:.453125,y:.015625},{x:.453125,y:.015625},{x:.484375,y:.015625},{x:.484375,y:.015625},{x:.515625,y:.015625},{x:.515625,y:.015625},{x:.546875,y:.015625},{x:.546875,y:.015625},{x:.578125,y:.015625},{x:.578125,y:.015625},{x:.609375,y:.015625},{x:.609375,y:.015625},{x:.640625,y:.015625},{x:.640625,y:.015625},{x:.671875,y:.015625},{x:.671875,y:.015625},{x:.703125,y:.015625},{x:.703125,y:.015625},{x:.734375,y:.015625},{x:.734375,y:.015625},{x:.765625,y:.015625},{x:.765625,y:.015625},{x:.796875,y:.015625},{x:.796875,y:.015625},{x:.828125,y:.015625},{x:.828125,y:.015625},{x:.859375,y:.015625},{x:.859375,y:.015625},{x:.890625,y:.015625},{x:.890625,y:.015625},{x:.921875,y:.015625},{x:.921875,y:.015625},{x:.953125,y:.015625},{x:.953125,y:.015625},{x:.984375,y:.015625},{x:.984375,y:.015625},{x:.015625,y:.046875},{x:.015625,y:.046875},{x:.046875,y:.046875},{x:.046875,y:.046875},{x:.078125,y:.046875},{x:.078125,y:.046875},{x:.109375,y:.046875},{x:.109375,y:.046875},{x:.140625,y:.046875},{x:.140625,y:.046875},{x:.171875,y:.046875},{x:.171875,y:.046875},{x:.203125,y:.046875},{x:.203125,y:.046875},{x:.234375,y:.046875},{x:.234375,y:.046875},{x:.265625,y:.046875},{x:.265625,y:.046875},{x:.296875,y:.046875},{x:.296875,y:.046875},{x:.328125,y:.046875},{x:.328125,y:.046875},{x:.359375,y:.046875},{x:.359375,y:.046875},{x:.390625,y:.046875},{x:.390625,y:.046875},{x:.421875,y:.046875},{x:.421875,y:.046875},{x:.453125,y:.046875},{x:.453125,y:.046875},{x:.484375,y:.046875},{x:.484375,y:.046875},{x:.515625,y:.046875},{x:.515625,y:.046875},{x:.546875,y:.046875},{x:.546875,y:.046875},{x:.578125,y:.046875},{x:.578125,y:.046875},{x:.609375,y:.046875},{x:.609375,y:.046875},{x:.640625,y:.046875},{x:.640625,y:.046875},{x:.671875,y:.046875},{x:.671875,y:.046875},{x:.703125,y:.046875},{x:.703125,y:.046875},{x:.734375,y:.046875},{x:.734375,y:.046875},{x:.765625,y:.046875},{x:.765625,y:.046875},{x:.796875,y:.046875},{x:.796875,y:.046875},{x:.828125,y:.046875},{x:.828125,y:.046875},{x:.859375,y:.046875},{x:.859375,y:.046875},{x:.890625,y:.046875},{x:.890625,y:.046875},{x:.921875,y:.046875},{x:.921875,y:.046875},{x:.953125,y:.046875},{x:.953125,y:.046875},{x:.984375,y:.046875},{x:.984375,y:.046875},{x:.015625,y:.078125},{x:.015625,y:.078125},{x:.046875,y:.078125},{x:.046875,y:.078125},{x:.078125,y:.078125},{x:.078125,y:.078125},{x:.109375,y:.078125},{x:.109375,y:.078125},{x:.140625,y:.078125},{x:.140625,y:.078125},{x:.171875,y:.078125},{x:.171875,y:.078125},{x:.203125,y:.078125},{x:.203125,y:.078125},{x:.234375,y:.078125},{x:.234375,y:.078125},{x:.265625,y:.078125},{x:.265625,y:.078125},{x:.296875,y:.078125},{x:.296875,y:.078125},{x:.328125,y:.078125},{x:.328125,y:.078125},{x:.359375,y:.078125},{x:.359375,y:.078125},{x:.390625,y:.078125},{x:.390625,y:.078125},{x:.421875,y:.078125},{x:.421875,y:.078125},{x:.453125,y:.078125},{x:.453125,y:.078125},{x:.484375,y:.078125},{x:.484375,y:.078125},{x:.515625,y:.078125},{x:.515625,y:.078125},{x:.546875,y:.078125},{x:.546875,y:.078125},{x:.578125,y:.078125},{x:.578125,y:.078125},{x:.609375,y:.078125},{x:.609375,y:.078125},{x:.640625,y:.078125},{x:.640625,y:.078125},{x:.671875,y:.078125},{x:.671875,y:.078125},{x:.703125,y:.078125},{x:.703125,y:.078125},{x:.734375,y:.078125},{x:.734375,y:.078125},{x:.765625,y:.078125},{x:.765625,y:.078125},{x:.796875,y:.078125},{x:.796875,y:.078125},{x:.828125,y:.078125},{x:.828125,y:.078125},{x:.859375,y:.078125},{x:.859375,y:.078125},{x:.890625,y:.078125},{x:.890625,y:.078125},{x:.921875,y:.078125},{x:.921875,y:.078125},{x:.953125,y:.078125},{x:.953125,y:.078125},{x:.984375,y:.078125},{x:.984375,y:.078125},{x:.015625,y:.109375},{x:.015625,y:.109375},{x:.046875,y:.109375},{x:.046875,y:.109375},{x:.078125,y:.109375},{x:.078125,y:.109375},{x:.109375,y:.109375},{x:.109375,y:.109375},{x:.140625,y:.109375},{x:.140625,y:.109375},{x:.171875,y:.109375},{x:.171875,y:.109375},{x:.203125,y:.109375},{x:.203125,y:.109375},{x:.234375,y:.109375},{x:.234375,y:.109375},{x:.265625,y:.109375},{x:.265625,y:.109375},{x:.296875,y:.109375},{x:.296875,y:.109375},{x:.328125,y:.109375},{x:.328125,y:.109375},{x:.359375,y:.109375},{x:.359375,y:.109375},{x:.390625,y:.109375},{x:.390625,y:.109375},{x:.421875,y:.109375},{x:.421875,y:.109375},{x:.453125,y:.109375},{x:.453125,y:.109375},{x:.484375,y:.109375},{x:.484375,y:.109375},{x:.515625,y:.109375},{x:.515625,y:.109375},{x:.546875,y:.109375},{x:.546875,y:.109375},{x:.578125,y:.109375},{x:.578125,y:.109375},{x:.609375,y:.109375},{x:.609375,y:.109375},{x:.640625,y:.109375},{x:.640625,y:.109375},{x:.671875,y:.109375},{x:.671875,y:.109375},{x:.703125,y:.109375},{x:.703125,y:.109375},{x:.734375,y:.109375},{x:.734375,y:.109375},{x:.765625,y:.109375},{x:.765625,y:.109375},{x:.796875,y:.109375},{x:.796875,y:.109375},{x:.828125,y:.109375},{x:.828125,y:.109375},{x:.859375,y:.109375},{x:.859375,y:.109375},{x:.890625,y:.109375},{x:.890625,y:.109375},{x:.921875,y:.109375},{x:.921875,y:.109375},{x:.953125,y:.109375},{x:.953125,y:.109375},{x:.984375,y:.109375},{x:.984375,y:.109375},{x:.015625,y:.140625},{x:.015625,y:.140625},{x:.046875,y:.140625},{x:.046875,y:.140625},{x:.078125,y:.140625},{x:.078125,y:.140625},{x:.109375,y:.140625},{x:.109375,y:.140625},{x:.140625,y:.140625},{x:.140625,y:.140625},{x:.171875,y:.140625},{x:.171875,y:.140625},{x:.203125,y:.140625},{x:.203125,y:.140625},{x:.234375,y:.140625},{x:.234375,y:.140625},{x:.265625,y:.140625},{x:.265625,y:.140625},{x:.296875,y:.140625},{x:.296875,y:.140625},{x:.328125,y:.140625},{x:.328125,y:.140625},{x:.359375,y:.140625},{x:.359375,y:.140625},{x:.390625,y:.140625},{x:.390625,y:.140625},{x:.421875,y:.140625},{x:.421875,y:.140625},{x:.453125,y:.140625},{x:.453125,y:.140625},{x:.484375,y:.140625},{x:.484375,y:.140625},{x:.515625,y:.140625},{x:.515625,y:.140625},{x:.546875,y:.140625},{x:.546875,y:.140625},{x:.578125,y:.140625},{x:.578125,y:.140625},{x:.609375,y:.140625},{x:.609375,y:.140625},{x:.640625,y:.140625},{x:.640625,y:.140625},{x:.671875,y:.140625},{x:.671875,y:.140625},{x:.703125,y:.140625},{x:.703125,y:.140625},{x:.734375,y:.140625},{x:.734375,y:.140625},{x:.765625,y:.140625},{x:.765625,y:.140625},{x:.796875,y:.140625},{x:.796875,y:.140625},{x:.828125,y:.140625},{x:.828125,y:.140625},{x:.859375,y:.140625},{x:.859375,y:.140625},{x:.890625,y:.140625},{x:.890625,y:.140625},{x:.921875,y:.140625},{x:.921875,y:.140625},{x:.953125,y:.140625},{x:.953125,y:.140625},{x:.984375,y:.140625},{x:.984375,y:.140625},{x:.015625,y:.171875},{x:.015625,y:.171875},{x:.046875,y:.171875},{x:.046875,y:.171875},{x:.078125,y:.171875},{x:.078125,y:.171875},{x:.109375,y:.171875},{x:.109375,y:.171875},{x:.140625,y:.171875},{x:.140625,y:.171875},{x:.171875,y:.171875},{x:.171875,y:.171875},{x:.203125,y:.171875},{x:.203125,y:.171875},{x:.234375,y:.171875},{x:.234375,y:.171875},{x:.265625,y:.171875},{x:.265625,y:.171875},{x:.296875,y:.171875},{x:.296875,y:.171875},{x:.328125,y:.171875},{x:.328125,y:.171875},{x:.359375,y:.171875},{x:.359375,y:.171875},{x:.390625,y:.171875},{x:.390625,y:.171875},{x:.421875,y:.171875},{x:.421875,y:.171875},{x:.453125,y:.171875},{x:.453125,y:.171875},{x:.484375,y:.171875},{x:.484375,y:.171875},{x:.515625,y:.171875},{x:.515625,y:.171875},{x:.546875,y:.171875},{x:.546875,y:.171875},{x:.578125,y:.171875},{x:.578125,y:.171875},{x:.609375,y:.171875},{x:.609375,y:.171875},{x:.640625,y:.171875},{x:.640625,y:.171875},{x:.671875,y:.171875},{x:.671875,y:.171875},{x:.703125,y:.171875},{x:.703125,y:.171875},{x:.734375,y:.171875},{x:.734375,y:.171875},{x:.765625,y:.171875},{x:.765625,y:.171875},{x:.796875,y:.171875},{x:.796875,y:.171875},{x:.828125,y:.171875},{x:.828125,y:.171875},{x:.859375,y:.171875},{x:.859375,y:.171875},{x:.890625,y:.171875},{x:.890625,y:.171875},{x:.921875,y:.171875},{x:.921875,y:.171875},{x:.953125,y:.171875},{x:.953125,y:.171875},{x:.984375,y:.171875},{x:.984375,y:.171875},{x:.015625,y:.203125},{x:.015625,y:.203125},{x:.046875,y:.203125},{x:.046875,y:.203125},{x:.078125,y:.203125},{x:.078125,y:.203125},{x:.109375,y:.203125},{x:.109375,y:.203125},{x:.140625,y:.203125},{x:.140625,y:.203125},{x:.171875,y:.203125},{x:.171875,y:.203125},{x:.203125,y:.203125},{x:.203125,y:.203125},{x:.234375,y:.203125},{x:.234375,y:.203125},{x:.265625,y:.203125},{x:.265625,y:.203125},{x:.296875,y:.203125},{x:.296875,y:.203125},{x:.328125,y:.203125},{x:.328125,y:.203125},{x:.359375,y:.203125},{x:.359375,y:.203125},{x:.390625,y:.203125},{x:.390625,y:.203125},{x:.421875,y:.203125},{x:.421875,y:.203125},{x:.453125,y:.203125},{x:.453125,y:.203125},{x:.484375,y:.203125},{x:.484375,y:.203125},{x:.515625,y:.203125},{x:.515625,y:.203125},{x:.546875,y:.203125},{x:.546875,y:.203125},{x:.578125,y:.203125},{x:.578125,y:.203125},{x:.609375,y:.203125},{x:.609375,y:.203125},{x:.640625,y:.203125},{x:.640625,y:.203125},{x:.671875,y:.203125},{x:.671875,y:.203125},{x:.703125,y:.203125},{x:.703125,y:.203125},{x:.734375,y:.203125},{x:.734375,y:.203125},{x:.765625,y:.203125},{x:.765625,y:.203125},{x:.796875,y:.203125},{x:.796875,y:.203125},{x:.828125,y:.203125},{x:.828125,y:.203125},{x:.859375,y:.203125},{x:.859375,y:.203125},{x:.890625,y:.203125},{x:.890625,y:.203125},{x:.921875,y:.203125},{x:.921875,y:.203125},{x:.953125,y:.203125},{x:.953125,y:.203125},{x:.984375,y:.203125},{x:.984375,y:.203125},{x:.015625,y:.234375},{x:.015625,y:.234375},{x:.046875,y:.234375},{x:.046875,y:.234375},{x:.078125,y:.234375},{x:.078125,y:.234375},{x:.109375,y:.234375},{x:.109375,y:.234375},{x:.140625,y:.234375},{x:.140625,y:.234375},{x:.171875,y:.234375},{x:.171875,y:.234375},{x:.203125,y:.234375},{x:.203125,y:.234375},{x:.234375,y:.234375},{x:.234375,y:.234375},{x:.265625,y:.234375},{x:.265625,y:.234375},{x:.296875,y:.234375},{x:.296875,y:.234375},{x:.328125,y:.234375},{x:.328125,y:.234375},{x:.359375,y:.234375},{x:.359375,y:.234375},{x:.390625,y:.234375},{x:.390625,y:.234375},{x:.421875,y:.234375},{x:.421875,y:.234375},{x:.453125,y:.234375},{x:.453125,y:.234375},{x:.484375,y:.234375},{x:.484375,y:.234375},{x:.515625,y:.234375},{x:.515625,y:.234375},{x:.546875,y:.234375},{x:.546875,y:.234375},{x:.578125,y:.234375},{x:.578125,y:.234375},{x:.609375,y:.234375},{x:.609375,y:.234375},{x:.640625,y:.234375},{x:.640625,y:.234375},{x:.671875,y:.234375},{x:.671875,y:.234375},{x:.703125,y:.234375},{x:.703125,y:.234375},{x:.734375,y:.234375},{x:.734375,y:.234375},{x:.765625,y:.234375},{x:.765625,y:.234375},{x:.796875,y:.234375},{x:.796875,y:.234375},{x:.828125,y:.234375},{x:.828125,y:.234375},{x:.859375,y:.234375},{x:.859375,y:.234375},{x:.890625,y:.234375},{x:.890625,y:.234375},{x:.921875,y:.234375},{x:.921875,y:.234375},{x:.953125,y:.234375},{x:.953125,y:.234375},{x:.984375,y:.234375},{x:.984375,y:.234375},{x:.015625,y:.265625},{x:.015625,y:.265625},{x:.046875,y:.265625},{x:.046875,y:.265625},{x:.078125,y:.265625},{x:.078125,y:.265625},{x:.109375,y:.265625},{x:.109375,y:.265625},{x:.140625,y:.265625},{x:.140625,y:.265625},{x:.171875,y:.265625},{x:.171875,y:.265625},{x:.203125,y:.265625},{x:.203125,y:.265625},{x:.234375,y:.265625},{x:.234375,y:.265625},{x:.265625,y:.265625},{x:.265625,y:.265625},{x:.296875,y:.265625},{x:.296875,y:.265625},{x:.328125,y:.265625},{x:.328125,y:.265625},{x:.359375,y:.265625},{x:.359375,y:.265625},{x:.390625,y:.265625},{x:.390625,y:.265625},{x:.421875,y:.265625},{x:.421875,y:.265625},{x:.453125,y:.265625},{x:.453125,y:.265625},{x:.484375,y:.265625},{x:.484375,y:.265625},{x:.515625,y:.265625},{x:.515625,y:.265625},{x:.546875,y:.265625},{x:.546875,y:.265625},{x:.578125,y:.265625},{x:.578125,y:.265625},{x:.609375,y:.265625},{x:.609375,y:.265625},{x:.640625,y:.265625},{x:.640625,y:.265625},{x:.671875,y:.265625},{x:.671875,y:.265625},{x:.703125,y:.265625},{x:.703125,y:.265625},{x:.734375,y:.265625},{x:.734375,y:.265625},{x:.765625,y:.265625},{x:.765625,y:.265625},{x:.796875,y:.265625},{x:.796875,y:.265625},{x:.828125,y:.265625},{x:.828125,y:.265625},{x:.859375,y:.265625},{x:.859375,y:.265625},{x:.890625,y:.265625},{x:.890625,y:.265625},{x:.921875,y:.265625},{x:.921875,y:.265625},{x:.953125,y:.265625},{x:.953125,y:.265625},{x:.984375,y:.265625},{x:.984375,y:.265625},{x:.015625,y:.296875},{x:.015625,y:.296875},{x:.046875,y:.296875},{x:.046875,y:.296875},{x:.078125,y:.296875},{x:.078125,y:.296875},{x:.109375,y:.296875},{x:.109375,y:.296875},{x:.140625,y:.296875},{x:.140625,y:.296875},{x:.171875,y:.296875},{x:.171875,y:.296875},{x:.203125,y:.296875},{x:.203125,y:.296875},{x:.234375,y:.296875},{x:.234375,y:.296875},{x:.265625,y:.296875},{x:.265625,y:.296875},{x:.296875,y:.296875},{x:.296875,y:.296875},{x:.328125,y:.296875},{x:.328125,y:.296875},{x:.359375,y:.296875},{x:.359375,y:.296875},{x:.390625,y:.296875},{x:.390625,y:.296875},{x:.421875,y:.296875},{x:.421875,y:.296875},{x:.453125,y:.296875},{x:.453125,y:.296875},{x:.484375,y:.296875},{x:.484375,y:.296875},{x:.515625,y:.296875},{x:.515625,y:.296875},{x:.546875,y:.296875},{x:.546875,y:.296875},{x:.578125,y:.296875},{x:.578125,y:.296875},{x:.609375,y:.296875},{x:.609375,y:.296875},{x:.640625,y:.296875},{x:.640625,y:.296875},{x:.671875,y:.296875},{x:.671875,y:.296875},{x:.703125,y:.296875},{x:.703125,y:.296875},{x:.734375,y:.296875},{x:.734375,y:.296875},{x:.765625,y:.296875},{x:.765625,y:.296875},{x:.796875,y:.296875},{x:.796875,y:.296875},{x:.828125,y:.296875},{x:.828125,y:.296875},{x:.859375,y:.296875},{x:.859375,y:.296875},{x:.890625,y:.296875},{x:.890625,y:.296875},{x:.921875,y:.296875},{x:.921875,y:.296875},{x:.953125,y:.296875},{x:.953125,y:.296875},{x:.984375,y:.296875},{x:.984375,y:.296875},{x:.015625,y:.328125},{x:.015625,y:.328125},{x:.046875,y:.328125},{x:.046875,y:.328125},{x:.078125,y:.328125},{x:.078125,y:.328125},{x:.109375,y:.328125},{x:.109375,y:.328125},{x:.140625,y:.328125},{x:.140625,y:.328125},{x:.171875,y:.328125},{x:.171875,y:.328125},{x:.203125,y:.328125},{x:.203125,y:.328125},{x:.234375,y:.328125},{x:.234375,y:.328125},{x:.265625,y:.328125},{x:.265625,y:.328125},{x:.296875,y:.328125},{x:.296875,y:.328125},{x:.328125,y:.328125},{x:.328125,y:.328125},{x:.359375,y:.328125},{x:.359375,y:.328125},{x:.390625,y:.328125},{x:.390625,y:.328125},{x:.421875,y:.328125},{x:.421875,y:.328125},{x:.453125,y:.328125},{x:.453125,y:.328125},{x:.484375,y:.328125},{x:.484375,y:.328125},{x:.515625,y:.328125},{x:.515625,y:.328125},{x:.546875,y:.328125},{x:.546875,y:.328125},{x:.578125,y:.328125},{x:.578125,y:.328125},{x:.609375,y:.328125},{x:.609375,y:.328125},{x:.640625,y:.328125},{x:.640625,y:.328125},{x:.671875,y:.328125},{x:.671875,y:.328125},{x:.703125,y:.328125},{x:.703125,y:.328125},{x:.734375,y:.328125},{x:.734375,y:.328125},{x:.765625,y:.328125},{x:.765625,y:.328125},{x:.796875,y:.328125},{x:.796875,y:.328125},{x:.828125,y:.328125},{x:.828125,y:.328125},{x:.859375,y:.328125},{x:.859375,y:.328125},{x:.890625,y:.328125},{x:.890625,y:.328125},{x:.921875,y:.328125},{x:.921875,y:.328125},{x:.953125,y:.328125},{x:.953125,y:.328125},{x:.984375,y:.328125},{x:.984375,y:.328125},{x:.015625,y:.359375},{x:.015625,y:.359375},{x:.046875,y:.359375},{x:.046875,y:.359375},{x:.078125,y:.359375},{x:.078125,y:.359375},{x:.109375,y:.359375},{x:.109375,y:.359375},{x:.140625,y:.359375},{x:.140625,y:.359375},{x:.171875,y:.359375},{x:.171875,y:.359375},{x:.203125,y:.359375},{x:.203125,y:.359375},{x:.234375,y:.359375},{x:.234375,y:.359375},{x:.265625,y:.359375},{x:.265625,y:.359375},{x:.296875,y:.359375},{x:.296875,y:.359375},{x:.328125,y:.359375},{x:.328125,y:.359375},{x:.359375,y:.359375},{x:.359375,y:.359375},{x:.390625,y:.359375},{x:.390625,y:.359375},{x:.421875,y:.359375},{x:.421875,y:.359375},{x:.453125,y:.359375},{x:.453125,y:.359375},{x:.484375,y:.359375},{x:.484375,y:.359375},{x:.515625,y:.359375},{x:.515625,y:.359375},{x:.546875,y:.359375},{x:.546875,y:.359375},{x:.578125,y:.359375},{x:.578125,y:.359375},{x:.609375,y:.359375},{x:.609375,y:.359375},{x:.640625,y:.359375},{x:.640625,y:.359375},{x:.671875,y:.359375},{x:.671875,y:.359375},{x:.703125,y:.359375},{x:.703125,y:.359375},{x:.734375,y:.359375},{x:.734375,y:.359375},{x:.765625,y:.359375},{x:.765625,y:.359375},{x:.796875,y:.359375},{x:.796875,y:.359375},{x:.828125,y:.359375},{x:.828125,y:.359375},{x:.859375,y:.359375},{x:.859375,y:.359375},{x:.890625,y:.359375},{x:.890625,y:.359375},{x:.921875,y:.359375},{x:.921875,y:.359375},{x:.953125,y:.359375},{x:.953125,y:.359375},{x:.984375,y:.359375},{x:.984375,y:.359375},{x:.015625,y:.390625},{x:.015625,y:.390625},{x:.046875,y:.390625},{x:.046875,y:.390625},{x:.078125,y:.390625},{x:.078125,y:.390625},{x:.109375,y:.390625},{x:.109375,y:.390625},{x:.140625,y:.390625},{x:.140625,y:.390625},{x:.171875,y:.390625},{x:.171875,y:.390625},{x:.203125,y:.390625},{x:.203125,y:.390625},{x:.234375,y:.390625},{x:.234375,y:.390625},{x:.265625,y:.390625},{x:.265625,y:.390625},{x:.296875,y:.390625},{x:.296875,y:.390625},{x:.328125,y:.390625},{x:.328125,y:.390625},{x:.359375,y:.390625},{x:.359375,y:.390625},{x:.390625,y:.390625},{x:.390625,y:.390625},{x:.421875,y:.390625},{x:.421875,y:.390625},{x:.453125,y:.390625},{x:.453125,y:.390625},{x:.484375,y:.390625},{x:.484375,y:.390625},{x:.515625,y:.390625},{x:.515625,y:.390625},{x:.546875,y:.390625},{x:.546875,y:.390625},{x:.578125,y:.390625},{x:.578125,y:.390625},{x:.609375,y:.390625},{x:.609375,y:.390625},{x:.640625,y:.390625},{x:.640625,y:.390625},{x:.671875,y:.390625},{x:.671875,y:.390625},{x:.703125,y:.390625},{x:.703125,y:.390625},{x:.734375,y:.390625},{x:.734375,y:.390625},{x:.765625,y:.390625},{x:.765625,y:.390625},{x:.796875,y:.390625},{x:.796875,y:.390625},{x:.828125,y:.390625},{x:.828125,y:.390625},{x:.859375,y:.390625},{x:.859375,y:.390625},{x:.890625,y:.390625},{x:.890625,y:.390625},{x:.921875,y:.390625},{x:.921875,y:.390625},{x:.953125,y:.390625},{x:.953125,y:.390625},{x:.984375,y:.390625},{x:.984375,y:.390625},{x:.015625,y:.421875},{x:.015625,y:.421875},{x:.046875,y:.421875},{x:.046875,y:.421875},{x:.078125,y:.421875},{x:.078125,y:.421875},{x:.109375,y:.421875},{x:.109375,y:.421875},{x:.140625,y:.421875},{x:.140625,y:.421875},{x:.171875,y:.421875},{x:.171875,y:.421875},{x:.203125,y:.421875},{x:.203125,y:.421875},{x:.234375,y:.421875},{x:.234375,y:.421875},{x:.265625,y:.421875},{x:.265625,y:.421875},{x:.296875,y:.421875},{x:.296875,y:.421875},{x:.328125,y:.421875},{x:.328125,y:.421875},{x:.359375,y:.421875},{x:.359375,y:.421875},{x:.390625,y:.421875},{x:.390625,y:.421875},{x:.421875,y:.421875},{x:.421875,y:.421875},{x:.453125,y:.421875},{x:.453125,y:.421875},{x:.484375,y:.421875},{x:.484375,y:.421875},{x:.515625,y:.421875},{x:.515625,y:.421875},{x:.546875,y:.421875},{x:.546875,y:.421875},{x:.578125,y:.421875},{x:.578125,y:.421875},{x:.609375,y:.421875},{x:.609375,y:.421875},{x:.640625,y:.421875},{x:.640625,y:.421875},{x:.671875,y:.421875},{x:.671875,y:.421875},{x:.703125,y:.421875},{x:.703125,y:.421875},{x:.734375,y:.421875},{x:.734375,y:.421875},{x:.765625,y:.421875},{x:.765625,y:.421875},{x:.796875,y:.421875},{x:.796875,y:.421875},{x:.828125,y:.421875},{x:.828125,y:.421875},{x:.859375,y:.421875},{x:.859375,y:.421875},{x:.890625,y:.421875},{x:.890625,y:.421875},{x:.921875,y:.421875},{x:.921875,y:.421875},{x:.953125,y:.421875},{x:.953125,y:.421875},{x:.984375,y:.421875},{x:.984375,y:.421875},{x:.015625,y:.453125},{x:.015625,y:.453125},{x:.046875,y:.453125},{x:.046875,y:.453125},{x:.078125,y:.453125},{x:.078125,y:.453125},{x:.109375,y:.453125},{x:.109375,y:.453125},{x:.140625,y:.453125},{x:.140625,y:.453125},{x:.171875,y:.453125},{x:.171875,y:.453125},{x:.203125,y:.453125},{x:.203125,y:.453125},{x:.234375,y:.453125},{x:.234375,y:.453125},{x:.265625,y:.453125},{x:.265625,y:.453125},{x:.296875,y:.453125},{x:.296875,y:.453125},{x:.328125,y:.453125},{x:.328125,y:.453125},{x:.359375,y:.453125},{x:.359375,y:.453125},{x:.390625,y:.453125},{x:.390625,y:.453125},{x:.421875,y:.453125},{x:.421875,y:.453125},{x:.453125,y:.453125},{x:.453125,y:.453125},{x:.484375,y:.453125},{x:.484375,y:.453125},{x:.515625,y:.453125},{x:.515625,y:.453125},{x:.546875,y:.453125},{x:.546875,y:.453125},{x:.578125,y:.453125},{x:.578125,y:.453125},{x:.609375,y:.453125},{x:.609375,y:.453125},{x:.640625,y:.453125},{x:.640625,y:.453125},{x:.671875,y:.453125},{x:.671875,y:.453125},{x:.703125,y:.453125},{x:.703125,y:.453125},{x:.734375,y:.453125},{x:.734375,y:.453125},{x:.765625,y:.453125},{x:.765625,y:.453125},{x:.796875,y:.453125},{x:.796875,y:.453125},{x:.828125,y:.453125},{x:.828125,y:.453125},{x:.859375,y:.453125},{x:.859375,y:.453125},{x:.890625,y:.453125},{x:.890625,y:.453125},{x:.921875,y:.453125},{x:.921875,y:.453125},{x:.953125,y:.453125},{x:.953125,y:.453125},{x:.984375,y:.453125},{x:.984375,y:.453125},{x:.015625,y:.484375},{x:.015625,y:.484375},{x:.046875,y:.484375},{x:.046875,y:.484375},{x:.078125,y:.484375},{x:.078125,y:.484375},{x:.109375,y:.484375},{x:.109375,y:.484375},{x:.140625,y:.484375},{x:.140625,y:.484375},{x:.171875,y:.484375},{x:.171875,y:.484375},{x:.203125,y:.484375},{x:.203125,y:.484375},{x:.234375,y:.484375},{x:.234375,y:.484375},{x:.265625,y:.484375},{x:.265625,y:.484375},{x:.296875,y:.484375},{x:.296875,y:.484375},{x:.328125,y:.484375},{x:.328125,y:.484375},{x:.359375,y:.484375},{x:.359375,y:.484375},{x:.390625,y:.484375},{x:.390625,y:.484375},{x:.421875,y:.484375},{x:.421875,y:.484375},{x:.453125,y:.484375},{x:.453125,y:.484375},{x:.484375,y:.484375},{x:.484375,y:.484375},{x:.515625,y:.484375},{x:.515625,y:.484375},{x:.546875,y:.484375},{x:.546875,y:.484375},{x:.578125,y:.484375},{x:.578125,y:.484375},{x:.609375,y:.484375},{x:.609375,y:.484375},{x:.640625,y:.484375},{x:.640625,y:.484375},{x:.671875,y:.484375},{x:.671875,y:.484375},{x:.703125,y:.484375},{x:.703125,y:.484375},{x:.734375,y:.484375},{x:.734375,y:.484375},{x:.765625,y:.484375},{x:.765625,y:.484375},{x:.796875,y:.484375},{x:.796875,y:.484375},{x:.828125,y:.484375},{x:.828125,y:.484375},{x:.859375,y:.484375},{x:.859375,y:.484375},{x:.890625,y:.484375},{x:.890625,y:.484375},{x:.921875,y:.484375},{x:.921875,y:.484375},{x:.953125,y:.484375},{x:.953125,y:.484375},{x:.984375,y:.484375},{x:.984375,y:.484375},{x:.015625,y:.515625},{x:.015625,y:.515625},{x:.046875,y:.515625},{x:.046875,y:.515625},{x:.078125,y:.515625},{x:.078125,y:.515625},{x:.109375,y:.515625},{x:.109375,y:.515625},{x:.140625,y:.515625},{x:.140625,y:.515625},{x:.171875,y:.515625},{x:.171875,y:.515625},{x:.203125,y:.515625},{x:.203125,y:.515625},{x:.234375,y:.515625},{x:.234375,y:.515625},{x:.265625,y:.515625},{x:.265625,y:.515625},{x:.296875,y:.515625},{x:.296875,y:.515625},{x:.328125,y:.515625},{x:.328125,y:.515625},{x:.359375,y:.515625},{x:.359375,y:.515625},{x:.390625,y:.515625},{x:.390625,y:.515625},{x:.421875,y:.515625},{x:.421875,y:.515625},{x:.453125,y:.515625},{x:.453125,y:.515625},{x:.484375,y:.515625},{x:.484375,y:.515625},{x:.515625,y:.515625},{x:.515625,y:.515625},{x:.546875,y:.515625},{x:.546875,y:.515625},{x:.578125,y:.515625},{x:.578125,y:.515625},{x:.609375,y:.515625},{x:.609375,y:.515625},{x:.640625,y:.515625},{x:.640625,y:.515625},{x:.671875,y:.515625},{x:.671875,y:.515625},{x:.703125,y:.515625},{x:.703125,y:.515625},{x:.734375,y:.515625},{x:.734375,y:.515625},{x:.765625,y:.515625},{x:.765625,y:.515625},{x:.796875,y:.515625},{x:.796875,y:.515625},{x:.828125,y:.515625},{x:.828125,y:.515625},{x:.859375,y:.515625},{x:.859375,y:.515625},{x:.890625,y:.515625},{x:.890625,y:.515625},{x:.921875,y:.515625},{x:.921875,y:.515625},{x:.953125,y:.515625},{x:.953125,y:.515625},{x:.984375,y:.515625},{x:.984375,y:.515625},{x:.015625,y:.546875},{x:.015625,y:.546875},{x:.046875,y:.546875},{x:.046875,y:.546875},{x:.078125,y:.546875},{x:.078125,y:.546875},{x:.109375,y:.546875},{x:.109375,y:.546875},{x:.140625,y:.546875},{x:.140625,y:.546875},{x:.171875,y:.546875},{x:.171875,y:.546875},{x:.203125,y:.546875},{x:.203125,y:.546875},{x:.234375,y:.546875},{x:.234375,y:.546875},{x:.265625,y:.546875},{x:.265625,y:.546875},{x:.296875,y:.546875},{x:.296875,y:.546875},{x:.328125,y:.546875},{x:.328125,y:.546875},{x:.359375,y:.546875},{x:.359375,y:.546875},{x:.390625,y:.546875},{x:.390625,y:.546875},{x:.421875,y:.546875},{x:.421875,y:.546875},{x:.453125,y:.546875},{x:.453125,y:.546875},{x:.484375,y:.546875},{x:.484375,y:.546875},{x:.515625,y:.546875},{x:.515625,y:.546875},{x:.546875,y:.546875},{x:.546875,y:.546875},{x:.578125,y:.546875},{x:.578125,y:.546875},{x:.609375,y:.546875},{x:.609375,y:.546875},{x:.640625,y:.546875},{x:.640625,y:.546875},{x:.671875,y:.546875},{x:.671875,y:.546875},{x:.703125,y:.546875},{x:.703125,y:.546875},{x:.734375,y:.546875},{x:.734375,y:.546875},{x:.765625,y:.546875},{x:.765625,y:.546875},{x:.796875,y:.546875},{x:.796875,y:.546875},{x:.828125,y:.546875},{x:.828125,y:.546875},{x:.859375,y:.546875},{x:.859375,y:.546875},{x:.890625,y:.546875},{x:.890625,y:.546875},{x:.921875,y:.546875},{x:.921875,y:.546875},{x:.953125,y:.546875},{x:.953125,y:.546875},{x:.984375,y:.546875},{x:.984375,y:.546875},{x:.015625,y:.578125},{x:.015625,y:.578125},{x:.046875,y:.578125},{x:.046875,y:.578125},{x:.078125,y:.578125},{x:.078125,y:.578125},{x:.109375,y:.578125},{x:.109375,y:.578125},{x:.140625,y:.578125},{x:.140625,y:.578125},{x:.171875,y:.578125},{x:.171875,y:.578125},{x:.203125,y:.578125},{x:.203125,y:.578125},{x:.234375,y:.578125},{x:.234375,y:.578125},{x:.265625,y:.578125},{x:.265625,y:.578125},{x:.296875,y:.578125},{x:.296875,y:.578125},{x:.328125,y:.578125},{x:.328125,y:.578125},{x:.359375,y:.578125},{x:.359375,y:.578125},{x:.390625,y:.578125},{x:.390625,y:.578125},{x:.421875,y:.578125},{x:.421875,y:.578125},{x:.453125,y:.578125},{x:.453125,y:.578125},{x:.484375,y:.578125},{x:.484375,y:.578125},{x:.515625,y:.578125},{x:.515625,y:.578125},{x:.546875,y:.578125},{x:.546875,y:.578125},{x:.578125,y:.578125},{x:.578125,y:.578125},{x:.609375,y:.578125},{x:.609375,y:.578125},{x:.640625,y:.578125},{x:.640625,y:.578125},{x:.671875,y:.578125},{x:.671875,y:.578125},{x:.703125,y:.578125},{x:.703125,y:.578125},{x:.734375,y:.578125},{x:.734375,y:.578125},{x:.765625,y:.578125},{x:.765625,y:.578125},{x:.796875,y:.578125},{x:.796875,y:.578125},{x:.828125,y:.578125},{x:.828125,y:.578125},{x:.859375,y:.578125},{x:.859375,y:.578125},{x:.890625,y:.578125},{x:.890625,y:.578125},{x:.921875,y:.578125},{x:.921875,y:.578125},{x:.953125,y:.578125},{x:.953125,y:.578125},{x:.984375,y:.578125},{x:.984375,y:.578125},{x:.015625,y:.609375},{x:.015625,y:.609375},{x:.046875,y:.609375},{x:.046875,y:.609375},{x:.078125,y:.609375},{x:.078125,y:.609375},{x:.109375,y:.609375},{x:.109375,y:.609375},{x:.140625,y:.609375},{x:.140625,y:.609375},{x:.171875,y:.609375},{x:.171875,y:.609375},{x:.203125,y:.609375},{x:.203125,y:.609375},{x:.234375,y:.609375},{x:.234375,y:.609375},{x:.265625,y:.609375},{x:.265625,y:.609375},{x:.296875,y:.609375},{x:.296875,y:.609375},{x:.328125,y:.609375},{x:.328125,y:.609375},{x:.359375,y:.609375},{x:.359375,y:.609375},{x:.390625,y:.609375},{x:.390625,y:.609375},{x:.421875,y:.609375},{x:.421875,y:.609375},{x:.453125,y:.609375},{x:.453125,y:.609375},{x:.484375,y:.609375},{x:.484375,y:.609375},{x:.515625,y:.609375},{x:.515625,y:.609375},{x:.546875,y:.609375},{x:.546875,y:.609375},{x:.578125,y:.609375},{x:.578125,y:.609375},{x:.609375,y:.609375},{x:.609375,y:.609375},{x:.640625,y:.609375},{x:.640625,y:.609375},{x:.671875,y:.609375},{x:.671875,y:.609375},{x:.703125,y:.609375},{x:.703125,y:.609375},{x:.734375,y:.609375},{x:.734375,y:.609375},{x:.765625,y:.609375},{x:.765625,y:.609375},{x:.796875,y:.609375},{x:.796875,y:.609375},{x:.828125,y:.609375},{x:.828125,y:.609375},{x:.859375,y:.609375},{x:.859375,y:.609375},{x:.890625,y:.609375},{x:.890625,y:.609375},{x:.921875,y:.609375},{x:.921875,y:.609375},{x:.953125,y:.609375},{x:.953125,y:.609375},{x:.984375,y:.609375},{x:.984375,y:.609375},{x:.015625,y:.640625},{x:.015625,y:.640625},{x:.046875,y:.640625},{x:.046875,y:.640625},{x:.078125,y:.640625},{x:.078125,y:.640625},{x:.109375,y:.640625},{x:.109375,y:.640625},{x:.140625,y:.640625},{x:.140625,y:.640625},{x:.171875,y:.640625},{x:.171875,y:.640625},{x:.203125,y:.640625},{x:.203125,y:.640625},{x:.234375,y:.640625},{x:.234375,y:.640625},{x:.265625,y:.640625},{x:.265625,y:.640625},{x:.296875,y:.640625},{x:.296875,y:.640625},{x:.328125,y:.640625},{x:.328125,y:.640625},{x:.359375,y:.640625},{x:.359375,y:.640625},{x:.390625,y:.640625},{x:.390625,y:.640625},{x:.421875,y:.640625},{x:.421875,y:.640625},{x:.453125,y:.640625},{x:.453125,y:.640625},{x:.484375,y:.640625},{x:.484375,y:.640625},{x:.515625,y:.640625},{x:.515625,y:.640625},{x:.546875,y:.640625},{x:.546875,y:.640625},{x:.578125,y:.640625},{x:.578125,y:.640625},{x:.609375,y:.640625},{x:.609375,y:.640625},{x:.640625,y:.640625},{x:.640625,y:.640625},{x:.671875,y:.640625},{x:.671875,y:.640625},{x:.703125,y:.640625},{x:.703125,y:.640625},{x:.734375,y:.640625},{x:.734375,y:.640625},{x:.765625,y:.640625},{x:.765625,y:.640625},{x:.796875,y:.640625},{x:.796875,y:.640625},{x:.828125,y:.640625},{x:.828125,y:.640625},{x:.859375,y:.640625},{x:.859375,y:.640625},{x:.890625,y:.640625},{x:.890625,y:.640625},{x:.921875,y:.640625},{x:.921875,y:.640625},{x:.953125,y:.640625},{x:.953125,y:.640625},{x:.984375,y:.640625},{x:.984375,y:.640625},{x:.015625,y:.671875},{x:.015625,y:.671875},{x:.046875,y:.671875},{x:.046875,y:.671875},{x:.078125,y:.671875},{x:.078125,y:.671875},{x:.109375,y:.671875},{x:.109375,y:.671875},{x:.140625,y:.671875},{x:.140625,y:.671875},{x:.171875,y:.671875},{x:.171875,y:.671875},{x:.203125,y:.671875},{x:.203125,y:.671875},{x:.234375,y:.671875},{x:.234375,y:.671875},{x:.265625,y:.671875},{x:.265625,y:.671875},{x:.296875,y:.671875},{x:.296875,y:.671875},{x:.328125,y:.671875},{x:.328125,y:.671875},{x:.359375,y:.671875},{x:.359375,y:.671875},{x:.390625,y:.671875},{x:.390625,y:.671875},{x:.421875,y:.671875},{x:.421875,y:.671875},{x:.453125,y:.671875},{x:.453125,y:.671875},{x:.484375,y:.671875},{x:.484375,y:.671875},{x:.515625,y:.671875},{x:.515625,y:.671875},{x:.546875,y:.671875},{x:.546875,y:.671875},{x:.578125,y:.671875},{x:.578125,y:.671875},{x:.609375,y:.671875},{x:.609375,y:.671875},{x:.640625,y:.671875},{x:.640625,y:.671875},{x:.671875,y:.671875},{x:.671875,y:.671875},{x:.703125,y:.671875},{x:.703125,y:.671875},{x:.734375,y:.671875},{x:.734375,y:.671875},{x:.765625,y:.671875},{x:.765625,y:.671875},{x:.796875,y:.671875},{x:.796875,y:.671875},{x:.828125,y:.671875},{x:.828125,y:.671875},{x:.859375,y:.671875},{x:.859375,y:.671875},{x:.890625,y:.671875},{x:.890625,y:.671875},{x:.921875,y:.671875},{x:.921875,y:.671875},{x:.953125,y:.671875},{x:.953125,y:.671875},{x:.984375,y:.671875},{x:.984375,y:.671875},{x:.015625,y:.703125},{x:.015625,y:.703125},{x:.046875,y:.703125},{x:.046875,y:.703125},{x:.078125,y:.703125},{x:.078125,y:.703125},{x:.109375,y:.703125},{x:.109375,y:.703125},{x:.140625,y:.703125},{x:.140625,y:.703125},{x:.171875,y:.703125},{x:.171875,y:.703125},{x:.203125,y:.703125},{x:.203125,y:.703125},{x:.234375,y:.703125},{x:.234375,y:.703125},{x:.265625,y:.703125},{x:.265625,y:.703125},{x:.296875,y:.703125},{x:.296875,y:.703125},{x:.328125,y:.703125},{x:.328125,y:.703125},{x:.359375,y:.703125},{x:.359375,y:.703125},{x:.390625,y:.703125},{x:.390625,y:.703125},{x:.421875,y:.703125},{x:.421875,y:.703125},{x:.453125,y:.703125},{x:.453125,y:.703125},{x:.484375,y:.703125},{x:.484375,y:.703125},{x:.515625,y:.703125},{x:.515625,y:.703125},{x:.546875,y:.703125},{x:.546875,y:.703125},{x:.578125,y:.703125},{x:.578125,y:.703125},{x:.609375,y:.703125},{x:.609375,y:.703125},{x:.640625,y:.703125},{x:.640625,y:.703125},{x:.671875,y:.703125},{x:.671875,y:.703125},{x:.703125,y:.703125},{x:.703125,y:.703125},{x:.734375,y:.703125},{x:.734375,y:.703125},{x:.765625,y:.703125},{x:.765625,y:.703125},{x:.796875,y:.703125},{x:.796875,y:.703125},{x:.828125,y:.703125},{x:.828125,y:.703125},{x:.859375,y:.703125},{x:.859375,y:.703125},{x:.890625,y:.703125},{x:.890625,y:.703125},{x:.921875,y:.703125},{x:.921875,y:.703125},{x:.953125,y:.703125},{x:.953125,y:.703125},{x:.984375,y:.703125},{x:.984375,y:.703125},{x:.015625,y:.734375},{x:.015625,y:.734375},{x:.046875,y:.734375},{x:.046875,y:.734375},{x:.078125,y:.734375},{x:.078125,y:.734375},{x:.109375,y:.734375},{x:.109375,y:.734375},{x:.140625,y:.734375},{x:.140625,y:.734375},{x:.171875,y:.734375},{x:.171875,y:.734375},{x:.203125,y:.734375},{x:.203125,y:.734375},{x:.234375,y:.734375},{x:.234375,y:.734375},{x:.265625,y:.734375},{x:.265625,y:.734375},{x:.296875,y:.734375},{x:.296875,y:.734375},{x:.328125,y:.734375},{x:.328125,y:.734375},{x:.359375,y:.734375},{x:.359375,y:.734375},{x:.390625,y:.734375},{x:.390625,y:.734375},{x:.421875,y:.734375},{x:.421875,y:.734375},{x:.453125,y:.734375},{x:.453125,y:.734375},{x:.484375,y:.734375},{x:.484375,y:.734375},{x:.515625,y:.734375},{x:.515625,y:.734375},{x:.546875,y:.734375},{x:.546875,y:.734375},{x:.578125,y:.734375},{x:.578125,y:.734375},{x:.609375,y:.734375},{x:.609375,y:.734375},{x:.640625,y:.734375},{x:.640625,y:.734375},{x:.671875,y:.734375},{x:.671875,y:.734375},{x:.703125,y:.734375},{x:.703125,y:.734375},{x:.734375,y:.734375},{x:.734375,y:.734375},{x:.765625,y:.734375},{x:.765625,y:.734375},{x:.796875,y:.734375},{x:.796875,y:.734375},{x:.828125,y:.734375},{x:.828125,y:.734375},{x:.859375,y:.734375},{x:.859375,y:.734375},{x:.890625,y:.734375},{x:.890625,y:.734375},{x:.921875,y:.734375},{x:.921875,y:.734375},{x:.953125,y:.734375},{x:.953125,y:.734375},{x:.984375,y:.734375},{x:.984375,y:.734375},{x:.015625,y:.765625},{x:.015625,y:.765625},{x:.046875,y:.765625},{x:.046875,y:.765625},{x:.078125,y:.765625},{x:.078125,y:.765625},{x:.109375,y:.765625},{x:.109375,y:.765625},{x:.140625,y:.765625},{x:.140625,y:.765625},{x:.171875,y:.765625},{x:.171875,y:.765625},{x:.203125,y:.765625},{x:.203125,y:.765625},{x:.234375,y:.765625},{x:.234375,y:.765625},{x:.265625,y:.765625},{x:.265625,y:.765625},{x:.296875,y:.765625},{x:.296875,y:.765625},{x:.328125,y:.765625},{x:.328125,y:.765625},{x:.359375,y:.765625},{x:.359375,y:.765625},{x:.390625,y:.765625},{x:.390625,y:.765625},{x:.421875,y:.765625},{x:.421875,y:.765625},{x:.453125,y:.765625},{x:.453125,y:.765625},{x:.484375,y:.765625},{x:.484375,y:.765625},{x:.515625,y:.765625},{x:.515625,y:.765625},{x:.546875,y:.765625},{x:.546875,y:.765625},{x:.578125,y:.765625},{x:.578125,y:.765625},{x:.609375,y:.765625},{x:.609375,y:.765625},{x:.640625,y:.765625},{x:.640625,y:.765625},{x:.671875,y:.765625},{x:.671875,y:.765625},{x:.703125,y:.765625},{x:.703125,y:.765625},{x:.734375,y:.765625},{x:.734375,y:.765625},{x:.765625,y:.765625},{x:.765625,y:.765625},{x:.796875,y:.765625},{x:.796875,y:.765625},{x:.828125,y:.765625},{x:.828125,y:.765625},{x:.859375,y:.765625},{x:.859375,y:.765625},{x:.890625,y:.765625},{x:.890625,y:.765625},{x:.921875,y:.765625},{x:.921875,y:.765625},{x:.953125,y:.765625},{x:.953125,y:.765625},{x:.984375,y:.765625},{x:.984375,y:.765625},{x:.015625,y:.796875},{x:.015625,y:.796875},{x:.046875,y:.796875},{x:.046875,y:.796875},{x:.078125,y:.796875},{x:.078125,y:.796875},{x:.109375,y:.796875},{x:.109375,y:.796875},{x:.140625,y:.796875},{x:.140625,y:.796875},{x:.171875,y:.796875},{x:.171875,y:.796875},{x:.203125,y:.796875},{x:.203125,y:.796875},{x:.234375,y:.796875},{x:.234375,y:.796875},{x:.265625,y:.796875},{x:.265625,y:.796875},{x:.296875,y:.796875},{x:.296875,y:.796875},{x:.328125,y:.796875},{x:.328125,y:.796875},{x:.359375,y:.796875},{x:.359375,y:.796875},{x:.390625,y:.796875},{x:.390625,y:.796875},{x:.421875,y:.796875},{x:.421875,y:.796875},{x:.453125,y:.796875},{x:.453125,y:.796875},{x:.484375,y:.796875},{x:.484375,y:.796875},{x:.515625,y:.796875},{x:.515625,y:.796875},{x:.546875,y:.796875},{x:.546875,y:.796875},{x:.578125,y:.796875},{x:.578125,y:.796875},{x:.609375,y:.796875},{x:.609375,y:.796875},{x:.640625,y:.796875},{x:.640625,y:.796875},{x:.671875,y:.796875},{x:.671875,y:.796875},{x:.703125,y:.796875},{x:.703125,y:.796875},{x:.734375,y:.796875},{x:.734375,y:.796875},{x:.765625,y:.796875},{x:.765625,y:.796875},{x:.796875,y:.796875},{x:.796875,y:.796875},{x:.828125,y:.796875},{x:.828125,y:.796875},{x:.859375,y:.796875},{x:.859375,y:.796875},{x:.890625,y:.796875},{x:.890625,y:.796875},{x:.921875,y:.796875},{x:.921875,y:.796875},{x:.953125,y:.796875},{x:.953125,y:.796875},{x:.984375,y:.796875},{x:.984375,y:.796875},{x:.015625,y:.828125},{x:.015625,y:.828125},{x:.046875,y:.828125},{x:.046875,y:.828125},{x:.078125,y:.828125},{x:.078125,y:.828125},{x:.109375,y:.828125},{x:.109375,y:.828125},{x:.140625,y:.828125},{x:.140625,y:.828125},{x:.171875,y:.828125},{x:.171875,y:.828125},{x:.203125,y:.828125},{x:.203125,y:.828125},{x:.234375,y:.828125},{x:.234375,y:.828125},{x:.265625,y:.828125},{x:.265625,y:.828125},{x:.296875,y:.828125},{x:.296875,y:.828125},{x:.328125,y:.828125},{x:.328125,y:.828125},{x:.359375,y:.828125},{x:.359375,y:.828125},{x:.390625,y:.828125},{x:.390625,y:.828125},{x:.421875,y:.828125},{x:.421875,y:.828125},{x:.453125,y:.828125},{x:.453125,y:.828125},{x:.484375,y:.828125},{x:.484375,y:.828125},{x:.515625,y:.828125},{x:.515625,y:.828125},{x:.546875,y:.828125},{x:.546875,y:.828125},{x:.578125,y:.828125},{x:.578125,y:.828125},{x:.609375,y:.828125},{x:.609375,y:.828125},{x:.640625,y:.828125},{x:.640625,y:.828125},{x:.671875,y:.828125},{x:.671875,y:.828125},{x:.703125,y:.828125},{x:.703125,y:.828125},{x:.734375,y:.828125},{x:.734375,y:.828125},{x:.765625,y:.828125},{x:.765625,y:.828125},{x:.796875,y:.828125},{x:.796875,y:.828125},{x:.828125,y:.828125},{x:.828125,y:.828125},{x:.859375,y:.828125},{x:.859375,y:.828125},{x:.890625,y:.828125},{x:.890625,y:.828125},{x:.921875,y:.828125},{x:.921875,y:.828125},{x:.953125,y:.828125},{x:.953125,y:.828125},{x:.984375,y:.828125},{x:.984375,y:.828125},{x:.015625,y:.859375},{x:.015625,y:.859375},{x:.046875,y:.859375},{x:.046875,y:.859375},{x:.078125,y:.859375},{x:.078125,y:.859375},{x:.109375,y:.859375},{x:.109375,y:.859375},{x:.140625,y:.859375},{x:.140625,y:.859375},{x:.171875,y:.859375},{x:.171875,y:.859375},{x:.203125,y:.859375},{x:.203125,y:.859375},{x:.234375,y:.859375},{x:.234375,y:.859375},{x:.265625,y:.859375},{x:.265625,y:.859375},{x:.296875,y:.859375},{x:.296875,y:.859375},{x:.328125,y:.859375},{x:.328125,y:.859375},{x:.359375,y:.859375},{x:.359375,y:.859375},{x:.390625,y:.859375},{x:.390625,y:.859375},{x:.421875,y:.859375},{x:.421875,y:.859375},{x:.453125,y:.859375},{x:.453125,y:.859375},{x:.484375,y:.859375},{x:.484375,y:.859375},{x:.515625,y:.859375},{x:.515625,y:.859375},{x:.546875,y:.859375},{x:.546875,y:.859375},{x:.578125,y:.859375},{x:.578125,y:.859375},{x:.609375,y:.859375},{x:.609375,y:.859375},{x:.640625,y:.859375},{x:.640625,y:.859375},{x:.671875,y:.859375},{x:.671875,y:.859375},{x:.703125,y:.859375},{x:.703125,y:.859375},{x:.734375,y:.859375},{x:.734375,y:.859375},{x:.765625,y:.859375},{x:.765625,y:.859375},{x:.796875,y:.859375},{x:.796875,y:.859375},{x:.828125,y:.859375},{x:.828125,y:.859375},{x:.859375,y:.859375},{x:.859375,y:.859375},{x:.890625,y:.859375},{x:.890625,y:.859375},{x:.921875,y:.859375},{x:.921875,y:.859375},{x:.953125,y:.859375},{x:.953125,y:.859375},{x:.984375,y:.859375},{x:.984375,y:.859375},{x:.015625,y:.890625},{x:.015625,y:.890625},{x:.046875,y:.890625},{x:.046875,y:.890625},{x:.078125,y:.890625},{x:.078125,y:.890625},{x:.109375,y:.890625},{x:.109375,y:.890625},{x:.140625,y:.890625},{x:.140625,y:.890625},{x:.171875,y:.890625},{x:.171875,y:.890625},{x:.203125,y:.890625},{x:.203125,y:.890625},{x:.234375,y:.890625},{x:.234375,y:.890625},{x:.265625,y:.890625},{x:.265625,y:.890625},{x:.296875,y:.890625},{x:.296875,y:.890625},{x:.328125,y:.890625},{x:.328125,y:.890625},{x:.359375,y:.890625},{x:.359375,y:.890625},{x:.390625,y:.890625},{x:.390625,y:.890625},{x:.421875,y:.890625},{x:.421875,y:.890625},{x:.453125,y:.890625},{x:.453125,y:.890625},{x:.484375,y:.890625},{x:.484375,y:.890625},{x:.515625,y:.890625},{x:.515625,y:.890625},{x:.546875,y:.890625},{x:.546875,y:.890625},{x:.578125,y:.890625},{x:.578125,y:.890625},{x:.609375,y:.890625},{x:.609375,y:.890625},{x:.640625,y:.890625},{x:.640625,y:.890625},{x:.671875,y:.890625},{x:.671875,y:.890625},{x:.703125,y:.890625},{x:.703125,y:.890625},{x:.734375,y:.890625},{x:.734375,y:.890625},{x:.765625,y:.890625},{x:.765625,y:.890625},{x:.796875,y:.890625},{x:.796875,y:.890625},{x:.828125,y:.890625},{x:.828125,y:.890625},{x:.859375,y:.890625},{x:.859375,y:.890625},{x:.890625,y:.890625},{x:.890625,y:.890625},{x:.921875,y:.890625},{x:.921875,y:.890625},{x:.953125,y:.890625},{x:.953125,y:.890625},{x:.984375,y:.890625},{x:.984375,y:.890625},{x:.015625,y:.921875},{x:.015625,y:.921875},{x:.046875,y:.921875},{x:.046875,y:.921875},{x:.078125,y:.921875},{x:.078125,y:.921875},{x:.109375,y:.921875},{x:.109375,y:.921875},{x:.140625,y:.921875},{x:.140625,y:.921875},{x:.171875,y:.921875},{x:.171875,y:.921875},{x:.203125,y:.921875},{x:.203125,y:.921875},{x:.234375,y:.921875},{x:.234375,y:.921875},{x:.265625,y:.921875},{x:.265625,y:.921875},{x:.296875,y:.921875},{x:.296875,y:.921875},{x:.328125,y:.921875},{x:.328125,y:.921875},{x:.359375,y:.921875},{x:.359375,y:.921875},{x:.390625,y:.921875},{x:.390625,y:.921875},{x:.421875,y:.921875},{x:.421875,y:.921875},{x:.453125,y:.921875},{x:.453125,y:.921875},{x:.484375,y:.921875},{x:.484375,y:.921875},{x:.515625,y:.921875},{x:.515625,y:.921875},{x:.546875,y:.921875},{x:.546875,y:.921875},{x:.578125,y:.921875},{x:.578125,y:.921875},{x:.609375,y:.921875},{x:.609375,y:.921875},{x:.640625,y:.921875},{x:.640625,y:.921875},{x:.671875,y:.921875},{x:.671875,y:.921875},{x:.703125,y:.921875},{x:.703125,y:.921875},{x:.734375,y:.921875},{x:.734375,y:.921875},{x:.765625,y:.921875},{x:.765625,y:.921875},{x:.796875,y:.921875},{x:.796875,y:.921875},{x:.828125,y:.921875},{x:.828125,y:.921875},{x:.859375,y:.921875},{x:.859375,y:.921875},{x:.890625,y:.921875},{x:.890625,y:.921875},{x:.921875,y:.921875},{x:.921875,y:.921875},{x:.953125,y:.921875},{x:.953125,y:.921875},{x:.984375,y:.921875},{x:.984375,y:.921875},{x:.015625,y:.953125},{x:.015625,y:.953125},{x:.046875,y:.953125},{x:.046875,y:.953125},{x:.078125,y:.953125},{x:.078125,y:.953125},{x:.109375,y:.953125},{x:.109375,y:.953125},{x:.140625,y:.953125},{x:.140625,y:.953125},{x:.171875,y:.953125},{x:.171875,y:.953125},{x:.203125,y:.953125},{x:.203125,y:.953125},{x:.234375,y:.953125},{x:.234375,y:.953125},{x:.265625,y:.953125},{x:.265625,y:.953125},{x:.296875,y:.953125},{x:.296875,y:.953125},{x:.328125,y:.953125},{x:.328125,y:.953125},{x:.359375,y:.953125},{x:.359375,y:.953125},{x:.390625,y:.953125},{x:.390625,y:.953125},{x:.421875,y:.953125},{x:.421875,y:.953125},{x:.453125,y:.953125},{x:.453125,y:.953125},{x:.484375,y:.953125},{x:.484375,y:.953125},{x:.515625,y:.953125},{x:.515625,y:.953125},{x:.546875,y:.953125},{x:.546875,y:.953125},{x:.578125,y:.953125},{x:.578125,y:.953125},{x:.609375,y:.953125},{x:.609375,y:.953125},{x:.640625,y:.953125},{x:.640625,y:.953125},{x:.671875,y:.953125},{x:.671875,y:.953125},{x:.703125,y:.953125},{x:.703125,y:.953125},{x:.734375,y:.953125},{x:.734375,y:.953125},{x:.765625,y:.953125},{x:.765625,y:.953125},{x:.796875,y:.953125},{x:.796875,y:.953125},{x:.828125,y:.953125},{x:.828125,y:.953125},{x:.859375,y:.953125},{x:.859375,y:.953125},{x:.890625,y:.953125},{x:.890625,y:.953125},{x:.921875,y:.953125},{x:.921875,y:.953125},{x:.953125,y:.953125},{x:.953125,y:.953125},{x:.984375,y:.953125},{x:.984375,y:.953125},{x:.015625,y:.984375},{x:.015625,y:.984375},{x:.046875,y:.984375},{x:.046875,y:.984375},{x:.078125,y:.984375},{x:.078125,y:.984375},{x:.109375,y:.984375},{x:.109375,y:.984375},{x:.140625,y:.984375},{x:.140625,y:.984375},{x:.171875,y:.984375},{x:.171875,y:.984375},{x:.203125,y:.984375},{x:.203125,y:.984375},{x:.234375,y:.984375},{x:.234375,y:.984375},{x:.265625,y:.984375},{x:.265625,y:.984375},{x:.296875,y:.984375},{x:.296875,y:.984375},{x:.328125,y:.984375},{x:.328125,y:.984375},{x:.359375,y:.984375},{x:.359375,y:.984375},{x:.390625,y:.984375},{x:.390625,y:.984375},{x:.421875,y:.984375},{x:.421875,y:.984375},{x:.453125,y:.984375},{x:.453125,y:.984375},{x:.484375,y:.984375},{x:.484375,y:.984375},{x:.515625,y:.984375},{x:.515625,y:.984375},{x:.546875,y:.984375},{x:.546875,y:.984375},{x:.578125,y:.984375},{x:.578125,y:.984375},{x:.609375,y:.984375},{x:.609375,y:.984375},{x:.640625,y:.984375},{x:.640625,y:.984375},{x:.671875,y:.984375},{x:.671875,y:.984375},{x:.703125,y:.984375},{x:.703125,y:.984375},{x:.734375,y:.984375},{x:.734375,y:.984375},{x:.765625,y:.984375},{x:.765625,y:.984375},{x:.796875,y:.984375},{x:.796875,y:.984375},{x:.828125,y:.984375},{x:.828125,y:.984375},{x:.859375,y:.984375},{x:.859375,y:.984375},{x:.890625,y:.984375},{x:.890625,y:.984375},{x:.921875,y:.984375},{x:.921875,y:.984375},{x:.953125,y:.984375},{x:.953125,y:.984375},{x:.984375,y:.984375},{x:.984375,y:.984375},{x:.03125,y:.03125},{x:.03125,y:.03125},{x:.09375,y:.03125},{x:.09375,y:.03125},{x:.15625,y:.03125},{x:.15625,y:.03125},{x:.21875,y:.03125},{x:.21875,y:.03125},{x:.28125,y:.03125},{x:.28125,y:.03125},{x:.34375,y:.03125},{x:.34375,y:.03125},{x:.40625,y:.03125},{x:.40625,y:.03125},{x:.46875,y:.03125},{x:.46875,y:.03125},{x:.53125,y:.03125},{x:.53125,y:.03125},{x:.59375,y:.03125},{x:.59375,y:.03125},{x:.65625,y:.03125},{x:.65625,y:.03125},{x:.71875,y:.03125},{x:.71875,y:.03125},{x:.78125,y:.03125},{x:.78125,y:.03125},{x:.84375,y:.03125},{x:.84375,y:.03125},{x:.90625,y:.03125},{x:.90625,y:.03125},{x:.96875,y:.03125},{x:.96875,y:.03125},{x:.03125,y:.09375},{x:.03125,y:.09375},{x:.09375,y:.09375},{x:.09375,y:.09375},{x:.15625,y:.09375},{x:.15625,y:.09375},{x:.21875,y:.09375},{x:.21875,y:.09375},{x:.28125,y:.09375},{x:.28125,y:.09375},{x:.34375,y:.09375},{x:.34375,y:.09375},{x:.40625,y:.09375},{x:.40625,y:.09375},{x:.46875,y:.09375},{x:.46875,y:.09375},{x:.53125,y:.09375},{x:.53125,y:.09375},{x:.59375,y:.09375},{x:.59375,y:.09375},{x:.65625,y:.09375},{x:.65625,y:.09375},{x:.71875,y:.09375},{x:.71875,y:.09375},{x:.78125,y:.09375},{x:.78125,y:.09375},{x:.84375,y:.09375},{x:.84375,y:.09375},{x:.90625,y:.09375},{x:.90625,y:.09375},{x:.96875,y:.09375},{x:.96875,y:.09375},{x:.03125,y:.15625},{x:.03125,y:.15625},{x:.09375,y:.15625},{x:.09375,y:.15625},{x:.15625,y:.15625},{x:.15625,y:.15625},{x:.21875,y:.15625},{x:.21875,y:.15625},{x:.28125,y:.15625},{x:.28125,y:.15625},{x:.34375,y:.15625},{x:.34375,y:.15625},{x:.40625,y:.15625},{x:.40625,y:.15625},{x:.46875,y:.15625},{x:.46875,y:.15625},{x:.53125,y:.15625},{x:.53125,y:.15625},{x:.59375,y:.15625},{x:.59375,y:.15625},{x:.65625,y:.15625},{x:.65625,y:.15625},{x:.71875,y:.15625},{x:.71875,y:.15625},{x:.78125,y:.15625},{x:.78125,y:.15625},{x:.84375,y:.15625},{x:.84375,y:.15625},{x:.90625,y:.15625},{x:.90625,y:.15625},{x:.96875,y:.15625},{x:.96875,y:.15625},{x:.03125,y:.21875},{x:.03125,y:.21875},{x:.09375,y:.21875},{x:.09375,y:.21875},{x:.15625,y:.21875},{x:.15625,y:.21875},{x:.21875,y:.21875},{x:.21875,y:.21875},{x:.28125,y:.21875},{x:.28125,y:.21875},{x:.34375,y:.21875},{x:.34375,y:.21875},{x:.40625,y:.21875},{x:.40625,y:.21875},{x:.46875,y:.21875},{x:.46875,y:.21875},{x:.53125,y:.21875},{x:.53125,y:.21875},{x:.59375,y:.21875},{x:.59375,y:.21875},{x:.65625,y:.21875},{x:.65625,y:.21875},{x:.71875,y:.21875},{x:.71875,y:.21875},{x:.78125,y:.21875},{x:.78125,y:.21875},{x:.84375,y:.21875},{x:.84375,y:.21875},{x:.90625,y:.21875},{x:.90625,y:.21875},{x:.96875,y:.21875},{x:.96875,y:.21875},{x:.03125,y:.28125},{x:.03125,y:.28125},{x:.09375,y:.28125},{x:.09375,y:.28125},{x:.15625,y:.28125},{x:.15625,y:.28125},{x:.21875,y:.28125},{x:.21875,y:.28125},{x:.28125,y:.28125},{x:.28125,y:.28125},{x:.34375,y:.28125},{x:.34375,y:.28125},{x:.40625,y:.28125},{x:.40625,y:.28125},{x:.46875,y:.28125},{x:.46875,y:.28125},{x:.53125,y:.28125},{x:.53125,y:.28125},{x:.59375,y:.28125},{x:.59375,y:.28125},{x:.65625,y:.28125},{x:.65625,y:.28125},{x:.71875,y:.28125},{x:.71875,y:.28125},{x:.78125,y:.28125},{x:.78125,y:.28125},{x:.84375,y:.28125},{x:.84375,y:.28125},{x:.90625,y:.28125},{x:.90625,y:.28125},{x:.96875,y:.28125},{x:.96875,y:.28125},{x:.03125,y:.34375},{x:.03125,y:.34375},{x:.09375,y:.34375},{x:.09375,y:.34375},{x:.15625,y:.34375},{x:.15625,y:.34375},{x:.21875,y:.34375},{x:.21875,y:.34375},{x:.28125,y:.34375},{x:.28125,y:.34375},{x:.34375,y:.34375},{x:.34375,y:.34375},{x:.40625,y:.34375},{x:.40625,y:.34375},{x:.46875,y:.34375},{x:.46875,y:.34375},{x:.53125,y:.34375},{x:.53125,y:.34375},{x:.59375,y:.34375},{x:.59375,y:.34375},{x:.65625,y:.34375},{x:.65625,y:.34375},{x:.71875,y:.34375},{x:.71875,y:.34375},{x:.78125,y:.34375},{x:.78125,y:.34375},{x:.84375,y:.34375},{x:.84375,y:.34375},{x:.90625,y:.34375},{x:.90625,y:.34375},{x:.96875,y:.34375},{x:.96875,y:.34375},{x:.03125,y:.40625},{x:.03125,y:.40625},{x:.09375,y:.40625},{x:.09375,y:.40625},{x:.15625,y:.40625},{x:.15625,y:.40625},{x:.21875,y:.40625},{x:.21875,y:.40625},{x:.28125,y:.40625},{x:.28125,y:.40625},{x:.34375,y:.40625},{x:.34375,y:.40625},{x:.40625,y:.40625},{x:.40625,y:.40625},{x:.46875,y:.40625},{x:.46875,y:.40625},{x:.53125,y:.40625},{x:.53125,y:.40625},{x:.59375,y:.40625},{x:.59375,y:.40625},{x:.65625,y:.40625},{x:.65625,y:.40625},{x:.71875,y:.40625},{x:.71875,y:.40625},{x:.78125,y:.40625},{x:.78125,y:.40625},{x:.84375,y:.40625},{x:.84375,y:.40625},{x:.90625,y:.40625},{x:.90625,y:.40625},{x:.96875,y:.40625},{x:.96875,y:.40625},{x:.03125,y:.46875},{x:.03125,y:.46875},{x:.09375,y:.46875},{x:.09375,y:.46875},{x:.15625,y:.46875},{x:.15625,y:.46875},{x:.21875,y:.46875},{x:.21875,y:.46875},{x:.28125,y:.46875},{x:.28125,y:.46875},{x:.34375,y:.46875},{x:.34375,y:.46875},{x:.40625,y:.46875},{x:.40625,y:.46875},{x:.46875,y:.46875},{x:.46875,y:.46875},{x:.53125,y:.46875},{x:.53125,y:.46875},{x:.59375,y:.46875},{x:.59375,y:.46875},{x:.65625,y:.46875},{x:.65625,y:.46875},{x:.71875,y:.46875},{x:.71875,y:.46875},{x:.78125,y:.46875},{x:.78125,y:.46875},{x:.84375,y:.46875},{x:.84375,y:.46875},{x:.90625,y:.46875},{x:.90625,y:.46875},{x:.96875,y:.46875},{x:.96875,y:.46875},{x:.03125,y:.53125},{x:.03125,y:.53125},{x:.09375,y:.53125},{x:.09375,y:.53125},{x:.15625,y:.53125},{x:.15625,y:.53125},{x:.21875,y:.53125},{x:.21875,y:.53125},{x:.28125,y:.53125},{x:.28125,y:.53125},{x:.34375,y:.53125},{x:.34375,y:.53125},{x:.40625,y:.53125},{x:.40625,y:.53125},{x:.46875,y:.53125},{x:.46875,y:.53125},{x:.53125,y:.53125},{x:.53125,y:.53125},{x:.59375,y:.53125},{x:.59375,y:.53125},{x:.65625,y:.53125},{x:.65625,y:.53125},{x:.71875,y:.53125},{x:.71875,y:.53125},{x:.78125,y:.53125},{x:.78125,y:.53125},{x:.84375,y:.53125},{x:.84375,y:.53125},{x:.90625,y:.53125},{x:.90625,y:.53125},{x:.96875,y:.53125},{x:.96875,y:.53125},{x:.03125,y:.59375},{x:.03125,y:.59375},{x:.09375,y:.59375},{x:.09375,y:.59375},{x:.15625,y:.59375},{x:.15625,y:.59375},{x:.21875,y:.59375},{x:.21875,y:.59375},{x:.28125,y:.59375},{x:.28125,y:.59375},{x:.34375,y:.59375},{x:.34375,y:.59375},{x:.40625,y:.59375},{x:.40625,y:.59375},{x:.46875,y:.59375},{x:.46875,y:.59375},{x:.53125,y:.59375},{x:.53125,y:.59375},{x:.59375,y:.59375},{x:.59375,y:.59375},{x:.65625,y:.59375},{x:.65625,y:.59375},{x:.71875,y:.59375},{x:.71875,y:.59375},{x:.78125,y:.59375},{x:.78125,y:.59375},{x:.84375,y:.59375},{x:.84375,y:.59375},{x:.90625,y:.59375},{x:.90625,y:.59375},{x:.96875,y:.59375},{x:.96875,y:.59375},{x:.03125,y:.65625},{x:.03125,y:.65625},{x:.09375,y:.65625},{x:.09375,y:.65625},{x:.15625,y:.65625},{x:.15625,y:.65625},{x:.21875,y:.65625},{x:.21875,y:.65625},{x:.28125,y:.65625},{x:.28125,y:.65625},{x:.34375,y:.65625},{x:.34375,y:.65625},{x:.40625,y:.65625},{x:.40625,y:.65625},{x:.46875,y:.65625},{x:.46875,y:.65625},{x:.53125,y:.65625},{x:.53125,y:.65625},{x:.59375,y:.65625},{x:.59375,y:.65625},{x:.65625,y:.65625},{x:.65625,y:.65625},{x:.71875,y:.65625},{x:.71875,y:.65625},{x:.78125,y:.65625},{x:.78125,y:.65625},{x:.84375,y:.65625},{x:.84375,y:.65625},{x:.90625,y:.65625},{x:.90625,y:.65625},{x:.96875,y:.65625},{x:.96875,y:.65625},{x:.03125,y:.71875},{x:.03125,y:.71875},{x:.09375,y:.71875},{x:.09375,y:.71875},{x:.15625,y:.71875},{x:.15625,y:.71875},{x:.21875,y:.71875},{x:.21875,y:.71875},{x:.28125,y:.71875},{x:.28125,y:.71875},{x:.34375,y:.71875},{x:.34375,y:.71875},{x:.40625,y:.71875},{x:.40625,y:.71875},{x:.46875,y:.71875},{x:.46875,y:.71875},{x:.53125,y:.71875},{x:.53125,y:.71875},{x:.59375,y:.71875},{x:.59375,y:.71875},{x:.65625,y:.71875},{x:.65625,y:.71875},{x:.71875,y:.71875},{x:.71875,y:.71875},{x:.78125,y:.71875},{x:.78125,y:.71875},{x:.84375,y:.71875},{x:.84375,y:.71875},{x:.90625,y:.71875},{x:.90625,y:.71875},{x:.96875,y:.71875},{x:.96875,y:.71875},{x:.03125,y:.78125},{x:.03125,y:.78125},{x:.09375,y:.78125},{x:.09375,y:.78125},{x:.15625,y:.78125},{x:.15625,y:.78125},{x:.21875,y:.78125},{x:.21875,y:.78125},{x:.28125,y:.78125},{x:.28125,y:.78125},{x:.34375,y:.78125},{x:.34375,y:.78125},{x:.40625,y:.78125},{x:.40625,y:.78125},{x:.46875,y:.78125},{x:.46875,y:.78125},{x:.53125,y:.78125},{x:.53125,y:.78125},{x:.59375,y:.78125},{x:.59375,y:.78125},{x:.65625,y:.78125},{x:.65625,y:.78125},{x:.71875,y:.78125},{x:.71875,y:.78125},{x:.78125,y:.78125},{x:.78125,y:.78125},{x:.84375,y:.78125},{x:.84375,y:.78125},{x:.90625,y:.78125},{x:.90625,y:.78125},{x:.96875,y:.78125},{x:.96875,y:.78125},{x:.03125,y:.84375},{x:.03125,y:.84375},{x:.09375,y:.84375},{x:.09375,y:.84375},{x:.15625,y:.84375},{x:.15625,y:.84375},{x:.21875,y:.84375},{x:.21875,y:.84375},{x:.28125,y:.84375},{x:.28125,y:.84375},{x:.34375,y:.84375},{x:.34375,y:.84375},{x:.40625,y:.84375},{x:.40625,y:.84375},{x:.46875,y:.84375},{x:.46875,y:.84375},{x:.53125,y:.84375},{x:.53125,y:.84375},{x:.59375,y:.84375},{x:.59375,y:.84375},{x:.65625,y:.84375},{x:.65625,y:.84375},{x:.71875,y:.84375},{x:.71875,y:.84375},{x:.78125,y:.84375},{x:.78125,y:.84375},{x:.84375,y:.84375},{x:.84375,y:.84375},{x:.90625,y:.84375},{x:.90625,y:.84375},{x:.96875,y:.84375},{x:.96875,y:.84375},{x:.03125,y:.90625},{x:.03125,y:.90625},{x:.09375,y:.90625},{x:.09375,y:.90625},{x:.15625,y:.90625},{x:.15625,y:.90625},{x:.21875,y:.90625},{x:.21875,y:.90625},{x:.28125,y:.90625},{x:.28125,y:.90625},{x:.34375,y:.90625},{x:.34375,y:.90625},{x:.40625,y:.90625},{x:.40625,y:.90625},{x:.46875,y:.90625},{x:.46875,y:.90625},{x:.53125,y:.90625},{x:.53125,y:.90625},{x:.59375,y:.90625},{x:.59375,y:.90625},{x:.65625,y:.90625},{x:.65625,y:.90625},{x:.71875,y:.90625},{x:.71875,y:.90625},{x:.78125,y:.90625},{x:.78125,y:.90625},{x:.84375,y:.90625},{x:.84375,y:.90625},{x:.90625,y:.90625},{x:.90625,y:.90625},{x:.96875,y:.90625},{x:.96875,y:.90625},{x:.03125,y:.96875},{x:.03125,y:.96875},{x:.09375,y:.96875},{x:.09375,y:.96875},{x:.15625,y:.96875},{x:.15625,y:.96875},{x:.21875,y:.96875},{x:.21875,y:.96875},{x:.28125,y:.96875},{x:.28125,y:.96875},{x:.34375,y:.96875},{x:.34375,y:.96875},{x:.40625,y:.96875},{x:.40625,y:.96875},{x:.46875,y:.96875},{x:.46875,y:.96875},{x:.53125,y:.96875},{x:.53125,y:.96875},{x:.59375,y:.96875},{x:.59375,y:.96875},{x:.65625,y:.96875},{x:.65625,y:.96875},{x:.71875,y:.96875},{x:.71875,y:.96875},{x:.78125,y:.96875},{x:.78125,y:.96875},{x:.84375,y:.96875},{x:.84375,y:.96875},{x:.90625,y:.96875},{x:.90625,y:.96875},{x:.96875,y:.96875},{x:.96875,y:.96875},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375}];var P5=class{constructor(e){var t;this.model=e,this.anchors=PA.map(s=>[s.x,s.y]),this.anchorsTensor=r.tensor2d(this.anchors),this.inputSize=(t=this.model)==null?void 0:t.inputs[0].shape[2],this.inputSizeTensor=r.tensor1d([this.inputSize,this.inputSize]),this.doubleInputSizeTensor=r.tensor1d([this.inputSize*2,this.inputSize*2])}normalizeBoxes(e){return r.tidy(()=>{let t=r.slice(e,[0,0],[-1,2]),s=r.slice(e,[0,2],[-1,2]),o=r.add(r.div(t,this.inputSizeTensor),this.anchorsTensor),i=r.div(s,this.doubleInputSizeTensor),n=r.mul(r.sub(o,i),this.inputSizeTensor),a=r.mul(r.add(o,i),this.inputSizeTensor);return r.concat2d([n,a],1)})}normalizeLandmarks(e,t){return r.tidy(()=>{let s=r.add(r.div(e.reshape([-1,7,2]),this.inputSizeTensor),this.anchors[t]);return r.mul(s,this.inputSizeTensor)})}async getBoxes(e,t){let s=this.model.predict(e),o=s.squeeze();s.dispose();let i=r.tidy(()=>r.sigmoid(r.slice(o,[0,0],[-1,1])).squeeze()),n=i.dataSync(),a=r.slice(o,[0,1],[-1,4]),x=this.normalizeBoxes(a);a.dispose();let l=await r.image.nonMaxSuppressionAsync(x,n,t.hand.maxDetected,t.hand.iouThreshold,t.hand.minConfidence),d=l.arraySync();i.dispose(),l.dispose();let y=[];for(let h of d)if(n[h]>=t.hand.minConfidence){let p=r.slice(x,[h,0],[1,-1]),M=r.slice(o,[h,5],[1,14]),c=r.tidy(()=>this.normalizeLandmarks(M,h).reshape([-1,2]));M.dispose(),y.push({box:p,palmLandmarks:c,confidence:n[h]})}return o.dispose(),x.dispose(),y}async estimateHandBounds(e,t){let s=e.shape[1],o=e.shape[2],i=r.tidy(()=>e.resizeBilinear([this.inputSize,this.inputSize]).div(127.5).sub(1)),n=await this.getBoxes(i,t);i.dispose();let a=[];if(!n||n.length===0)return a;for(let x of n){let l=x.box.dataSync(),d=l.slice(0,2),y=l.slice(2,4),h=x.palmLandmarks.arraySync();x.box.dispose(),x.palmLandmarks.dispose(),a.push(TA({startPoint:d,endPoint:y,palmLandmarks:h,confidence:x.confidence},[o/this.inputSize,s/this.inputSize]))}return a}};function u2(A){return A-2*Math.PI*Math.floor((A+Math.PI)/(2*Math.PI))}function zA(A,e){let t=Math.PI/2-Math.atan2(-(e[1]-A[1]),e[0]-A[0]);return u2(t)}var MA=(A,e)=>[[1,0,A],[0,1,e],[0,0,1]];function G(A,e){let t=0;for(let s=0;sn[0]),s=e.map(n=>n[1]),o=[Math.min(...t),Math.min(...s)],i=[Math.max(...t),Math.max(...s)];return{startPoint:o,endPoint:i}}getBoxForPalmLandmarks(e,t){let s=e.map(i=>M5([...i,1],t)),o=this.calculateLandmarksBoundingBox(s);return O0(Z0(o),b2)}getBoxForHandLandmarks(e){let t=this.calculateLandmarksBoundingBox(e),s=O0(Z0(t),RA);s.palmLandmarks=[];for(let o=0;o[n[0]*(p[0]-this.inputSize/2),n[1]*(p[1]-this.inputSize/2),n[2]*p[2]]),x=z5(s,[0,0]),l=a.map(p=>[...M5(p,x),p[2]]),d=EA(o),y=[...h0(t),1],h=[G(y,d[0]),G(y,d[1])];return l.map(p=>[p[0]+h[0],p[1]+h[1],p[2]])}async estimateHands(e,t){let s=!1,o;(this.skipped===0||this.skipped>t.hand.skipFrames||!t.hand.landmarks||!t.videoOptimized)&&(o=await this.handDetector.estimateHandBounds(e,t),this.skipped=0),t.videoOptimized&&this.skipped++,o&&o.length>0&&(o.length!==this.detectedHands&&this.detectedHands!==t.hand.maxDetected||!t.hand.landmarks)&&(this.detectedHands=0,this.storedBoxes=[...o],this.storedBoxes.length>0&&(s=!0));let i=[];t.hand.skipInitial&&this.detectedHands===0&&(this.skipped=0);for(let n=0;n=t.hand.minConfidence){let R=r.reshape(z,[-1,3]),j=R.arraySync();z.dispose(),R.dispose();let g=this.transformRawCoords(j,p,x,h),m=this.getBoxForHandLandmarks(g);this.storedBoxes[n]=m;let T={landmarks:g,confidence:E,box:{topLeft:m.startPoint,bottomRight:m.endPoint}};i.push(T)}else this.storedBoxes[n]=null;z.dispose()}else{let x=O0(Z0(a),RA),l={confidence:a.confidence,box:{topLeft:x.startPoint,bottomRight:x.endPoint}};i.push(l)}}return this.storedBoxes=this.storedBoxes.filter(n=>n!==null),this.detectedHands=i.length,i}};var SA={thumb:[1,2,3,4],indexFinger:[5,6,7,8],middleFinger:[9,10,11,12],ringFinger:[13,14,15,16],pinky:[17,18,19,20],palmBase:[0]},Q,_,wA;async function R5(A,e){let t=await wA.estimateHands(A,e);if(!t)return[];let s=[];for(let o of t){let i={};if(o.landmarks)for(let x of Object.keys(SA))i[x]=SA[x].map(l=>o.landmarks[l]);let n=o.box?[Math.max(0,o.box.topLeft[0]),Math.max(0,o.box.topLeft[1]),Math.min(A.shape[2],o.box.bottomRight[0])-Math.max(0,o.box.topLeft[0]),Math.min(A.shape[1],o.box.bottomRight[1])-Math.max(0,o.box.topLeft[1])]:[],a=[o.box.topLeft[0]/A.shape[2],o.box.topLeft[1]/A.shape[1],(o.box.bottomRight[0]-o.box.topLeft[0])/A.shape[2],(o.box.bottomRight[1]-o.box.topLeft[1])/A.shape[1]];s.push({confidence:Math.round(100*o.confidence)/100,box:n,boxRaw:a,landmarks:o.landmarks,annotations:i})}return s}async function j5(A){!Q||!_?([Q,_]=await Promise.all([A.hand.enabled?r.loadGraphModel(O(A.modelBasePath,A.hand.detector.modelPath),{fromTFHub:A.hand.detector.modelPath.includes("tfhub.dev")}):null,A.hand.landmarks?r.loadGraphModel(O(A.modelBasePath,A.hand.skeleton.modelPath),{fromTFHub:A.hand.skeleton.modelPath.includes("tfhub.dev")}):null]),A.hand.enabled&&(!Q||!Q.modelUrl?b("load model failed:",A.hand.detector.modelPath):A.debug&&b("load model:",Q.modelUrl),!_||!_.modelUrl?b("load model failed:",A.hand.skeleton.modelPath):A.debug&&b("load model:",_.modelUrl))):(A.debug&&b("cached model:",Q.modelUrl),A.debug&&b("cached model:",_.modelUrl));let e=new P5(Q);return wA=new v5(e,_),[Q,_]}var S5={};Y(S5,{load:()=>w5,predict:()=>W5});var WA=["nose","leftEyeInside","leftEye","leftEyeOutside","rightEyeInside","rightEye","rightEyeOutside","leftEar","rightEar","leftMouth","rightMouth","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftPalm","rightPalm","leftIndex","rightIndex","leftPinky","rightPinky","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle","leftHeel","rightHeel","leftFoot","rightFoot","midHip","forehead","leftThumb","leftHand","rightThumb","rightHand"],IA=["nose","leftEyeInside","leftEye","leftEyeOutside","rightEyeInside","rightEye","rightEyeOutside","leftEar","rightEar","leftMouth","rightMouth","leftShoulder","rightShoulder","leftElbow","rightElbow","left:15","right:16","left:17","right:18","left:19","right:20","left:21","right:22","leftChest","rightChest","neck","forehead","left:27","right:28","left:29","right:30"];var Z;async function w5(A){return Z?A.debug&&b("cached model:",Z.modelUrl):(Z=await r.loadGraphModel(O(A.modelBasePath,A.body.modelPath)),Z.width=parseInt(Z.signature.inputs["input_1:0"].tensorShape.dim[2].size),Z.height=parseInt(Z.signature.inputs["input_1:0"].tensorShape.dim[1].size),!Z||!Z.modelUrl?b("load model failed:",A.body.modelPath):A.debug&&b("load model:",Z.modelUrl)),Z}async function W5(A,e){if(!Z||!e.body.enabled)return null;let t={width:A.shape[2],height:A.shape[1]},s=r.image.resizeBilinear(A,[Z.width,Z.height],!1),o=r.div(s,[255]);s.dispose();let i=await Z.predict(o),n=i.find(y=>y.size===195||y.size===155).dataSync();i.forEach(y=>y.dispose()),o.dispose();let a=[],x=n.length===195?WA:IA,l=5;for(let y=0;yh.score>y?h.score:y,0),keypoints:a}]}var I5={};Y(I5,{load:()=>k5,predict:()=>O5});var L0=[{class:1,label:"person"},{class:2,label:"bicycle"},{class:3,label:"car"},{class:4,label:"motorcycle"},{class:5,label:"airplane"},{class:6,label:"bus"},{class:7,label:"train"},{class:8,label:"truck"},{class:9,label:"boat"},{class:10,label:"traffic light"},{class:11,label:"fire hydrant"},{class:12,label:"stop sign"},{class:13,label:"parking meter"},{class:14,label:"bench"},{class:15,label:"bird"},{class:16,label:"cat"},{class:17,label:"dog"},{class:18,label:"horse"},{class:19,label:"sheep"},{class:20,label:"cow"},{class:21,label:"elephant"},{class:22,label:"bear"},{class:23,label:"zebra"},{class:24,label:"giraffe"},{class:25,label:"backpack"},{class:26,label:"umbrella"},{class:27,label:"handbag"},{class:28,label:"tie"},{class:29,label:"suitcase"},{class:30,label:"frisbee"},{class:31,label:"skis"},{class:32,label:"snowboard"},{class:33,label:"sports ball"},{class:34,label:"kite"},{class:35,label:"baseball bat"},{class:36,label:"baseball glove"},{class:37,label:"skateboard"},{class:38,label:"surfboard"},{class:39,label:"tennis racket"},{class:40,label:"bottle"},{class:41,label:"wine glass"},{class:42,label:"cup"},{class:43,label:"fork"},{class:44,label:"knife"},{class:45,label:"spoon"},{class:46,label:"bowl"},{class:47,label:"banana"},{class:48,label:"apple"},{class:49,label:"sandwich"},{class:50,label:"orange"},{class:51,label:"broccoli"},{class:52,label:"carrot"},{class:53,label:"hot dog"},{class:54,label:"pizza"},{class:55,label:"donut"},{class:56,label:"cake"},{class:57,label:"chair"},{class:58,label:"couch"},{class:59,label:"potted plant"},{class:60,label:"bed"},{class:61,label:"dining table"},{class:62,label:"toilet"},{class:63,label:"tv"},{class:64,label:"laptop"},{class:65,label:"mouse"},{class:66,label:"remote"},{class:67,label:"keyboard"},{class:68,label:"cell phone"},{class:69,label:"microwave"},{class:70,label:"oven"},{class:71,label:"toaster"},{class:72,label:"sink"},{class:73,label:"refrigerator"},{class:74,label:"book"},{class:75,label:"clock"},{class:76,label:"vase"},{class:77,label:"scissors"},{class:78,label:"teddy bear"},{class:79,label:"hair drier"},{class:80,label:"toothbrush"}];var L,N5=[],V0=Number.MAX_SAFE_INTEGER,H0=2.5;async function k5(A){if(L)A.debug&&b("cached model:",L.modelUrl);else{L=await r.loadGraphModel(O(A.modelBasePath,A.object.modelPath));let e=Object.values(L.modelSignature.inputs);if(L.inputSize=Array.isArray(e)?parseInt(e[0].tensorShape.dim[2].size):null,!L.inputSize)throw new Error(`Human: Cannot determine model inputSize: ${A.object.modelPath}`);!L||!L.modelUrl?b("load model failed:",A.object.modelPath):A.debug&&b("load model:",L.modelUrl)}return L}async function P2(A,e,t,s){let o=0,i=[];for(let l of[1,2,4])r.tidy(()=>{var u,z;let d=l*13,y=(u=A.find(E=>E.shape[1]===d**2&&E.shape[2]===L0.length))==null?void 0:u.squeeze(),h=(z=A.find(E=>E.shape[1]===d**2&&E.shape[2]s.object.minConfidence&&R!==61){let g=(.5+Math.trunc(E%d))/d,m=(.5+Math.trunc(E/d))/d,T=M[E].map(A0=>A0*(d/l/e)),[v,w]=[g-H0/l*T[0],m-H0/l*T[1]],[k,K]=[g+H0/l*T[2]-v,m+H0/l*T[3]-w],V=[v,w,k,K];V=V.map(A0=>Math.max(0,Math.min(A0,1)));let T0=[V[0]*t[0],V[1]*t[1],V[2]*t[0],V[3]*t[1]],K0={id:o++,strideSize:l,score:Math.round(100*j)/100,class:R+1,label:L0[R].label,center:[Math.trunc(t[0]*g),Math.trunc(t[1]*m)],centerRaw:[g,m],box:T0.map(A0=>Math.trunc(A0)),boxRaw:V};i.push(K0)}}});A.forEach(l=>r.dispose(l));let n=i.map(l=>l.boxRaw),a=i.map(l=>l.score),x=[];if(n&&n.length>0){let l=await r.image.nonMaxSuppressionAsync(n,a,s.object.maxDetected,s.object.iouThreshold,s.object.minConfidence);x=l.dataSync(),r.dispose(l)}return i=i.filter((l,d)=>x.includes(d)).sort((l,d)=>d.score-l.score),i}async function O5(A,e){return L?V00?(V0++,N5):(e.videoOptimized?V0=0:V0=Number.MAX_SAFE_INTEGER,new Promise(async t=>{let s=[A.shape[2],A.shape[1]],o=r.image.resizeBilinear(A,[L.inputSize,L.inputSize],!1),i=o.div(255),n=i.transpose([0,3,1,2]);i.dispose(),o.dispose();let a;e.object.enabled&&(a=await L.predict(n)),n.dispose();let x=await P2(a,L.inputSize,s,e);N5=x,t(x)})):null}var NA=A=>{if(!A)return[];let e=[];for(let t=0;tx.part==="leftWrist"),o=A[t].keypoints.find(x=>x.part==="rightWrist"),i=A[t].keypoints.find(x=>x.part==="nose");i&&s&&o&&s.position.yx.part==="leftShoulder"),a=A[t].keypoints.find(x=>x.part==="rightShoulder");n&&a&&e.push({body:t,gesture:`leaning ${n.position.y>a.position.y?"left":"right"}`})}return e},kA=A=>{if(!A)return[];let e=[];for(let t=0;t0){let s=A[t].mesh[33][2]-A[t].mesh[263][2];Math.abs(s)<10?e.push({face:t,gesture:"facing center"}):e.push({face:t,gesture:`facing ${s<0?"left":"right"}`}),Math.abs(A[t].mesh[374][1]-A[t].mesh[386][1])/Math.abs(A[t].mesh[443][1]-A[t].mesh[450][1])<.2&&e.push({face:t,gesture:"blink left eye"}),Math.abs(A[t].mesh[145][1]-A[t].mesh[159][1])/Math.abs(A[t].mesh[223][1]-A[t].mesh[230][1])<.2&&e.push({face:t,gesture:"blink right eye"});let n=Math.min(100,500*Math.abs(A[t].mesh[13][1]-A[t].mesh[14][1])/Math.abs(A[t].mesh[10][1]-A[t].mesh[152][1]));n>10&&e.push({face:t,gesture:`mouth ${Math.trunc(n)}% open`});let a=A[t].mesh[152][2];Math.abs(a)>10&&e.push({face:t,gesture:`head ${a<0?"up":"down"}`})}return e},OA=A=>{if(!A)return[];let e=[];for(let t=0;t.033||y>.033)&&(l=!1),h>.033&&e.push({iris:t,gesture:"looking right"}),y>.033&&e.push({iris:t,gesture:"looking left"});let p=Math.abs(A[t].mesh[145][1]-A[t].annotations.rightEyeIris[0][1])/A[t].annotations.rightEyeIris[0][1],M=Math.abs(A[t].mesh[374][1]-A[t].annotations.leftEyeIris[0][1])/A[t].annotations.leftEyeIris[0][1];(M<.015||p<.015||M>.03||p>.03)&&(l=!1),(M<.015||p<.015)&&e.push({iris:t,gesture:"looking down"}),(M>.03||p>.03)&&e.push({iris:t,gesture:"looking up"}),l&&e.push({iris:t,gesture:"looking center"})}return e},ZA=A=>{if(!A)return[];let e=[];for(let t=0;t0){let o=s.reduce((n,a)=>n.position[2]n.position[1]L5});function z2(A,e,t){let s=function(a,x,l){let d=new RegExp("\\b"+x+" \\w+ (\\w+)","ig");a.replace(d,(y,h)=>(l[h]=0,y))},o=function(a,x){let l=A.createShader(x);if(A.shaderSource(l,a),A.compileShader(l),!A.getShaderParameter(l,A.COMPILE_STATUS))throw new Error("Filter: GL compile failed",A.getShaderInfoLog(l));return l};this.uniform={},this.attribute={};let i=o(e,A.VERTEX_SHADER),n=o(t,A.FRAGMENT_SHADER);if(this.id=A.createProgram(),A.attachShader(this.id,i),A.attachShader(this.id,n),A.linkProgram(this.id),!A.getProgramParameter(this.id,A.LINK_STATUS))throw new Error("Filter: GL link failed",A.getProgramInfoLog(this.id));A.useProgram(this.id),s(e,"attribute",this.attribute);for(let a in this.attribute)this.attribute[a]=A.getAttribLocation(this.id,a);s(e,"uniform",this.uniform),s(t,"uniform",this.uniform);for(let a in this.uniform)this.uniform[a]=A.getUniformLocation(this.id,a)}function LA(A){A||(A={});let e=0,t=null,s=!1,o=-1,i=[null,null],n=[],a=-1,x=-1,l=null,d=null,y={},h=A.canvas||document.createElement("canvas"),p={},M={INTERMEDIATE:1},c=h.getContext("webgl");if(!c)throw new Error("Filter: getContext() failed");this.addFilter=function(g){let m=Array.prototype.slice.call(arguments,1),T=y[g];n.push({func:T,args:m})},this.reset=function(){n=[]};let u=function(g,m){if(!(g===a&&m===x)){if(h.width=g,a=g,h.height=m,x=m,!l){let T=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,-1,1,0,0,1,-1,1,1,1,1,1,0]);l=c.createBuffer(),c.bindBuffer(c.ARRAY_BUFFER,l),c.bufferData(c.ARRAY_BUFFER,T,c.STATIC_DRAW),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0)}c.viewport(0,0,a,x),i=[null,null]}},z=function(g,m){let T=c.createFramebuffer();c.bindFramebuffer(c.FRAMEBUFFER,T);let v=c.createRenderbuffer();c.bindRenderbuffer(c.RENDERBUFFER,v);let w=c.createTexture();return c.bindTexture(c.TEXTURE_2D,w),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,g,m,0,c.RGBA,c.UNSIGNED_BYTE,null),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,w,0),c.bindTexture(c.TEXTURE_2D,null),c.bindFramebuffer(c.FRAMEBUFFER,null),{fbo:T,texture:w}},E=function(g){return i[g]=i[g]||z(a,x),i[g]},R=function(g=null){var w,k;let m=null,T=null,v=!1;e===0?m=t:m=(w=E(o))==null?void 0:w.texture,e++,s&&!(g&M.INTERMEDIATE)?(T=null,v=e%2==0):(o=(o+1)%2,T=(k=E(o))==null?void 0:k.fbo),c.bindTexture(c.TEXTURE_2D,m),c.bindFramebuffer(c.FRAMEBUFFER,T),c.uniform1f(d.uniform.flipY,v?-1:1),c.drawArrays(c.TRIANGLES,0,6)};this.apply=function(g){if(u(g.width,g.height),e=0,t||(t=c.createTexture()),c.bindTexture(c.TEXTURE_2D,t),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,g),n.length===0)return R(),h;for(let m=0;m0,i=A.naturalHeight||A.videoHeight||A.height||A.shape&&A.shape[2]>0,n=o,a=i;if(n>H0&&(n=H0,a=n*i/o),a>H0&&(a=H0,n=a*o/i),e.filter.width>0?n=e.filter.width:e.filter.height>0&&(n=o*(e.filter.height/i)),e.filter.height>0?a=e.filter.height:e.filter.width>0&&(a=i*(e.filter.width/o)),!n||!a)throw new Error("Human: Input cannot determine dimension");(!P||(P==null?void 0:P.width)!==n||(P==null?void 0:P.height)!==a)&&(P=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(n,a):document.createElement("canvas"),(P==null?void 0:P.width)!==n&&(P.width=n),(P==null?void 0:P.height)!==a&&(P.height=a));let x=P.getContext("2d");if(A instanceof ImageData?x.putImageData(A,0,0):e.filter.flip&&typeof x.translate!="undefined"?(x.translate(o,0),x.scale(-1,1),x.drawImage(A,0,0,o,i,0,0,P==null?void 0:P.width,P==null?void 0:P.height),x.setTransform(1,0,0,1,0,0)):x.drawImage(A,0,0,o,i,0,0,P==null?void 0:P.width,P==null?void 0:P.height),e.filter.enabled){if((!I||!W||P.width!==W.width||(P==null?void 0:P.height)!==(W==null?void 0:W.height))&&(W=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(P==null?void 0:P.width,P==null?void 0:P.height):document.createElement("canvas"),(W==null?void 0:W.width)!==(P==null?void 0:P.width)&&(W.width=P==null?void 0:P.width),(W==null?void 0:W.height)!==(P==null?void 0:P.height)&&(W.height=P==null?void 0:P.height),I=r.ENV.flags.IS_BROWSER?new ZA({canvas:W}):null),!I)return{tensor:null,canvas:P};I.reset(),I.addFilter("brightness",e.filter.brightness),e.filter.contrast!==0&&I.addFilter("contrast",e.filter.contrast),e.filter.sharpness!==0&&I.addFilter("sharpen",e.filter.sharpness),e.filter.blur!==0&&I.addFilter("blur",e.filter.blur),e.filter.saturation!==0&&I.addFilter("saturation",e.filter.saturation),e.filter.hue!==0&&I.addFilter("hue",e.filter.hue),e.filter.negative&&I.addFilter("negative"),e.filter.sepia&&I.addFilter("sepia"),e.filter.vintage&&I.addFilter("brownie"),e.filter.sepia&&I.addFilter("sepia"),e.filter.kodachrome&&I.addFilter("kodachrome"),e.filter.technicolor&&I.addFilter("technicolor"),e.filter.polaroid&&I.addFilter("polaroid"),e.filter.pixelate!==0&&I.addFilter("pixelate",e.filter.pixelate),I.apply(P)}else W=P,I&&(I=null);let l;if(W.data){let y=[W.height,W.width,3];l=r.tensor3d(W.data,y,"int32")}else if(W instanceof ImageData)l=r.browser.fromPixels(W);else if(e.backend==="webgl"||e.backend==="humangl"){let y=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(n,a):document.createElement("canvas");y.width=n,y.height=a;let h=y.getContext("2d");h==null||h.drawImage(W,0,0),l=r.browser.fromPixels(y)}else{let y=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(n,a):document.createElement("canvas");y.width=n,y.height=a;let h=y.getContext("2d");h==null||h.drawImage(W,0,0);let p=h==null?void 0:h.getImageData(0,0,n,a);l=r.browser.fromPixels(p)}let d=l.toFloat();t=d.expandDims(0),l.dispose(),d.dispose()}let s=e.filter.return?W:null;return{tensor:t,canvas:s}}var L5={};Y(L5,{all:()=>M2,body:()=>HA,canvas:()=>z2,face:()=>VA,gesture:()=>LA,hand:()=>XA,object:()=>FA,options:()=>t0});var t0={color:"rgba(173, 216, 230, 0.3)",labelColor:"rgba(173, 216, 230, 1)",shadowColor:"black",font:'small-caps 16px "Segoe UI"',lineHeight:24,lineWidth:6,pointSize:2,roundRect:28,drawPoints:!1,drawLabels:!0,drawBoxes:!1,drawPolygons:!0,fillPolygons:!1,useDepth:!0,useCurves:!1,bufferedOutput:!1,useRawBoxes:!1,calculateHandBox:!0};function X0(A,e,t,s=0,o){A.fillStyle=o.useDepth&&s?`rgba(${127.5+2*s}, ${127.5-2*s}, 255, 0.3)`:o.color,A.beginPath(),A.arc(e,t,o.pointSize,0,2*Math.PI),A.fill()}function n0(A,e,t,s,o,i){if(A.beginPath(),i.useCurves){let n=(e+e+s)/2,a=(t+t+o)/2;A.ellipse(n,a,s/2,o/2,0,0,2*Math.PI)}else A.lineWidth=i.lineWidth,A.moveTo(e+i.roundRect,t),A.lineTo(e+s-i.roundRect,t),A.quadraticCurveTo(e+s,t,e+s,t+i.roundRect),A.lineTo(e+s,t+o-i.roundRect),A.quadraticCurveTo(e+s,t+o,e+s-i.roundRect,t+o),A.lineTo(e+i.roundRect,t+o),A.quadraticCurveTo(e,t+o,e,t+o-i.roundRect),A.lineTo(e,t+i.roundRect),A.quadraticCurveTo(e,t,e+i.roundRect,t),A.closePath();A.stroke()}function V5(A,e=[],t){if(!(e===void 0||e.length===0)){A.beginPath(),A.moveTo(e[0][0],e[0][1]);for(let s of e)A.strokeStyle=t.useDepth&&s[2]?`rgba(${127.5+2*s[2]}, ${127.5-2*s[2]}, 255, 0.3)`:t.color,A.fillStyle=t.useDepth&&s[2]?`rgba(${127.5+2*s[2]}, ${127.5-2*s[2]}, 255, 0.3)`:t.color,A.lineTo(s[0],parseInt(s[1]));A.stroke(),t.fillPolygons&&(A.closePath(),A.fill())}}function h0(A,e=[],t){if(!(e===void 0||e.length===0)){if(!t.useCurves||e.length<=2){V5(A,e,t);return}A.moveTo(e[0][0],e[0][1]);for(let s=0;s1&&x[1].length>0){let l=a[1]>0?`#${a[1]}`:"",d=`${a[0]} ${l}: ${x[1]}`;s.shadowColor&&s.shadowColor!==""&&(o.fillStyle=s.shadowColor,o.fillText(d,8,2+i*s.lineHeight)),o.fillStyle=s.labelColor,o.fillText(d,6,0+i*s.lineHeight),i+=1}}}async function VA(A,e,t){let s=X(t0,t);if(!e||!A||!(A instanceof HTMLCanvasElement))return;let o=A.getContext("2d");if(!!o)for(let i of e){o.font=s.font,o.strokeStyle=s.color,o.fillStyle=s.color,s.drawBoxes&&(s.useRawBoxes?n0(o,A.width*i.boxRaw[0],A.height*i.boxRaw[1],A.width*i.boxRaw[2],A.height*i.boxRaw[3],s):n0(o,i.box[0],i.box[1],i.box[2],i.box[3],s));let n=[];if(n.push(`face confidence: ${Math.trunc(100*i.confidence)}%`),i.genderConfidence&&n.push(`${i.gender||""} ${Math.trunc(100*i.genderConfidence)}% confident`),i.age&&n.push(`age: ${i.age||""}`),i.iris&&n.push(`iris distance: ${i.iris}`),i.emotion&&i.emotion.length>0){let a=i.emotion.map(x=>`${Math.trunc(100*x.score)}% ${x.emotion}`);n.push(a.join(" "))}i.rotation&&i.rotation.angle&&i.rotation.angle.roll&&n.push(`roll: ${Math.trunc(100*i.rotation.angle.roll)/100} yaw:${Math.trunc(100*i.rotation.angle.yaw)/100} pitch:${Math.trunc(100*i.rotation.angle.pitch)/100}`),n.length===0&&n.push("face"),o.fillStyle=s.color;for(let a=n.length-1;a>=0;a--){let x=Math.max(i.box[0],0),l=a*s.lineHeight+i.box[1];s.shadowColor&&s.shadowColor!==""&&(o.fillStyle=s.shadowColor,o.fillText(n[a],x+5,l+16)),o.fillStyle=s.labelColor,o.fillText(n[a],x+4,l+15)}if(o.lineWidth=1,i.mesh&&i.mesh.length>0){if(s.drawPoints)for(let a of i.mesh)X0(o,a[0],a[1],a[2],s);if(s.drawPolygons){o.lineWidth=1;for(let a=0;ai.mesh[l]);V5(o,x,s)}if(i.annotations&&i.annotations.leftEyeIris){o.strokeStyle=s.useDepth?"rgba(255, 200, 255, 0.3)":s.color,o.beginPath();let a=Math.abs(i.annotations.leftEyeIris[3][0]-i.annotations.leftEyeIris[1][0])/2,x=Math.abs(i.annotations.leftEyeIris[4][1]-i.annotations.leftEyeIris[2][1])/2;o.ellipse(i.annotations.leftEyeIris[0][0],i.annotations.leftEyeIris[0][1],a,x,0,0,2*Math.PI),o.stroke(),s.fillPolygons&&(o.fillStyle=s.useDepth?"rgba(255, 255, 200, 0.3)":s.color,o.fill())}if(i.annotations&&i.annotations.rightEyeIris){o.strokeStyle=s.useDepth?"rgba(255, 200, 255, 0.3)":s.color,o.beginPath();let a=Math.abs(i.annotations.rightEyeIris[3][0]-i.annotations.rightEyeIris[1][0])/2,x=Math.abs(i.annotations.rightEyeIris[4][1]-i.annotations.rightEyeIris[2][1])/2;o.ellipse(i.annotations.rightEyeIris[0][0],i.annotations.rightEyeIris[0][1],a,x,0,0,2*Math.PI),o.stroke(),s.fillPolygons&&(o.fillStyle=s.useDepth?"rgba(255, 255, 200, 0.3)":s.color,o.fill())}}}}}var _=[];async function HA(A,e,t){let s=X(t0,t);if(!e||!A||!(A instanceof HTMLCanvasElement))return;let o=A.getContext("2d");if(!!o){o.lineJoin="round";for(let i=0;ix.part==="leftShoulder"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightShoulder"),n&&a.push([n.position.x,n.position.y]),h0(o,a,s),a.length=0,n=e[i].keypoints.find(x=>x.part==="rightShoulder"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightHip"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftHip"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftShoulder"),n&&a.push([n.position.x,n.position.y]),a.length===4&&V5(o,a,s),a.length=0,n=e[i].keypoints.find(x=>x.part==="leftHip"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftKnee"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftAnkle"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftHeel"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftFoot"),n&&a.push([n.position.x,n.position.y]),h0(o,a,s),a.length=0,n=e[i].keypoints.find(x=>x.part==="rightHip"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightKnee"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightAnkle"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightHeel"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightFoot"),n&&a.push([n.position.x,n.position.y]),h0(o,a,s),a.length=0,n=e[i].keypoints.find(x=>x.part==="leftShoulder"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftElbow"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftWrist"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftPalm"),n&&a.push([n.position.x,n.position.y]),h0(o,a,s),a.length=0,n=e[i].keypoints.find(x=>x.part==="rightShoulder"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightElbow"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightWrist"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightPalm"),n&&a.push([n.position.x,n.position.y]),h0(o,a,s)}}}}async function XA(A,e,t){let s=X(t0,t);if(!e||!A||!(A instanceof HTMLCanvasElement))return;let o=A.getContext("2d");if(!!o){o.lineJoin="round",o.font=s.font;for(let i of e){if(s.drawBoxes){o.strokeStyle=s.color,o.fillStyle=s.color;let n;if(!s.calculateHandBox)n=s.useRawBoxes?i.boxRaw:i.box;else if(n=[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,0,0],i.landmarks&&i.landmarks.length>0){for(let a of i.landmarks)a[0]n[2]&&(n[2]=a[0]),a[1]>n[3]&&(n[3]=a[1]);n[2]-=n[0],n[3]-=n[1]}s.useRawBoxes?n0(o,A.width*n[0],A.height*n[1],A.width*n[2],A.height*n[3],s):n0(o,n[0],n[1],n[2],n[3],s),s.drawLabels&&(s.shadowColor&&s.shadowColor!==""&&(o.fillStyle=s.shadowColor,o.fillText("hand",n[0]+3,1+n[1]+s.lineHeight,n[2])),o.fillStyle=s.labelColor,o.fillText("hand",n[0]+2,0+n[1]+s.lineHeight,n[2])),o.stroke()}if(s.drawPoints&&i.landmarks&&i.landmarks.length>0)for(let n of i.landmarks)o.fillStyle=s.useDepth?`rgba(${127.5+2*n[2]}, ${127.5-2*n[2]}, 255, 0.5)`:s.color,X0(o,n[0],n[1],0,s);if(s.drawLabels){let n=(a,x)=>{o.fillStyle=s.useDepth?`rgba(${127.5+2*a[a.length-1][2]}, ${127.5-2*a[a.length-1][2]}, 255, 0.5)`:s.color,o.fillText(x,a[a.length-1][0]+4,a[a.length-1][1]+4)};o.font=s.font,n(i.annotations.indexFinger,"index"),n(i.annotations.middleFinger,"middle"),n(i.annotations.ringFinger,"ring"),n(i.annotations.pinky,"pinky"),n(i.annotations.thumb,"thumb"),n(i.annotations.palmBase,"palm")}if(s.drawPolygons){let n=a=>{if(!!a)for(let x=0;x0?x-1:0][0],a[x>0?x-1:0][1]),o.lineTo(a[x][0],a[x][1]),o.stroke()};o.lineWidth=s.lineWidth,n(i.annotations.indexFinger),n(i.annotations.middleFinger),n(i.annotations.ringFinger),n(i.annotations.pinky),n(i.annotations.thumb)}}}}async function FA(A,e,t){let s=X(t0,t);if(!e||!A||!(A instanceof HTMLCanvasElement))return;let o=A.getContext("2d");if(!!o){o.lineJoin="round",o.font=s.font;for(let i of e)if(s.drawBoxes){if(o.strokeStyle=s.color,o.fillStyle=s.color,s.useRawBoxes?n0(o,A.width*i.boxRaw[0],A.height*i.boxRaw[1],A.width*i.boxRaw[2],A.height*i.boxRaw[3],s):n0(o,i.box[0],i.box[1],i.box[2],i.box[3],s),s.drawLabels){let n=`${Math.round(100*i.score)}% ${i.label}`;s.shadowColor&&s.shadowColor!==""&&(o.fillStyle=s.shadowColor,o.fillText(n,i.box[0]+3,1+i.box[1]+s.lineHeight,i.box[2])),o.fillStyle=s.labelColor,o.fillText(n,i.box[0]+2,0+i.box[1]+s.lineHeight,i.box[2])}o.stroke()}}}async function z2(A,e){if(!A||!e||!(A instanceof HTMLCanvasElement)||!(e instanceof HTMLCanvasElement))return;let t=A.getContext("2d");t==null||t.drawImage(A,0,0)}async function M2(A,e,t){let s=X(t0,t);!e||!A||A instanceof HTMLCanvasElement&&(VA(A,e.face,s),HA(A,e.body,s),XA(A,e.hand,s),LA(A,e.gesture,s),FA(A,e.object,s))}var F0=` +`)}var X0=2048,P,W,I;function L5(A,e){let t;if(!A)throw new Error("Human: Input is missing");if(!(A instanceof r.Tensor)&&!(typeof Image!="undefined"&&A instanceof Image)&&!(typeof ImageData!="undefined"&&A instanceof ImageData)&&!(typeof ImageBitmap!="undefined"&&A instanceof ImageBitmap)&&!(typeof HTMLImageElement!="undefined"&&A instanceof HTMLImageElement)&&!(typeof HTMLMediaElement!="undefined"&&A instanceof HTMLMediaElement)&&!(typeof HTMLVideoElement!="undefined"&&A instanceof HTMLVideoElement)&&!(typeof HTMLCanvasElement!="undefined"&&A instanceof HTMLCanvasElement)&&!(typeof OffscreenCanvas!="undefined"&&A instanceof OffscreenCanvas))throw new Error("Human: Input type is not recognized");if(A instanceof r.Tensor)if(A.shape&&A.shape.length===4&&A.shape[0]===1&&A.shape[3]===3)t=r.clone(A);else throw new Error(`Human: Input tensor shape must be [1, height, width, 3] and instead was ${A.shape}`);else{let o=A.naturalWidth||A.videoWidth||A.width||A.shape&&A.shape[1]>0,i=A.naturalHeight||A.videoHeight||A.height||A.shape&&A.shape[2]>0,n=o,a=i;if(n>X0&&(n=X0,a=n*i/o),a>X0&&(a=X0,n=a*o/i),e.filter.width>0?n=e.filter.width:e.filter.height>0&&(n=o*(e.filter.height/i)),e.filter.height>0?a=e.filter.height:e.filter.width>0&&(a=i*(e.filter.width/o)),!n||!a)throw new Error("Human: Input cannot determine dimension");(!P||(P==null?void 0:P.width)!==n||(P==null?void 0:P.height)!==a)&&(P=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(n,a):document.createElement("canvas"),(P==null?void 0:P.width)!==n&&(P.width=n),(P==null?void 0:P.height)!==a&&(P.height=a));let x=P.getContext("2d");if(A instanceof ImageData?x.putImageData(A,0,0):e.filter.flip&&typeof x.translate!="undefined"?(x.translate(o,0),x.scale(-1,1),x.drawImage(A,0,0,o,i,0,0,P==null?void 0:P.width,P==null?void 0:P.height),x.setTransform(1,0,0,1,0,0)):x.drawImage(A,0,0,o,i,0,0,P==null?void 0:P.width,P==null?void 0:P.height),e.filter.enabled){if((!I||!W||P.width!==W.width||(P==null?void 0:P.height)!==(W==null?void 0:W.height))&&(W=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(P==null?void 0:P.width,P==null?void 0:P.height):document.createElement("canvas"),(W==null?void 0:W.width)!==(P==null?void 0:P.width)&&(W.width=P==null?void 0:P.width),(W==null?void 0:W.height)!==(P==null?void 0:P.height)&&(W.height=P==null?void 0:P.height),I=r.ENV.flags.IS_BROWSER?new LA({canvas:W}):null),!I)return{tensor:null,canvas:P};I.reset(),I.addFilter("brightness",e.filter.brightness),e.filter.contrast!==0&&I.addFilter("contrast",e.filter.contrast),e.filter.sharpness!==0&&I.addFilter("sharpen",e.filter.sharpness),e.filter.blur!==0&&I.addFilter("blur",e.filter.blur),e.filter.saturation!==0&&I.addFilter("saturation",e.filter.saturation),e.filter.hue!==0&&I.addFilter("hue",e.filter.hue),e.filter.negative&&I.addFilter("negative"),e.filter.sepia&&I.addFilter("sepia"),e.filter.vintage&&I.addFilter("brownie"),e.filter.sepia&&I.addFilter("sepia"),e.filter.kodachrome&&I.addFilter("kodachrome"),e.filter.technicolor&&I.addFilter("technicolor"),e.filter.polaroid&&I.addFilter("polaroid"),e.filter.pixelate!==0&&I.addFilter("pixelate",e.filter.pixelate),I.apply(P)}else W=P,I&&(I=null);let l;if(W.data){let y=[W.height,W.width,3];l=r.tensor3d(W.data,y,"int32")}else if(W instanceof ImageData)l=r.browser.fromPixels(W);else if(e.backend==="webgl"||e.backend==="humangl"){let y=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(n,a):document.createElement("canvas");y.width=n,y.height=a;let h=y.getContext("2d");h==null||h.drawImage(W,0,0),l=r.browser.fromPixels(y)}else{let y=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(n,a):document.createElement("canvas");y.width=n,y.height=a;let h=y.getContext("2d");h==null||h.drawImage(W,0,0);let p=h==null?void 0:h.getImageData(0,0,n,a);l=r.browser.fromPixels(p)}let d=l.toFloat();t=d.expandDims(0),l.dispose(),d.dispose()}let s=e.filter.return?W:null;return{tensor:t,canvas:s}}var V5={};Y(V5,{all:()=>v2,body:()=>XA,canvas:()=>M2,face:()=>HA,gesture:()=>VA,hand:()=>FA,object:()=>qA,options:()=>n0});var n0={color:"rgba(173, 216, 230, 0.3)",labelColor:"rgba(173, 216, 230, 1)",shadowColor:"black",font:'small-caps 16px "Segoe UI"',lineHeight:24,lineWidth:6,pointSize:2,roundRect:28,drawPoints:!1,drawLabels:!0,drawBoxes:!1,drawPolygons:!0,fillPolygons:!1,useDepth:!0,useCurves:!1,bufferedOutput:!1,useRawBoxes:!1,calculateHandBox:!0};function F0(A,e,t,s=0,o){A.fillStyle=o.useDepth&&s?`rgba(${127.5+2*s}, ${127.5-2*s}, 255, 0.3)`:o.color,A.beginPath(),A.arc(e,t,o.pointSize,0,2*Math.PI),A.fill()}function o0(A,e,t,s,o,i){if(A.beginPath(),i.useCurves){let n=(e+e+s)/2,a=(t+t+o)/2;A.ellipse(n,a,s/2,o/2,0,0,2*Math.PI)}else A.lineWidth=i.lineWidth,A.moveTo(e+i.roundRect,t),A.lineTo(e+s-i.roundRect,t),A.quadraticCurveTo(e+s,t,e+s,t+i.roundRect),A.lineTo(e+s,t+o-i.roundRect),A.quadraticCurveTo(e+s,t+o,e+s-i.roundRect,t+o),A.lineTo(e+i.roundRect,t+o),A.quadraticCurveTo(e,t+o,e,t+o-i.roundRect),A.lineTo(e,t+i.roundRect),A.quadraticCurveTo(e,t,e+i.roundRect,t),A.closePath();A.stroke()}function H5(A,e=[],t){if(!(e===void 0||e.length===0)){A.beginPath(),A.moveTo(e[0][0],e[0][1]);for(let s of e)A.strokeStyle=t.useDepth&&s[2]?`rgba(${127.5+2*s[2]}, ${127.5-2*s[2]}, 255, 0.3)`:t.color,A.fillStyle=t.useDepth&&s[2]?`rgba(${127.5+2*s[2]}, ${127.5-2*s[2]}, 255, 0.3)`:t.color,A.lineTo(s[0],parseInt(s[1]));A.stroke(),t.fillPolygons&&(A.closePath(),A.fill())}}function u0(A,e=[],t){if(!(e===void 0||e.length===0)){if(!t.useCurves||e.length<=2){H5(A,e,t);return}A.moveTo(e[0][0],e[0][1]);for(let s=0;s1&&x[1].length>0){let l=a[1]>0?`#${a[1]}`:"",d=`${a[0]} ${l}: ${x[1]}`;s.shadowColor&&s.shadowColor!==""&&(o.fillStyle=s.shadowColor,o.fillText(d,8,2+i*s.lineHeight)),o.fillStyle=s.labelColor,o.fillText(d,6,0+i*s.lineHeight),i+=1}}}async function HA(A,e,t){let s=X(n0,t);if(!e||!A||!(A instanceof HTMLCanvasElement))return;let o=A.getContext("2d");if(!!o)for(let i of e){o.font=s.font,o.strokeStyle=s.color,o.fillStyle=s.color,s.drawBoxes&&(s.useRawBoxes?o0(o,A.width*i.boxRaw[0],A.height*i.boxRaw[1],A.width*i.boxRaw[2],A.height*i.boxRaw[3],s):o0(o,i.box[0],i.box[1],i.box[2],i.box[3],s));let n=[];if(n.push(`face confidence: ${Math.trunc(100*i.confidence)}%`),i.genderConfidence&&n.push(`${i.gender||""} ${Math.trunc(100*i.genderConfidence)}% confident`),i.age&&n.push(`age: ${i.age||""}`),i.iris&&n.push(`iris distance: ${i.iris}`),i.emotion&&i.emotion.length>0){let a=i.emotion.map(x=>`${Math.trunc(100*x.score)}% ${x.emotion}`);n.push(a.join(" "))}i.rotation&&i.rotation.angle&&i.rotation.angle.roll&&n.push(`roll: ${Math.trunc(100*i.rotation.angle.roll)/100} yaw:${Math.trunc(100*i.rotation.angle.yaw)/100} pitch:${Math.trunc(100*i.rotation.angle.pitch)/100}`),n.length===0&&n.push("face"),o.fillStyle=s.color;for(let a=n.length-1;a>=0;a--){let x=Math.max(i.box[0],0),l=a*s.lineHeight+i.box[1];s.shadowColor&&s.shadowColor!==""&&(o.fillStyle=s.shadowColor,o.fillText(n[a],x+5,l+16)),o.fillStyle=s.labelColor,o.fillText(n[a],x+4,l+15)}if(o.lineWidth=1,i.mesh&&i.mesh.length>0){if(s.drawPoints)for(let a of i.mesh)F0(o,a[0],a[1],a[2],s);if(s.drawPolygons){o.lineWidth=1;for(let a=0;ai.mesh[l]);H5(o,x,s)}if(i.annotations&&i.annotations.leftEyeIris){o.strokeStyle=s.useDepth?"rgba(255, 200, 255, 0.3)":s.color,o.beginPath();let a=Math.abs(i.annotations.leftEyeIris[3][0]-i.annotations.leftEyeIris[1][0])/2,x=Math.abs(i.annotations.leftEyeIris[4][1]-i.annotations.leftEyeIris[2][1])/2;o.ellipse(i.annotations.leftEyeIris[0][0],i.annotations.leftEyeIris[0][1],a,x,0,0,2*Math.PI),o.stroke(),s.fillPolygons&&(o.fillStyle=s.useDepth?"rgba(255, 255, 200, 0.3)":s.color,o.fill())}if(i.annotations&&i.annotations.rightEyeIris){o.strokeStyle=s.useDepth?"rgba(255, 200, 255, 0.3)":s.color,o.beginPath();let a=Math.abs(i.annotations.rightEyeIris[3][0]-i.annotations.rightEyeIris[1][0])/2,x=Math.abs(i.annotations.rightEyeIris[4][1]-i.annotations.rightEyeIris[2][1])/2;o.ellipse(i.annotations.rightEyeIris[0][0],i.annotations.rightEyeIris[0][1],a,x,0,0,2*Math.PI),o.stroke(),s.fillPolygons&&(o.fillStyle=s.useDepth?"rgba(255, 255, 200, 0.3)":s.color,o.fill())}}}}}var $=[];async function XA(A,e,t){let s=X(n0,t);if(!e||!A||!(A instanceof HTMLCanvasElement))return;let o=A.getContext("2d");if(!!o){o.lineJoin="round";for(let i=0;ix.part==="leftShoulder"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightShoulder"),n&&a.push([n.position.x,n.position.y]),u0(o,a,s),a.length=0,n=e[i].keypoints.find(x=>x.part==="rightShoulder"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightHip"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftHip"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftShoulder"),n&&a.push([n.position.x,n.position.y]),a.length===4&&H5(o,a,s),a.length=0,n=e[i].keypoints.find(x=>x.part==="leftHip"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftKnee"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftAnkle"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftHeel"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftFoot"),n&&a.push([n.position.x,n.position.y]),u0(o,a,s),a.length=0,n=e[i].keypoints.find(x=>x.part==="rightHip"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightKnee"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightAnkle"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightHeel"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightFoot"),n&&a.push([n.position.x,n.position.y]),u0(o,a,s),a.length=0,n=e[i].keypoints.find(x=>x.part==="leftShoulder"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftElbow"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftWrist"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="leftPalm"),n&&a.push([n.position.x,n.position.y]),u0(o,a,s),a.length=0,n=e[i].keypoints.find(x=>x.part==="rightShoulder"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightElbow"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightWrist"),n&&a.push([n.position.x,n.position.y]),n=e[i].keypoints.find(x=>x.part==="rightPalm"),n&&a.push([n.position.x,n.position.y]),u0(o,a,s)}}}}async function FA(A,e,t){let s=X(n0,t);if(!e||!A||!(A instanceof HTMLCanvasElement))return;let o=A.getContext("2d");if(!!o){o.lineJoin="round",o.font=s.font;for(let i of e){if(s.drawBoxes){o.strokeStyle=s.color,o.fillStyle=s.color;let n;if(!s.calculateHandBox)n=s.useRawBoxes?i.boxRaw:i.box;else if(n=[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,0,0],i.landmarks&&i.landmarks.length>0){for(let a of i.landmarks)a[0]n[2]&&(n[2]=a[0]),a[1]>n[3]&&(n[3]=a[1]);n[2]-=n[0],n[3]-=n[1]}s.useRawBoxes?o0(o,A.width*n[0],A.height*n[1],A.width*n[2],A.height*n[3],s):o0(o,n[0],n[1],n[2],n[3],s),s.drawLabels&&(s.shadowColor&&s.shadowColor!==""&&(o.fillStyle=s.shadowColor,o.fillText("hand",n[0]+3,1+n[1]+s.lineHeight,n[2])),o.fillStyle=s.labelColor,o.fillText("hand",n[0]+2,0+n[1]+s.lineHeight,n[2])),o.stroke()}if(s.drawPoints&&i.landmarks&&i.landmarks.length>0)for(let n of i.landmarks)o.fillStyle=s.useDepth?`rgba(${127.5+2*n[2]}, ${127.5-2*n[2]}, 255, 0.5)`:s.color,F0(o,n[0],n[1],0,s);if(s.drawLabels){let n=(a,x)=>{o.fillStyle=s.useDepth?`rgba(${127.5+2*a[a.length-1][2]}, ${127.5-2*a[a.length-1][2]}, 255, 0.5)`:s.color,o.fillText(x,a[a.length-1][0]+4,a[a.length-1][1]+4)};o.font=s.font,n(i.annotations.indexFinger,"index"),n(i.annotations.middleFinger,"middle"),n(i.annotations.ringFinger,"ring"),n(i.annotations.pinky,"pinky"),n(i.annotations.thumb,"thumb"),n(i.annotations.palmBase,"palm")}if(s.drawPolygons){let n=a=>{if(!!a)for(let x=0;x0?x-1:0][0],a[x>0?x-1:0][1]),o.lineTo(a[x][0],a[x][1]),o.stroke()};o.lineWidth=s.lineWidth,n(i.annotations.indexFinger),n(i.annotations.middleFinger),n(i.annotations.ringFinger),n(i.annotations.pinky),n(i.annotations.thumb)}}}}async function qA(A,e,t){let s=X(n0,t);if(!e||!A||!(A instanceof HTMLCanvasElement))return;let o=A.getContext("2d");if(!!o){o.lineJoin="round",o.font=s.font;for(let i of e)if(s.drawBoxes){if(o.strokeStyle=s.color,o.fillStyle=s.color,s.useRawBoxes?o0(o,A.width*i.boxRaw[0],A.height*i.boxRaw[1],A.width*i.boxRaw[2],A.height*i.boxRaw[3],s):o0(o,i.box[0],i.box[1],i.box[2],i.box[3],s),s.drawLabels){let n=`${Math.round(100*i.score)}% ${i.label}`;s.shadowColor&&s.shadowColor!==""&&(o.fillStyle=s.shadowColor,o.fillText(n,i.box[0]+3,1+i.box[1]+s.lineHeight,i.box[2])),o.fillStyle=s.labelColor,o.fillText(n,i.box[0]+2,0+i.box[1]+s.lineHeight,i.box[2])}o.stroke()}}}async function M2(A,e){if(!A||!e||!(A instanceof HTMLCanvasElement)||!(e instanceof HTMLCanvasElement))return;let t=A.getContext("2d");t==null||t.drawImage(A,0,0)}async function v2(A,e,t){let s=X(n0,t);!e||!A||A instanceof HTMLCanvasElement&&(HA(A,e.face,s),XA(A,e.body,s),FA(A,e.hand,s),VA(A,e.gesture,s),qA(A,e.object,s))}var q0=` /9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUA AAABAAAARgEoAAMAAAABAAIAAAExAAIAAAARAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQu bmV0IDQuMi4xMwAA/9sAQwAGBAUGBQQGBgUGBwcGCAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxob @@ -163,7 +163,7 @@ PQ4GJ+ashuK0MhWaoWcA0AaOmASMK7jRNPWYBmHyiuepO2x10qfcv6vYxCzYqoGK4HVYVTJrmb5l c6oaM5TUJ8EgGsG4kLNUHT0M64OaqMMikSRsuKbnFMRLG3zVehOaGNE445NNlnVFpDMu6uie9Vo1 8z5mOAOST2pDK91cNN+5tsrH3PrW54a06KxT7fdrlh/q1Pc+tJ6IUdZGvHPLezMcnBOWbsPap5r3 ylFtbdT1xUWNWzU0/Zbwlgfmx8zGsHWtRHmMqE59aAMyNifvHPc1f0gtPdqkY5JosJHeNci2tktY -euPnNY+oXWZEVJNrZ9aun8SIq/CzodHuriIokhDIR1ronbKZr0o6o8ipoz//2Q==`,q0=` +euPnNY+oXWZEVJNrZ9aun8SIq/CzodHuriIokhDIR1ronbKZr0o6o8ipoz//2Q==`,B0=` /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAsICAoIBwsKCQoNDAsNERwSEQ8PESIZGhQcKSQrKigk JyctMkA3LTA9MCcnOEw5PUNFSElIKzZPVU5GVEBHSEX/2wBDAQwNDREPESESEiFFLicuRUVFRUVF RUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUX/wAARCASwBLADASIA @@ -731,5 +731,5 @@ AAAAAAJAAAAAAAAAAAAAABAJEAAAAAAAAAAAAAAAIEoBKAAAAAAAAAAAAAAABAlAAAAAAAIAAAAA BAkBAkBAkBAlACEgMZjdjbFW8bWrEx8YWANb6Fp+bfwab+vLDKMFK9qxH5L0bAr8OPRPKz2AY7J2 SbAjYZAI2E7AIEgIEgIEgMdkSy2NgY7MdlmyNoBXsxmFuyNgVTVjNV3KjlBRNTlXTVHKCrlIqt5T lBhEMohlFerLlBjEMohMVTEARDKCITsAk2AEgAAAkAAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAD/ -2Q==`;var qA="1.8.3";var y0,u0,p0,o0,B0,b0,U0,Y0,J0,E2=class{constructor(e={}){y0.set(this,void 0);u0.set(this,void 0);p0.set(this,void 0);o0.set(this,void 0);this.analyze=(...e)=>{if(!q(this,u0))return;let t=this.tf.engine().state.numTensors,s=q(this,y0);A0(this,y0,t);let o=t-s;o!==0&&b(...e,o)};B0.set(this,e=>{if(!q(this,p0))return null;if(!e)return"input is not defined";if(this.tf.ENV.flags.IS_NODE&&!(e instanceof r.Tensor))return"input must be a tensor";try{this.tf.getBackend()}catch(t){return"backend not loaded"}return null});b0.set(this,async(e=!1)=>{var t;if(this.config.backend&&this.config.backend.length>0&&e||this.tf.getBackend()!==this.config.backend){let s=S();if(this.state="backend",this.config.backend&&this.config.backend.length>0){if(typeof window=="undefined"&&typeof WorkerGlobalScope!="undefined"&&this.config.debug&&b("running inside web worker"),this.tf.ENV.flags.IS_BROWSER&&this.config.backend==="tensorflow"&&(this.config.backend="webgl"),this.tf.ENV.flags.IS_NODE&&(this.config.backend==="webgl"||this.config.backend==="humangl")&&(this.config.backend="tensorflow"),this.config.debug&&b("setting backend:",this.config.backend),this.config.backend==="wasm"){if(this.config.debug&&b("wasm path:",this.config.wasmPath),typeof((t=this.tf)==null?void 0:t.setWasmPaths)!="undefined")this.tf.setWasmPaths(this.config.wasmPath);else throw new Error("Human: WASM backend is not loaded");let o=await this.tf.env().getAsync("WASM_HAS_SIMD_SUPPORT"),i=await this.tf.env().getAsync("WASM_HAS_MULTITHREAD_SUPPORT");this.config.debug&&b(`wasm execution: ${o?"SIMD":"no SIMD"} ${i?"multithreaded":"singlethreaded"}`),this.config.debug&&!o&&b("warning: wasm simd support is not enabled")}this.config.backend==="humangl"&&G5();try{await this.tf.setBackend(this.config.backend)}catch(o){b("error: cannot set backend:",this.config.backend,o)}}if(this.tf.enableProdMode(),this.tf.getBackend()==="webgl"||this.tf.getBackend()==="humangl"){this.tf.ENV.set("CHECK_COMPUTATION_FOR_ERRORS",!1),this.tf.ENV.set("WEBGL_PACK_DEPTHWISECONV",!0),typeof this.config.deallocate!="undefined"&&(b("changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:",!0),this.tf.ENV.set("WEBGL_DELETE_TEXTURE_THRESHOLD",0));let o=await this.tf.backend().getGPGPUContext().gl;this.config.debug&&b(`gl version:${o.getParameter(o.VERSION)} renderer:${o.getParameter(o.RENDERER)}`)}await this.tf.ready(),this.perf.backend=Math.trunc(S()-s)}});U0.set(this,async()=>{let e=(o,i="application/octet-stream")=>fetch(`data:${i};base64,${o}`).then(n=>n.blob()),t,s;switch(this.config.warmup){case"face":t=await e(F0);break;case"full":t=await e(q0);break;default:t=null}if(t){let o=await createImageBitmap(t);s=await this.detect(o,this.config),o.close()}return s});Y0.set(this,async()=>new Promise(e=>{let t,s=0;switch(this.config.warmup){case"face":s=256,t="data:image/jpeg;base64,"+F0;break;case"full":case"body":s=1200,t="data:image/jpeg;base64,"+q0;break;default:t=null}let o=new Image;o.onload=async()=>{let i=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(s,s):document.createElement("canvas");i.width=o.naturalWidth,i.height=o.naturalHeight;let n=i.getContext("2d");n==null||n.drawImage(o,0,0);let a=await this.detect(i,this.config);e(a)},t?o.src=t:e(null)}));J0.set(this,async()=>{let e=o=>Buffer.from(o,"base64"),t;if(this.config.warmup==="face"&&(t=e(F0)),(this.config.warmup==="body"||this.config.warmup==="full")&&(t=e(q0)),!t)return null;let s;if(typeof r.node!="undefined"){let o=r.node.decodeJpeg(t),i=o.expandDims(0);this.tf.dispose(o),s=await this.detect(i,this.config),this.tf.dispose(i)}else this.config.debug&&b("Warmup tfjs-node not loaded");return s});this.tf=r,this.draw=L5,this.version=qA,this.config=X(B5,e),this.state="idle",A0(this,y0,0),A0(this,u0,!1),A0(this,p0,!1),A0(this,o0,!0),this.perf={},this.models={face:null,posenet:null,blazepose:null,efficientpose:null,handpose:null,iris:null,age:null,gender:null,emotion:null,embedding:null,nanodet:null,faceres:null},this.image=t=>Z5(t,this.config),this.classes={facemesh:A5,emotion:o5,faceres:a5,body:this.config.body.modelPath.includes("posenet")?p5:j5,hand:v5,nanodet:W5},this.faceTriangulation=aA,this.faceUVMap=xA,this.sysinfo=U5()}similarity(e,t){return y5(e,t)}enhance(e){return l5(e)}match(e,t,s=0){return yA(e,t,s)}async load(e={}){this.state="load";let t=S();e&&(this.config=X(this.config,e)),q(this,o0)&&(this.config.debug&&b(`version: ${this.version}`),this.config.debug&&b(`tfjs version: ${this.tf.version_core}`),this.config.debug&&b("platform:",this.sysinfo.platform),this.config.debug&&b("agent:",this.sysinfo.agent),await q(this,b0).call(this,!0),this.tf.ENV.flags.IS_BROWSER&&(this.config.debug&&b("configuration:",this.config),this.config.debug&&b("tf flags:",this.tf.ENV.flags))),this.config.async?[this.models.face,this.models.emotion,this.models.handpose,this.models.posenet,this.models.blazepose,this.models.nanodet,this.models.faceres]=await Promise.all([this.models.face||(this.config.face.enabled?n5(this.config):null),this.models.emotion||(this.config.face.enabled&&this.config.face.emotion.enabled?r5(this.config):null),this.models.handpose||(this.config.hand.enabled?R5(this.config):null),this.models.posenet||(this.config.body.enabled&&this.config.body.modelPath.includes("posenet")?g5(this.config):null),this.models.blazepose||(this.config.body.enabled&&this.config.body.modelPath.includes("blazepose")?S5(this.config):null),this.models.nanodet||(this.config.object.enabled?N5(this.config):null),this.models.faceres||(this.config.face.enabled&&this.config.face.description.enabled?x5(this.config):null)]):(this.config.face.enabled&&!this.models.face&&(this.models.face=await n5(this.config)),this.config.face.enabled&&this.config.face.emotion.enabled&&!this.models.emotion&&(this.models.emotion=await r5(this.config)),this.config.hand.enabled&&!this.models.handpose&&(this.models.handpose=await R5(this.config)),this.config.body.enabled&&!this.models.posenet&&this.config.body.modelPath.includes("posenet")&&(this.models.posenet=await g5(this.config)),this.config.body.enabled&&!this.models.blazepose&&this.config.body.modelPath.includes("blazepose")&&(this.models.blazepose=await S5(this.config)),this.config.object.enabled&&!this.models.nanodet&&(this.models.nanodet=await N5(this.config)),this.config.face.enabled&&this.config.face.description.enabled&&!this.models.faceres&&(this.models.faceres=await x5(this.config))),q(this,o0)&&(this.config.debug&&b("tf engine state:",this.tf.engine().state.numBytes,"bytes",this.tf.engine().state.numTensors,"tensors"),A0(this,o0,!1));let s=Math.trunc(S()-t);s>(this.perf.load||0)&&(this.perf.load=s)}async detect(e,t={}){return new Promise(async s=>{this.state="config";let o;this.config=X(this.config,t),this.state="check";let i=q(this,B0).call(this,e);i&&(b(i,e),s({error:i}));let n=S();await q(this,b0).call(this),await this.load();let a;e&&this.config.videoOptimized&&typeof window!="undefined"&&typeof WorkerGlobalScope!="undefined"&&(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof Image!="undefined"&&e instanceof Image||typeof ImageData!="undefined"&&e instanceof ImageData||typeof ImageBitmap!="undefined"&&O5 instanceof ImageBitmap)&&(b("disabling video optimization"),a=this.config.videoOptimized,this.config.videoOptimized=!1),o=S();let x=Z5(e,this.config);if(!x||!x.tensor){b("could not convert input to tensor"),s({error:"could not convert input to tensor"});return}this.perf.image=Math.trunc(S()-o),this.analyze("Get Image:");let l,d,y,h,p;this.config.async?(y=this.config.face.enabled?c5(this,x.tensor):[],this.perf.face&&delete this.perf.face):(this.state="run:face",o=S(),y=this.config.face.enabled?await c5(this,x.tensor):[],p=Math.trunc(S()-o),p>0&&(this.perf.face=p)),this.analyze("Start Body:"),this.config.async?(this.config.body.modelPath.includes("posenet")?l=this.config.body.enabled?b5(x.tensor,this.config):[]:this.config.body.modelPath.includes("blazepose")&&(l=this.config.body.enabled?w5(x.tensor,this.config):[]),this.perf.body&&delete this.perf.body):(this.state="run:body",o=S(),this.config.body.modelPath.includes("posenet")?l=this.config.body.enabled?await b5(x.tensor,this.config):[]:this.config.body.modelPath.includes("blazepose")&&(l=this.config.body.enabled?await w5(x.tensor,this.config):[]),p=Math.trunc(S()-o),p>0&&(this.perf.body=p)),this.analyze("End Body:"),this.analyze("Start Hand:"),this.config.async?(d=this.config.hand.enabled?E5(x.tensor,this.config):[],this.perf.hand&&delete this.perf.hand):(this.state="run:hand",o=S(),d=this.config.hand.enabled?await E5(x.tensor,this.config):[],p=Math.trunc(S()-o),p>0&&(this.perf.hand=p)),this.analyze("End Hand:"),this.analyze("Start Object:"),this.config.async?(h=this.config.object.enabled?k5(x.tensor,this.config):[],this.perf.object&&delete this.perf.object):(this.state="run:object",o=S(),h=this.config.object.enabled?await k5(x.tensor,this.config):[],p=Math.trunc(S()-o),p>0&&(this.perf.object=p)),this.analyze("End Object:"),this.config.async&&([y,l,d,h]=await Promise.all([y,l,d,h])),r.dispose(x.tensor);let M=[];this.config.gesture.enabled&&(o=S(),M=[...NA(y),...IA(l),...OA(d),...kA(y)],this.config.async?this.perf.gesture&&delete this.perf.gesture:this.perf.gesture=Math.trunc(S()-o)),a&&(this.config.videoOptimized=a),this.perf.total=Math.trunc(S()-n),this.state="idle";let c={face:y,body:l,hand:d,gesture:M,object:h,performance:this.perf,canvas:x.canvas};s(c)})}async warmup(e={}){let t=S();if(e&&(this.config=X(this.config,e)),!this.config.warmup||this.config.warmup==="none")return{error:"null"};let s=this.config.videoOptimized;this.config.videoOptimized=!1;let o;typeof createImageBitmap=="function"?o=await q(this,U0).call(this):typeof Image!="undefined"?o=await q(this,Y0).call(this):o=await q(this,J0).call(this),this.config.videoOptimized=s;let i=S();return this.config.debug&&b("Warmup",this.config.warmup,Math.round(i-t),"ms",o),o}};y0=new WeakMap,u0=new WeakMap,p0=new WeakMap,o0=new WeakMap,B0=new WeakMap,b0=new WeakMap,U0=new WeakMap,Y0=new WeakMap,J0=new WeakMap;export{E2 as Human,E2 as default}; +2Q==`;var BA="1.8.4";var l0,p0,b0,s0,U0,g0,Y0,J0,C0,R2=class{constructor(e={}){J(this,l0,void 0);J(this,p0,void 0);J(this,b0,void 0);J(this,s0,void 0);this.analyze=(...e)=>{if(!q(this,p0))return;let t=this.tf.engine().state.numTensors,s=q(this,l0);e0(this,l0,t);let o=t-s;o!==0&&b(...e,o)};J(this,U0,e=>{if(!q(this,b0))return null;if(!e)return"input is not defined";if(this.tf.ENV.flags.IS_NODE&&!(e instanceof r.Tensor))return"input must be a tensor";try{this.tf.getBackend()}catch(t){return"backend not loaded"}return null});J(this,g0,async(e=!1)=>{var t;if(this.config.backend&&this.config.backend.length>0&&e||this.tf.getBackend()!==this.config.backend){let s=S();if(this.state="backend",this.config.backend&&this.config.backend.length>0){if(typeof window=="undefined"&&typeof WorkerGlobalScope!="undefined"&&this.config.debug&&b("running inside web worker"),this.tf.ENV.flags.IS_BROWSER&&this.config.backend==="tensorflow"&&(this.config.backend="webgl"),this.tf.ENV.flags.IS_NODE&&(this.config.backend==="webgl"||this.config.backend==="humangl")&&(this.config.backend="tensorflow"),this.config.debug&&b("setting backend:",this.config.backend),this.config.backend==="wasm"){if(this.config.debug&&b("wasm path:",this.config.wasmPath),typeof((t=this.tf)==null?void 0:t.setWasmPaths)!="undefined")this.tf.setWasmPaths(this.config.wasmPath);else throw new Error("Human: WASM backend is not loaded");let o=await this.tf.env().getAsync("WASM_HAS_SIMD_SUPPORT"),i=await this.tf.env().getAsync("WASM_HAS_MULTITHREAD_SUPPORT");this.config.debug&&b(`wasm execution: ${o?"SIMD":"no SIMD"} ${i?"multithreaded":"singlethreaded"}`),this.config.debug&&!o&&b("warning: wasm simd support is not enabled")}this.config.backend==="humangl"&&Q5();try{await this.tf.setBackend(this.config.backend)}catch(o){b("error: cannot set backend:",this.config.backend,o)}}if(this.tf.enableProdMode(),this.tf.getBackend()==="webgl"||this.tf.getBackend()==="humangl"){this.tf.ENV.set("CHECK_COMPUTATION_FOR_ERRORS",!1),this.tf.ENV.set("WEBGL_PACK_DEPTHWISECONV",!0),typeof this.config.deallocate!="undefined"&&(b("changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:",!0),this.tf.ENV.set("WEBGL_DELETE_TEXTURE_THRESHOLD",0));let o=await this.tf.backend().getGPGPUContext().gl;this.config.debug&&b(`gl version:${o.getParameter(o.VERSION)} renderer:${o.getParameter(o.RENDERER)}`)}await this.tf.ready(),this.perf.backend=Math.trunc(S()-s)}});J(this,Y0,async()=>{let e=(o,i="application/octet-stream")=>fetch(`data:${i};base64,${o}`).then(n=>n.blob()),t,s;switch(this.config.warmup){case"face":t=await e(q0);break;case"full":t=await e(B0);break;default:t=null}if(t){let o=await createImageBitmap(t);s=await this.detect(o,this.config),o.close()}return s});J(this,J0,async()=>new Promise(e=>{let t,s=0;switch(this.config.warmup){case"face":s=256,t="data:image/jpeg;base64,"+q0;break;case"full":case"body":s=1200,t="data:image/jpeg;base64,"+B0;break;default:t=null}let o=new Image;o.onload=async()=>{let i=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(s,s):document.createElement("canvas");i.width=o.naturalWidth,i.height=o.naturalHeight;let n=i.getContext("2d");n==null||n.drawImage(o,0,0);let a=await this.detect(i,this.config);e(a)},t?o.src=t:e(null)}));J(this,C0,async()=>{let e=o=>Buffer.from(o,"base64"),t;if(this.config.warmup==="face"&&(t=e(q0)),(this.config.warmup==="body"||this.config.warmup==="full")&&(t=e(B0)),!t)return null;let s;if(typeof r.node!="undefined"){let o=r.node.decodeJpeg(t),i=o.expandDims(0);this.tf.dispose(o),s=await this.detect(i,this.config),this.tf.dispose(i)}else this.config.debug&&b("Warmup tfjs-node not loaded");return s});this.tf=r,this.draw=V5,this.version=BA,this.config=X(U5,e),this.state="idle",e0(this,l0,0),e0(this,p0,!1),e0(this,b0,!1),e0(this,s0,!0),this.perf={},this.models={face:null,posenet:null,blazepose:null,efficientpose:null,handpose:null,iris:null,age:null,gender:null,emotion:null,embedding:null,nanodet:null,faceres:null},this.image=t=>L5(t,this.config),this.classes={facemesh:e5,emotion:s5,faceres:x5,body:this.config.body.modelPath.includes("posenet")?b5:S5,hand:E5,nanodet:I5},this.faceTriangulation=xA,this.faceUVMap=yA,this.sysinfo=Y5()}similarity(e,t){return l5(e,t)}enhance(e){return c5(e)}match(e,t,s=0){return lA(e,t,s)}async load(e={}){this.state="load";let t=S();e&&(this.config=X(this.config,e)),q(this,s0)&&(this.config.debug&&b(`version: ${this.version}`),this.config.debug&&b(`tfjs version: ${this.tf.version_core}`),this.config.debug&&b("platform:",this.sysinfo.platform),this.config.debug&&b("agent:",this.sysinfo.agent),await q(this,g0).call(this,!0),this.tf.ENV.flags.IS_BROWSER&&(this.config.debug&&b("configuration:",this.config),this.config.debug&&b("tf flags:",this.tf.ENV.flags))),this.config.async?[this.models.face,this.models.emotion,this.models.handpose,this.models.posenet,this.models.blazepose,this.models.nanodet,this.models.faceres]=await Promise.all([this.models.face||(this.config.face.enabled?o5(this.config):null),this.models.emotion||(this.config.face.enabled&&this.config.face.emotion.enabled?a5(this.config):null),this.models.handpose||(this.config.hand.enabled?j5(this.config):null),this.models.posenet||(this.config.body.enabled&&this.config.body.modelPath.includes("posenet")?T5(this.config):null),this.models.blazepose||(this.config.body.enabled&&this.config.body.modelPath.includes("blazepose")?w5(this.config):null),this.models.nanodet||(this.config.object.enabled?k5(this.config):null),this.models.faceres||(this.config.face.enabled&&this.config.face.description.enabled?y5(this.config):null)]):(this.config.face.enabled&&!this.models.face&&(this.models.face=await o5(this.config)),this.config.face.enabled&&this.config.face.emotion.enabled&&!this.models.emotion&&(this.models.emotion=await a5(this.config)),this.config.hand.enabled&&!this.models.handpose&&(this.models.handpose=await j5(this.config)),this.config.body.enabled&&!this.models.posenet&&this.config.body.modelPath.includes("posenet")&&(this.models.posenet=await T5(this.config)),this.config.body.enabled&&!this.models.blazepose&&this.config.body.modelPath.includes("blazepose")&&(this.models.blazepose=await w5(this.config)),this.config.object.enabled&&!this.models.nanodet&&(this.models.nanodet=await k5(this.config)),this.config.face.enabled&&this.config.face.description.enabled&&!this.models.faceres&&(this.models.faceres=await y5(this.config))),q(this,s0)&&(this.config.debug&&b("tf engine state:",this.tf.engine().state.numBytes,"bytes",this.tf.engine().state.numTensors,"tensors"),e0(this,s0,!1));let s=Math.trunc(S()-t);s>(this.perf.load||0)&&(this.perf.load=s)}async detect(e,t={}){return new Promise(async s=>{this.state="config";let o;this.config=X(this.config,t),this.state="check";let i=q(this,U0).call(this,e);i&&(b(i,e),s({error:i}));let n=S();await q(this,g0).call(this),await this.load();let a;e&&this.config.videoOptimized&&typeof window!="undefined"&&typeof WorkerGlobalScope!="undefined"&&(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof Image!="undefined"&&e instanceof Image||typeof ImageData!="undefined"&&e instanceof ImageData||typeof ImageBitmap!="undefined"&&Z5 instanceof ImageBitmap)&&(b("disabling video optimization"),a=this.config.videoOptimized,this.config.videoOptimized=!1),o=S();let x=L5(e,this.config);if(!x||!x.tensor){b("could not convert input to tensor"),s({error:"could not convert input to tensor"});return}this.perf.image=Math.trunc(S()-o),this.analyze("Get Image:");let l,d,y,h,p;this.config.async?(y=this.config.face.enabled?d5(this,x.tensor):[],this.perf.face&&delete this.perf.face):(this.state="run:face",o=S(),y=this.config.face.enabled?await d5(this,x.tensor):[],p=Math.trunc(S()-o),p>0&&(this.perf.face=p)),this.analyze("Start Body:"),this.config.async?(this.config.body.modelPath.includes("posenet")?l=this.config.body.enabled?g5(x.tensor,this.config):[]:this.config.body.modelPath.includes("blazepose")&&(l=this.config.body.enabled?W5(x.tensor,this.config):[]),this.perf.body&&delete this.perf.body):(this.state="run:body",o=S(),this.config.body.modelPath.includes("posenet")?l=this.config.body.enabled?await g5(x.tensor,this.config):[]:this.config.body.modelPath.includes("blazepose")&&(l=this.config.body.enabled?await W5(x.tensor,this.config):[]),p=Math.trunc(S()-o),p>0&&(this.perf.body=p)),this.analyze("End Body:"),this.analyze("Start Hand:"),this.config.async?(d=this.config.hand.enabled?R5(x.tensor,this.config):[],this.perf.hand&&delete this.perf.hand):(this.state="run:hand",o=S(),d=this.config.hand.enabled?await R5(x.tensor,this.config):[],p=Math.trunc(S()-o),p>0&&(this.perf.hand=p)),this.analyze("End Hand:"),this.analyze("Start Object:"),this.config.async?(h=this.config.object.enabled?O5(x.tensor,this.config):[],this.perf.object&&delete this.perf.object):(this.state="run:object",o=S(),h=this.config.object.enabled?await O5(x.tensor,this.config):[],p=Math.trunc(S()-o),p>0&&(this.perf.object=p)),this.analyze("End Object:"),this.config.async&&([y,l,d,h]=await Promise.all([y,l,d,h])),r.dispose(x.tensor);let M=[];this.config.gesture.enabled&&(o=S(),M=[...kA(y),...NA(l),...ZA(d),...OA(y)],this.config.async?this.perf.gesture&&delete this.perf.gesture:this.perf.gesture=Math.trunc(S()-o)),a&&(this.config.videoOptimized=a),this.perf.total=Math.trunc(S()-n),this.state="idle";let c={face:y,body:l,hand:d,gesture:M,object:h,performance:this.perf,canvas:x.canvas};s(c)})}async warmup(e={}){let t=S();if(e&&(this.config=X(this.config,e)),!this.config.warmup||this.config.warmup==="none")return{error:"null"};let s=this.config.videoOptimized;this.config.videoOptimized=!1;let o;typeof createImageBitmap=="function"?o=await q(this,Y0).call(this):typeof Image!="undefined"?o=await q(this,J0).call(this):o=await q(this,C0).call(this),this.config.videoOptimized=s;let i=S();return this.config.debug&&b("Warmup",this.config.warmup,Math.round(i-t),"ms",o),o}};l0=new WeakMap,p0=new WeakMap,b0=new WeakMap,s0=new WeakMap,U0=new WeakMap,g0=new WeakMap,Y0=new WeakMap,J0=new WeakMap,C0=new WeakMap;export{R2 as Human,R2 as default}; //# sourceMappingURL=human.esm-nobundle.js.map diff --git a/dist/human.esm-nobundle.js.map b/dist/human.esm-nobundle.js.map index 5712b2b2..2de1b49b 100644 --- a/dist/human.esm-nobundle.js.map +++ b/dist/human.esm-nobundle.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/helpers.ts", "../src/config.ts", "../src/sysinfo.ts", "../src/tfjs/tf-browser.ts", "../src/tfjs/backend.ts", "../src/blazeface/facemesh.ts", "../src/blazeface/box.ts", "../src/blazeface/util.ts", "../src/blazeface/blazeface.ts", "../src/blazeface/coords.ts", "../src/blazeface/facepipeline.ts", "../src/emotion/emotion.ts", "../src/faceres/faceres.ts", "../src/faceall.ts", "../src/posenet/posenet.ts", "../src/posenet/keypoints.ts", "../src/posenet/utils.ts", "../src/posenet/poses.ts", "../src/handpose/handpose.ts", "../src/handpose/box.ts", "../src/handpose/anchors.ts", "../src/handpose/handdetector.ts", "../src/handpose/util.ts", "../src/handpose/handpipeline.ts", "../src/blazepose/blazepose.ts", "../src/blazepose/annotations.ts", "../src/nanodet/nanodet.ts", "../src/nanodet/labels.ts", "../src/gesture/gesture.ts", "../src/image/image.ts", "../src/image/imagefx.js", "../src/draw/draw.ts", "../src/sample.ts", "../src/human.ts"], - "sourcesContent": ["// helper function: join two paths\nexport function join(folder: string, file: string): string {\n const separator = folder.endsWith('/') ? '' : '/';\n const skipJoin = file.startsWith('.') || file.startsWith('/') || file.startsWith('http:') || file.startsWith('https:') || file.startsWith('file:');\n const path = skipJoin ? `${file}` : `${folder}${separator}${file}`;\n if (!path.toLocaleLowerCase().includes('.json')) throw new Error(`Human: ModelPath Error: ${path} Expecting JSON file`);\n return path;\n}\n\n// helper function: wrapper around console output\nexport function log(...msg) {\n const dt = new Date();\n const ts = `${dt.getHours().toString().padStart(2, '0')}:${dt.getMinutes().toString().padStart(2, '0')}:${dt.getSeconds().toString().padStart(2, '0')}.${dt.getMilliseconds().toString().padStart(3, '0')}`;\n // eslint-disable-next-line no-console\n if (msg) console.log(ts, 'Human:', ...msg);\n}\n\n// helper function: gets elapsed time on both browser and nodejs\nexport const now = () => {\n if (typeof performance !== 'undefined') return performance.now();\n return parseInt((Number(process.hrtime.bigint()) / 1000 / 1000).toString());\n};\n\n// helper function: perform deep merge of multiple objects so it allows full inheriance with overrides\nexport function mergeDeep(...objects) {\n const isObject = (obj) => obj && typeof obj === 'object';\n return objects.reduce((prev, obj) => {\n Object.keys(obj || {}).forEach((key) => {\n const pVal = prev[key];\n const oVal = obj[key];\n if (Array.isArray(pVal) && Array.isArray(oVal)) prev[key] = pVal.concat(...oVal);\n else if (isObject(pVal) && isObject(oVal)) prev[key] = mergeDeep(pVal, oVal);\n else prev[key] = oVal;\n });\n return prev;\n }, {});\n}\n", "/* eslint-disable indent */\n/* eslint-disable no-multi-spaces */\n\n/**\n * Configuration interface definition for **Human** library\n *\n * Contains all configurable parameters\n */\nexport interface Config {\n /** Backend used for TFJS operations */\n backend: null | '' | 'cpu' | 'wasm' | 'webgl' | 'humangl' | 'tensorflow',\n\n /** Path to *.wasm files if backend is set to `wasm` */\n wasmPath: string,\n\n /** Print debug statements to console */\n debug: boolean,\n\n /** Perform model loading and inference concurrently or sequentially */\n async: boolean,\n\n /** Perform additional optimizations when input is video,\n * - must be disabled for images\n * - automatically disabled for Image, ImageData, ImageBitmap and Tensor inputs\n * - skips boundary detection for every `skipFrames` frames specified for each model\n * - while maintaining in-box detection since objects don't change definition as fast */\n videoOptimized: boolean,\n\n /** What to use for `human.warmup()`\n * - warmup pre-initializes all models for faster inference but can take significant time on startup\n * - only used for `webgl` and `humangl` backends\n */\n warmup: 'none' | 'face' | 'full' | 'body',\n\n /** Base model path (typically starting with file://, http:// or https://) for all models\n * - individual modelPath values are relative to this path\n */\n modelBasePath: string,\n\n /** Run input through image filters before inference\n * - image filters run with near-zero latency as they are executed on the GPU\n */\n filter: {\n enabled: boolean,\n /** Resize input width\n * - if both width and height are set to 0, there is no resizing\n * - if just one is set, second one is scaled automatically\n * - if both are set, values are used as-is\n */\n width: number,\n /** Resize input height\n * - if both width and height are set to 0, there is no resizing\n * - if just one is set, second one is scaled automatically\n * - if both are set, values are used as-is\n */\n height: number,\n /** Return processed canvas imagedata in result */\n return: boolean,\n /** Flip input as mirror image */\n flip: boolean,\n /** Range: -1 (darken) to 1 (lighten) */\n brightness: number,\n /** Range: -1 (reduce contrast) to 1 (increase contrast) */\n contrast: number,\n /** Range: 0 (no sharpening) to 1 (maximum sharpening) */\n sharpness: number,\n /** Range: 0 (no blur) to N (blur radius in pixels) */\n blur: number\n /** Range: -1 (reduce saturation) to 1 (increase saturation) */\n saturation: number,\n /** Range: 0 (no change) to 360 (hue rotation in degrees) */\n hue: number,\n /** Image negative */\n negative: boolean,\n /** Image sepia colors */\n sepia: boolean,\n /** Image vintage colors */\n vintage: boolean,\n /** Image kodachrome colors */\n kodachrome: boolean,\n /** Image technicolor colors */\n technicolor: boolean,\n /** Image polaroid camera effect */\n polaroid: boolean,\n /** Range: 0 (no pixelate) to N (number of pixels to pixelate) */\n pixelate: number,\n },\n // type definition end\n\n /** Controlls gesture detection */\n gesture: {\n enabled: boolean,\n },\n\n /** Controlls and configures all face-specific options:\n * - face detection, face mesh detection, age, gender, emotion detection and face description\n * Parameters:\n * - enabled: true/false\n * - modelPath: path for each of face models\n * - minConfidence: threshold for discarding a prediction\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of faces detected in the input, should be set to the minimum number for performance\n * - rotation: use calculated rotated face image or just box with rotation as-is, false means higher performance, but incorrect mesh mapping on higher face angles\n * - skipFrames: how many frames to go without re-running the face detector and just run modified face mesh analysis, only valid if videoOptimized is set to true\n * - skipInitial: if previous detection resulted in no faces detected, should skipFrames be reset immediately to force new detection cycle\n * - return: return extracted face as tensor for futher user processing\n */\n face: {\n enabled: boolean,\n detector: {\n modelPath: string,\n rotation: boolean,\n maxDetected: number,\n skipFrames: number,\n skipInitial: boolean,\n minConfidence: number,\n iouThreshold: number,\n return: boolean,\n },\n mesh: {\n enabled: boolean,\n modelPath: string,\n },\n iris: {\n enabled: boolean,\n modelPath: string,\n },\n description: {\n enabled: boolean,\n modelPath: string,\n skipFrames: number,\n minConfidence: number,\n },\n emotion: {\n enabled: boolean,\n minConfidence: number,\n skipFrames: number,\n modelPath: string,\n },\n },\n\n /** Controlls and configures all body detection specific options\n * - enabled: true/false\n * - modelPath: body pose model, can be absolute path or relative to modelBasePath\n * - minConfidence: threshold for discarding a prediction\n * - maxDetected: maximum number of people detected in the input, should be set to the minimum number for performance\n */\n body: {\n enabled: boolean,\n modelPath: string,\n maxDetected: number,\n minConfidence: number,\n },\n\n /** Controlls and configures all hand detection specific options\n * - enabled: true/false\n * - landmarks: detect hand landmarks or just hand boundary box\n * - modelPath: paths for hand detector and hand skeleton models, can be absolute path or relative to modelBasePath\n * - minConfidence: threshold for discarding a prediction\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of hands detected in the input, should be set to the minimum number for performance\n * - rotation: use best-guess rotated hand image or just box with rotation as-is, false means higher performance, but incorrect finger mapping if hand is inverted\n * - skipFrames: how many frames to go without re-running the hand bounding box detector and just run modified hand skeleton detector, only valid if videoOptimized is set to true\n * - skipInitial: if previous detection resulted in no hands detected, should skipFrames be reset immediately to force new detection cycle\n */\n hand: {\n enabled: boolean,\n rotation: boolean,\n skipFrames: number,\n skipInitial: boolean,\n minConfidence: number,\n iouThreshold: number,\n maxDetected: number,\n landmarks: boolean,\n detector: {\n modelPath: string,\n },\n skeleton: {\n modelPath: string,\n },\n },\n\n /** Controlls and configures all object detection specific options\n * - enabled: true/false\n * - modelPath: object detection model, can be absolute path or relative to modelBasePath\n * - minConfidence: minimum score that detection must have to return as valid object\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of detections to return\n * - skipFrames: run object detection every n input frames, only valid if videoOptimized is set to true\n */\n object: {\n enabled: boolean,\n modelPath: string,\n minConfidence: number,\n iouThreshold: number,\n maxDetected: number,\n skipFrames: number,\n },\n}\n\nconst config: Config = {\n backend: 'webgl', // select tfjs backend to use, leave empty to use default backend\n // can be 'webgl', 'wasm', 'cpu', or 'humangl' which is a custom version of webgl\n modelBasePath: '../models/', // base path for all models\n wasmPath: '../assets/', // path for wasm binariesm, only used for backend: wasm\n debug: true, // print additional status messages to console\n async: true, // execute enabled models in parallel\n videoOptimized: true, // perform additional optimizations when input is video,\n // automatically disabled for Image, ImageData, ImageBitmap\n // skips boundary detection for every n frames\n // while maintaining in-box detection since objects cannot move that fast\n warmup: 'full', // what to use for human.warmup(), can be 'none', 'face', 'full'\n // warmup pre-initializes all models for faster inference but can take\n // significant time on startup\n // only used for `webgl` and `humangl` backends\n filter: { // run input through image filters before inference\n // image filters run with near-zero latency as they are executed on the GPU\n enabled: true, // enable image pre-processing filters\n width: 0, // resize input width\n height: 0, // resize input height\n // if both width and height are set to 0, there is no resizing\n // if just one is set, second one is scaled automatically\n // if both are set, values are used as-is\n flip: false, // flip input as mirror image\n return: true, // return processed canvas imagedata in result\n brightness: 0, // range: -1 (darken) to 1 (lighten)\n contrast: 0, // range: -1 (reduce contrast) to 1 (increase contrast)\n sharpness: 0, // range: 0 (no sharpening) to 1 (maximum sharpening)\n blur: 0, // range: 0 (no blur) to N (blur radius in pixels)\n saturation: 0, // range: -1 (reduce saturation) to 1 (increase saturation)\n hue: 0, // range: 0 (no change) to 360 (hue rotation in degrees)\n negative: false, // image negative\n sepia: false, // image sepia colors\n vintage: false, // image vintage colors\n kodachrome: false, // image kodachrome colors\n technicolor: false, // image technicolor colors\n polaroid: false, // image polaroid camera effect\n pixelate: 0, // range: 0 (no pixelate) to N (number of pixels to pixelate)\n },\n\n gesture: {\n enabled: true, // enable gesture recognition based on model results\n },\n\n face: {\n enabled: true, // controls if specified modul is enabled\n // face.enabled is required for all face models:\n // detector, mesh, iris, age, gender, emotion\n // (note: module is not loaded until it is required)\n detector: {\n modelPath: 'blazeface.json', // detector model, can be absolute path or relative to modelBasePath\n rotation: false, // use best-guess rotated face image or just box with rotation as-is\n // false means higher performance, but incorrect mesh mapping if face angle is above 20 degrees\n // this parameter is not valid in nodejs\n maxDetected: 10, // maximum number of faces detected in the input\n // should be set to the minimum number for performance\n skipFrames: 21, // how many frames to go without re-running the face bounding box detector\n // only used for video inputs\n // e.g., if model is running st 25 FPS, we can re-use existing bounding\n // box for updated face analysis as the head probably hasn't moved much\n // in short time (10 * 1/25 = 0.25 sec)\n skipInitial: false, // if previous detection resulted in no faces detected,\n // should skipFrames be reset immediately to force new detection cycle\n minConfidence: 0.2, // threshold for discarding a prediction\n iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed\n return: false, // return extracted face as tensor\n },\n\n mesh: {\n enabled: true,\n modelPath: 'facemesh.json', // facemesh model, can be absolute path or relative to modelBasePath\n },\n\n iris: {\n enabled: true,\n modelPath: 'iris.json', // face iris model\n // can be either absolute path or relative to modelBasePath\n },\n\n description: {\n enabled: true, // to improve accuracy of face description extraction it is\n // recommended to enable detector.rotation and mesh.enabled\n modelPath: 'faceres.json', // face description model\n // can be either absolute path or relative to modelBasePath\n skipFrames: 31, // how many frames to go without re-running the detector\n // only used for video inputs\n minConfidence: 0.1, // threshold for discarding a prediction\n },\n\n emotion: {\n enabled: true,\n minConfidence: 0.1, // threshold for discarding a prediction\n skipFrames: 32, // how many frames to go without re-running the detector\n modelPath: 'emotion.json', // face emotion model, can be absolute path or relative to modelBasePath\n },\n },\n\n body: {\n enabled: true,\n modelPath: 'posenet.json', // body model, can be absolute path or relative to modelBasePath\n // can be 'posenet' or 'blazepose'\n maxDetected: 1, // maximum number of people detected in the input\n // should be set to the minimum number for performance\n // only valid for posenet as blazepose only detects single pose\n minConfidence: 0.1, // threshold for discarding a prediction\n },\n\n hand: {\n enabled: true,\n rotation: false, // use best-guess rotated hand image or just box with rotation as-is\n // false means higher performance, but incorrect finger mapping if hand is inverted\n skipFrames: 12, // how many frames to go without re-running the hand bounding box detector\n // only used for video inputs\n // e.g., if model is running st 25 FPS, we can re-use existing bounding\n // box for updated hand skeleton analysis as the hand probably\n // hasn't moved much in short time (10 * 1/25 = 0.25 sec)\n skipInitial: false, // if previous detection resulted in no hands detected,\n // should skipFrames be reset immediately to force new detection cycle\n minConfidence: 0.1, // threshold for discarding a prediction\n iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed\n maxDetected: 2, // maximum number of hands detected in the input\n // should be set to the minimum number for performance\n landmarks: true, // detect hand landmarks or just hand boundary box\n detector: {\n modelPath: 'handdetect.json', // hand detector model, can be absolute path or relative to modelBasePath\n },\n skeleton: {\n modelPath: 'handskeleton.json', // hand skeleton model, can be absolute path or relative to modelBasePath\n },\n },\n\n object: {\n enabled: false,\n modelPath: 'nanodet.json', // experimental: object detection model, can be absolute path or relative to modelBasePath\n minConfidence: 0.2, // threshold for discarding a prediction\n iouThreshold: 0.4, // ammount of overlap between two detected objects before one object is removed\n maxDetected: 10, // maximum number of objects detected in the input\n skipFrames: 41, // how many frames to go without re-running the detector\n },\n};\nexport { config as defaults };\n", "export function info(): { platform: string, agent: string } {\n let platform;\n let agent;\n if (typeof navigator !== 'undefined') {\n const raw = navigator.userAgent.match(/\\(([^()]+)\\)/g);\n if (raw && raw[0]) {\n const platformMatch = raw[0].match(/\\(([^()]+)\\)/g);\n platform = platformMatch ? platformMatch[0].replace(/\\(|\\)/g, '') : '';\n agent = navigator.userAgent.replace(raw[0], '');\n if (platform[1]) agent = agent.replace(raw[1], '');\n agent = agent.replace(/ /g, ' ');\n }\n } else if (typeof process !== 'undefined') {\n platform = `${process.platform} ${process.arch}`;\n agent = `NodeJS ${process.version}`;\n }\n return { platform, agent };\n}\n", "// wrapper to load tfjs in a single place so version can be changed quickly\n\n// simplified\n// { modules: 1250, moduleBytes: 4013323, imports: 7, importBytes: 2255, outputBytes: 2991826, outputFiles: 'dist/tfjs.esm.js' }\n// export * from '@tensorflow/tfjs/dist/index.js';\n// export * from '@tensorflow/tfjs-backend-wasm';\n\n// modular\n// { modules: 1253, moduleBytes: 4029357, imports: 7, importBytes: 2285, outputBytes: 2998298, outputFiles: 'dist/tfjs.esm.js' }\n\n// get versions of all packages.\nimport * as packageBundle from '@tensorflow/tfjs/package.json';\nimport * as packageCore from '@tensorflow/tfjs-core/package.json';\nimport * as packageData from '@tensorflow/tfjs-data/package.json';\nimport * as packageLayers from '@tensorflow/tfjs-layers/package.json';\nimport * as packageConverter from '@tensorflow/tfjs-converter/package.json';\n// for backends, get version from source so it can register backend during import\nimport { version_cpu } from '@tensorflow/tfjs-backend-cpu/dist/index.js';\nimport { version_webgl } from '@tensorflow/tfjs-backend-webgl/dist/index.js';\nimport { version_wasm } from '@tensorflow/tfjs-backend-wasm/dist/index.js';\n\n// export all - compiled\nexport * from '@tensorflow/tfjs-core/dist/index.js';\nexport * from '@tensorflow/tfjs-layers/dist/index.js';\nexport * from '@tensorflow/tfjs-converter/dist/index.js';\nexport * as data from '@tensorflow/tfjs-data/dist/index.js';\nexport * from '@tensorflow/tfjs-backend-cpu/dist/index.js';\nexport * from '@tensorflow/tfjs-backend-webgl/dist/index.js';\nexport * from '@tensorflow/tfjs-backend-wasm/dist/index.js';\n\n// export all - sources\n/*\nexport * from '@tensorflow/tfjs-core/src/index';\nexport * from '@tensorflow/tfjs-layers/src/index';\nexport * from '@tensorflow/tfjs-converter/src/index';\nexport * as data from '@tensorflow/tfjs-data/src/index';\nexport * from '@tensorflow/tfjs-backend-cpu/src/index';\nexport * from '@tensorflow/tfjs-backend-webgl/src/index';\nexport * from '@tensorflow/tfjs-backend-wasm/src/index';\n*/\n\n// export versions\nexport const version = {\n tfjs: packageBundle?.version || undefined,\n 'tfjs-core': packageCore?.version || undefined,\n 'tfjs-data': packageData?.version || undefined,\n 'tfjs-layers': packageLayers?.version || undefined,\n 'tfjs-converter': packageConverter?.version || undefined,\n 'tfjs-backend-cpu': version_cpu || undefined,\n 'tfjs-backend-webgl': version_webgl || undefined,\n 'tfjs-backend-wasm': version_wasm || undefined,\n};\n// export const version = {};\n", "import { log } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\n\nexport const config = {\n name: 'humangl',\n priority: 99,\n canvas: null,\n gl: null,\n width: 1024,\n height: 1024,\n webGLattr: { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.2\n alpha: false,\n antialias: false,\n premultipliedAlpha: false,\n preserveDrawingBuffer: false,\n depth: false,\n stencil: false,\n failIfMajorPerformanceCaveat: false,\n desynchronized: true,\n },\n};\n\nexport function register(): void {\n if (!tf.findBackend(config.name)) {\n log('backend registration:', config.name);\n try {\n config.canvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(config.width, config.height) : document.createElement('canvas');\n } catch (err) {\n log('error: cannot create canvas:', err);\n return;\n }\n try {\n config.gl = config.canvas.getContext('webgl2', config.webGLattr);\n } catch (err) {\n log('error: cannot get WebGL2 context:', err);\n return;\n }\n try {\n tf.setWebGLContext(2, config.gl);\n } catch (err) {\n log('error: cannot set WebGL2 context:', err);\n return;\n }\n try {\n const ctx = new tf.GPGPUContext(config.gl);\n tf.registerBackend(config.name, () => new tf.MathBackendWebGL(ctx), config.priority);\n } catch (err) {\n log('error: cannot register WebGL backend:', err);\n return;\n }\n try {\n const kernels = tf.getKernelsForBackend('webgl');\n kernels.forEach((kernelConfig) => {\n const newKernelConfig = { ...kernelConfig, backendName: config.name };\n tf.registerKernel(newKernelConfig);\n });\n } catch (err) {\n log('error: cannot update WebGL backend registration:', err);\n return;\n }\n try {\n tf.ENV.set('WEBGL_VERSION', 2);\n // tf.ENV.set('WEBGL_MAX_TEXTURE_SIZE', config.gl.getParameter(config.gl.MAX_TEXTURE_SIZE));\n // tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true);\n // tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);\n } catch (err) {\n log('error: cannot set WebGL backend flags:', err);\n return;\n }\n log('backend registered:', config.name);\n }\n}\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as blazeface from './blazeface';\nimport * as facepipeline from './facepipeline';\nimport * as coords from './coords';\n\nlet faceModels:[any, any, any] = [null, null, null];\nlet facePipeline;\n\nexport async function predict(input, config): Promise<{ confidence, boxConfidence, faceConfidence, box, mesh, boxRaw, meshRaw, annotations, image }[]> {\n const predictions = await facePipeline.predict(input, config);\n const results: Array<{ confidence, boxConfidence, faceConfidence, box, mesh, boxRaw, meshRaw, annotations, image }> = [];\n for (const prediction of (predictions || [])) {\n if (!prediction || prediction.isDisposedInternal) continue; // guard against disposed tensors on long running operations such as pause in middle of processing\n const meshRaw = prediction.mesh.map((pt) => [\n pt[0] / input.shape[2],\n pt[1] / input.shape[1],\n pt[2] / facePipeline.meshSize,\n ]);\n const annotations = {};\n if (prediction.mesh && prediction.mesh.length > 0) {\n for (const key of Object.keys(coords.MESH_ANNOTATIONS)) annotations[key] = coords.MESH_ANNOTATIONS[key].map((index) => prediction.mesh[index]);\n }\n const clampedBox = prediction.box ? [\n Math.max(0, prediction.box.startPoint[0]),\n Math.max(0, prediction.box.startPoint[1]),\n Math.min(input.shape[2], prediction.box.endPoint[0]) - Math.max(0, prediction.box.startPoint[0]),\n Math.min(input.shape[1], prediction.box.endPoint[1]) - Math.max(0, prediction.box.startPoint[1]),\n ] : 0;\n const boxRaw = prediction.box ? [\n prediction.box.startPoint[0] / input.shape[2],\n prediction.box.startPoint[1] / input.shape[1],\n (prediction.box.endPoint[0] - prediction.box.startPoint[0]) / input.shape[2],\n (prediction.box.endPoint[1] - prediction.box.startPoint[1]) / input.shape[1],\n ] : [];\n results.push({\n confidence: Math.round(100 * prediction.faceConfidence || 100 * prediction.boxConfidence || 0) / 100,\n boxConfidence: Math.round(100 * prediction.boxConfidence) / 100,\n faceConfidence: Math.round(100 * prediction.faceConfidence) / 100,\n box: clampedBox,\n boxRaw,\n mesh: prediction.mesh,\n meshRaw,\n annotations,\n image: prediction.image,\n });\n if (prediction.coords) prediction.coords.dispose();\n }\n return results;\n}\n\nexport async function load(config): Promise<[Object, Object, Object]> {\n if ((!faceModels[0] && config.face.enabled) || (!faceModels[1] && config.face.mesh.enabled) || (!faceModels[2] && config.face.iris.enabled)) {\n faceModels = await Promise.all([\n (!faceModels[0] && config.face.enabled) ? blazeface.load(config) : null,\n (!faceModels[1] && config.face.mesh.enabled) ? tf.loadGraphModel(join(config.modelBasePath, config.face.mesh.modelPath), { fromTFHub: config.face.mesh.modelPath.includes('tfhub.dev') }) : null,\n (!faceModels[2] && config.face.iris.enabled) ? tf.loadGraphModel(join(config.modelBasePath, config.face.iris.modelPath), { fromTFHub: config.face.iris.modelPath.includes('tfhub.dev') }) : null,\n ]);\n if (config.face.mesh.enabled) {\n if (!faceModels[1] || !faceModels[1].modelUrl) log('load model failed:', config.face.mesh.modelPath);\n else if (config.debug) log('load model:', faceModels[1].modelUrl);\n }\n if (config.face.iris.enabled) {\n if (!faceModels[2] || !faceModels[1].modelUrl) log('load model failed:', config.face.iris.modelPath);\n else if (config.debug) log('load model:', faceModels[2].modelUrl);\n }\n } else if (config.debug) {\n log('cached model:', faceModels[0].model.modelUrl);\n log('cached model:', faceModels[1].modelUrl);\n log('cached model:', faceModels[2].modelUrl);\n }\n facePipeline = new facepipeline.Pipeline(faceModels[0], faceModels[1], faceModels[2]);\n return faceModels;\n}\n\nexport const triangulation = coords.TRI468;\nexport const uvmap = coords.UV468;\n", "import * as tf from '../../dist/tfjs.esm.js';\n\nexport function scaleBoxCoordinates(box, factor) {\n const startPoint = [box.startPoint[0] * factor[0], box.startPoint[1] * factor[1]];\n const endPoint = [box.endPoint[0] * factor[0], box.endPoint[1] * factor[1]];\n return { startPoint, endPoint };\n}\n\nexport function getBoxSize(box) {\n return [\n Math.abs(box.endPoint[0] - box.startPoint[0]),\n Math.abs(box.endPoint[1] - box.startPoint[1]),\n ];\n}\n\nexport function getBoxCenter(box) {\n return [\n box.startPoint[0] + (box.endPoint[0] - box.startPoint[0]) / 2,\n box.startPoint[1] + (box.endPoint[1] - box.startPoint[1]) / 2,\n ];\n}\n\nexport function cutBoxFromImageAndResize(box, image, cropSize) {\n const h = image.shape[1];\n const w = image.shape[2];\n const boxes = [[\n box.startPoint[1] / h,\n box.startPoint[0] / w,\n box.endPoint[1] / h,\n box.endPoint[0] / w,\n ]];\n return tf.image.cropAndResize(image, boxes, [0], cropSize);\n}\n\nexport function enlargeBox(box, factor = 1.5) {\n const center = getBoxCenter(box);\n const size = getBoxSize(box);\n const newHalfSize = [factor * size[0] / 2, factor * size[1] / 2];\n const startPoint = [center[0] - newHalfSize[0], center[1] - newHalfSize[1]];\n const endPoint = [center[0] + newHalfSize[0], center[1] + newHalfSize[1]];\n return { startPoint, endPoint, landmarks: box.landmarks };\n}\n\nexport function squarifyBox(box) {\n const centers = getBoxCenter(box);\n const size = getBoxSize(box);\n const maxEdge = Math.max(...size);\n const halfSize = maxEdge / 2;\n const startPoint = [Math.round(centers[0] - halfSize), Math.round(centers[1] - halfSize)];\n const endPoint = [Math.round(centers[0] + halfSize), Math.round(centers[1] + halfSize)];\n return { startPoint, endPoint, landmarks: box.landmarks };\n}\n\nexport function calculateLandmarksBoundingBox(landmarks) {\n const xs = landmarks.map((d) => d[0]);\n const ys = landmarks.map((d) => d[1]);\n const startPoint = [Math.min(...xs), Math.min(...ys)];\n const endPoint = [Math.max(...xs), Math.max(...ys)];\n return { startPoint, endPoint, landmarks };\n}\n\nexport const disposeBox = (t) => {\n t.startPoint.dispose();\n t.endPoint.dispose();\n};\n\nexport const createBox = (startEndTensor) => ({\n startPoint: tf.slice(startEndTensor, [0, 0], [-1, 2]),\n endPoint: tf.slice(startEndTensor, [0, 2], [-1, 2]),\n});\n", "export const IDENTITY_MATRIX = [[1, 0, 0], [0, 1, 0], [0, 0, 1]];\n/**\n * Normalizes the provided angle to the range -pi to pi.\n * @param angle The angle in radians to be normalized.\n */\nexport function normalizeRadians(angle) {\n return angle - 2 * Math.PI * Math.floor((angle + Math.PI) / (2 * Math.PI));\n}\n\n/**\n * Computes the angle of rotation between two anchor points.\n * @param point1 First anchor point\n * @param point2 Second anchor point\n */\nexport function computeRotation(point1, point2) {\n const radians = Math.PI / 2 - Math.atan2(-(point2[1] - point1[1]), point2[0] - point1[0]);\n return normalizeRadians(radians);\n}\n\nexport function radToDegrees(rad) {\n return rad * 180 / Math.PI;\n}\n\nexport function buildTranslationMatrix(x, y) {\n return [[1, 0, x], [0, 1, y], [0, 0, 1]];\n}\n\nexport function dot(v1, v2) {\n let product = 0;\n for (let i = 0; i < v1.length; i++) {\n product += v1[i] * v2[i];\n }\n return product;\n}\n\nexport function getColumnFrom2DArr(arr, columnIndex) {\n const column: Array = [];\n for (let i = 0; i < arr.length; i++) {\n column.push(arr[i][columnIndex]);\n }\n return column;\n}\n\nexport function multiplyTransformMatrices(mat1, mat2) {\n const product: Array = [];\n const size = mat1.length;\n for (let row = 0; row < size; row++) {\n product.push([]);\n for (let col = 0; col < size; col++) {\n product[row].push(dot(mat1[row], getColumnFrom2DArr(mat2, col)));\n }\n }\n return product;\n}\n\nexport function buildRotationMatrix(rotation, center) {\n const cosA = Math.cos(rotation);\n const sinA = Math.sin(rotation);\n const rotationMatrix = [[cosA, -sinA, 0], [sinA, cosA, 0], [0, 0, 1]];\n const translationMatrix = buildTranslationMatrix(center[0], center[1]);\n const translationTimesRotation = multiplyTransformMatrices(translationMatrix, rotationMatrix);\n const negativeTranslationMatrix = buildTranslationMatrix(-center[0], -center[1]);\n return multiplyTransformMatrices(translationTimesRotation, negativeTranslationMatrix);\n}\n\nexport function invertTransformMatrix(matrix) {\n const rotationComponent = [[matrix[0][0], matrix[1][0]], [matrix[0][1], matrix[1][1]]];\n const translationComponent = [matrix[0][2], matrix[1][2]];\n const invertedTranslation = [\n -dot(rotationComponent[0], translationComponent),\n -dot(rotationComponent[1], translationComponent),\n ];\n return [\n rotationComponent[0].concat(invertedTranslation[0]),\n rotationComponent[1].concat(invertedTranslation[1]),\n [0, 0, 1],\n ];\n}\n\nexport function rotatePoint(homogeneousCoordinate, rotationMatrix) {\n return [\n dot(homogeneousCoordinate, rotationMatrix[0]),\n dot(homogeneousCoordinate, rotationMatrix[1]),\n ];\n}\n\nexport function xyDistanceBetweenPoints(a, b) {\n return Math.sqrt(((a[0] - b[0]) ** 2) + ((a[1] - b[1]) ** 2));\n}\n\nexport function generateAnchors(inputSize) {\n const spec = { strides: [inputSize / 16, inputSize / 8], anchors: [2, 6] };\n const anchors: Array<[number, number]> = [];\n for (let i = 0; i < spec.strides.length; i++) {\n const stride = spec.strides[i];\n const gridRows = Math.floor((inputSize + stride - 1) / stride);\n const gridCols = Math.floor((inputSize + stride - 1) / stride);\n const anchorsNum = spec.anchors[i];\n for (let gridY = 0; gridY < gridRows; gridY++) {\n const anchorY = stride * (gridY + 0.5);\n for (let gridX = 0; gridX < gridCols; gridX++) {\n const anchorX = stride * (gridX + 0.5);\n for (let n = 0; n < anchorsNum; n++) {\n anchors.push([anchorX, anchorY]);\n }\n }\n }\n }\n return anchors;\n}\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as box from './box';\nimport * as util from './util';\n\nconst keypointsCount = 6;\n\nfunction decodeBounds(boxOutputs, anchors, inputSize) {\n const boxStarts = tf.slice(boxOutputs, [0, 1], [-1, 2]);\n const centers = tf.add(boxStarts, anchors);\n const boxSizes = tf.slice(boxOutputs, [0, 3], [-1, 2]);\n const boxSizesNormalized = tf.div(boxSizes, inputSize);\n const centersNormalized = tf.div(centers, inputSize);\n const halfBoxSize = tf.div(boxSizesNormalized, 2);\n const starts = tf.sub(centersNormalized, halfBoxSize);\n const ends = tf.add(centersNormalized, halfBoxSize);\n const startNormalized = tf.mul(starts, inputSize);\n const endNormalized = tf.mul(ends, inputSize);\n const concatAxis = 1;\n return tf.concat2d([startNormalized, endNormalized], concatAxis);\n}\n\nexport class BlazeFaceModel {\n model: any;\n anchorsData: any;\n anchors: any;\n inputSize: number;\n config: any;\n\n constructor(model, config) {\n this.model = model;\n this.anchorsData = util.generateAnchors(model.inputs[0].shape[1]);\n this.anchors = tf.tensor2d(this.anchorsData);\n this.inputSize = model.inputs[0].shape[2];\n this.config = config;\n }\n\n async getBoundingBoxes(inputImage) {\n // sanity check on input\n if ((!inputImage) || (inputImage.isDisposedInternal) || (inputImage.shape.length !== 4) || (inputImage.shape[1] < 1) || (inputImage.shape[2] < 1)) return null;\n const [batch, boxes, scores] = tf.tidy(() => {\n const resizedImage = inputImage.resizeBilinear([this.inputSize, this.inputSize]);\n const normalizedImage = resizedImage.div(127.5).sub(0.5);\n const res = this.model.execute(normalizedImage);\n let batchOut;\n if (Array.isArray(res)) { // are we using tfhub or pinto converted model?\n const sorted = res.sort((a, b) => a.size - b.size);\n const concat384 = tf.concat([sorted[0], sorted[2]], 2); // dim: 384, 1 + 16\n const concat512 = tf.concat([sorted[1], sorted[3]], 2); // dim: 512, 1 + 16\n const concat = tf.concat([concat512, concat384], 1);\n batchOut = concat.squeeze(0);\n } else {\n batchOut = res.squeeze(); // when using tfhub model\n }\n const boxesOut = decodeBounds(batchOut, this.anchors, [this.inputSize, this.inputSize]);\n const logits = tf.slice(batchOut, [0, 0], [-1, 1]);\n const scoresOut = tf.sigmoid(logits).squeeze().dataSync();\n return [batchOut, boxesOut, scoresOut];\n });\n const nmsTensor = await tf.image.nonMaxSuppressionAsync(boxes, scores, this.config.face.detector.maxDetected, this.config.face.detector.iouThreshold, this.config.face.detector.minConfidence);\n const nms = nmsTensor.arraySync();\n nmsTensor.dispose();\n const annotatedBoxes: Array<{ box: any, landmarks: any, anchor: number[], confidence: number }> = [];\n for (let i = 0; i < nms.length; i++) {\n const confidence = scores[nms[i]];\n if (confidence > this.config.face.detector.minConfidence) {\n const boundingBox = tf.slice(boxes, [nms[i], 0], [1, -1]);\n const localBox = box.createBox(boundingBox);\n boundingBox.dispose();\n const anchor = this.anchorsData[nms[i]];\n const landmarks = tf.tidy(() => tf.slice(batch, [nms[i], keypointsCount - 1], [1, -1]).squeeze().reshape([keypointsCount, -1]));\n annotatedBoxes.push({ box: localBox, landmarks, anchor, confidence });\n }\n }\n // boundingBoxes.forEach((t) => t.dispose());\n batch.dispose();\n boxes.dispose();\n // scores.dispose();\n return {\n boxes: annotatedBoxes,\n scaleFactor: [inputImage.shape[2] / this.inputSize, inputImage.shape[1] / this.inputSize],\n };\n }\n}\n\nexport async function load(config) {\n const model = await tf.loadGraphModel(join(config.modelBasePath, config.face.detector.modelPath), { fromTFHub: config.face.detector.modelPath.includes('tfhub.dev') });\n const blazeFace = new BlazeFaceModel(model, config);\n if (!model || !model.modelUrl) log('load model failed:', config.face.detector.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n return blazeFace;\n}\n", "export const MESH_ANNOTATIONS = {\n silhouette: [\n 10, 338, 297, 332, 284, 251, 389, 356, 454, 323, 361, 288,\n 397, 365, 379, 378, 400, 377, 152, 148, 176, 149, 150, 136,\n 172, 58, 132, 93, 234, 127, 162, 21, 54, 103, 67, 109,\n ],\n lipsUpperOuter: [61, 185, 40, 39, 37, 0, 267, 269, 270, 409, 291],\n lipsLowerOuter: [146, 91, 181, 84, 17, 314, 405, 321, 375, 291],\n lipsUpperInner: [78, 191, 80, 81, 82, 13, 312, 311, 310, 415, 308],\n lipsLowerInner: [78, 95, 88, 178, 87, 14, 317, 402, 318, 324, 308],\n rightEyeUpper0: [246, 161, 160, 159, 158, 157, 173],\n rightEyeLower0: [33, 7, 163, 144, 145, 153, 154, 155, 133],\n rightEyeUpper1: [247, 30, 29, 27, 28, 56, 190],\n rightEyeLower1: [130, 25, 110, 24, 23, 22, 26, 112, 243],\n rightEyeUpper2: [113, 225, 224, 223, 222, 221, 189],\n rightEyeLower2: [226, 31, 228, 229, 230, 231, 232, 233, 244],\n rightEyeLower3: [143, 111, 117, 118, 119, 120, 121, 128, 245],\n rightEyebrowUpper: [156, 70, 63, 105, 66, 107, 55, 193],\n rightEyebrowLower: [35, 124, 46, 53, 52, 65],\n rightEyeIris: [473, 474, 475, 476, 477],\n leftEyeUpper0: [466, 388, 387, 386, 385, 384, 398],\n leftEyeLower0: [263, 249, 390, 373, 374, 380, 381, 382, 362],\n leftEyeUpper1: [467, 260, 259, 257, 258, 286, 414],\n leftEyeLower1: [359, 255, 339, 254, 253, 252, 256, 341, 463],\n leftEyeUpper2: [342, 445, 444, 443, 442, 441, 413],\n leftEyeLower2: [446, 261, 448, 449, 450, 451, 452, 453, 464],\n leftEyeLower3: [372, 340, 346, 347, 348, 349, 350, 357, 465],\n leftEyebrowUpper: [383, 300, 293, 334, 296, 336, 285, 417],\n leftEyebrowLower: [265, 353, 276, 283, 282, 295],\n leftEyeIris: [468, 469, 470, 471, 472],\n midwayBetweenEyes: [168],\n noseTip: [1],\n noseBottom: [2],\n noseRightCorner: [98],\n noseLeftCorner: [327],\n rightCheek: [205],\n leftCheek: [425],\n};\n\nexport const MESH_TO_IRIS_INDICES_MAP = [ // A mapping from facemesh model keypoints to iris model keypoints.\n { key: 'EyeUpper0', indices: [9, 10, 11, 12, 13, 14, 15] },\n { key: 'EyeUpper1', indices: [25, 26, 27, 28, 29, 30, 31] },\n { key: 'EyeUpper2', indices: [41, 42, 43, 44, 45, 46, 47] },\n { key: 'EyeLower0', indices: [0, 1, 2, 3, 4, 5, 6, 7, 8] },\n { key: 'EyeLower1', indices: [16, 17, 18, 19, 20, 21, 22, 23, 24] },\n { key: 'EyeLower2', indices: [32, 33, 34, 35, 36, 37, 38, 39, 40] },\n { key: 'EyeLower3', indices: [54, 55, 56, 57, 58, 59, 60, 61, 62] },\n // { key: 'EyebrowUpper', indices: [63, 64, 65, 66, 67, 68, 69, 70] },\n // { key: 'EyebrowLower', indices: [48, 49, 50, 51, 52, 53] },\n];\n\nexport const UV468 = [\n [0.499976992607117, 0.652534008026123],\n [0.500025987625122, 0.547487020492554],\n [0.499974012374878, 0.602371990680695],\n [0.482113003730774, 0.471979022026062],\n [0.500150978565216, 0.527155995368958],\n [0.499909996986389, 0.498252987861633],\n [0.499523013830185, 0.40106201171875],\n [0.289712011814117, 0.380764007568359],\n [0.499954998493195, 0.312398016452789],\n [0.499987006187439, 0.269918978214264],\n [0.500023007392883, 0.107050001621246],\n [0.500023007392883, 0.666234016418457],\n [0.5000159740448, 0.679224014282227],\n [0.500023007392883, 0.692348003387451],\n [0.499976992607117, 0.695277988910675],\n [0.499976992607117, 0.70593398809433],\n [0.499976992607117, 0.719385027885437],\n [0.499976992607117, 0.737019002437592],\n [0.499967992305756, 0.781370997428894],\n [0.499816000461578, 0.562981009483337],\n [0.473773002624512, 0.573909997940063],\n [0.104906998574734, 0.254140973091125],\n [0.365929991006851, 0.409575998783112],\n [0.338757991790771, 0.41302502155304],\n [0.311120003461838, 0.409460008144379],\n [0.274657994508743, 0.389131009578705],\n [0.393361985683441, 0.403706014156342],\n [0.345234006643295, 0.344011008739471],\n [0.370094001293182, 0.346076011657715],\n [0.319321990013123, 0.347265005111694],\n [0.297903001308441, 0.353591024875641],\n [0.24779200553894, 0.410809993743896],\n [0.396889001131058, 0.842755019664764],\n [0.280097991228104, 0.375599980354309],\n [0.106310002505779, 0.399955987930298],\n [0.2099249958992, 0.391353011131287],\n [0.355807989835739, 0.534406006336212],\n [0.471751004457474, 0.65040397644043],\n [0.474155008792877, 0.680191993713379],\n [0.439785003662109, 0.657229006290436],\n [0.414617002010345, 0.66654098033905],\n [0.450374007225037, 0.680860996246338],\n [0.428770989179611, 0.682690978050232],\n [0.374971002340317, 0.727805018424988],\n [0.486716985702515, 0.547628998756409],\n [0.485300987958908, 0.527395009994507],\n [0.257764995098114, 0.314490020275116],\n [0.401223003864288, 0.455172002315521],\n [0.429818987846375, 0.548614978790283],\n [0.421351999044418, 0.533740997314453],\n [0.276895999908447, 0.532056987285614],\n [0.483370006084442, 0.499586999416351],\n [0.33721199631691, 0.282882988452911],\n [0.296391993761063, 0.293242990970612],\n [0.169294998049736, 0.193813979625702],\n [0.447580009698868, 0.302609980106354],\n [0.392390012741089, 0.353887975215912],\n [0.354490011930466, 0.696784019470215],\n [0.067304998636246, 0.730105042457581],\n [0.442739009857178, 0.572826027870178],\n [0.457098007202148, 0.584792017936707],\n [0.381974011659622, 0.694710969924927],\n [0.392388999462128, 0.694203019142151],\n [0.277076005935669, 0.271932005882263],\n [0.422551989555359, 0.563233017921448],\n [0.385919004678726, 0.281364023685455],\n [0.383103013038635, 0.255840003490448],\n [0.331431001424789, 0.119714021682739],\n [0.229923993349075, 0.232002973556519],\n [0.364500999450684, 0.189113974571228],\n [0.229622006416321, 0.299540996551514],\n [0.173287004232407, 0.278747975826263],\n [0.472878992557526, 0.666198015213013],\n [0.446828007698059, 0.668527007102966],\n [0.422762006521225, 0.673889994621277],\n [0.445307999849319, 0.580065965652466],\n [0.388103008270264, 0.693961024284363],\n [0.403039008378983, 0.706539988517761],\n [0.403629004955292, 0.693953037261963],\n [0.460041999816895, 0.557139039039612],\n [0.431158006191254, 0.692366003990173],\n [0.452181994915009, 0.692366003990173],\n [0.475387006998062, 0.692366003990173],\n [0.465828001499176, 0.779190003871918],\n [0.472328990697861, 0.736225962638855],\n [0.473087012767792, 0.717857003211975],\n [0.473122000694275, 0.704625964164734],\n [0.473033010959625, 0.695277988910675],\n [0.427942007780075, 0.695277988910675],\n [0.426479011774063, 0.703539967536926],\n [0.423162013292313, 0.711845993995667],\n [0.4183090031147, 0.720062971115112],\n [0.390094995498657, 0.639572978019714],\n [0.013953999616206, 0.560034036636353],\n [0.499913990497589, 0.58014702796936],\n [0.413199990987778, 0.69539999961853],\n [0.409626007080078, 0.701822996139526],\n [0.468080013990402, 0.601534962654114],\n [0.422728985548019, 0.585985004901886],\n [0.463079988956451, 0.593783974647522],\n [0.37211999297142, 0.47341400384903],\n [0.334562003612518, 0.496073007583618],\n [0.411671012639999, 0.546965003013611],\n [0.242175996303558, 0.14767599105835],\n [0.290776997804642, 0.201445996761322],\n [0.327338010072708, 0.256527006626129],\n [0.399509996175766, 0.748921036720276],\n [0.441727995872498, 0.261676013469696],\n [0.429764986038208, 0.187834024429321],\n [0.412198007106781, 0.108901023864746],\n [0.288955003023148, 0.398952007293701],\n [0.218936994671822, 0.435410976409912],\n [0.41278201341629, 0.398970007896423],\n [0.257135003805161, 0.355440020561218],\n [0.427684992551804, 0.437960982322693],\n [0.448339998722076, 0.536936044692993],\n [0.178560003638268, 0.45755398273468],\n [0.247308000922203, 0.457193970680237],\n [0.286267012357712, 0.467674970626831],\n [0.332827985286713, 0.460712015628815],\n [0.368755996227264, 0.447206974029541],\n [0.398963987827301, 0.432654976844788],\n [0.476410001516342, 0.405806005001068],\n [0.189241006970406, 0.523923993110657],\n [0.228962004184723, 0.348950982093811],\n [0.490725994110107, 0.562400996685028],\n [0.404670000076294, 0.485132992267609],\n [0.019469000399113, 0.401564002037048],\n [0.426243007183075, 0.420431017875671],\n [0.396993011236191, 0.548797011375427],\n [0.266469985246658, 0.376977026462555],\n [0.439121007919312, 0.51895797252655],\n [0.032313998788595, 0.644356966018677],\n [0.419054001569748, 0.387154996395111],\n [0.462783008813858, 0.505746960639954],\n [0.238978996872902, 0.779744982719421],\n [0.198220998048782, 0.831938028335571],\n [0.107550002634525, 0.540755033493042],\n [0.183610007166862, 0.740257024765015],\n [0.134409993886948, 0.333683013916016],\n [0.385764002799988, 0.883153975009918],\n [0.490967005491257, 0.579378008842468],\n [0.382384985685349, 0.508572995662689],\n [0.174399003386497, 0.397670984268188],\n [0.318785011768341, 0.39623498916626],\n [0.343364000320435, 0.400596976280212],\n [0.396100014448166, 0.710216999053955],\n [0.187885001301765, 0.588537991046906],\n [0.430987000465393, 0.944064974784851],\n [0.318993002176285, 0.898285031318665],\n [0.266247987747192, 0.869701027870178],\n [0.500023007392883, 0.190576016902924],\n [0.499976992607117, 0.954452991485596],\n [0.366169989109039, 0.398822009563446],\n [0.393207013607025, 0.39553701877594],\n [0.410373002290726, 0.391080021858215],\n [0.194993004202843, 0.342101991176605],\n [0.388664990663528, 0.362284004688263],\n [0.365961998701096, 0.355970978736877],\n [0.343364000320435, 0.355356991291046],\n [0.318785011768341, 0.35834002494812],\n [0.301414996385574, 0.363156020641327],\n [0.058132998645306, 0.319076001644135],\n [0.301414996385574, 0.387449026107788],\n [0.499987989664078, 0.618434011936188],\n [0.415838003158569, 0.624195992946625],\n [0.445681989192963, 0.566076993942261],\n [0.465844005346298, 0.620640993118286],\n [0.49992299079895, 0.351523995399475],\n [0.288718998432159, 0.819945991039276],\n [0.335278987884521, 0.852819979190826],\n [0.440512001514435, 0.902418971061707],\n [0.128294005990028, 0.791940987110138],\n [0.408771991729736, 0.373893976211548],\n [0.455606997013092, 0.451801002025604],\n [0.499877005815506, 0.908990025520325],\n [0.375436991453171, 0.924192011356354],\n [0.11421000212431, 0.615022003650665],\n [0.448662012815475, 0.695277988910675],\n [0.4480200111866, 0.704632043838501],\n [0.447111994028091, 0.715808033943176],\n [0.444831997156143, 0.730794012546539],\n [0.430011987686157, 0.766808986663818],\n [0.406787008047104, 0.685672998428345],\n [0.400738000869751, 0.681069016456604],\n [0.392399996519089, 0.677703022956848],\n [0.367855995893478, 0.663918972015381],\n [0.247923001646996, 0.601333022117615],\n [0.452769994735718, 0.420849978923798],\n [0.43639200925827, 0.359887003898621],\n [0.416164010763168, 0.368713974952698],\n [0.413385987281799, 0.692366003990173],\n [0.228018000721931, 0.683571994304657],\n [0.468268007040024, 0.352671027183533],\n [0.411361992359161, 0.804327011108398],\n [0.499989002943039, 0.469825029373169],\n [0.479153990745544, 0.442654013633728],\n [0.499974012374878, 0.439637005329132],\n [0.432112008333206, 0.493588984012604],\n [0.499886006116867, 0.866917014122009],\n [0.49991300702095, 0.821729004383087],\n [0.456548988819122, 0.819200992584229],\n [0.344549000263214, 0.745438992977142],\n [0.37890899181366, 0.574010014533997],\n [0.374292999505997, 0.780184984207153],\n [0.319687992334366, 0.570737957954407],\n [0.357154995203018, 0.604269981384277],\n [0.295284003019333, 0.621580958366394],\n [0.447750002145767, 0.862477004528046],\n [0.410986006259918, 0.508723020553589],\n [0.31395098567009, 0.775308012962341],\n [0.354128003120422, 0.812552988529205],\n [0.324548006057739, 0.703992962837219],\n [0.189096003770828, 0.646299958229065],\n [0.279776990413666, 0.71465802192688],\n [0.1338230073452, 0.682700991630554],\n [0.336768001317978, 0.644733011722565],\n [0.429883986711502, 0.466521978378296],\n [0.455527991056442, 0.548622965812683],\n [0.437114000320435, 0.558896005153656],\n [0.467287987470627, 0.529924988746643],\n [0.414712011814117, 0.335219979286194],\n [0.37704598903656, 0.322777986526489],\n [0.344107985496521, 0.320150971412659],\n [0.312875986099243, 0.32233202457428],\n [0.283526003360748, 0.333190023899078],\n [0.241245999932289, 0.382785975933075],\n [0.102986000478268, 0.468762993812561],\n [0.267612010240555, 0.424560010433197],\n [0.297879010438919, 0.433175981044769],\n [0.333433985710144, 0.433878004550934],\n [0.366427004337311, 0.426115989685059],\n [0.396012008190155, 0.416696012020111],\n [0.420121014118195, 0.41022801399231],\n [0.007561000064015, 0.480777025222778],\n [0.432949006557465, 0.569517970085144],\n [0.458638995885849, 0.479089021682739],\n [0.473466008901596, 0.545744001865387],\n [0.476087987422943, 0.563830018043518],\n [0.468472003936768, 0.555056989192963],\n [0.433990985155106, 0.582361996173859],\n [0.483518004417419, 0.562983989715576],\n [0.482482999563217, 0.57784903049469],\n [0.42645001411438, 0.389798998832703],\n [0.438998997211456, 0.39649498462677],\n [0.450067013502121, 0.400434017181396],\n [0.289712011814117, 0.368252992630005],\n [0.276670008897781, 0.363372981548309],\n [0.517862021923065, 0.471948027610779],\n [0.710287988185883, 0.380764007568359],\n [0.526226997375488, 0.573909997940063],\n [0.895093023777008, 0.254140973091125],\n [0.634069979190826, 0.409575998783112],\n [0.661242008209229, 0.41302502155304],\n [0.688880026340485, 0.409460008144379],\n [0.725341975688934, 0.389131009578705],\n [0.606630027294159, 0.40370500087738],\n [0.654766023159027, 0.344011008739471],\n [0.629905998706818, 0.346076011657715],\n [0.680678009986877, 0.347265005111694],\n [0.702096998691559, 0.353591024875641],\n [0.75221198797226, 0.410804986953735],\n [0.602918028831482, 0.842862963676453],\n [0.719901978969574, 0.375599980354309],\n [0.893692970275879, 0.399959981441498],\n [0.790081977844238, 0.391354024410248],\n [0.643998026847839, 0.534487962722778],\n [0.528249025344849, 0.65040397644043],\n [0.525849997997284, 0.680191040039062],\n [0.560214996337891, 0.657229006290436],\n [0.585384011268616, 0.66654098033905],\n [0.549625992774963, 0.680860996246338],\n [0.57122802734375, 0.682691991329193],\n [0.624852001667023, 0.72809898853302],\n [0.513050019741058, 0.547281980514526],\n [0.51509702205658, 0.527251958847046],\n [0.742246985435486, 0.314507007598877],\n [0.598631024360657, 0.454979002475739],\n [0.570338010787964, 0.548575043678284],\n [0.578631997108459, 0.533622980117798],\n [0.723087012767792, 0.532054007053375],\n [0.516445994377136, 0.499638974666595],\n [0.662801027297974, 0.282917976379395],\n [0.70362401008606, 0.293271005153656],\n [0.830704987049103, 0.193813979625702],\n [0.552385985851288, 0.302568018436432],\n [0.607609987258911, 0.353887975215912],\n [0.645429015159607, 0.696707010269165],\n [0.932694971561432, 0.730105042457581],\n [0.557260990142822, 0.572826027870178],\n [0.542901992797852, 0.584792017936707],\n [0.6180260181427, 0.694710969924927],\n [0.607590973377228, 0.694203019142151],\n [0.722943007946014, 0.271963000297546],\n [0.577413976192474, 0.563166975975037],\n [0.614082992076874, 0.281386971473694],\n [0.616907000541687, 0.255886018276215],\n [0.668509006500244, 0.119913995265961],\n [0.770092010498047, 0.232020974159241],\n [0.635536015033722, 0.189248979091644],\n [0.77039098739624, 0.299556016921997],\n [0.826722025871277, 0.278755009174347],\n [0.527121007442474, 0.666198015213013],\n [0.553171992301941, 0.668527007102966],\n [0.577238023281097, 0.673889994621277],\n [0.554691970348358, 0.580065965652466],\n [0.611896991729736, 0.693961024284363],\n [0.59696102142334, 0.706539988517761],\n [0.596370995044708, 0.693953037261963],\n [0.539958000183105, 0.557139039039612],\n [0.568841993808746, 0.692366003990173],\n [0.547818005084991, 0.692366003990173],\n [0.52461302280426, 0.692366003990173],\n [0.534089982509613, 0.779141008853912],\n [0.527670979499817, 0.736225962638855],\n [0.526912987232208, 0.717857003211975],\n [0.526877999305725, 0.704625964164734],\n [0.526966989040375, 0.695277988910675],\n [0.572058022022247, 0.695277988910675],\n [0.573521018028259, 0.703539967536926],\n [0.57683801651001, 0.711845993995667],\n [0.581691026687622, 0.720062971115112],\n [0.609944999217987, 0.639909982681274],\n [0.986046016216278, 0.560034036636353],\n [0.5867999792099, 0.69539999961853],\n [0.590372025966644, 0.701822996139526],\n [0.531915009021759, 0.601536989212036],\n [0.577268004417419, 0.585934996604919],\n [0.536915004253387, 0.593786001205444],\n [0.627542972564697, 0.473352015018463],\n [0.665585994720459, 0.495950996875763],\n [0.588353991508484, 0.546862006187439],\n [0.757824003696442, 0.14767599105835],\n [0.709249973297119, 0.201507985591888],\n [0.672684013843536, 0.256581008434296],\n [0.600408971309662, 0.74900496006012],\n [0.55826598405838, 0.261672019958496],\n [0.570303976535797, 0.187870979309082],\n [0.588165998458862, 0.109044015407562],\n [0.711045026779175, 0.398952007293701],\n [0.781069993972778, 0.435405015945435],\n [0.587247014045715, 0.398931980133057],\n [0.742869973182678, 0.355445981025696],\n [0.572156012058258, 0.437651991844177],\n [0.55186802148819, 0.536570012569427],\n [0.821442008018494, 0.457556009292603],\n [0.752701997756958, 0.457181990146637],\n [0.71375697851181, 0.467626988887787],\n [0.66711300611496, 0.460672974586487],\n [0.631101012229919, 0.447153985500336],\n [0.6008620262146, 0.432473003864288],\n [0.523481011390686, 0.405627012252808],\n [0.810747981071472, 0.523926019668579],\n [0.771045982837677, 0.348959028720856],\n [0.509127020835876, 0.562718033790588],\n [0.595292985439301, 0.485023975372314],\n [0.980530977249146, 0.401564002037048],\n [0.573499977588654, 0.420000016689301],\n [0.602994978427887, 0.548687994480133],\n [0.733529984951019, 0.376977026462555],\n [0.560611009597778, 0.519016981124878],\n [0.967685997486115, 0.644356966018677],\n [0.580985009670258, 0.387160003185272],\n [0.537728011608124, 0.505385041236877],\n [0.760966002941132, 0.779752969741821],\n [0.801778972148895, 0.831938028335571],\n [0.892440974712372, 0.54076099395752],\n [0.816350996494293, 0.740260004997253],\n [0.865594983100891, 0.333687007427216],\n [0.614073991775513, 0.883246004581451],\n [0.508952975273132, 0.579437971115112],\n [0.617941975593567, 0.508316040039062],\n [0.825608015060425, 0.397674977779388],\n [0.681214988231659, 0.39623498916626],\n [0.656635999679565, 0.400596976280212],\n [0.603900015354156, 0.710216999053955],\n [0.81208598613739, 0.588539004325867],\n [0.56801301240921, 0.944564998149872],\n [0.681007981300354, 0.898285031318665],\n [0.733752012252808, 0.869701027870178],\n [0.633830010890961, 0.398822009563446],\n [0.606792986392975, 0.39553701877594],\n [0.589659988880157, 0.391062021255493],\n [0.805015981197357, 0.342108011245728],\n [0.611334979534149, 0.362284004688263],\n [0.634037971496582, 0.355970978736877],\n [0.656635999679565, 0.355356991291046],\n [0.681214988231659, 0.35834002494812],\n [0.698584973812103, 0.363156020641327],\n [0.941866993904114, 0.319076001644135],\n [0.698584973812103, 0.387449026107788],\n [0.584177017211914, 0.624107003211975],\n [0.554318010807037, 0.566076993942261],\n [0.534153997898102, 0.62064003944397],\n [0.711217999458313, 0.819975018501282],\n [0.664629995822906, 0.852871000766754],\n [0.559099972248077, 0.902631998062134],\n [0.871706008911133, 0.791940987110138],\n [0.591234028339386, 0.373893976211548],\n [0.544341027736664, 0.451583981513977],\n [0.624562978744507, 0.924192011356354],\n [0.88577002286911, 0.615028977394104],\n [0.551338016986847, 0.695277988910675],\n [0.551980018615723, 0.704632043838501],\n [0.552887976169586, 0.715808033943176],\n [0.555167973041534, 0.730794012546539],\n [0.569944024085999, 0.767035007476807],\n [0.593203008174896, 0.685675978660583],\n [0.599261999130249, 0.681069016456604],\n [0.607599973678589, 0.677703022956848],\n [0.631937980651855, 0.663500010967255],\n [0.752032995223999, 0.601315021514893],\n [0.547226011753082, 0.420395016670227],\n [0.563543975353241, 0.359827995300293],\n [0.583841025829315, 0.368713974952698],\n [0.586614012718201, 0.692366003990173],\n [0.771915018558502, 0.683578014373779],\n [0.531597018241882, 0.352482974529266],\n [0.588370978832245, 0.804440975189209],\n [0.52079701423645, 0.442565023899078],\n [0.567984998226166, 0.493479013442993],\n [0.543282985687256, 0.819254994392395],\n [0.655317008495331, 0.745514988899231],\n [0.621008992195129, 0.574018001556396],\n [0.625559985637665, 0.78031200170517],\n [0.680198013782501, 0.570719003677368],\n [0.64276397228241, 0.604337990283966],\n [0.704662978649139, 0.621529996395111],\n [0.552012026309967, 0.862591981887817],\n [0.589071989059448, 0.508637011051178],\n [0.685944974422455, 0.775357007980347],\n [0.645735025405884, 0.812640011310577],\n [0.675342977046967, 0.703978002071381],\n [0.810858011245728, 0.646304965019226],\n [0.72012197971344, 0.714666962623596],\n [0.866151988506317, 0.682704985141754],\n [0.663187026977539, 0.644596993923187],\n [0.570082008838654, 0.466325998306274],\n [0.544561982154846, 0.548375964164734],\n [0.562758982181549, 0.558784961700439],\n [0.531987011432648, 0.530140042304993],\n [0.585271000862122, 0.335177004337311],\n [0.622952997684479, 0.32277899980545],\n [0.655896008014679, 0.320163011550903],\n [0.687132000923157, 0.322345972061157],\n [0.716481983661652, 0.333200991153717],\n [0.758756995201111, 0.382786989212036],\n [0.897013008594513, 0.468769013881683],\n [0.732392013072968, 0.424547016620636],\n [0.70211398601532, 0.433162987232208],\n [0.66652500629425, 0.433866024017334],\n [0.633504986763, 0.426087975502014],\n [0.603875994682312, 0.416586995124817],\n [0.579657971858978, 0.409945011138916],\n [0.992439985275269, 0.480777025222778],\n [0.567192018032074, 0.569419980049133],\n [0.54136598110199, 0.478899002075195],\n [0.526564002037048, 0.546118021011353],\n [0.523913025856018, 0.563830018043518],\n [0.531529009342194, 0.555056989192963],\n [0.566035985946655, 0.582329034805298],\n [0.51631098985672, 0.563053965568542],\n [0.5174720287323, 0.577877044677734],\n [0.573594987392426, 0.389806985855103],\n [0.560697972774506, 0.395331978797913],\n [0.549755990505219, 0.399751007556915],\n [0.710287988185883, 0.368252992630005],\n [0.723330020904541, 0.363372981548309],\n];\n\nexport const TRI468 = [\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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];\n\nexport const TRI68 = [0, 1, 36, 0, 36, 17, 1, 2, 41, 1, 41, 36, 2, 3, 31, 2, 31, 41, 3, 4, 48, 3, 48, 31, 4, 5, 48, 5, 6, 48, 6, 7, 59, 6, 59, 48, 7, 8, 58, 7, 58, 59,\n 8, 9, 56, 8, 56, 57, 8, 57, 58, 9, 10, 55, 9, 55, 56, 10, 11, 54, 10, 54, 55, 11, 12, 54, 12, 13, 54, 13, 14, 35, 13, 35, 54, 14, 15, 46, 14, 46, 35, 15, 16,\n 45, 15, 45, 46, 16, 26, 45, 17, 36, 18, 18, 37, 19, 18, 36, 37, 19, 38, 20, 19, 37, 38, 20, 39, 21, 20, 38, 39, 21, 39, 27, 22, 42, 23, 22, 27, 42, 23, 43, 24,\n 23, 42, 43, 24, 44, 25, 24, 43, 44, 25, 45, 26, 25, 44, 45, 27, 39, 28, 27, 28, 42, 28, 39, 29, 28, 29, 42, 29, 31, 30, 29, 30, 35, 29, 40, 31, 29, 35, 47, 29,\n 39, 40, 29, 47, 42, 30, 31, 32, 30, 32, 33, 30, 33, 34, 30, 34, 35, 31, 50, 32, 31, 40, 41, 31, 48, 49, 31, 49, 50, 32, 51, 33, 32, 50, 51, 33, 51, 34, 34, 52,\n 35, 34, 51, 52, 35, 46, 47, 35, 52, 53, 35, 53, 54, 36, 41, 37, 37, 40, 38, 37, 41, 40, 38, 40, 39, 42, 47, 43, 43, 47, 44, 44, 46, 45, 44, 47, 46, 48, 60, 49,\n 48, 59, 60, 49, 61, 50, 49, 60, 61, 50, 62, 51, 50, 61, 62, 51, 62, 52, 52, 63, 53, 52, 62, 63, 53, 64, 54, 53, 63, 64, 54, 64, 55, 55, 65, 56, 55, 64, 65, 56,\n 66, 57, 56, 65, 66, 57, 66, 58, 58, 67, 59, 58, 66, 67, 59, 67, 60, 60, 67, 61, 61, 66, 62, 61, 67, 66, 62, 66, 63, 63, 65, 64, 63, 66, 65, 21, 27, 22];\n\nexport const TRI33 = [\n /* eyes */ 0, 8, 7, 7, 8, 1, 2, 10, 9, 9, 10, 3,\n /* brows */ 17, 0, 18, 18, 0, 7, 18, 7, 19, 19, 7, 1, 19, 1, 11, 19, 11, 20, 21, 3, 22, 21, 9, 3, 20, 9, 21, 20, 2, 9, 20, 11, 2,\n /* 4head */ 23, 17, 18, 25, 21, 22, 24, 19, 20, 24, 18, 19, 24, 20, 21, 24, 23, 18, 24, 21, 25,\n /* nose */ 11, 12, 4, 11, 4, 13, 1, 12, 11, 11, 13, 2, 12, 14, 4, 4, 14, 13,\n /* up-lip */ 14, 5, 15, 14, 15, 6, 12, 5, 14, 14, 6, 13,\n /* cheeks */ 8, 12, 1, 2, 13, 10, 8, 26, 12, 10, 13, 27, 26, 5, 12, 13, 6, 27, 0, 26, 8, 10, 27, 3,\n /* chin */ 5, 32, 16, 16, 32, 6, 5, 30, 32, 6, 32, 31,\n /* cont */ 26, 30, 5, 27, 6, 31, 0, 28, 26, 3, 27, 29, 17, 28, 0, 3, 29, 22, 23, 28, 17, 22, 29, 25, 28, 30, 26, 27, 31, 29,\n];\n\nexport const TRI7 = [0, 4, 1, 2, 4, 3, 4, 5, 6];\n\nexport const VTX68 = [\n /* cont */ 127, 234, 132, 58, 172, 150, 149, 148, 152, 377, 378, 379, 397, 288, 361, 454, 356,\n /* brows */ 70, 63, 105, 66, 107, 336, 296, 334, 293, 300,\n /* nose */ 168, 6, 195, 4, 98, 97, 2, 326, 327,\n /* eyes */ 33, 160, 158, 133, 153, 144, 362, 385, 387, 263, 373, 380,\n /* lip */ 57, 40, 37, 0, 267, 270, 287, 321, 314, 17, 84, 91,\n /* mouth */ 78, 81, 13, 311, 308, 402, 14, 178,\n];\n\nexport const VTX33 = [33, 133, 362, 263, 1, 62, 308, 159, 145, 386, 374, 6, 102, 331, 2, 13, 14, 70, 105, 107, 336, 334, 300, 54, 10, 284, 50, 280, 234, 454, 58, 288, 152];\n\nexport const VTX7 = [33, 133, 362, 263, 1, 78, 308];\n\nexport const UV68 = VTX68.map((x) => UV468[x]);\n\nexport const UV33 = VTX33.map((x) => UV468[x]);\n\nexport const UV7 = VTX7.map((x) => UV468[x]);\n", "import * as tf from '../../dist/tfjs.esm.js';\nimport * as bounding from './box';\nimport * as util from './util';\nimport * as coords from './coords';\n\nconst leftOutline = coords.MESH_ANNOTATIONS['leftEyeLower0'];\nconst rightOutline = coords.MESH_ANNOTATIONS['rightEyeLower0'];\n\nconst eyeLandmarks = {\n leftBounds: [leftOutline[0], leftOutline[leftOutline.length - 1]],\n rightBounds: [rightOutline[0], rightOutline[rightOutline.length - 1]],\n};\n\nconst meshLandmarks = {\n count: 468,\n mouth: 13,\n symmetryLine: [13, coords.MESH_ANNOTATIONS['midwayBetweenEyes'][0]],\n};\n\nconst blazeFaceLandmarks = {\n leftEye: 0,\n rightEye: 1,\n nose: 2,\n mouth: 3,\n leftEar: 4,\n rightEar: 5,\n symmetryLine: [3, 2],\n};\n\nconst irisLandmarks = {\n upperCenter: 3,\n lowerCenter: 4,\n index: 71,\n numCoordinates: 76,\n};\n\n// Replace the raw coordinates returned by facemesh with refined iris model coordinates\n// Update the z coordinate to be an average of the original and the new.\nfunction replaceRawCoordinates(rawCoords, newCoords, prefix, keys) {\n for (let i = 0; i < coords.MESH_TO_IRIS_INDICES_MAP.length; i++) {\n const { key, indices } = coords.MESH_TO_IRIS_INDICES_MAP[i];\n const originalIndices = coords.MESH_ANNOTATIONS[`${prefix}${key}`];\n if (!keys || keys.includes(key)) {\n for (let j = 0; j < indices.length; j++) {\n const index = indices[j];\n rawCoords[originalIndices[j]] = [\n newCoords[index][0], newCoords[index][1],\n (newCoords[index][2] + rawCoords[originalIndices[j]][2]) / 2,\n ];\n }\n }\n }\n}\n// The Pipeline coordinates between the bounding box and skeleton models.\nexport class Pipeline {\n storedBoxes: any;\n boundingBoxDetector: any;\n meshDetector: any;\n irisModel: any;\n boxSize: number;\n meshSize: number;\n irisSize: number;\n irisEnlarge: number;\n skipped: number;\n detectedFaces: number;\n\n constructor(boundingBoxDetector, meshDetector, irisModel) {\n // An array of facial bounding boxes.\n this.storedBoxes = [];\n this.boundingBoxDetector = boundingBoxDetector;\n this.meshDetector = meshDetector;\n this.irisModel = irisModel;\n this.boxSize = boundingBoxDetector?.model?.inputs[0].shape[2] || 0;\n this.meshSize = meshDetector?.inputs[0].shape[2] || boundingBoxDetector?.model?.inputs[0].shape[2];\n this.irisSize = irisModel?.inputs[0].shape[1] || 0;\n this.irisEnlarge = 2.3;\n this.skipped = 0;\n this.detectedFaces = 0;\n }\n\n transformRawCoords(rawCoords, box, angle, rotationMatrix) {\n const boxSize = bounding.getBoxSize({ startPoint: box.startPoint, endPoint: box.endPoint });\n const coordsScaled = rawCoords.map((coord) => ([\n boxSize[0] / this.meshSize * (coord[0] - this.meshSize / 2),\n boxSize[1] / this.meshSize * (coord[1] - this.meshSize / 2),\n coord[2],\n ]));\n const coordsRotationMatrix = (angle !== 0) ? util.buildRotationMatrix(angle, [0, 0]) : util.IDENTITY_MATRIX;\n const coordsRotated = (angle !== 0) ? coordsScaled.map((coord) => ([...util.rotatePoint(coord, coordsRotationMatrix), coord[2]])) : coordsScaled;\n const inverseRotationMatrix = (angle !== 0) ? util.invertTransformMatrix(rotationMatrix) : util.IDENTITY_MATRIX;\n const boxCenter = [...bounding.getBoxCenter({ startPoint: box.startPoint, endPoint: box.endPoint }), 1];\n return coordsRotated.map((coord) => ([\n Math.round(coord[0] + util.dot(boxCenter, inverseRotationMatrix[0])),\n Math.round(coord[1] + util.dot(boxCenter, inverseRotationMatrix[1])),\n Math.round(coord[2]),\n ]));\n }\n\n // eslint-disable-next-line class-methods-use-this\n getLeftToRightEyeDepthDifference(rawCoords) {\n const leftEyeZ = rawCoords[eyeLandmarks.leftBounds[0]][2];\n const rightEyeZ = rawCoords[eyeLandmarks.rightBounds[0]][2];\n return leftEyeZ - rightEyeZ;\n }\n\n // Returns a box describing a cropped region around the eye fit for passing to the iris model.\n getEyeBox(rawCoords, face, eyeInnerCornerIndex, eyeOuterCornerIndex, flip = false) {\n const box = bounding.squarifyBox(bounding.enlargeBox(bounding.calculateLandmarksBoundingBox([rawCoords[eyeInnerCornerIndex], rawCoords[eyeOuterCornerIndex]]), this.irisEnlarge));\n const boxSize = bounding.getBoxSize(box);\n let crop = tf.image.cropAndResize(face, [[\n box.startPoint[1] / this.meshSize,\n box.startPoint[0] / this.meshSize, box.endPoint[1] / this.meshSize,\n box.endPoint[0] / this.meshSize,\n ]], [0], [this.irisSize, this.irisSize]);\n if (flip && tf.ENV.flags.IS_BROWSER) {\n crop = tf.image.flipLeftRight(crop); // flipLeftRight is not defined for tfjs-node\n }\n return { box, boxSize, crop };\n }\n\n // Given a cropped image of an eye, returns the coordinates of the contours surrounding the eye and the iris.\n getEyeCoords(eyeData, eyeBox, eyeBoxSize, flip = false) {\n const eyeRawCoords: Array = [];\n for (let i = 0; i < irisLandmarks.numCoordinates; i++) {\n const x = eyeData[i * 3];\n const y = eyeData[i * 3 + 1];\n const z = eyeData[i * 3 + 2];\n eyeRawCoords.push([\n (flip ? (1 - (x / this.irisSize)) : (x / this.irisSize)) * eyeBoxSize[0] + eyeBox.startPoint[0],\n (y / this.irisSize) * eyeBoxSize[1] + eyeBox.startPoint[1], z,\n ]);\n }\n return { rawCoords: eyeRawCoords, iris: eyeRawCoords.slice(irisLandmarks.index) };\n }\n\n // The z-coordinates returned for the iris are unreliable, so we take the z values from the surrounding keypoints.\n // eslint-disable-next-line class-methods-use-this\n getAdjustedIrisCoords(rawCoords, irisCoords, direction) {\n const upperCenterZ = rawCoords[coords.MESH_ANNOTATIONS[`${direction}EyeUpper0`][irisLandmarks.upperCenter]][2];\n const lowerCenterZ = rawCoords[coords.MESH_ANNOTATIONS[`${direction}EyeLower0`][irisLandmarks.lowerCenter]][2];\n const averageZ = (upperCenterZ + lowerCenterZ) / 2;\n // Iris indices: 0: center | 1: right | 2: above | 3: left | 4: below\n return irisCoords.map((coord, i) => {\n let z = averageZ;\n if (i === 2) {\n z = upperCenterZ;\n } else if (i === 4) {\n z = lowerCenterZ;\n }\n return [coord[0], coord[1], z];\n });\n }\n\n async predict(input, config) {\n let useFreshBox = false;\n // run new detector every skipFrames unless we only want box to start with\n let detector;\n if ((this.skipped === 0) || (this.skipped > config.face.detector.skipFrames) || !config.face.mesh.enabled || !config.videoOptimized) {\n detector = await this.boundingBoxDetector.getBoundingBoxes(input);\n this.skipped = 0;\n }\n if (config.videoOptimized) this.skipped++;\n\n // if detector result count doesn't match current working set, use it to reset current working set\n if (!config.videoOptimized || (detector && detector.boxes && (!config.face.mesh.enabled || (detector.boxes.length !== this.detectedFaces) && (this.detectedFaces !== config.face.detector.maxDetected)))) {\n this.storedBoxes = [];\n this.detectedFaces = 0;\n for (const possible of detector.boxes) {\n this.storedBoxes.push({ startPoint: possible.box.startPoint.dataSync(), endPoint: possible.box.endPoint.dataSync(), landmarks: possible.landmarks, confidence: possible.confidence });\n }\n if (this.storedBoxes.length > 0) useFreshBox = true;\n }\n\n if (config.face.detector.skipInitial && this.detectedFaces === 0) this.skipped = 0;\n\n if (useFreshBox) {\n if (!detector || !detector.boxes || (detector.boxes.length === 0)) {\n this.storedBoxes = [];\n this.detectedFaces = 0;\n return null;\n }\n for (let i = 0; i < this.storedBoxes.length; i++) {\n const scaledBox = bounding.scaleBoxCoordinates({ startPoint: this.storedBoxes[i].startPoint, endPoint: this.storedBoxes[i].endPoint }, detector.scaleFactor);\n const enlargedBox = bounding.enlargeBox(scaledBox);\n const squarifiedBox = bounding.squarifyBox(enlargedBox);\n const landmarks = this.storedBoxes[i].landmarks.arraySync();\n const confidence = this.storedBoxes[i].confidence;\n this.storedBoxes[i] = { ...squarifiedBox, confidence, landmarks };\n }\n }\n if (detector && detector.boxes) {\n detector.boxes.forEach((prediction) => {\n prediction.box.startPoint.dispose();\n prediction.box.endPoint.dispose();\n prediction.landmarks.dispose();\n });\n }\n const results = tf.tidy(() => this.storedBoxes.map((box, i) => {\n // The facial bounding box landmarks could come either from blazeface (if we are using a fresh box), or from the mesh model (if we are reusing an old box).\n let face;\n let angle = 0;\n let rotationMatrix;\n\n if (config.face.detector.rotation && config.face.mesh.enabled && tf.ENV.flags.IS_BROWSER) {\n const [indexOfMouth, indexOfForehead] = (box.landmarks.length >= meshLandmarks.count) ? meshLandmarks.symmetryLine : blazeFaceLandmarks.symmetryLine;\n angle = util.computeRotation(box.landmarks[indexOfMouth], box.landmarks[indexOfForehead]);\n const faceCenter = bounding.getBoxCenter({ startPoint: box.startPoint, endPoint: box.endPoint });\n const faceCenterNormalized = [faceCenter[0] / input.shape[2], faceCenter[1] / input.shape[1]];\n const rotatedImage = tf.image.rotateWithOffset(input, angle, 0, faceCenterNormalized); // rotateWithOffset is not defined for tfjs-node\n rotationMatrix = util.buildRotationMatrix(-angle, faceCenter);\n if (config.face.mesh.enabled) face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, rotatedImage, [this.meshSize, this.meshSize]).div(255);\n else face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, rotatedImage, [this.boxSize, this.boxSize]).div(255);\n } else {\n rotationMatrix = util.IDENTITY_MATRIX;\n const clonedImage = input.clone();\n if (config.face.mesh.enabled) face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, clonedImage, [this.meshSize, this.meshSize]).div(255);\n else face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, clonedImage, [this.boxSize, this.boxSize]).div(255);\n }\n\n // if we're not going to produce mesh, don't spend time with further processing\n if (!config.face.mesh.enabled) {\n const prediction = {\n mesh: [],\n box,\n faceConfidence: null,\n boxConfidence: box.confidence,\n confidence: box.confidence,\n image: face,\n };\n return prediction;\n }\n\n const [, confidence, contourCoords] = this.meshDetector.execute(face); // The first returned tensor represents facial contours which are already included in the coordinates.\n const faceConfidence = confidence.dataSync()[0];\n if (faceConfidence < config.face.detector.minConfidence) {\n this.storedBoxes[i].confidence = faceConfidence; // reset confidence of cached box\n return null; // if below confidence just exit\n }\n const coordsReshaped = tf.reshape(contourCoords, [-1, 3]);\n let rawCoords = coordsReshaped.arraySync();\n\n if (config.face.iris.enabled) {\n const { box: leftEyeBox, boxSize: leftEyeBoxSize, crop: leftEyeCrop } = this.getEyeBox(rawCoords, face, eyeLandmarks.leftBounds[0], eyeLandmarks.leftBounds[1], true);\n const { box: rightEyeBox, boxSize: rightEyeBoxSize, crop: rightEyeCrop } = this.getEyeBox(rawCoords, face, eyeLandmarks.rightBounds[0], eyeLandmarks.rightBounds[1]);\n const eyePredictions = this.irisModel.predict(tf.concat([leftEyeCrop, rightEyeCrop]));\n const eyePredictionsData = eyePredictions.dataSync();\n const leftEyeData = eyePredictionsData.slice(0, irisLandmarks.numCoordinates * 3);\n const { rawCoords: leftEyeRawCoords, iris: leftIrisRawCoords } = this.getEyeCoords(leftEyeData, leftEyeBox, leftEyeBoxSize, true);\n const rightEyeData = eyePredictionsData.slice(irisLandmarks.numCoordinates * 3);\n const { rawCoords: rightEyeRawCoords, iris: rightIrisRawCoords } = this.getEyeCoords(rightEyeData, rightEyeBox, rightEyeBoxSize);\n const leftToRightEyeDepthDifference = this.getLeftToRightEyeDepthDifference(rawCoords);\n if (Math.abs(leftToRightEyeDepthDifference) < 30) { // User is looking straight ahead.\n replaceRawCoordinates(rawCoords, leftEyeRawCoords, 'left', null);\n replaceRawCoordinates(rawCoords, rightEyeRawCoords, 'right', null);\n // If the user is looking to the left or to the right, the iris coordinates tend to diverge too much from the mesh coordinates for them to be merged\n // So we only update a single contour line above and below the eye.\n } else if (leftToRightEyeDepthDifference < 1) { // User is looking towards the right.\n replaceRawCoordinates(rawCoords, leftEyeRawCoords, 'left', ['EyeUpper0', 'EyeLower0']);\n } else { // User is looking towards the left.\n replaceRawCoordinates(rawCoords, rightEyeRawCoords, 'right', ['EyeUpper0', 'EyeLower0']);\n }\n const adjustedLeftIrisCoords = this.getAdjustedIrisCoords(rawCoords, leftIrisRawCoords, 'left');\n const adjustedRightIrisCoords = this.getAdjustedIrisCoords(rawCoords, rightIrisRawCoords, 'right');\n rawCoords = rawCoords.concat(adjustedLeftIrisCoords).concat(adjustedRightIrisCoords);\n }\n\n // override box from detection with one calculated from mesh\n const mesh = this.transformRawCoords(rawCoords, box, angle, rotationMatrix);\n const storeConfidence = box.confidence;\n box = bounding.enlargeBox(bounding.calculateLandmarksBoundingBox(mesh), 1.5); // redefine box with mesh calculated one\n box.confidence = storeConfidence;\n\n // do rotation one more time with mesh keypoints if we want to return perfect image\n if (config.face.detector.rotation && config.face.mesh.enabled && config.face.description.enabled && tf.ENV.flags.IS_BROWSER) {\n const [indexOfMouth, indexOfForehead] = (box.landmarks.length >= meshLandmarks.count) ? meshLandmarks.symmetryLine : blazeFaceLandmarks.symmetryLine;\n angle = util.computeRotation(box.landmarks[indexOfMouth], box.landmarks[indexOfForehead]);\n const faceCenter = bounding.getBoxCenter({ startPoint: box.startPoint, endPoint: box.endPoint });\n const faceCenterNormalized = [faceCenter[0] / input.shape[2], faceCenter[1] / input.shape[1]];\n const rotatedImage = tf.image.rotateWithOffset(input.toFloat(), angle, 0, faceCenterNormalized); // rotateWithOffset is not defined for tfjs-node\n rotationMatrix = util.buildRotationMatrix(-angle, faceCenter);\n face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, rotatedImage, [this.meshSize, this.meshSize]).div(255);\n }\n\n const prediction = {\n mesh,\n box,\n faceConfidence,\n boxConfidence: box.confidence,\n image: face,\n };\n\n // updated stored cache values\n const storedBox = bounding.squarifyBox(box);\n // @ts-ignore box itself doesn't have those properties, but we stored them for future use\n storedBox.confidence = box.confidence;\n // @ts-ignore box itself doesn't have those properties, but we stored them for future use\n storedBox.faceConfidence = faceConfidence;\n // this.storedBoxes[i] = { ...squarifiedLandmarksBox, confidence: box.confidence, faceConfidence };\n this.storedBoxes[i] = storedBox;\n\n return prediction;\n }));\n\n // results = results.filter((a) => a !== null);\n // remove cache entries for detected boxes on low confidence\n if (config.face.mesh.enabled) this.storedBoxes = this.storedBoxes.filter((a) => a.confidence > config.face.detector.minConfidence);\n this.detectedFaces = results.length;\n\n return results;\n }\n}\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\n\nconst annotations = ['angry', 'disgust', 'fear', 'happy', 'sad', 'surprise', 'neutral'];\nlet model;\nlet last: Array<{ score: number, emotion: string }> = [];\nlet skipped = Number.MAX_SAFE_INTEGER;\n\n// tuning values\nconst rgb = [0.2989, 0.5870, 0.1140]; // factors for red/green/blue colors when converting to grayscale\n\nexport async function load(config) {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.face.emotion.modelPath));\n if (!model || !model.modelUrl) log('load model failed:', config.face.emotion.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n\nexport async function predict(image, config) {\n if (!model) return null;\n if ((skipped < config.face.emotion.skipFrames) && config.videoOptimized && (last.length > 0)) {\n skipped++;\n return last;\n }\n if (config.videoOptimized) skipped = 0;\n else skipped = Number.MAX_SAFE_INTEGER;\n return new Promise(async (resolve) => {\n const resize = tf.image.resizeBilinear(image, [model.inputs[0].shape[2], model.inputs[0].shape[1]], false);\n const [red, green, blue] = tf.split(resize, 3, 3);\n resize.dispose();\n // weighted rgb to grayscale: https://www.mathworks.com/help/matlab/ref/rgb2gray.html\n const redNorm = tf.mul(red, rgb[0]);\n const greenNorm = tf.mul(green, rgb[1]);\n const blueNorm = tf.mul(blue, rgb[2]);\n red.dispose();\n green.dispose();\n blue.dispose();\n const grayscale = tf.addN([redNorm, greenNorm, blueNorm]);\n redNorm.dispose();\n greenNorm.dispose();\n blueNorm.dispose();\n const normalize = tf.tidy(() => grayscale.sub(0.5).mul(2));\n grayscale.dispose();\n const obj: Array<{ score: number, emotion: string }> = [];\n if (config.face.emotion.enabled) {\n const emotionT = await model.predict(normalize); // result is already in range 0..1, no need for additional activation\n const data = emotionT.dataSync();\n tf.dispose(emotionT);\n for (let i = 0; i < data.length; i++) {\n if (data[i] > config.face.emotion.minConfidence) obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] });\n }\n obj.sort((a, b) => b.score - a.score);\n }\n normalize.dispose();\n last = obj;\n resolve(obj);\n });\n}\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\n\nlet model;\nlet last = { age: 0 };\nlet skipped = Number.MAX_SAFE_INTEGER;\n\ntype Tensor = typeof tf.Tensor;\ntype DB = Array<{ name: string, source: string, embedding: number[] }>;\n\nexport async function load(config) {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.face.description.modelPath));\n if (!model || !model.modelUrl) log('load model failed:', config.face.description.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n\nexport function similarity(embedding1, embedding2, order = 2): number {\n if (!embedding1 || !embedding2) return 0;\n if (embedding1?.length === 0 || embedding2?.length === 0) return 0;\n if (embedding1?.length !== embedding2?.length) return 0;\n // general minkowski distance, euclidean distance is limited case where order is 2\n const distance = 5.0 * embedding1\n .map((val, i) => (Math.abs(embedding1[i] - embedding2[i]) ** order)) // distance squared\n .reduce((sum, now) => (sum + now), 0) // sum all distances\n ** (1 / order); // get root of\n const res = Math.max(0, 100 - distance) / 100.0;\n return res;\n}\n\nexport function match(embedding: Array, db: DB, threshold = 0) {\n let best = { similarity: 0, name: '', source: '', embedding: [] as number[] };\n if (!embedding || !db || !Array.isArray(embedding) || !Array.isArray(db)) return best;\n for (const f of db) {\n if (f.embedding && f.name) {\n const perc = similarity(embedding, f.embedding);\n if (perc > threshold && perc > best.similarity) best = { ...f, similarity: perc };\n }\n }\n return best;\n}\n\nexport function enhance(input): Tensor {\n const image = tf.tidy(() => {\n // input received from detector is already normalized to 0..1\n // input is also assumed to be straightened\n const tensor = input.image || input.tensor || input;\n if (!(tensor instanceof tf.Tensor)) return null;\n // do a tight crop of image and resize it to fit the model\n const box = [[0.05, 0.15, 0.85, 0.85]]; // empyrical values for top, left, bottom, right\n // const box = [[0.0, 0.0, 1.0, 1.0]]; // basically no crop for test\n const crop = (tensor.shape.length === 3)\n ? tf.image.cropAndResize(tf.expandDims(tensor, 0), box, [0], [model.inputs[0].shape[2], model.inputs[0].shape[1]]) // add batch dimension if missing\n : tf.image.cropAndResize(tensor, box, [0], [model.inputs[0].shape[2], model.inputs[0].shape[1]]);\n // const crop = tf.image.resizeBilinear(tensor, [model.inputs[0].shape[2], model.inputs[0].shape[1]], false); // just resize to fit the embedding model\n\n /*\n // convert to black&white to avoid colorization impact\n const rgb = [0.2989, 0.5870, 0.1140]; // factors for red/green/blue colors when converting to grayscale: https://www.mathworks.com/help/matlab/ref/rgb2gray.html\n const [red, green, blue] = tf.split(crop, 3, 3);\n const redNorm = tf.mul(red, rgb[0]);\n const greenNorm = tf.mul(green, rgb[1]);\n const blueNorm = tf.mul(blue, rgb[2]);\n const grayscale = tf.addN([redNorm, greenNorm, blueNorm]);\n const merge = tf.stack([grayscale, grayscale, grayscale], 3).squeeze(4);\n */\n\n /*\n // optional increase image contrast\n // or do it per-channel so mean is done on each channel\n // or do it based on histogram\n const mean = merge.mean();\n const factor = 5;\n const contrast = merge.sub(mean).mul(factor).add(mean);\n */\n\n /*\n // normalize brightness from 0..1\n const darken = crop.sub(crop.min());\n const lighten = darken.div(darken.max());\n */\n\n const norm = crop.mul(255);\n\n return norm;\n });\n return image;\n}\n\nexport async function predict(image, config) {\n if (!model) return null;\n if ((skipped < config.face.description.skipFrames) && config.videoOptimized && last.age && (last.age > 0)) {\n skipped++;\n return last;\n }\n if (config.videoOptimized) skipped = 0;\n else skipped = Number.MAX_SAFE_INTEGER;\n return new Promise(async (resolve) => {\n const enhanced = enhance(image);\n\n let resT;\n const obj = {\n age: 0,\n gender: 'unknown',\n genderConfidence: 0,\n descriptor: [] };\n\n if (config.face.description.enabled) resT = await model.predict(enhanced);\n tf.dispose(enhanced);\n\n if (resT) {\n tf.tidy(() => {\n const gender = resT.find((t) => t.shape[1] === 1).dataSync();\n const confidence = Math.trunc(200 * Math.abs((gender[0] - 0.5))) / 100;\n if (confidence > config.face.description.minConfidence) {\n obj.gender = gender[0] <= 0.5 ? 'female' : 'male';\n obj.genderConfidence = Math.min(0.99, confidence);\n }\n const age = resT.find((t) => t.shape[1] === 100).argMax(1).dataSync()[0];\n const all = resT.find((t) => t.shape[1] === 100).dataSync();\n obj.age = Math.round(all[age - 1] > all[age + 1] ? 10 * age - 100 * all[age - 1] : 10 * age + 100 * all[age + 1]) / 10;\n\n const desc = resT.find((t) => t.shape[1] === 1024);\n // const reshape = desc.reshape([128, 8]);\n // const reduce = reshape.logSumExp(1); // reduce 2nd dimension by calculating logSumExp on it\n\n obj.descriptor = [...desc.dataSync()];\n });\n resT.forEach((t) => tf.dispose(t));\n }\n\n last = obj;\n resolve(obj);\n });\n}\n", "import { log, now } from './helpers';\nimport * as tf from '../dist/tfjs.esm.js';\nimport * as facemesh from './blazeface/facemesh';\nimport * as emotion from './emotion/emotion';\nimport * as faceres from './faceres/faceres';\n\ntype Tensor = typeof tf.Tensor;\n\nconst calculateFaceAngle = (face, image_size): { angle: { pitch: number, yaw: number, roll: number }, matrix: [number, number, number, number, number, number, number, number, number] } => {\n // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\n const degrees = (theta) => (theta * 180) / Math.PI;\n // const degrees = (theta) => Math.abs(((theta * 180) / Math.PI) % 360);\n const normalize = (v) => { // normalize vector\n const length = Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);\n v[0] /= length;\n v[1] /= length;\n v[2] /= length;\n return v;\n };\n const subVectors = (a, b) => { // vector subtraction (a - b)\n const x = a[0] - b[0];\n const y = a[1] - b[1];\n const z = a[2] - b[2];\n return [x, y, z];\n };\n const crossVectors = (a, b) => { // vector cross product (a x b)\n const x = a[1] * b[2] - a[2] * b[1];\n const y = a[2] * b[0] - a[0] * b[2];\n const z = a[0] * b[1] - a[1] * b[0];\n return [x, y, z];\n };\n // 3x3 rotation matrix to Euler angles based on https://www.geometrictools.com/Documentation/EulerAngles.pdf\n const rotationMatrixToEulerAngle = (r) => {\n // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\n const [r00, r01, r02, r10, r11, r12, r20, r21, r22] = r;\n let thetaX; let thetaY; let thetaZ;\n if (r10 < 1) { // YZX calculation\n if (r10 > -1) {\n thetaZ = Math.asin(r10);\n thetaY = Math.atan2(-r20, r00);\n thetaX = Math.atan2(-r12, r11);\n } else {\n thetaZ = -Math.PI / 2;\n thetaY = -Math.atan2(r21, r22);\n thetaX = 0;\n }\n } else {\n thetaZ = Math.PI / 2;\n thetaY = Math.atan2(r21, r22);\n thetaX = 0;\n }\n return { pitch: 2 * -thetaX, yaw: 2 * -thetaY, roll: 2 * -thetaZ };\n };\n // simple Euler angle calculation based existing 3D mesh\n // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\n const meshToEulerAngle = (mesh) => {\n const radians = (a1, a2, b1, b2) => Math.atan2(b2 - a2, b1 - a1);\n // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\n const angle = {\n // values are in radians in range of -pi/2 to pi/2 which is -90 to +90 degrees\n // value of 0 means center\n // pitch is face move up/down\n pitch: radians(mesh[10][1], mesh[10][2], mesh[152][1], mesh[152][2]), // looking at y,z of top and bottom points of the face\n // yaw is face turn left/right\n yaw: radians(mesh[33][0], mesh[33][2], mesh[263][0], mesh[263][2]), // looking at x,z of outside corners of leftEye and rightEye\n // roll is face lean left/right\n roll: radians(mesh[33][0], mesh[33][1], mesh[263][0], mesh[263][1]), // looking at x,y of outside corners of leftEye and rightEye\n };\n return angle;\n };\n\n const mesh = face.meshRaw;\n if (!mesh || mesh.length < 300) return { angle: { pitch: 0, yaw: 0, roll: 0 }, matrix: [1, 0, 0, 0, 1, 0, 0, 0, 1] };\n\n const size = Math.max(face.boxRaw[2] * image_size[0], face.boxRaw[3] * image_size[1]) / 1.5;\n // top, bottom, left, right\n const pts = [mesh[10], mesh[152], mesh[234], mesh[454]].map((pt) => [\n // make the xyz coordinates proportional, independent of the image/box size\n pt[0] * image_size[0] / size,\n pt[1] * image_size[1] / size,\n pt[2],\n ]);\n\n const y_axis = normalize(subVectors(pts[1], pts[0]));\n let x_axis = normalize(subVectors(pts[3], pts[2]));\n const z_axis = normalize(crossVectors(x_axis, y_axis));\n // adjust x_axis to make sure that all axes are perpendicular to each other\n x_axis = crossVectors(y_axis, z_axis);\n\n // Rotation Matrix from Axis Vectors - http://renderdan.blogspot.com/2006/05/rotation-matrix-from-axis-vectors.html\n // 3x3 rotation matrix is flatten to array in row-major order. Note that the rotation represented by this matrix is inverted.\n const matrix: [number, number, number, number, number, number, number, number, number] = [\n x_axis[0], x_axis[1], x_axis[2],\n y_axis[0], y_axis[1], y_axis[2],\n z_axis[0], z_axis[1], z_axis[2],\n ];\n const angle = rotationMatrixToEulerAngle(matrix);\n // const angle = meshToEulerAngle(mesh);\n return { angle, matrix };\n};\n\nexport const detectFace = async (parent, input): Promise => {\n // run facemesh, includes blazeface and iris\n // eslint-disable-next-line no-async-promise-executor\n let timeStamp;\n let ageRes;\n let genderRes;\n let emotionRes;\n let embeddingRes;\n let descRes;\n const faceRes: Array<{\n confidence: number,\n boxConfidence: number,\n faceConfidence: number,\n box: [number, number, number, number],\n mesh: Array<[number, number, number]>\n meshRaw: Array<[number, number, number]>\n boxRaw: [number, number, number, number],\n annotations: Array<{ part: string, points: Array<[number, number, number]>[] }>,\n age: number,\n gender: string,\n genderConfidence: number,\n emotion: string,\n embedding: number[],\n iris: number,\n rotation: {\n angle: { pitch: number, yaw: number, roll: number },\n matrix: [number, number, number, number, number, number, number, number, number]\n },\n tensor: Tensor,\n }> = [];\n parent.state = 'run:face';\n timeStamp = now();\n const faces = await facemesh.predict(input, parent.config);\n parent.perf.face = Math.trunc(now() - timeStamp);\n if (!faces) return [];\n for (const face of faces) {\n parent.analyze('Get Face');\n\n // is something went wrong, skip the face\n if (!face.image || face.image.isDisposedInternal) {\n log('Face object is disposed:', face.image);\n continue;\n }\n\n const rotation = calculateFaceAngle(face, [input.shape[2], input.shape[1]]);\n\n // run emotion, inherits face from blazeface\n parent.analyze('Start Emotion:');\n if (parent.config.async) {\n emotionRes = parent.config.face.emotion.enabled ? emotion.predict(face.image, parent.config) : {};\n } else {\n parent.state = 'run:emotion';\n timeStamp = now();\n emotionRes = parent.config.face.emotion.enabled ? await emotion.predict(face.image, parent.config) : {};\n parent.perf.emotion = Math.trunc(now() - timeStamp);\n }\n parent.analyze('End Emotion:');\n\n // run emotion, inherits face from blazeface\n parent.analyze('Start Description:');\n if (parent.config.async) {\n descRes = parent.config.face.description.enabled ? faceres.predict(face, parent.config) : [];\n } else {\n parent.state = 'run:description';\n timeStamp = now();\n descRes = parent.config.face.description.enabled ? await faceres.predict(face.image, parent.config) : [];\n parent.perf.embedding = Math.trunc(now() - timeStamp);\n }\n parent.analyze('End Description:');\n\n // if async wait for results\n if (parent.config.async) {\n [ageRes, genderRes, emotionRes, embeddingRes, descRes] = await Promise.all([ageRes, genderRes, emotionRes, embeddingRes, descRes]);\n }\n\n parent.analyze('Finish Face:');\n\n // calculate iris distance\n // iris: array[ center, left, top, right, bottom]\n if (!parent.config.face.iris.enabled && face?.annotations?.leftEyeIris && face?.annotations?.rightEyeIris) {\n delete face.annotations.leftEyeIris;\n delete face.annotations.rightEyeIris;\n }\n const irisSize = (face.annotations?.leftEyeIris && face.annotations?.rightEyeIris)\n /* average human iris size is 11.7mm */\n ? 11.7 * Math.max(Math.abs(face.annotations.leftEyeIris[3][0] - face.annotations.leftEyeIris[1][0]), Math.abs(face.annotations.rightEyeIris[4][1] - face.annotations.rightEyeIris[2][1]))\n : 0;\n\n // combine results\n faceRes.push({\n ...face,\n age: descRes.age,\n gender: descRes.gender,\n genderConfidence: descRes.genderConfidence,\n embedding: descRes.descriptor,\n emotion: emotionRes,\n iris: (irisSize !== 0) ? Math.trunc(irisSize) / 100 : 0,\n rotation,\n tensor: parent.config.face.detector.return ? face.image?.squeeze() : null,\n });\n // dispose original face tensor\n face.image?.dispose();\n\n parent.analyze('End Face');\n }\n parent.analyze('End FaceMesh:');\n if (parent.config.async) {\n if (parent.perf.face) delete parent.perf.face;\n if (parent.perf.age) delete parent.perf.age;\n if (parent.perf.gender) delete parent.perf.gender;\n if (parent.perf.emotion) delete parent.perf.emotion;\n }\n return faceRes;\n};\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as poses from './poses';\nimport * as util from './utils';\n\nlet model;\nconst poseNetOutputs = ['MobilenetV1/offset_2/BiasAdd'/* offsets */, 'MobilenetV1/heatmap_2/BiasAdd'/* heatmapScores */, 'MobilenetV1/displacement_fwd_2/BiasAdd'/* displacementFwd */, 'MobilenetV1/displacement_bwd_2/BiasAdd'/* displacementBwd */];\n\nexport async function predict(input, config) {\n const res = tf.tidy(() => {\n const resized = input.resizeBilinear([model.inputs[0].shape[2], model.inputs[0].shape[1]]);\n const normalized = resized.toFloat().div(127.5).sub(1.0);\n const results = model.execute(normalized, poseNetOutputs);\n const results3d = results.map((y) => y.squeeze([0]));\n results3d[1] = results3d[1].sigmoid(); // apply sigmoid on scores\n return results3d;\n });\n\n const buffers = await Promise.all(res.map((tensor) => tensor.buffer()));\n for (const t of res) t.dispose();\n\n const decoded = await poses.decode(buffers[0], buffers[1], buffers[2], buffers[3], config.body.maxDetected, config.body.minConfidence);\n const scaled = util.scalePoses(decoded, [input.shape[1], input.shape[2]], [model.inputs[0].shape[2], model.inputs[0].shape[1]]);\n return scaled;\n}\n\nexport async function load(config) {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.body.modelPath));\n if (!model || !model.modelUrl) log('load model failed:', config.body.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n", "export const partNames = [\n 'nose', 'leftEye', 'rightEye', 'leftEar', 'rightEar', 'leftShoulder',\n 'rightShoulder', 'leftElbow', 'rightElbow', 'leftWrist', 'rightWrist',\n 'leftHip', 'rightHip', 'leftKnee', 'rightKnee', 'leftAnkle', 'rightAnkle',\n];\n\nexport const count = partNames.length; // 17 keypoints\n\nexport const partIds = partNames.reduce((result, jointName, i) => {\n result[jointName] = i;\n return result;\n}, {});\n\nconst connectedPartNames = [\n ['leftHip', 'leftShoulder'], ['leftElbow', 'leftShoulder'],\n ['leftElbow', 'leftWrist'], ['leftHip', 'leftKnee'],\n ['leftKnee', 'leftAnkle'], ['rightHip', 'rightShoulder'],\n ['rightElbow', 'rightShoulder'], ['rightElbow', 'rightWrist'],\n ['rightHip', 'rightKnee'], ['rightKnee', 'rightAnkle'],\n ['leftShoulder', 'rightShoulder'], ['leftHip', 'rightHip'],\n];\nexport const connectedPartIndices = connectedPartNames.map(([jointNameA, jointNameB]) => ([partIds[jointNameA], partIds[jointNameB]]));\n\nexport const poseChain = [\n ['nose', 'leftEye'], ['leftEye', 'leftEar'], ['nose', 'rightEye'],\n ['rightEye', 'rightEar'], ['nose', 'leftShoulder'],\n ['leftShoulder', 'leftElbow'], ['leftElbow', 'leftWrist'],\n ['leftShoulder', 'leftHip'], ['leftHip', 'leftKnee'],\n ['leftKnee', 'leftAnkle'], ['nose', 'rightShoulder'],\n ['rightShoulder', 'rightElbow'], ['rightElbow', 'rightWrist'],\n ['rightShoulder', 'rightHip'], ['rightHip', 'rightKnee'],\n ['rightKnee', 'rightAnkle'],\n];\n", "import * as kpt from './keypoints';\n\nexport function eitherPointDoesntMeetConfidence(a, b, minConfidence) {\n return (a < minConfidence || b < minConfidence);\n}\n\nexport function getAdjacentKeyPoints(keypoints, minConfidence) {\n return kpt.connectedPartIndices.reduce((result, [leftJoint, rightJoint]) => {\n if (eitherPointDoesntMeetConfidence(keypoints[leftJoint].score, keypoints[rightJoint].score, minConfidence)) {\n return result;\n }\n result.push([keypoints[leftJoint], keypoints[rightJoint]]);\n return result;\n }, []);\n}\n\nexport function getBoundingBox(keypoints) {\n const coord = keypoints.reduce(({ maxX, maxY, minX, minY }, { position: { x, y } }) => ({\n maxX: Math.max(maxX, x),\n maxY: Math.max(maxY, y),\n minX: Math.min(minX, x),\n minY: Math.min(minY, y),\n }), {\n maxX: Number.NEGATIVE_INFINITY,\n maxY: Number.NEGATIVE_INFINITY,\n minX: Number.POSITIVE_INFINITY,\n minY: Number.POSITIVE_INFINITY,\n });\n return [coord.minX, coord.minY, coord.maxX - coord.minX, coord.maxY - coord.minY];\n}\n\nexport function scalePoses(poses, [height, width], [inputResolutionHeight, inputResolutionWidth]) {\n const scalePose = (pose, scaleY, scaleX) => ({\n score: pose.score,\n box: [Math.trunc(pose.box[0] * scaleX), Math.trunc(pose.box[1] * scaleY), Math.trunc(pose.box[2] * scaleX), Math.trunc(pose.box[3] * scaleY)],\n keypoints: pose.keypoints.map(({ score, part, position }) => ({\n score,\n part,\n position: { x: Math.trunc(position.x * scaleX), y: Math.trunc(position.y * scaleY) },\n })),\n });\n const scaledPoses = poses.map((pose) => scalePose(pose, height / inputResolutionHeight, width / inputResolutionWidth));\n return scaledPoses;\n}\n\n// algorithm based on Coursera Lecture from Algorithms, Part 1: https://www.coursera.org/learn/algorithms-part1/lecture/ZjoSM/heapsort\nexport class MaxHeap {\n priorityQueue: any;\n numberOfElements: number;\n getElementValue: any;\n\n constructor(maxSize, getElementValue) {\n this.priorityQueue = new Array(maxSize);\n this.numberOfElements = -1;\n this.getElementValue = getElementValue;\n }\n\n enqueue(x) {\n this.priorityQueue[++this.numberOfElements] = x;\n this.swim(this.numberOfElements);\n }\n\n dequeue() {\n const max = this.priorityQueue[0];\n this.exchange(0, this.numberOfElements--);\n this.sink(0);\n this.priorityQueue[this.numberOfElements + 1] = null;\n return max;\n }\n\n empty() { return this.numberOfElements === -1; }\n\n size() { return this.numberOfElements + 1; }\n\n all() { return this.priorityQueue.slice(0, this.numberOfElements + 1); }\n\n max() { return this.priorityQueue[0]; }\n\n swim(k) {\n while (k > 0 && this.less(Math.floor(k / 2), k)) {\n this.exchange(k, Math.floor(k / 2));\n k = Math.floor(k / 2);\n }\n }\n\n sink(k) {\n while (2 * k <= this.numberOfElements) {\n let j = 2 * k;\n if (j < this.numberOfElements && this.less(j, j + 1)) j++;\n if (!this.less(k, j)) break;\n this.exchange(k, j);\n k = j;\n }\n }\n\n getValueAt(i) {\n return this.getElementValue(this.priorityQueue[i]);\n }\n\n less(i, j) {\n return this.getValueAt(i) < this.getValueAt(j);\n }\n\n exchange(i, j) {\n const t = this.priorityQueue[i];\n this.priorityQueue[i] = this.priorityQueue[j];\n this.priorityQueue[j] = t;\n }\n}\n\nexport function getOffsetPoint(y, x, keypoint, offsets) {\n return {\n y: offsets.get(y, x, keypoint),\n x: offsets.get(y, x, keypoint + kpt.count),\n };\n}\n\nexport function getImageCoords(part, outputStride, offsets) {\n const { heatmapY, heatmapX, id: keypoint } = part;\n const { y, x } = getOffsetPoint(heatmapY, heatmapX, keypoint, offsets);\n return {\n x: part.heatmapX * outputStride + x,\n y: part.heatmapY * outputStride + y,\n };\n}\n\nexport function fillArray(element, size) {\n const result = new Array(size);\n for (let i = 0; i < size; i++) {\n result[i] = element;\n }\n return result;\n}\n\nexport function clamp(a, min, max) {\n if (a < min) return min;\n if (a > max) return max;\n return a;\n}\n\nexport function squaredDistance(y1, x1, y2, x2) {\n const dy = y2 - y1;\n const dx = x2 - x1;\n return dy * dy + dx * dx;\n}\n\nexport function addVectors(a, b) {\n return { x: a.x + b.x, y: a.y + b.y };\n}\n\nexport function clampVector(a, min, max) {\n return { y: clamp(a.y, min, max), x: clamp(a.x, min, max) };\n}\n", "import * as utils from './utils';\nimport * as kpt from './keypoints';\n\nconst localMaximumRadius = 1;\nconst outputStride = 16;\nconst squaredNmsRadius = 50 ** 2;\n\nfunction traverse(edgeId, sourceKeypoint, targetId, scores, offsets, displacements, offsetRefineStep = 2) {\n const getDisplacement = (point) => ({\n y: displacements.get(point.y, point.x, edgeId),\n x: displacements.get(point.y, point.x, (displacements.shape[2] / 2) + edgeId),\n });\n const getStridedIndexNearPoint = (point, height, width) => ({\n y: utils.clamp(Math.round(point.y / outputStride), 0, height - 1),\n x: utils.clamp(Math.round(point.x / outputStride), 0, width - 1),\n });\n\n const [height, width] = scores.shape;\n // Nearest neighbor interpolation for the source->target displacements.\n const sourceKeypointIndices = getStridedIndexNearPoint(sourceKeypoint.position, height, width);\n const displacement = getDisplacement(sourceKeypointIndices);\n const displacedPoint = utils.addVectors(sourceKeypoint.position, displacement);\n let targetKeypoint = displacedPoint;\n for (let i = 0; i < offsetRefineStep; i++) {\n const targetKeypointIndices = getStridedIndexNearPoint(targetKeypoint, height, width);\n const offsetPoint = utils.getOffsetPoint(targetKeypointIndices.y, targetKeypointIndices.x, targetId, offsets);\n targetKeypoint = utils.addVectors(\n { x: targetKeypointIndices.x * outputStride, y: targetKeypointIndices.y * outputStride },\n { x: offsetPoint.x, y: offsetPoint.y },\n );\n }\n const targetKeyPointIndices = getStridedIndexNearPoint(targetKeypoint, height, width);\n const score = scores.get(targetKeyPointIndices.y, targetKeyPointIndices.x, targetId);\n return { position: targetKeypoint, part: kpt.partNames[targetId], score };\n}\n\nexport function decodePose(root, scores, offsets, displacementsFwd, displacementsBwd) {\n const tuples = kpt.poseChain.map(([parentJoinName, childJoinName]) => ([kpt.partIds[parentJoinName], kpt.partIds[childJoinName]]));\n const edgesFwd = tuples.map(([, childJointId]) => childJointId);\n const edgesBwd = tuples.map(([parentJointId]) => parentJointId);\n const numParts = scores.shape[2]; // [21,21,17]\n const numEdges = edgesFwd.length;\n const keypoints = new Array(numParts);\n // Start a new detection instance at the position of the root.\n const rootPoint = utils.getImageCoords(root.part, outputStride, offsets);\n keypoints[root.part.id] = {\n score: root.score,\n part: kpt.partNames[root.part.id],\n position: rootPoint,\n };\n // Decode the part positions upwards in the tree, following the backward displacements.\n for (let edge = numEdges - 1; edge >= 0; --edge) {\n const sourceId = edgesFwd[edge];\n const targetId = edgesBwd[edge];\n if (keypoints[sourceId] && !keypoints[targetId]) {\n keypoints[targetId] = traverse(edge, keypoints[sourceId], targetId, scores, offsets, displacementsBwd);\n }\n }\n // Decode the part positions downwards in the tree, following the forward displacements.\n for (let edge = 0; edge < numEdges; ++edge) {\n const sourceId = edgesBwd[edge];\n const targetId = edgesFwd[edge];\n if (keypoints[sourceId] && !keypoints[targetId]) {\n keypoints[targetId] = traverse(edge, keypoints[sourceId], targetId, scores, offsets, displacementsFwd);\n }\n }\n return keypoints;\n}\n\nfunction scoreIsMaximumInLocalWindow(keypointId, score, heatmapY, heatmapX, scores) {\n const [height, width] = scores.shape;\n let localMaximum = true;\n const yStart = Math.max(heatmapY - localMaximumRadius, 0);\n const yEnd = Math.min(heatmapY + localMaximumRadius + 1, height);\n for (let yCurrent = yStart; yCurrent < yEnd; ++yCurrent) {\n const xStart = Math.max(heatmapX - localMaximumRadius, 0);\n const xEnd = Math.min(heatmapX + localMaximumRadius + 1, width);\n for (let xCurrent = xStart; xCurrent < xEnd; ++xCurrent) {\n if (scores.get(yCurrent, xCurrent, keypointId) > score) {\n localMaximum = false;\n break;\n }\n }\n if (!localMaximum) break;\n }\n return localMaximum;\n}\n\nexport function buildPartWithScoreQueue(minConfidence, scores) {\n const [height, width, numKeypoints] = scores.shape;\n const queue = new utils.MaxHeap(height * width * numKeypoints, ({ score }) => score);\n for (let heatmapY = 0; heatmapY < height; ++heatmapY) {\n for (let heatmapX = 0; heatmapX < width; ++heatmapX) {\n for (let keypointId = 0; keypointId < numKeypoints; ++keypointId) {\n const score = scores.get(heatmapY, heatmapX, keypointId);\n // Only consider parts with score greater or equal to threshold as root candidates.\n if (score < minConfidence) continue;\n // Only consider keypoints whose score is maximum in a local window.\n if (scoreIsMaximumInLocalWindow(keypointId, score, heatmapY, heatmapX, scores)) queue.enqueue({ score, part: { heatmapY, heatmapX, id: keypointId } });\n }\n }\n }\n return queue;\n}\n\nfunction withinRadius(poses, { x, y }, keypointId) {\n return poses.some(({ keypoints }) => {\n const correspondingKeypoint = keypoints[keypointId]?.position;\n if (!correspondingKeypoint) return false;\n return utils.squaredDistance(y, x, correspondingKeypoint.y, correspondingKeypoint.x) <= squaredNmsRadius;\n });\n}\n\nfunction getInstanceScore(existingPoses, keypoints) {\n const notOverlappedKeypointScores = keypoints.reduce((result, { position, score }, keypointId) => {\n if (!withinRadius(existingPoses, position, keypointId)) result += score;\n return result;\n }, 0.0);\n return notOverlappedKeypointScores / keypoints.length;\n}\n\nexport function decode(offsets, scores, displacementsFwd, displacementsBwd, maxDetected, minConfidence) {\n const poses: Array<{ keypoints: any, box: any, score: number }> = [];\n const queue = buildPartWithScoreQueue(minConfidence, scores);\n // Generate at most maxDetected object instances per image in decreasing root part score order.\n while (poses.length < maxDetected && !queue.empty()) {\n // The top element in the queue is the next root candidate.\n const root = queue.dequeue();\n // Part-based non-maximum suppression: We reject a root candidate if it is within a disk of `nmsRadius` pixels from the corresponding part of a previously detected instance.\n const rootImageCoords = utils.getImageCoords(root.part, outputStride, offsets);\n if (withinRadius(poses, rootImageCoords, root.part.id)) continue;\n // Else start a new detection instance at the position of the root.\n let keypoints = decodePose(root, scores, offsets, displacementsFwd, displacementsBwd);\n keypoints = keypoints.filter((a) => a.score > minConfidence);\n const score = getInstanceScore(poses, keypoints);\n const box = utils.getBoundingBox(keypoints);\n if (score > minConfidence) poses.push({ keypoints, box, score: Math.round(100 * score) / 100 });\n }\n return poses;\n}\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as handdetector from './handdetector';\nimport * as handpipeline from './handpipeline';\n\nconst meshAnnotations = {\n thumb: [1, 2, 3, 4],\n indexFinger: [5, 6, 7, 8],\n middleFinger: [9, 10, 11, 12],\n ringFinger: [13, 14, 15, 16],\n pinky: [17, 18, 19, 20],\n palmBase: [0],\n};\n\nlet handDetectorModel;\nlet handPoseModel;\nlet handPipeline;\n\nexport async function predict(input, config) {\n const predictions = await handPipeline.estimateHands(input, config);\n if (!predictions) return [];\n const hands: Array<{ confidence: number, box: any, boxRaw: any, landmarks: any, annotations: any }> = [];\n for (const prediction of predictions) {\n const annotations = {};\n if (prediction.landmarks) {\n for (const key of Object.keys(meshAnnotations)) {\n annotations[key] = meshAnnotations[key].map((index) => prediction.landmarks[index]);\n }\n }\n const box = prediction.box ? [\n Math.max(0, prediction.box.topLeft[0]),\n Math.max(0, prediction.box.topLeft[1]),\n Math.min(input.shape[2], prediction.box.bottomRight[0]) - Math.max(0, prediction.box.topLeft[0]),\n Math.min(input.shape[1], prediction.box.bottomRight[1]) - Math.max(0, prediction.box.topLeft[1]),\n ] : [];\n const boxRaw = [\n (prediction.box.topLeft[0]) / input.shape[2],\n (prediction.box.topLeft[1]) / input.shape[1],\n (prediction.box.bottomRight[0] - prediction.box.topLeft[0]) / input.shape[2],\n (prediction.box.bottomRight[1] - prediction.box.topLeft[1]) / input.shape[1],\n ];\n hands.push({ confidence: Math.round(100 * prediction.confidence) / 100, box, boxRaw, landmarks: prediction.landmarks, annotations });\n }\n return hands;\n}\n\nexport async function load(config): Promise<[Object, Object]> {\n if (!handDetectorModel || !handPoseModel) {\n [handDetectorModel, handPoseModel] = await Promise.all([\n config.hand.enabled ? tf.loadGraphModel(join(config.modelBasePath, config.hand.detector.modelPath), { fromTFHub: config.hand.detector.modelPath.includes('tfhub.dev') }) : null,\n config.hand.landmarks ? tf.loadGraphModel(join(config.modelBasePath, config.hand.skeleton.modelPath), { fromTFHub: config.hand.skeleton.modelPath.includes('tfhub.dev') }) : null,\n ]);\n if (config.hand.enabled) {\n if (!handDetectorModel || !handDetectorModel.modelUrl) log('load model failed:', config.hand.detector.modelPath);\n else if (config.debug) log('load model:', handDetectorModel.modelUrl);\n if (!handPoseModel || !handPoseModel.modelUrl) log('load model failed:', config.hand.skeleton.modelPath);\n else if (config.debug) log('load model:', handPoseModel.modelUrl);\n }\n } else {\n if (config.debug) log('cached model:', handDetectorModel.modelUrl);\n if (config.debug) log('cached model:', handPoseModel.modelUrl);\n }\n const handDetector = new handdetector.HandDetector(handDetectorModel);\n handPipeline = new handpipeline.HandPipeline(handDetector, handPoseModel);\n return [handDetectorModel, handPoseModel];\n}\n", "import * as tf from '../../dist/tfjs.esm.js';\n\nexport function getBoxSize(box) {\n return [\n Math.abs(box.endPoint[0] - box.startPoint[0]),\n Math.abs(box.endPoint[1] - box.startPoint[1]),\n ];\n}\n\nexport function getBoxCenter(box) {\n return [\n box.startPoint[0] + (box.endPoint[0] - box.startPoint[0]) / 2,\n box.startPoint[1] + (box.endPoint[1] - box.startPoint[1]) / 2,\n ];\n}\n\nexport function cutBoxFromImageAndResize(box, image, cropSize) {\n const h = image.shape[1];\n const w = image.shape[2];\n const boxes = [[\n box.startPoint[1] / h,\n box.startPoint[0] / w,\n box.endPoint[1] / h,\n box.endPoint[0] / w,\n ]];\n return tf.image.cropAndResize(image, boxes, [0], cropSize);\n}\n\nexport function scaleBoxCoordinates(box, factor) {\n const startPoint = [box.startPoint[0] * factor[0], box.startPoint[1] * factor[1]];\n const endPoint = [box.endPoint[0] * factor[0], box.endPoint[1] * factor[1]];\n const palmLandmarks = box.palmLandmarks.map((coord) => {\n const scaledCoord = [coord[0] * factor[0], coord[1] * factor[1]];\n return scaledCoord;\n });\n return { startPoint, endPoint, palmLandmarks, confidence: box.confidence };\n}\n\nexport function enlargeBox(box, factor = 1.5) {\n const center = getBoxCenter(box);\n const size = getBoxSize(box);\n const newHalfSize = [factor * size[0] / 2, factor * size[1] / 2];\n const startPoint = [center[0] - newHalfSize[0], center[1] - newHalfSize[1]];\n const endPoint = [center[0] + newHalfSize[0], center[1] + newHalfSize[1]];\n return { startPoint, endPoint, palmLandmarks: box.palmLandmarks };\n}\n\nexport function squarifyBox(box) {\n const centers = getBoxCenter(box);\n const size = getBoxSize(box);\n const maxEdge = Math.max(...size);\n const halfSize = maxEdge / 2;\n const startPoint = [centers[0] - halfSize, centers[1] - halfSize];\n const endPoint = [centers[0] + halfSize, centers[1] + halfSize];\n return { startPoint, endPoint, palmLandmarks: box.palmLandmarks };\n}\n\nexport function shiftBox(box, shiftFactor) {\n const boxSize = [\n box.endPoint[0] - box.startPoint[0],\n box.endPoint[1] - box.startPoint[1],\n ];\n const shiftVector = [boxSize[0] * shiftFactor[0], boxSize[1] * shiftFactor[1]];\n const startPoint = [box.startPoint[0] + shiftVector[0], box.startPoint[1] + shiftVector[1]];\n const endPoint = [box.endPoint[0] + shiftVector[0], box.endPoint[1] + shiftVector[1]];\n return { startPoint, endPoint, palmLandmarks: box.palmLandmarks };\n}\n", "export const anchors = [\n {\n x: 0.015625,\n y: 0.015625,\n },\n {\n x: 0.015625,\n y: 0.015625,\n },\n {\n x: 0.046875,\n y: 0.015625,\n },\n {\n x: 0.046875,\n y: 0.015625,\n },\n {\n x: 0.078125,\n y: 0.015625,\n },\n {\n x: 0.078125,\n y: 0.015625,\n },\n {\n x: 0.109375,\n y: 0.015625,\n },\n {\n x: 0.109375,\n y: 0.015625,\n },\n {\n x: 0.140625,\n y: 0.015625,\n },\n {\n x: 0.140625,\n y: 0.015625,\n },\n {\n x: 0.171875,\n y: 0.015625,\n },\n {\n x: 0.171875,\n y: 0.015625,\n },\n {\n x: 0.203125,\n y: 0.015625,\n },\n {\n x: 0.203125,\n y: 0.015625,\n },\n {\n x: 0.234375,\n y: 0.015625,\n },\n {\n x: 0.234375,\n y: 0.015625,\n },\n {\n x: 0.265625,\n y: 0.015625,\n },\n {\n x: 0.265625,\n y: 0.015625,\n },\n {\n x: 0.296875,\n y: 0.015625,\n },\n {\n x: 0.296875,\n y: 0.015625,\n },\n {\n x: 0.328125,\n y: 0.015625,\n },\n {\n x: 0.328125,\n y: 0.015625,\n },\n {\n x: 0.359375,\n y: 0.015625,\n },\n {\n x: 0.359375,\n y: 0.015625,\n },\n {\n x: 0.390625,\n y: 0.015625,\n },\n {\n x: 0.390625,\n y: 0.015625,\n },\n {\n x: 0.421875,\n y: 0.015625,\n },\n {\n x: 0.421875,\n y: 0.015625,\n },\n {\n x: 0.453125,\n y: 0.015625,\n },\n {\n x: 0.453125,\n y: 0.015625,\n },\n {\n x: 0.484375,\n y: 0.015625,\n },\n {\n x: 0.484375,\n y: 0.015625,\n },\n {\n x: 0.515625,\n y: 0.015625,\n },\n {\n x: 0.515625,\n y: 0.015625,\n },\n {\n x: 0.546875,\n y: 0.015625,\n },\n {\n x: 0.546875,\n y: 0.015625,\n },\n {\n x: 0.578125,\n y: 0.015625,\n },\n {\n x: 0.578125,\n y: 0.015625,\n },\n {\n x: 0.609375,\n y: 0.015625,\n },\n {\n x: 0.609375,\n y: 0.015625,\n },\n {\n x: 0.640625,\n y: 0.015625,\n },\n {\n x: 0.640625,\n y: 0.015625,\n },\n {\n x: 0.671875,\n y: 0.015625,\n },\n {\n x: 0.671875,\n y: 0.015625,\n },\n {\n x: 0.703125,\n y: 0.015625,\n },\n {\n x: 0.703125,\n y: 0.015625,\n },\n {\n x: 0.734375,\n y: 0.015625,\n },\n {\n x: 0.734375,\n y: 0.015625,\n },\n {\n x: 0.765625,\n y: 0.015625,\n },\n {\n x: 0.765625,\n y: 0.015625,\n },\n {\n x: 0.796875,\n y: 0.015625,\n },\n {\n x: 0.796875,\n y: 0.015625,\n },\n {\n x: 0.828125,\n y: 0.015625,\n },\n {\n x: 0.828125,\n y: 0.015625,\n },\n {\n x: 0.859375,\n y: 0.015625,\n },\n {\n x: 0.859375,\n y: 0.015625,\n },\n {\n x: 0.890625,\n y: 0.015625,\n },\n {\n x: 0.890625,\n y: 0.015625,\n },\n {\n x: 0.921875,\n y: 0.015625,\n },\n {\n x: 0.921875,\n y: 0.015625,\n },\n {\n x: 0.953125,\n y: 0.015625,\n },\n {\n x: 0.953125,\n y: 0.015625,\n },\n {\n x: 0.984375,\n y: 0.015625,\n },\n {\n x: 0.984375,\n y: 0.015625,\n },\n {\n x: 0.015625,\n y: 0.046875,\n },\n {\n x: 0.015625,\n y: 0.046875,\n },\n {\n x: 0.046875,\n y: 0.046875,\n },\n {\n x: 0.046875,\n y: 0.046875,\n },\n {\n x: 0.078125,\n y: 0.046875,\n },\n {\n x: 0.078125,\n y: 0.046875,\n },\n {\n x: 0.109375,\n y: 0.046875,\n },\n {\n x: 0.109375,\n y: 0.046875,\n },\n {\n x: 0.140625,\n y: 0.046875,\n },\n {\n x: 0.140625,\n y: 0.046875,\n },\n {\n x: 0.171875,\n y: 0.046875,\n },\n {\n x: 0.171875,\n y: 0.046875,\n },\n {\n x: 0.203125,\n y: 0.046875,\n },\n {\n x: 0.203125,\n y: 0.046875,\n },\n {\n x: 0.234375,\n y: 0.046875,\n },\n {\n x: 0.234375,\n y: 0.046875,\n },\n {\n x: 0.265625,\n y: 0.046875,\n },\n {\n x: 0.265625,\n y: 0.046875,\n },\n {\n x: 0.296875,\n y: 0.046875,\n },\n {\n x: 0.296875,\n y: 0.046875,\n },\n {\n x: 0.328125,\n y: 0.046875,\n },\n {\n x: 0.328125,\n y: 0.046875,\n },\n {\n x: 0.359375,\n y: 0.046875,\n },\n {\n x: 0.359375,\n y: 0.046875,\n },\n {\n x: 0.390625,\n y: 0.046875,\n },\n {\n x: 0.390625,\n y: 0.046875,\n },\n {\n x: 0.421875,\n y: 0.046875,\n },\n {\n x: 0.421875,\n y: 0.046875,\n },\n {\n x: 0.453125,\n y: 0.046875,\n },\n {\n x: 0.453125,\n y: 0.046875,\n },\n {\n x: 0.484375,\n y: 0.046875,\n },\n {\n x: 0.484375,\n y: 0.046875,\n },\n {\n x: 0.515625,\n y: 0.046875,\n },\n {\n x: 0.515625,\n y: 0.046875,\n },\n {\n x: 0.546875,\n y: 0.046875,\n },\n {\n x: 0.546875,\n y: 0.046875,\n },\n {\n x: 0.578125,\n y: 0.046875,\n },\n {\n x: 0.578125,\n y: 0.046875,\n },\n {\n x: 0.609375,\n y: 0.046875,\n },\n {\n x: 0.609375,\n y: 0.046875,\n },\n {\n x: 0.640625,\n y: 0.046875,\n },\n {\n x: 0.640625,\n y: 0.046875,\n },\n {\n x: 0.671875,\n y: 0.046875,\n },\n {\n x: 0.671875,\n y: 0.046875,\n },\n {\n x: 0.703125,\n y: 0.046875,\n },\n {\n x: 0.703125,\n y: 0.046875,\n },\n {\n x: 0.734375,\n y: 0.046875,\n },\n {\n x: 0.734375,\n y: 0.046875,\n },\n {\n x: 0.765625,\n y: 0.046875,\n },\n {\n x: 0.765625,\n y: 0.046875,\n },\n {\n x: 0.796875,\n y: 0.046875,\n },\n {\n x: 0.796875,\n y: 0.046875,\n },\n {\n x: 0.828125,\n y: 0.046875,\n },\n {\n x: 0.828125,\n y: 0.046875,\n },\n {\n x: 0.859375,\n y: 0.046875,\n },\n {\n x: 0.859375,\n y: 0.046875,\n },\n {\n x: 0.890625,\n y: 0.046875,\n },\n {\n x: 0.890625,\n y: 0.046875,\n },\n {\n x: 0.921875,\n y: 0.046875,\n },\n {\n x: 0.921875,\n y: 0.046875,\n },\n {\n x: 0.953125,\n y: 0.046875,\n },\n {\n x: 0.953125,\n y: 0.046875,\n },\n {\n x: 0.984375,\n y: 0.046875,\n },\n {\n x: 0.984375,\n y: 0.046875,\n },\n {\n x: 0.015625,\n y: 0.078125,\n },\n {\n x: 0.015625,\n y: 0.078125,\n },\n {\n x: 0.046875,\n y: 0.078125,\n },\n {\n x: 0.046875,\n y: 0.078125,\n },\n {\n x: 0.078125,\n y: 0.078125,\n },\n {\n x: 0.078125,\n y: 0.078125,\n },\n {\n x: 0.109375,\n y: 0.078125,\n },\n {\n x: 0.109375,\n y: 0.078125,\n },\n {\n x: 0.140625,\n y: 0.078125,\n },\n {\n x: 0.140625,\n y: 0.078125,\n },\n {\n x: 0.171875,\n y: 0.078125,\n },\n {\n x: 0.171875,\n y: 0.078125,\n },\n {\n x: 0.203125,\n y: 0.078125,\n },\n {\n x: 0.203125,\n y: 0.078125,\n },\n {\n x: 0.234375,\n y: 0.078125,\n },\n {\n x: 0.234375,\n y: 0.078125,\n },\n {\n x: 0.265625,\n y: 0.078125,\n },\n {\n x: 0.265625,\n y: 0.078125,\n },\n {\n x: 0.296875,\n y: 0.078125,\n },\n {\n x: 0.296875,\n y: 0.078125,\n },\n {\n x: 0.328125,\n y: 0.078125,\n },\n {\n x: 0.328125,\n y: 0.078125,\n },\n {\n x: 0.359375,\n y: 0.078125,\n },\n {\n x: 0.359375,\n y: 0.078125,\n },\n {\n x: 0.390625,\n y: 0.078125,\n },\n {\n x: 0.390625,\n y: 0.078125,\n },\n {\n x: 0.421875,\n y: 0.078125,\n },\n {\n x: 0.421875,\n y: 0.078125,\n },\n {\n x: 0.453125,\n y: 0.078125,\n },\n {\n x: 0.453125,\n y: 0.078125,\n },\n {\n x: 0.484375,\n y: 0.078125,\n },\n {\n x: 0.484375,\n y: 0.078125,\n },\n {\n x: 0.515625,\n y: 0.078125,\n },\n {\n x: 0.515625,\n y: 0.078125,\n },\n {\n x: 0.546875,\n y: 0.078125,\n },\n {\n x: 0.546875,\n y: 0.078125,\n },\n {\n x: 0.578125,\n y: 0.078125,\n },\n {\n x: 0.578125,\n y: 0.078125,\n },\n {\n x: 0.609375,\n y: 0.078125,\n },\n {\n x: 0.609375,\n y: 0.078125,\n },\n {\n x: 0.640625,\n y: 0.078125,\n },\n {\n x: 0.640625,\n y: 0.078125,\n },\n {\n x: 0.671875,\n y: 0.078125,\n },\n {\n x: 0.671875,\n y: 0.078125,\n },\n {\n x: 0.703125,\n y: 0.078125,\n },\n {\n x: 0.703125,\n y: 0.078125,\n },\n {\n x: 0.734375,\n y: 0.078125,\n },\n {\n x: 0.734375,\n y: 0.078125,\n },\n {\n x: 0.765625,\n y: 0.078125,\n },\n {\n x: 0.765625,\n y: 0.078125,\n },\n {\n x: 0.796875,\n y: 0.078125,\n },\n {\n x: 0.796875,\n y: 0.078125,\n },\n {\n x: 0.828125,\n y: 0.078125,\n },\n {\n x: 0.828125,\n y: 0.078125,\n },\n {\n x: 0.859375,\n y: 0.078125,\n },\n {\n x: 0.859375,\n y: 0.078125,\n },\n {\n x: 0.890625,\n y: 0.078125,\n },\n {\n x: 0.890625,\n y: 0.078125,\n },\n {\n x: 0.921875,\n y: 0.078125,\n },\n {\n x: 0.921875,\n y: 0.078125,\n },\n {\n x: 0.953125,\n y: 0.078125,\n },\n {\n x: 0.953125,\n y: 0.078125,\n },\n {\n x: 0.984375,\n y: 0.078125,\n },\n {\n x: 0.984375,\n y: 0.078125,\n },\n {\n x: 0.015625,\n y: 0.109375,\n },\n {\n x: 0.015625,\n y: 0.109375,\n },\n {\n x: 0.046875,\n y: 0.109375,\n },\n {\n x: 0.046875,\n y: 0.109375,\n },\n {\n x: 0.078125,\n y: 0.109375,\n },\n {\n x: 0.078125,\n y: 0.109375,\n },\n {\n x: 0.109375,\n y: 0.109375,\n },\n {\n x: 0.109375,\n y: 0.109375,\n },\n {\n x: 0.140625,\n y: 0.109375,\n },\n {\n x: 0.140625,\n y: 0.109375,\n },\n {\n x: 0.171875,\n y: 0.109375,\n },\n {\n x: 0.171875,\n y: 0.109375,\n },\n {\n x: 0.203125,\n y: 0.109375,\n },\n {\n x: 0.203125,\n y: 0.109375,\n },\n {\n x: 0.234375,\n y: 0.109375,\n },\n {\n x: 0.234375,\n y: 0.109375,\n },\n {\n x: 0.265625,\n y: 0.109375,\n },\n {\n x: 0.265625,\n y: 0.109375,\n },\n {\n x: 0.296875,\n y: 0.109375,\n },\n {\n x: 0.296875,\n y: 0.109375,\n },\n {\n x: 0.328125,\n y: 0.109375,\n },\n {\n x: 0.328125,\n y: 0.109375,\n },\n {\n x: 0.359375,\n y: 0.109375,\n },\n {\n x: 0.359375,\n y: 0.109375,\n },\n {\n x: 0.390625,\n y: 0.109375,\n },\n {\n x: 0.390625,\n y: 0.109375,\n },\n {\n x: 0.421875,\n y: 0.109375,\n },\n {\n x: 0.421875,\n y: 0.109375,\n },\n {\n x: 0.453125,\n y: 0.109375,\n },\n {\n x: 0.453125,\n y: 0.109375,\n },\n {\n x: 0.484375,\n y: 0.109375,\n },\n {\n x: 0.484375,\n y: 0.109375,\n },\n {\n x: 0.515625,\n y: 0.109375,\n },\n {\n x: 0.515625,\n y: 0.109375,\n },\n {\n x: 0.546875,\n y: 0.109375,\n },\n {\n x: 0.546875,\n y: 0.109375,\n },\n {\n x: 0.578125,\n y: 0.109375,\n },\n {\n x: 0.578125,\n y: 0.109375,\n },\n {\n x: 0.609375,\n y: 0.109375,\n },\n {\n x: 0.609375,\n y: 0.109375,\n },\n {\n x: 0.640625,\n y: 0.109375,\n },\n {\n x: 0.640625,\n y: 0.109375,\n },\n {\n x: 0.671875,\n y: 0.109375,\n },\n {\n x: 0.671875,\n y: 0.109375,\n },\n {\n x: 0.703125,\n y: 0.109375,\n },\n {\n x: 0.703125,\n y: 0.109375,\n },\n {\n x: 0.734375,\n y: 0.109375,\n },\n {\n x: 0.734375,\n y: 0.109375,\n },\n {\n x: 0.765625,\n y: 0.109375,\n },\n {\n x: 0.765625,\n y: 0.109375,\n },\n {\n x: 0.796875,\n y: 0.109375,\n },\n {\n x: 0.796875,\n y: 0.109375,\n },\n {\n x: 0.828125,\n y: 0.109375,\n },\n {\n x: 0.828125,\n y: 0.109375,\n },\n {\n x: 0.859375,\n y: 0.109375,\n },\n {\n x: 0.859375,\n y: 0.109375,\n },\n {\n x: 0.890625,\n y: 0.109375,\n },\n {\n x: 0.890625,\n y: 0.109375,\n },\n {\n x: 0.921875,\n y: 0.109375,\n },\n {\n x: 0.921875,\n y: 0.109375,\n },\n {\n x: 0.953125,\n y: 0.109375,\n },\n {\n x: 0.953125,\n y: 0.109375,\n },\n {\n x: 0.984375,\n y: 0.109375,\n },\n {\n x: 0.984375,\n y: 0.109375,\n },\n {\n x: 0.015625,\n y: 0.140625,\n },\n {\n x: 0.015625,\n y: 0.140625,\n },\n {\n x: 0.046875,\n y: 0.140625,\n },\n {\n x: 0.046875,\n y: 0.140625,\n },\n {\n x: 0.078125,\n y: 0.140625,\n },\n {\n x: 0.078125,\n y: 0.140625,\n },\n {\n x: 0.109375,\n y: 0.140625,\n },\n {\n x: 0.109375,\n y: 0.140625,\n },\n {\n x: 0.140625,\n y: 0.140625,\n },\n {\n x: 0.140625,\n y: 0.140625,\n },\n {\n x: 0.171875,\n y: 0.140625,\n },\n {\n x: 0.171875,\n y: 0.140625,\n },\n {\n x: 0.203125,\n y: 0.140625,\n },\n {\n x: 0.203125,\n y: 0.140625,\n },\n {\n x: 0.234375,\n y: 0.140625,\n },\n {\n x: 0.234375,\n y: 0.140625,\n },\n {\n x: 0.265625,\n y: 0.140625,\n },\n {\n x: 0.265625,\n y: 0.140625,\n },\n {\n x: 0.296875,\n y: 0.140625,\n },\n {\n x: 0.296875,\n y: 0.140625,\n },\n {\n x: 0.328125,\n y: 0.140625,\n },\n {\n x: 0.328125,\n y: 0.140625,\n },\n {\n x: 0.359375,\n y: 0.140625,\n },\n {\n x: 0.359375,\n y: 0.140625,\n },\n {\n x: 0.390625,\n y: 0.140625,\n },\n {\n x: 0.390625,\n y: 0.140625,\n },\n {\n x: 0.421875,\n y: 0.140625,\n },\n {\n x: 0.421875,\n y: 0.140625,\n },\n {\n x: 0.453125,\n y: 0.140625,\n },\n {\n x: 0.453125,\n y: 0.140625,\n },\n {\n x: 0.484375,\n y: 0.140625,\n },\n {\n x: 0.484375,\n y: 0.140625,\n },\n {\n x: 0.515625,\n y: 0.140625,\n },\n {\n x: 0.515625,\n y: 0.140625,\n },\n {\n x: 0.546875,\n y: 0.140625,\n },\n {\n x: 0.546875,\n y: 0.140625,\n },\n {\n x: 0.578125,\n y: 0.140625,\n },\n {\n x: 0.578125,\n y: 0.140625,\n },\n {\n x: 0.609375,\n y: 0.140625,\n },\n {\n x: 0.609375,\n y: 0.140625,\n },\n {\n x: 0.640625,\n y: 0.140625,\n },\n {\n x: 0.640625,\n y: 0.140625,\n },\n {\n x: 0.671875,\n y: 0.140625,\n },\n {\n x: 0.671875,\n y: 0.140625,\n },\n {\n x: 0.703125,\n y: 0.140625,\n },\n {\n x: 0.703125,\n y: 0.140625,\n },\n {\n x: 0.734375,\n y: 0.140625,\n },\n {\n x: 0.734375,\n y: 0.140625,\n },\n {\n x: 0.765625,\n y: 0.140625,\n },\n {\n x: 0.765625,\n y: 0.140625,\n },\n {\n x: 0.796875,\n y: 0.140625,\n },\n {\n x: 0.796875,\n y: 0.140625,\n },\n {\n x: 0.828125,\n y: 0.140625,\n },\n {\n x: 0.828125,\n y: 0.140625,\n },\n {\n x: 0.859375,\n y: 0.140625,\n },\n {\n x: 0.859375,\n y: 0.140625,\n },\n {\n x: 0.890625,\n y: 0.140625,\n },\n {\n x: 0.890625,\n y: 0.140625,\n },\n {\n x: 0.921875,\n y: 0.140625,\n },\n {\n x: 0.921875,\n y: 0.140625,\n },\n {\n x: 0.953125,\n y: 0.140625,\n },\n {\n x: 0.953125,\n y: 0.140625,\n },\n {\n x: 0.984375,\n y: 0.140625,\n },\n {\n x: 0.984375,\n y: 0.140625,\n },\n {\n x: 0.015625,\n y: 0.171875,\n },\n {\n x: 0.015625,\n y: 0.171875,\n },\n {\n x: 0.046875,\n y: 0.171875,\n },\n {\n x: 0.046875,\n y: 0.171875,\n },\n {\n x: 0.078125,\n y: 0.171875,\n },\n {\n x: 0.078125,\n y: 0.171875,\n },\n {\n x: 0.109375,\n y: 0.171875,\n },\n {\n x: 0.109375,\n y: 0.171875,\n },\n {\n x: 0.140625,\n y: 0.171875,\n },\n {\n x: 0.140625,\n y: 0.171875,\n },\n {\n x: 0.171875,\n y: 0.171875,\n },\n {\n x: 0.171875,\n y: 0.171875,\n },\n {\n x: 0.203125,\n y: 0.171875,\n },\n {\n x: 0.203125,\n y: 0.171875,\n },\n {\n x: 0.234375,\n y: 0.171875,\n },\n {\n x: 0.234375,\n y: 0.171875,\n },\n {\n x: 0.265625,\n y: 0.171875,\n },\n {\n x: 0.265625,\n y: 0.171875,\n },\n {\n x: 0.296875,\n y: 0.171875,\n },\n {\n x: 0.296875,\n y: 0.171875,\n },\n {\n x: 0.328125,\n y: 0.171875,\n },\n {\n x: 0.328125,\n y: 0.171875,\n },\n {\n x: 0.359375,\n y: 0.171875,\n },\n {\n x: 0.359375,\n y: 0.171875,\n },\n {\n x: 0.390625,\n y: 0.171875,\n },\n {\n x: 0.390625,\n y: 0.171875,\n },\n {\n x: 0.421875,\n y: 0.171875,\n },\n {\n x: 0.421875,\n y: 0.171875,\n },\n {\n x: 0.453125,\n y: 0.171875,\n },\n {\n x: 0.453125,\n y: 0.171875,\n },\n {\n x: 0.484375,\n y: 0.171875,\n },\n {\n x: 0.484375,\n y: 0.171875,\n },\n {\n x: 0.515625,\n y: 0.171875,\n },\n {\n x: 0.515625,\n y: 0.171875,\n },\n {\n x: 0.546875,\n y: 0.171875,\n },\n {\n x: 0.546875,\n y: 0.171875,\n },\n {\n x: 0.578125,\n y: 0.171875,\n },\n {\n x: 0.578125,\n y: 0.171875,\n },\n {\n x: 0.609375,\n y: 0.171875,\n },\n {\n x: 0.609375,\n y: 0.171875,\n },\n {\n x: 0.640625,\n y: 0.171875,\n },\n {\n x: 0.640625,\n y: 0.171875,\n },\n {\n x: 0.671875,\n y: 0.171875,\n },\n {\n x: 0.671875,\n y: 0.171875,\n },\n {\n x: 0.703125,\n y: 0.171875,\n },\n {\n x: 0.703125,\n y: 0.171875,\n },\n {\n x: 0.734375,\n y: 0.171875,\n },\n {\n x: 0.734375,\n y: 0.171875,\n },\n {\n x: 0.765625,\n y: 0.171875,\n },\n {\n x: 0.765625,\n y: 0.171875,\n },\n {\n x: 0.796875,\n y: 0.171875,\n },\n {\n x: 0.796875,\n y: 0.171875,\n },\n {\n x: 0.828125,\n y: 0.171875,\n },\n {\n x: 0.828125,\n y: 0.171875,\n },\n {\n x: 0.859375,\n y: 0.171875,\n },\n {\n x: 0.859375,\n y: 0.171875,\n },\n {\n x: 0.890625,\n y: 0.171875,\n },\n {\n x: 0.890625,\n y: 0.171875,\n },\n {\n x: 0.921875,\n y: 0.171875,\n },\n {\n x: 0.921875,\n y: 0.171875,\n },\n {\n x: 0.953125,\n y: 0.171875,\n },\n {\n x: 0.953125,\n y: 0.171875,\n },\n {\n x: 0.984375,\n y: 0.171875,\n },\n {\n x: 0.984375,\n y: 0.171875,\n },\n {\n x: 0.015625,\n y: 0.203125,\n },\n {\n x: 0.015625,\n y: 0.203125,\n },\n {\n x: 0.046875,\n y: 0.203125,\n },\n {\n x: 0.046875,\n y: 0.203125,\n },\n {\n x: 0.078125,\n y: 0.203125,\n },\n {\n x: 0.078125,\n y: 0.203125,\n },\n {\n x: 0.109375,\n y: 0.203125,\n },\n {\n x: 0.109375,\n y: 0.203125,\n },\n {\n x: 0.140625,\n y: 0.203125,\n },\n {\n x: 0.140625,\n y: 0.203125,\n },\n {\n x: 0.171875,\n y: 0.203125,\n },\n {\n x: 0.171875,\n y: 0.203125,\n },\n {\n x: 0.203125,\n y: 0.203125,\n },\n {\n x: 0.203125,\n y: 0.203125,\n },\n {\n x: 0.234375,\n y: 0.203125,\n },\n {\n x: 0.234375,\n y: 0.203125,\n },\n {\n x: 0.265625,\n y: 0.203125,\n },\n {\n x: 0.265625,\n y: 0.203125,\n },\n {\n x: 0.296875,\n y: 0.203125,\n },\n {\n x: 0.296875,\n y: 0.203125,\n },\n {\n x: 0.328125,\n y: 0.203125,\n },\n {\n x: 0.328125,\n y: 0.203125,\n },\n {\n x: 0.359375,\n y: 0.203125,\n },\n {\n x: 0.359375,\n y: 0.203125,\n },\n {\n x: 0.390625,\n y: 0.203125,\n },\n {\n x: 0.390625,\n y: 0.203125,\n },\n {\n x: 0.421875,\n y: 0.203125,\n },\n {\n x: 0.421875,\n y: 0.203125,\n },\n {\n x: 0.453125,\n y: 0.203125,\n },\n {\n x: 0.453125,\n y: 0.203125,\n },\n {\n x: 0.484375,\n y: 0.203125,\n },\n {\n x: 0.484375,\n y: 0.203125,\n },\n {\n x: 0.515625,\n y: 0.203125,\n },\n {\n x: 0.515625,\n y: 0.203125,\n },\n {\n x: 0.546875,\n y: 0.203125,\n },\n {\n x: 0.546875,\n y: 0.203125,\n },\n {\n x: 0.578125,\n y: 0.203125,\n },\n {\n x: 0.578125,\n y: 0.203125,\n },\n {\n x: 0.609375,\n y: 0.203125,\n },\n {\n x: 0.609375,\n y: 0.203125,\n },\n {\n x: 0.640625,\n y: 0.203125,\n },\n {\n x: 0.640625,\n y: 0.203125,\n },\n {\n x: 0.671875,\n y: 0.203125,\n },\n {\n x: 0.671875,\n y: 0.203125,\n },\n {\n x: 0.703125,\n y: 0.203125,\n },\n {\n x: 0.703125,\n y: 0.203125,\n },\n {\n x: 0.734375,\n y: 0.203125,\n },\n {\n x: 0.734375,\n y: 0.203125,\n },\n {\n x: 0.765625,\n y: 0.203125,\n },\n {\n x: 0.765625,\n y: 0.203125,\n },\n {\n x: 0.796875,\n y: 0.203125,\n },\n {\n x: 0.796875,\n y: 0.203125,\n },\n {\n x: 0.828125,\n y: 0.203125,\n },\n {\n x: 0.828125,\n y: 0.203125,\n },\n {\n x: 0.859375,\n y: 0.203125,\n },\n {\n x: 0.859375,\n y: 0.203125,\n },\n {\n x: 0.890625,\n y: 0.203125,\n },\n {\n x: 0.890625,\n y: 0.203125,\n },\n {\n x: 0.921875,\n y: 0.203125,\n },\n {\n x: 0.921875,\n y: 0.203125,\n },\n {\n x: 0.953125,\n y: 0.203125,\n },\n {\n x: 0.953125,\n y: 0.203125,\n },\n {\n x: 0.984375,\n y: 0.203125,\n },\n {\n x: 0.984375,\n y: 0.203125,\n },\n {\n x: 0.015625,\n y: 0.234375,\n },\n {\n x: 0.015625,\n y: 0.234375,\n },\n {\n x: 0.046875,\n y: 0.234375,\n },\n {\n x: 0.046875,\n y: 0.234375,\n },\n {\n x: 0.078125,\n y: 0.234375,\n },\n {\n x: 0.078125,\n y: 0.234375,\n },\n {\n x: 0.109375,\n y: 0.234375,\n },\n {\n x: 0.109375,\n y: 0.234375,\n },\n {\n x: 0.140625,\n y: 0.234375,\n },\n {\n x: 0.140625,\n y: 0.234375,\n },\n {\n x: 0.171875,\n y: 0.234375,\n },\n {\n x: 0.171875,\n y: 0.234375,\n },\n {\n x: 0.203125,\n y: 0.234375,\n },\n {\n x: 0.203125,\n y: 0.234375,\n },\n {\n x: 0.234375,\n y: 0.234375,\n },\n {\n x: 0.234375,\n y: 0.234375,\n },\n {\n x: 0.265625,\n y: 0.234375,\n },\n {\n x: 0.265625,\n y: 0.234375,\n },\n {\n x: 0.296875,\n y: 0.234375,\n },\n {\n x: 0.296875,\n y: 0.234375,\n },\n {\n x: 0.328125,\n y: 0.234375,\n },\n {\n x: 0.328125,\n y: 0.234375,\n },\n {\n x: 0.359375,\n y: 0.234375,\n },\n {\n x: 0.359375,\n y: 0.234375,\n },\n {\n x: 0.390625,\n y: 0.234375,\n },\n {\n x: 0.390625,\n y: 0.234375,\n },\n {\n x: 0.421875,\n y: 0.234375,\n },\n {\n x: 0.421875,\n y: 0.234375,\n },\n {\n x: 0.453125,\n y: 0.234375,\n },\n {\n x: 0.453125,\n y: 0.234375,\n },\n {\n x: 0.484375,\n y: 0.234375,\n },\n {\n x: 0.484375,\n y: 0.234375,\n },\n {\n x: 0.515625,\n y: 0.234375,\n },\n {\n x: 0.515625,\n y: 0.234375,\n },\n {\n x: 0.546875,\n y: 0.234375,\n },\n {\n x: 0.546875,\n y: 0.234375,\n },\n {\n x: 0.578125,\n y: 0.234375,\n },\n {\n x: 0.578125,\n y: 0.234375,\n },\n {\n x: 0.609375,\n y: 0.234375,\n },\n {\n x: 0.609375,\n y: 0.234375,\n },\n {\n x: 0.640625,\n y: 0.234375,\n },\n {\n x: 0.640625,\n y: 0.234375,\n },\n {\n x: 0.671875,\n y: 0.234375,\n },\n {\n x: 0.671875,\n y: 0.234375,\n },\n {\n x: 0.703125,\n y: 0.234375,\n },\n {\n x: 0.703125,\n y: 0.234375,\n },\n {\n x: 0.734375,\n y: 0.234375,\n },\n {\n x: 0.734375,\n y: 0.234375,\n },\n {\n x: 0.765625,\n y: 0.234375,\n },\n {\n x: 0.765625,\n y: 0.234375,\n },\n {\n x: 0.796875,\n y: 0.234375,\n },\n {\n x: 0.796875,\n y: 0.234375,\n },\n {\n x: 0.828125,\n y: 0.234375,\n },\n {\n x: 0.828125,\n y: 0.234375,\n },\n {\n x: 0.859375,\n y: 0.234375,\n },\n {\n x: 0.859375,\n y: 0.234375,\n },\n {\n x: 0.890625,\n y: 0.234375,\n },\n {\n x: 0.890625,\n y: 0.234375,\n },\n {\n x: 0.921875,\n y: 0.234375,\n },\n {\n x: 0.921875,\n y: 0.234375,\n },\n {\n x: 0.953125,\n y: 0.234375,\n },\n {\n x: 0.953125,\n y: 0.234375,\n },\n {\n x: 0.984375,\n y: 0.234375,\n },\n {\n x: 0.984375,\n y: 0.234375,\n },\n {\n x: 0.015625,\n y: 0.265625,\n },\n {\n x: 0.015625,\n y: 0.265625,\n },\n {\n x: 0.046875,\n y: 0.265625,\n },\n {\n x: 0.046875,\n y: 0.265625,\n },\n {\n x: 0.078125,\n y: 0.265625,\n },\n {\n x: 0.078125,\n y: 0.265625,\n },\n {\n x: 0.109375,\n y: 0.265625,\n },\n {\n x: 0.109375,\n y: 0.265625,\n },\n {\n x: 0.140625,\n y: 0.265625,\n },\n {\n x: 0.140625,\n y: 0.265625,\n },\n {\n x: 0.171875,\n y: 0.265625,\n },\n {\n x: 0.171875,\n y: 0.265625,\n },\n {\n x: 0.203125,\n y: 0.265625,\n },\n {\n x: 0.203125,\n y: 0.265625,\n },\n {\n x: 0.234375,\n y: 0.265625,\n },\n {\n x: 0.234375,\n y: 0.265625,\n },\n {\n x: 0.265625,\n y: 0.265625,\n },\n {\n x: 0.265625,\n y: 0.265625,\n },\n {\n x: 0.296875,\n y: 0.265625,\n },\n {\n x: 0.296875,\n y: 0.265625,\n },\n {\n x: 0.328125,\n y: 0.265625,\n },\n {\n x: 0.328125,\n y: 0.265625,\n },\n {\n x: 0.359375,\n y: 0.265625,\n },\n {\n x: 0.359375,\n y: 0.265625,\n },\n {\n x: 0.390625,\n y: 0.265625,\n },\n {\n x: 0.390625,\n y: 0.265625,\n },\n {\n x: 0.421875,\n y: 0.265625,\n },\n {\n x: 0.421875,\n y: 0.265625,\n },\n {\n x: 0.453125,\n y: 0.265625,\n },\n {\n x: 0.453125,\n y: 0.265625,\n },\n {\n x: 0.484375,\n y: 0.265625,\n },\n {\n x: 0.484375,\n y: 0.265625,\n },\n {\n x: 0.515625,\n y: 0.265625,\n },\n {\n x: 0.515625,\n y: 0.265625,\n },\n {\n x: 0.546875,\n y: 0.265625,\n },\n {\n x: 0.546875,\n y: 0.265625,\n },\n {\n x: 0.578125,\n y: 0.265625,\n },\n {\n x: 0.578125,\n y: 0.265625,\n },\n {\n x: 0.609375,\n y: 0.265625,\n },\n {\n x: 0.609375,\n y: 0.265625,\n },\n {\n x: 0.640625,\n y: 0.265625,\n },\n {\n x: 0.640625,\n y: 0.265625,\n },\n {\n x: 0.671875,\n y: 0.265625,\n },\n {\n x: 0.671875,\n y: 0.265625,\n },\n {\n x: 0.703125,\n y: 0.265625,\n },\n {\n x: 0.703125,\n y: 0.265625,\n },\n {\n x: 0.734375,\n y: 0.265625,\n },\n {\n x: 0.734375,\n y: 0.265625,\n },\n {\n x: 0.765625,\n y: 0.265625,\n },\n {\n x: 0.765625,\n y: 0.265625,\n },\n {\n x: 0.796875,\n y: 0.265625,\n },\n {\n x: 0.796875,\n y: 0.265625,\n },\n {\n x: 0.828125,\n y: 0.265625,\n },\n {\n x: 0.828125,\n y: 0.265625,\n },\n {\n x: 0.859375,\n y: 0.265625,\n },\n {\n x: 0.859375,\n y: 0.265625,\n },\n {\n x: 0.890625,\n y: 0.265625,\n },\n {\n x: 0.890625,\n y: 0.265625,\n },\n {\n x: 0.921875,\n y: 0.265625,\n },\n {\n x: 0.921875,\n y: 0.265625,\n },\n {\n x: 0.953125,\n y: 0.265625,\n },\n {\n x: 0.953125,\n y: 0.265625,\n },\n {\n x: 0.984375,\n y: 0.265625,\n },\n {\n x: 0.984375,\n y: 0.265625,\n },\n {\n x: 0.015625,\n y: 0.296875,\n },\n {\n x: 0.015625,\n y: 0.296875,\n },\n {\n x: 0.046875,\n y: 0.296875,\n },\n {\n x: 0.046875,\n y: 0.296875,\n },\n {\n x: 0.078125,\n y: 0.296875,\n },\n {\n x: 0.078125,\n y: 0.296875,\n },\n {\n x: 0.109375,\n y: 0.296875,\n },\n {\n x: 0.109375,\n y: 0.296875,\n },\n {\n x: 0.140625,\n y: 0.296875,\n },\n {\n x: 0.140625,\n y: 0.296875,\n },\n {\n x: 0.171875,\n y: 0.296875,\n },\n {\n x: 0.171875,\n y: 0.296875,\n },\n {\n x: 0.203125,\n y: 0.296875,\n },\n {\n x: 0.203125,\n y: 0.296875,\n },\n {\n x: 0.234375,\n y: 0.296875,\n },\n {\n x: 0.234375,\n y: 0.296875,\n },\n {\n x: 0.265625,\n y: 0.296875,\n },\n {\n x: 0.265625,\n y: 0.296875,\n },\n {\n x: 0.296875,\n y: 0.296875,\n },\n {\n x: 0.296875,\n y: 0.296875,\n },\n {\n x: 0.328125,\n y: 0.296875,\n },\n {\n x: 0.328125,\n y: 0.296875,\n },\n {\n x: 0.359375,\n y: 0.296875,\n },\n {\n x: 0.359375,\n y: 0.296875,\n },\n {\n x: 0.390625,\n y: 0.296875,\n },\n {\n x: 0.390625,\n y: 0.296875,\n },\n {\n x: 0.421875,\n y: 0.296875,\n },\n {\n x: 0.421875,\n y: 0.296875,\n },\n {\n x: 0.453125,\n y: 0.296875,\n },\n {\n x: 0.453125,\n y: 0.296875,\n },\n {\n x: 0.484375,\n y: 0.296875,\n },\n {\n x: 0.484375,\n y: 0.296875,\n },\n {\n x: 0.515625,\n y: 0.296875,\n },\n {\n x: 0.515625,\n y: 0.296875,\n },\n {\n x: 0.546875,\n y: 0.296875,\n },\n {\n x: 0.546875,\n y: 0.296875,\n },\n {\n x: 0.578125,\n y: 0.296875,\n },\n {\n x: 0.578125,\n y: 0.296875,\n },\n {\n x: 0.609375,\n y: 0.296875,\n },\n {\n x: 0.609375,\n y: 0.296875,\n },\n {\n x: 0.640625,\n y: 0.296875,\n },\n {\n x: 0.640625,\n y: 0.296875,\n },\n {\n x: 0.671875,\n y: 0.296875,\n },\n {\n x: 0.671875,\n y: 0.296875,\n },\n {\n x: 0.703125,\n y: 0.296875,\n },\n {\n x: 0.703125,\n y: 0.296875,\n },\n {\n x: 0.734375,\n y: 0.296875,\n },\n {\n x: 0.734375,\n y: 0.296875,\n },\n {\n x: 0.765625,\n y: 0.296875,\n },\n {\n x: 0.765625,\n y: 0.296875,\n },\n {\n x: 0.796875,\n y: 0.296875,\n },\n {\n x: 0.796875,\n y: 0.296875,\n },\n {\n x: 0.828125,\n y: 0.296875,\n },\n {\n x: 0.828125,\n y: 0.296875,\n },\n {\n x: 0.859375,\n y: 0.296875,\n },\n {\n x: 0.859375,\n y: 0.296875,\n },\n {\n x: 0.890625,\n y: 0.296875,\n },\n {\n x: 0.890625,\n y: 0.296875,\n },\n {\n x: 0.921875,\n y: 0.296875,\n },\n {\n x: 0.921875,\n y: 0.296875,\n },\n {\n x: 0.953125,\n y: 0.296875,\n },\n {\n x: 0.953125,\n y: 0.296875,\n },\n {\n x: 0.984375,\n y: 0.296875,\n },\n {\n x: 0.984375,\n y: 0.296875,\n },\n {\n x: 0.015625,\n y: 0.328125,\n },\n {\n x: 0.015625,\n y: 0.328125,\n },\n {\n x: 0.046875,\n y: 0.328125,\n },\n {\n x: 0.046875,\n y: 0.328125,\n },\n {\n x: 0.078125,\n y: 0.328125,\n },\n {\n x: 0.078125,\n y: 0.328125,\n },\n {\n x: 0.109375,\n y: 0.328125,\n },\n {\n x: 0.109375,\n y: 0.328125,\n },\n {\n x: 0.140625,\n y: 0.328125,\n },\n {\n x: 0.140625,\n y: 0.328125,\n },\n {\n x: 0.171875,\n y: 0.328125,\n },\n {\n x: 0.171875,\n y: 0.328125,\n },\n {\n x: 0.203125,\n y: 0.328125,\n },\n {\n x: 0.203125,\n y: 0.328125,\n },\n {\n x: 0.234375,\n y: 0.328125,\n },\n {\n x: 0.234375,\n y: 0.328125,\n },\n {\n x: 0.265625,\n y: 0.328125,\n },\n {\n x: 0.265625,\n y: 0.328125,\n },\n {\n x: 0.296875,\n y: 0.328125,\n },\n {\n x: 0.296875,\n y: 0.328125,\n },\n {\n x: 0.328125,\n y: 0.328125,\n },\n {\n x: 0.328125,\n y: 0.328125,\n },\n {\n x: 0.359375,\n y: 0.328125,\n },\n {\n x: 0.359375,\n y: 0.328125,\n },\n {\n x: 0.390625,\n y: 0.328125,\n },\n {\n x: 0.390625,\n y: 0.328125,\n },\n {\n x: 0.421875,\n y: 0.328125,\n },\n {\n x: 0.421875,\n y: 0.328125,\n },\n {\n x: 0.453125,\n y: 0.328125,\n },\n {\n x: 0.453125,\n y: 0.328125,\n },\n {\n x: 0.484375,\n y: 0.328125,\n },\n {\n x: 0.484375,\n y: 0.328125,\n },\n {\n x: 0.515625,\n y: 0.328125,\n },\n {\n x: 0.515625,\n y: 0.328125,\n },\n {\n x: 0.546875,\n y: 0.328125,\n },\n {\n x: 0.546875,\n y: 0.328125,\n },\n {\n x: 0.578125,\n y: 0.328125,\n },\n {\n x: 0.578125,\n y: 0.328125,\n },\n {\n x: 0.609375,\n y: 0.328125,\n },\n {\n x: 0.609375,\n y: 0.328125,\n },\n {\n x: 0.640625,\n y: 0.328125,\n },\n {\n x: 0.640625,\n y: 0.328125,\n },\n {\n x: 0.671875,\n y: 0.328125,\n },\n {\n x: 0.671875,\n y: 0.328125,\n },\n {\n x: 0.703125,\n y: 0.328125,\n },\n {\n x: 0.703125,\n y: 0.328125,\n },\n {\n x: 0.734375,\n y: 0.328125,\n },\n {\n x: 0.734375,\n y: 0.328125,\n },\n {\n x: 0.765625,\n y: 0.328125,\n },\n {\n x: 0.765625,\n y: 0.328125,\n },\n {\n x: 0.796875,\n y: 0.328125,\n },\n {\n x: 0.796875,\n y: 0.328125,\n },\n {\n x: 0.828125,\n y: 0.328125,\n },\n {\n x: 0.828125,\n y: 0.328125,\n },\n {\n x: 0.859375,\n y: 0.328125,\n },\n {\n x: 0.859375,\n y: 0.328125,\n },\n {\n x: 0.890625,\n y: 0.328125,\n },\n {\n x: 0.890625,\n y: 0.328125,\n },\n {\n x: 0.921875,\n y: 0.328125,\n },\n {\n x: 0.921875,\n y: 0.328125,\n },\n {\n x: 0.953125,\n y: 0.328125,\n },\n {\n x: 0.953125,\n y: 0.328125,\n },\n {\n x: 0.984375,\n y: 0.328125,\n },\n {\n x: 0.984375,\n y: 0.328125,\n },\n {\n x: 0.015625,\n y: 0.359375,\n },\n {\n x: 0.015625,\n y: 0.359375,\n },\n {\n x: 0.046875,\n y: 0.359375,\n },\n {\n x: 0.046875,\n y: 0.359375,\n },\n {\n x: 0.078125,\n y: 0.359375,\n },\n {\n x: 0.078125,\n y: 0.359375,\n },\n {\n x: 0.109375,\n y: 0.359375,\n },\n {\n x: 0.109375,\n y: 0.359375,\n },\n {\n x: 0.140625,\n y: 0.359375,\n },\n {\n x: 0.140625,\n y: 0.359375,\n },\n {\n x: 0.171875,\n y: 0.359375,\n },\n {\n x: 0.171875,\n y: 0.359375,\n },\n {\n x: 0.203125,\n y: 0.359375,\n },\n {\n x: 0.203125,\n y: 0.359375,\n },\n {\n x: 0.234375,\n y: 0.359375,\n },\n {\n x: 0.234375,\n y: 0.359375,\n },\n {\n x: 0.265625,\n y: 0.359375,\n },\n {\n x: 0.265625,\n y: 0.359375,\n },\n {\n x: 0.296875,\n y: 0.359375,\n },\n {\n x: 0.296875,\n y: 0.359375,\n },\n {\n x: 0.328125,\n y: 0.359375,\n },\n {\n x: 0.328125,\n y: 0.359375,\n },\n {\n x: 0.359375,\n y: 0.359375,\n },\n {\n x: 0.359375,\n y: 0.359375,\n },\n {\n x: 0.390625,\n y: 0.359375,\n },\n {\n x: 0.390625,\n y: 0.359375,\n },\n {\n x: 0.421875,\n y: 0.359375,\n },\n {\n x: 0.421875,\n y: 0.359375,\n },\n {\n x: 0.453125,\n y: 0.359375,\n },\n {\n x: 0.453125,\n y: 0.359375,\n },\n {\n x: 0.484375,\n y: 0.359375,\n },\n {\n x: 0.484375,\n y: 0.359375,\n },\n {\n x: 0.515625,\n y: 0.359375,\n },\n {\n x: 0.515625,\n y: 0.359375,\n },\n {\n x: 0.546875,\n y: 0.359375,\n },\n {\n x: 0.546875,\n y: 0.359375,\n },\n {\n x: 0.578125,\n y: 0.359375,\n },\n {\n x: 0.578125,\n y: 0.359375,\n },\n {\n x: 0.609375,\n y: 0.359375,\n },\n {\n x: 0.609375,\n y: 0.359375,\n },\n {\n x: 0.640625,\n y: 0.359375,\n },\n {\n x: 0.640625,\n y: 0.359375,\n },\n {\n x: 0.671875,\n y: 0.359375,\n },\n {\n x: 0.671875,\n y: 0.359375,\n },\n {\n x: 0.703125,\n y: 0.359375,\n },\n {\n x: 0.703125,\n y: 0.359375,\n },\n {\n x: 0.734375,\n y: 0.359375,\n },\n {\n x: 0.734375,\n y: 0.359375,\n },\n {\n x: 0.765625,\n y: 0.359375,\n },\n {\n x: 0.765625,\n y: 0.359375,\n },\n {\n x: 0.796875,\n y: 0.359375,\n },\n {\n x: 0.796875,\n y: 0.359375,\n },\n {\n x: 0.828125,\n y: 0.359375,\n },\n {\n x: 0.828125,\n y: 0.359375,\n },\n {\n x: 0.859375,\n y: 0.359375,\n },\n {\n x: 0.859375,\n y: 0.359375,\n },\n {\n x: 0.890625,\n y: 0.359375,\n },\n {\n x: 0.890625,\n y: 0.359375,\n },\n {\n x: 0.921875,\n y: 0.359375,\n },\n {\n x: 0.921875,\n y: 0.359375,\n },\n {\n x: 0.953125,\n y: 0.359375,\n },\n {\n x: 0.953125,\n y: 0.359375,\n },\n {\n x: 0.984375,\n y: 0.359375,\n },\n {\n x: 0.984375,\n y: 0.359375,\n },\n {\n x: 0.015625,\n y: 0.390625,\n },\n {\n x: 0.015625,\n y: 0.390625,\n },\n {\n x: 0.046875,\n y: 0.390625,\n },\n {\n x: 0.046875,\n y: 0.390625,\n },\n {\n x: 0.078125,\n y: 0.390625,\n },\n {\n x: 0.078125,\n y: 0.390625,\n },\n {\n x: 0.109375,\n y: 0.390625,\n },\n {\n x: 0.109375,\n y: 0.390625,\n },\n {\n x: 0.140625,\n y: 0.390625,\n },\n {\n x: 0.140625,\n y: 0.390625,\n },\n {\n x: 0.171875,\n y: 0.390625,\n },\n {\n x: 0.171875,\n y: 0.390625,\n },\n {\n x: 0.203125,\n y: 0.390625,\n },\n {\n x: 0.203125,\n y: 0.390625,\n },\n {\n x: 0.234375,\n y: 0.390625,\n },\n {\n x: 0.234375,\n y: 0.390625,\n },\n {\n x: 0.265625,\n y: 0.390625,\n },\n {\n x: 0.265625,\n y: 0.390625,\n },\n {\n x: 0.296875,\n y: 0.390625,\n },\n {\n x: 0.296875,\n y: 0.390625,\n },\n {\n x: 0.328125,\n y: 0.390625,\n },\n {\n x: 0.328125,\n y: 0.390625,\n },\n {\n x: 0.359375,\n y: 0.390625,\n },\n {\n x: 0.359375,\n y: 0.390625,\n },\n {\n x: 0.390625,\n y: 0.390625,\n },\n {\n x: 0.390625,\n y: 0.390625,\n },\n {\n x: 0.421875,\n y: 0.390625,\n },\n {\n x: 0.421875,\n y: 0.390625,\n },\n {\n x: 0.453125,\n y: 0.390625,\n },\n {\n x: 0.453125,\n y: 0.390625,\n },\n {\n x: 0.484375,\n y: 0.390625,\n },\n {\n x: 0.484375,\n y: 0.390625,\n },\n {\n x: 0.515625,\n y: 0.390625,\n },\n {\n x: 0.515625,\n y: 0.390625,\n },\n {\n x: 0.546875,\n y: 0.390625,\n },\n {\n x: 0.546875,\n y: 0.390625,\n },\n {\n x: 0.578125,\n y: 0.390625,\n },\n {\n x: 0.578125,\n y: 0.390625,\n },\n {\n x: 0.609375,\n y: 0.390625,\n },\n {\n x: 0.609375,\n y: 0.390625,\n },\n {\n x: 0.640625,\n y: 0.390625,\n },\n {\n x: 0.640625,\n y: 0.390625,\n },\n {\n x: 0.671875,\n y: 0.390625,\n },\n {\n x: 0.671875,\n y: 0.390625,\n },\n {\n x: 0.703125,\n y: 0.390625,\n },\n {\n x: 0.703125,\n y: 0.390625,\n },\n {\n x: 0.734375,\n y: 0.390625,\n },\n {\n x: 0.734375,\n y: 0.390625,\n },\n {\n x: 0.765625,\n y: 0.390625,\n },\n {\n x: 0.765625,\n y: 0.390625,\n },\n {\n x: 0.796875,\n y: 0.390625,\n },\n {\n x: 0.796875,\n y: 0.390625,\n },\n {\n x: 0.828125,\n y: 0.390625,\n },\n {\n x: 0.828125,\n y: 0.390625,\n },\n {\n x: 0.859375,\n y: 0.390625,\n },\n {\n x: 0.859375,\n y: 0.390625,\n },\n {\n x: 0.890625,\n y: 0.390625,\n },\n {\n x: 0.890625,\n y: 0.390625,\n },\n {\n x: 0.921875,\n y: 0.390625,\n },\n {\n x: 0.921875,\n y: 0.390625,\n },\n {\n x: 0.953125,\n y: 0.390625,\n },\n {\n x: 0.953125,\n y: 0.390625,\n },\n {\n x: 0.984375,\n y: 0.390625,\n },\n {\n x: 0.984375,\n y: 0.390625,\n },\n {\n x: 0.015625,\n y: 0.421875,\n },\n {\n x: 0.015625,\n y: 0.421875,\n },\n {\n x: 0.046875,\n y: 0.421875,\n },\n {\n x: 0.046875,\n y: 0.421875,\n },\n {\n x: 0.078125,\n y: 0.421875,\n },\n {\n x: 0.078125,\n y: 0.421875,\n },\n {\n x: 0.109375,\n y: 0.421875,\n },\n {\n x: 0.109375,\n y: 0.421875,\n },\n {\n x: 0.140625,\n y: 0.421875,\n },\n {\n x: 0.140625,\n y: 0.421875,\n },\n {\n x: 0.171875,\n y: 0.421875,\n },\n {\n x: 0.171875,\n y: 0.421875,\n },\n {\n x: 0.203125,\n y: 0.421875,\n },\n {\n x: 0.203125,\n y: 0.421875,\n },\n {\n x: 0.234375,\n y: 0.421875,\n },\n {\n x: 0.234375,\n y: 0.421875,\n },\n {\n x: 0.265625,\n y: 0.421875,\n },\n {\n x: 0.265625,\n y: 0.421875,\n },\n {\n x: 0.296875,\n y: 0.421875,\n },\n {\n x: 0.296875,\n y: 0.421875,\n },\n {\n x: 0.328125,\n y: 0.421875,\n },\n {\n x: 0.328125,\n y: 0.421875,\n },\n {\n x: 0.359375,\n y: 0.421875,\n },\n {\n x: 0.359375,\n y: 0.421875,\n },\n {\n x: 0.390625,\n y: 0.421875,\n },\n {\n x: 0.390625,\n y: 0.421875,\n },\n {\n x: 0.421875,\n y: 0.421875,\n },\n {\n x: 0.421875,\n y: 0.421875,\n },\n {\n x: 0.453125,\n y: 0.421875,\n },\n {\n x: 0.453125,\n y: 0.421875,\n },\n {\n x: 0.484375,\n y: 0.421875,\n },\n {\n x: 0.484375,\n y: 0.421875,\n },\n {\n x: 0.515625,\n y: 0.421875,\n },\n {\n x: 0.515625,\n y: 0.421875,\n },\n {\n x: 0.546875,\n y: 0.421875,\n },\n {\n x: 0.546875,\n y: 0.421875,\n },\n {\n x: 0.578125,\n y: 0.421875,\n },\n {\n x: 0.578125,\n y: 0.421875,\n },\n {\n x: 0.609375,\n y: 0.421875,\n },\n {\n x: 0.609375,\n y: 0.421875,\n },\n {\n x: 0.640625,\n y: 0.421875,\n },\n {\n x: 0.640625,\n y: 0.421875,\n },\n {\n x: 0.671875,\n y: 0.421875,\n },\n {\n x: 0.671875,\n y: 0.421875,\n },\n {\n x: 0.703125,\n y: 0.421875,\n },\n {\n x: 0.703125,\n y: 0.421875,\n },\n {\n x: 0.734375,\n y: 0.421875,\n },\n {\n x: 0.734375,\n y: 0.421875,\n },\n {\n x: 0.765625,\n y: 0.421875,\n },\n {\n x: 0.765625,\n y: 0.421875,\n },\n {\n x: 0.796875,\n y: 0.421875,\n },\n {\n x: 0.796875,\n y: 0.421875,\n },\n {\n x: 0.828125,\n y: 0.421875,\n },\n {\n x: 0.828125,\n y: 0.421875,\n },\n {\n x: 0.859375,\n y: 0.421875,\n },\n {\n x: 0.859375,\n y: 0.421875,\n },\n {\n x: 0.890625,\n y: 0.421875,\n },\n {\n x: 0.890625,\n y: 0.421875,\n },\n {\n x: 0.921875,\n y: 0.421875,\n },\n {\n x: 0.921875,\n y: 0.421875,\n },\n {\n x: 0.953125,\n y: 0.421875,\n },\n {\n x: 0.953125,\n y: 0.421875,\n },\n {\n x: 0.984375,\n y: 0.421875,\n },\n {\n x: 0.984375,\n y: 0.421875,\n },\n {\n x: 0.015625,\n y: 0.453125,\n },\n {\n x: 0.015625,\n y: 0.453125,\n },\n {\n x: 0.046875,\n y: 0.453125,\n },\n {\n x: 0.046875,\n y: 0.453125,\n },\n {\n x: 0.078125,\n y: 0.453125,\n },\n {\n x: 0.078125,\n y: 0.453125,\n },\n {\n x: 0.109375,\n y: 0.453125,\n },\n {\n x: 0.109375,\n y: 0.453125,\n },\n {\n x: 0.140625,\n y: 0.453125,\n },\n {\n x: 0.140625,\n y: 0.453125,\n },\n {\n x: 0.171875,\n y: 0.453125,\n },\n {\n x: 0.171875,\n y: 0.453125,\n },\n {\n x: 0.203125,\n y: 0.453125,\n },\n {\n x: 0.203125,\n y: 0.453125,\n },\n {\n x: 0.234375,\n y: 0.453125,\n },\n {\n x: 0.234375,\n y: 0.453125,\n },\n {\n x: 0.265625,\n y: 0.453125,\n },\n {\n x: 0.265625,\n y: 0.453125,\n },\n {\n x: 0.296875,\n y: 0.453125,\n },\n {\n x: 0.296875,\n y: 0.453125,\n },\n {\n x: 0.328125,\n y: 0.453125,\n },\n {\n x: 0.328125,\n y: 0.453125,\n },\n {\n x: 0.359375,\n y: 0.453125,\n },\n {\n x: 0.359375,\n y: 0.453125,\n },\n {\n x: 0.390625,\n y: 0.453125,\n },\n {\n x: 0.390625,\n y: 0.453125,\n },\n {\n x: 0.421875,\n y: 0.453125,\n },\n {\n x: 0.421875,\n y: 0.453125,\n },\n {\n x: 0.453125,\n y: 0.453125,\n },\n {\n x: 0.453125,\n y: 0.453125,\n },\n {\n x: 0.484375,\n y: 0.453125,\n },\n {\n x: 0.484375,\n y: 0.453125,\n },\n {\n x: 0.515625,\n y: 0.453125,\n },\n {\n x: 0.515625,\n y: 0.453125,\n },\n {\n x: 0.546875,\n y: 0.453125,\n },\n {\n x: 0.546875,\n y: 0.453125,\n },\n {\n x: 0.578125,\n y: 0.453125,\n },\n {\n x: 0.578125,\n y: 0.453125,\n },\n {\n x: 0.609375,\n y: 0.453125,\n },\n {\n x: 0.609375,\n y: 0.453125,\n },\n {\n x: 0.640625,\n y: 0.453125,\n },\n {\n x: 0.640625,\n y: 0.453125,\n },\n {\n x: 0.671875,\n y: 0.453125,\n },\n {\n x: 0.671875,\n y: 0.453125,\n },\n {\n x: 0.703125,\n y: 0.453125,\n },\n {\n x: 0.703125,\n y: 0.453125,\n },\n {\n x: 0.734375,\n y: 0.453125,\n },\n {\n x: 0.734375,\n y: 0.453125,\n },\n {\n x: 0.765625,\n y: 0.453125,\n },\n {\n x: 0.765625,\n y: 0.453125,\n },\n {\n x: 0.796875,\n y: 0.453125,\n },\n {\n x: 0.796875,\n y: 0.453125,\n },\n {\n x: 0.828125,\n y: 0.453125,\n },\n {\n x: 0.828125,\n y: 0.453125,\n },\n {\n x: 0.859375,\n y: 0.453125,\n },\n {\n x: 0.859375,\n y: 0.453125,\n },\n {\n x: 0.890625,\n y: 0.453125,\n },\n {\n x: 0.890625,\n y: 0.453125,\n },\n {\n x: 0.921875,\n y: 0.453125,\n },\n {\n x: 0.921875,\n y: 0.453125,\n },\n {\n x: 0.953125,\n y: 0.453125,\n },\n {\n x: 0.953125,\n y: 0.453125,\n },\n {\n x: 0.984375,\n y: 0.453125,\n },\n {\n x: 0.984375,\n y: 0.453125,\n },\n {\n x: 0.015625,\n y: 0.484375,\n },\n {\n x: 0.015625,\n y: 0.484375,\n },\n {\n x: 0.046875,\n y: 0.484375,\n },\n {\n x: 0.046875,\n y: 0.484375,\n },\n {\n x: 0.078125,\n y: 0.484375,\n },\n {\n x: 0.078125,\n y: 0.484375,\n },\n {\n x: 0.109375,\n y: 0.484375,\n },\n {\n x: 0.109375,\n y: 0.484375,\n },\n {\n x: 0.140625,\n y: 0.484375,\n },\n {\n x: 0.140625,\n y: 0.484375,\n },\n {\n x: 0.171875,\n y: 0.484375,\n },\n {\n x: 0.171875,\n y: 0.484375,\n },\n {\n x: 0.203125,\n y: 0.484375,\n },\n {\n x: 0.203125,\n y: 0.484375,\n },\n {\n x: 0.234375,\n y: 0.484375,\n },\n {\n x: 0.234375,\n y: 0.484375,\n },\n {\n x: 0.265625,\n y: 0.484375,\n },\n {\n x: 0.265625,\n y: 0.484375,\n },\n {\n x: 0.296875,\n y: 0.484375,\n },\n {\n x: 0.296875,\n y: 0.484375,\n },\n {\n x: 0.328125,\n y: 0.484375,\n },\n {\n x: 0.328125,\n y: 0.484375,\n },\n {\n x: 0.359375,\n y: 0.484375,\n },\n {\n x: 0.359375,\n y: 0.484375,\n },\n {\n x: 0.390625,\n y: 0.484375,\n },\n {\n x: 0.390625,\n y: 0.484375,\n },\n {\n x: 0.421875,\n y: 0.484375,\n },\n {\n x: 0.421875,\n y: 0.484375,\n },\n {\n x: 0.453125,\n y: 0.484375,\n },\n {\n x: 0.453125,\n y: 0.484375,\n },\n {\n x: 0.484375,\n y: 0.484375,\n },\n {\n x: 0.484375,\n y: 0.484375,\n },\n {\n x: 0.515625,\n y: 0.484375,\n },\n {\n x: 0.515625,\n y: 0.484375,\n },\n {\n x: 0.546875,\n y: 0.484375,\n },\n {\n x: 0.546875,\n y: 0.484375,\n },\n {\n x: 0.578125,\n y: 0.484375,\n },\n {\n x: 0.578125,\n y: 0.484375,\n },\n {\n x: 0.609375,\n y: 0.484375,\n },\n {\n x: 0.609375,\n y: 0.484375,\n },\n {\n x: 0.640625,\n y: 0.484375,\n },\n {\n x: 0.640625,\n y: 0.484375,\n },\n {\n x: 0.671875,\n y: 0.484375,\n },\n {\n x: 0.671875,\n y: 0.484375,\n },\n {\n x: 0.703125,\n y: 0.484375,\n },\n {\n x: 0.703125,\n y: 0.484375,\n },\n {\n x: 0.734375,\n y: 0.484375,\n },\n {\n x: 0.734375,\n y: 0.484375,\n },\n {\n x: 0.765625,\n y: 0.484375,\n },\n {\n x: 0.765625,\n y: 0.484375,\n },\n {\n x: 0.796875,\n y: 0.484375,\n },\n {\n x: 0.796875,\n y: 0.484375,\n },\n {\n x: 0.828125,\n y: 0.484375,\n },\n {\n x: 0.828125,\n y: 0.484375,\n },\n {\n x: 0.859375,\n y: 0.484375,\n },\n {\n x: 0.859375,\n y: 0.484375,\n },\n {\n x: 0.890625,\n y: 0.484375,\n },\n {\n x: 0.890625,\n y: 0.484375,\n },\n {\n x: 0.921875,\n y: 0.484375,\n },\n {\n x: 0.921875,\n y: 0.484375,\n },\n {\n x: 0.953125,\n y: 0.484375,\n },\n {\n x: 0.953125,\n y: 0.484375,\n },\n {\n x: 0.984375,\n y: 0.484375,\n },\n {\n x: 0.984375,\n y: 0.484375,\n },\n {\n x: 0.015625,\n y: 0.515625,\n },\n {\n x: 0.015625,\n y: 0.515625,\n },\n {\n x: 0.046875,\n y: 0.515625,\n },\n {\n x: 0.046875,\n y: 0.515625,\n },\n {\n x: 0.078125,\n y: 0.515625,\n },\n {\n x: 0.078125,\n y: 0.515625,\n },\n {\n x: 0.109375,\n y: 0.515625,\n },\n {\n x: 0.109375,\n y: 0.515625,\n },\n {\n x: 0.140625,\n y: 0.515625,\n },\n {\n x: 0.140625,\n y: 0.515625,\n },\n {\n x: 0.171875,\n y: 0.515625,\n },\n {\n x: 0.171875,\n y: 0.515625,\n },\n {\n x: 0.203125,\n y: 0.515625,\n },\n {\n x: 0.203125,\n y: 0.515625,\n },\n {\n x: 0.234375,\n y: 0.515625,\n },\n {\n x: 0.234375,\n y: 0.515625,\n },\n {\n x: 0.265625,\n y: 0.515625,\n },\n {\n x: 0.265625,\n y: 0.515625,\n },\n {\n x: 0.296875,\n y: 0.515625,\n },\n {\n x: 0.296875,\n y: 0.515625,\n },\n {\n x: 0.328125,\n y: 0.515625,\n },\n {\n x: 0.328125,\n y: 0.515625,\n },\n {\n x: 0.359375,\n y: 0.515625,\n },\n {\n x: 0.359375,\n y: 0.515625,\n },\n {\n x: 0.390625,\n y: 0.515625,\n },\n {\n x: 0.390625,\n y: 0.515625,\n },\n {\n x: 0.421875,\n y: 0.515625,\n },\n {\n x: 0.421875,\n y: 0.515625,\n },\n {\n x: 0.453125,\n y: 0.515625,\n },\n {\n x: 0.453125,\n y: 0.515625,\n },\n {\n x: 0.484375,\n y: 0.515625,\n },\n {\n x: 0.484375,\n y: 0.515625,\n },\n {\n x: 0.515625,\n y: 0.515625,\n },\n {\n x: 0.515625,\n y: 0.515625,\n },\n {\n x: 0.546875,\n y: 0.515625,\n },\n {\n x: 0.546875,\n y: 0.515625,\n },\n {\n x: 0.578125,\n y: 0.515625,\n },\n {\n x: 0.578125,\n y: 0.515625,\n },\n {\n x: 0.609375,\n y: 0.515625,\n },\n {\n x: 0.609375,\n y: 0.515625,\n },\n {\n x: 0.640625,\n y: 0.515625,\n },\n {\n x: 0.640625,\n y: 0.515625,\n },\n {\n x: 0.671875,\n y: 0.515625,\n },\n {\n x: 0.671875,\n y: 0.515625,\n },\n {\n x: 0.703125,\n y: 0.515625,\n },\n {\n x: 0.703125,\n y: 0.515625,\n },\n {\n x: 0.734375,\n y: 0.515625,\n },\n {\n x: 0.734375,\n y: 0.515625,\n },\n {\n x: 0.765625,\n y: 0.515625,\n },\n {\n x: 0.765625,\n y: 0.515625,\n },\n {\n x: 0.796875,\n y: 0.515625,\n },\n {\n x: 0.796875,\n y: 0.515625,\n },\n {\n x: 0.828125,\n y: 0.515625,\n },\n {\n x: 0.828125,\n y: 0.515625,\n },\n {\n x: 0.859375,\n y: 0.515625,\n },\n {\n x: 0.859375,\n y: 0.515625,\n },\n {\n x: 0.890625,\n y: 0.515625,\n },\n {\n x: 0.890625,\n y: 0.515625,\n },\n {\n x: 0.921875,\n y: 0.515625,\n },\n {\n x: 0.921875,\n y: 0.515625,\n },\n {\n x: 0.953125,\n y: 0.515625,\n },\n {\n x: 0.953125,\n y: 0.515625,\n },\n {\n x: 0.984375,\n y: 0.515625,\n },\n {\n x: 0.984375,\n y: 0.515625,\n },\n {\n x: 0.015625,\n y: 0.546875,\n },\n {\n x: 0.015625,\n y: 0.546875,\n },\n {\n x: 0.046875,\n y: 0.546875,\n },\n {\n x: 0.046875,\n y: 0.546875,\n },\n {\n x: 0.078125,\n y: 0.546875,\n },\n {\n x: 0.078125,\n y: 0.546875,\n },\n {\n x: 0.109375,\n y: 0.546875,\n },\n {\n x: 0.109375,\n y: 0.546875,\n },\n {\n x: 0.140625,\n y: 0.546875,\n },\n {\n x: 0.140625,\n y: 0.546875,\n },\n {\n x: 0.171875,\n y: 0.546875,\n },\n {\n x: 0.171875,\n y: 0.546875,\n },\n {\n x: 0.203125,\n y: 0.546875,\n },\n {\n x: 0.203125,\n y: 0.546875,\n },\n {\n x: 0.234375,\n y: 0.546875,\n },\n {\n x: 0.234375,\n y: 0.546875,\n },\n {\n x: 0.265625,\n y: 0.546875,\n },\n {\n x: 0.265625,\n y: 0.546875,\n },\n {\n x: 0.296875,\n y: 0.546875,\n },\n {\n x: 0.296875,\n y: 0.546875,\n },\n {\n x: 0.328125,\n y: 0.546875,\n },\n {\n x: 0.328125,\n y: 0.546875,\n },\n {\n x: 0.359375,\n y: 0.546875,\n },\n {\n x: 0.359375,\n y: 0.546875,\n },\n {\n x: 0.390625,\n y: 0.546875,\n },\n {\n x: 0.390625,\n y: 0.546875,\n },\n {\n x: 0.421875,\n y: 0.546875,\n },\n {\n x: 0.421875,\n y: 0.546875,\n },\n {\n x: 0.453125,\n y: 0.546875,\n },\n {\n x: 0.453125,\n y: 0.546875,\n },\n {\n x: 0.484375,\n y: 0.546875,\n },\n {\n x: 0.484375,\n y: 0.546875,\n },\n {\n x: 0.515625,\n y: 0.546875,\n },\n {\n x: 0.515625,\n y: 0.546875,\n },\n {\n x: 0.546875,\n y: 0.546875,\n },\n {\n x: 0.546875,\n y: 0.546875,\n },\n {\n x: 0.578125,\n y: 0.546875,\n },\n {\n x: 0.578125,\n y: 0.546875,\n },\n {\n x: 0.609375,\n y: 0.546875,\n },\n {\n x: 0.609375,\n y: 0.546875,\n },\n {\n x: 0.640625,\n y: 0.546875,\n },\n {\n x: 0.640625,\n y: 0.546875,\n },\n {\n x: 0.671875,\n y: 0.546875,\n },\n {\n x: 0.671875,\n y: 0.546875,\n },\n {\n x: 0.703125,\n y: 0.546875,\n },\n {\n x: 0.703125,\n y: 0.546875,\n },\n {\n x: 0.734375,\n y: 0.546875,\n },\n {\n x: 0.734375,\n y: 0.546875,\n },\n {\n x: 0.765625,\n y: 0.546875,\n },\n {\n x: 0.765625,\n y: 0.546875,\n },\n {\n x: 0.796875,\n y: 0.546875,\n },\n {\n x: 0.796875,\n y: 0.546875,\n },\n {\n x: 0.828125,\n y: 0.546875,\n },\n {\n x: 0.828125,\n y: 0.546875,\n },\n {\n x: 0.859375,\n y: 0.546875,\n },\n {\n x: 0.859375,\n y: 0.546875,\n },\n {\n x: 0.890625,\n y: 0.546875,\n },\n {\n x: 0.890625,\n y: 0.546875,\n },\n {\n x: 0.921875,\n y: 0.546875,\n },\n {\n x: 0.921875,\n y: 0.546875,\n },\n {\n x: 0.953125,\n y: 0.546875,\n },\n {\n x: 0.953125,\n y: 0.546875,\n },\n {\n x: 0.984375,\n y: 0.546875,\n },\n {\n x: 0.984375,\n y: 0.546875,\n },\n {\n x: 0.015625,\n y: 0.578125,\n },\n {\n x: 0.015625,\n y: 0.578125,\n },\n {\n x: 0.046875,\n y: 0.578125,\n },\n {\n x: 0.046875,\n y: 0.578125,\n },\n {\n x: 0.078125,\n y: 0.578125,\n },\n {\n x: 0.078125,\n y: 0.578125,\n },\n {\n x: 0.109375,\n y: 0.578125,\n },\n {\n x: 0.109375,\n y: 0.578125,\n },\n {\n x: 0.140625,\n y: 0.578125,\n },\n {\n x: 0.140625,\n y: 0.578125,\n },\n {\n x: 0.171875,\n y: 0.578125,\n },\n {\n x: 0.171875,\n y: 0.578125,\n },\n {\n x: 0.203125,\n y: 0.578125,\n },\n {\n x: 0.203125,\n y: 0.578125,\n },\n {\n x: 0.234375,\n y: 0.578125,\n },\n {\n x: 0.234375,\n y: 0.578125,\n },\n {\n x: 0.265625,\n y: 0.578125,\n },\n {\n x: 0.265625,\n y: 0.578125,\n },\n {\n x: 0.296875,\n y: 0.578125,\n },\n {\n x: 0.296875,\n y: 0.578125,\n },\n {\n x: 0.328125,\n y: 0.578125,\n },\n {\n x: 0.328125,\n y: 0.578125,\n },\n {\n x: 0.359375,\n y: 0.578125,\n },\n {\n x: 0.359375,\n y: 0.578125,\n },\n {\n x: 0.390625,\n y: 0.578125,\n },\n {\n x: 0.390625,\n y: 0.578125,\n },\n {\n x: 0.421875,\n y: 0.578125,\n },\n {\n x: 0.421875,\n y: 0.578125,\n },\n {\n x: 0.453125,\n y: 0.578125,\n },\n {\n x: 0.453125,\n y: 0.578125,\n },\n {\n x: 0.484375,\n y: 0.578125,\n },\n {\n x: 0.484375,\n y: 0.578125,\n },\n {\n x: 0.515625,\n y: 0.578125,\n },\n {\n x: 0.515625,\n y: 0.578125,\n },\n {\n x: 0.546875,\n y: 0.578125,\n },\n {\n x: 0.546875,\n y: 0.578125,\n },\n {\n x: 0.578125,\n y: 0.578125,\n },\n {\n x: 0.578125,\n y: 0.578125,\n },\n {\n x: 0.609375,\n y: 0.578125,\n },\n {\n x: 0.609375,\n y: 0.578125,\n },\n {\n x: 0.640625,\n y: 0.578125,\n },\n {\n x: 0.640625,\n y: 0.578125,\n },\n {\n x: 0.671875,\n y: 0.578125,\n },\n {\n x: 0.671875,\n y: 0.578125,\n },\n {\n x: 0.703125,\n y: 0.578125,\n },\n {\n x: 0.703125,\n y: 0.578125,\n },\n {\n x: 0.734375,\n y: 0.578125,\n },\n {\n x: 0.734375,\n y: 0.578125,\n },\n {\n x: 0.765625,\n y: 0.578125,\n },\n {\n x: 0.765625,\n y: 0.578125,\n },\n {\n x: 0.796875,\n y: 0.578125,\n },\n {\n x: 0.796875,\n y: 0.578125,\n },\n {\n x: 0.828125,\n y: 0.578125,\n },\n {\n x: 0.828125,\n y: 0.578125,\n },\n {\n x: 0.859375,\n y: 0.578125,\n },\n {\n x: 0.859375,\n y: 0.578125,\n },\n {\n x: 0.890625,\n y: 0.578125,\n },\n {\n x: 0.890625,\n y: 0.578125,\n },\n {\n x: 0.921875,\n y: 0.578125,\n },\n {\n x: 0.921875,\n y: 0.578125,\n },\n {\n x: 0.953125,\n y: 0.578125,\n },\n {\n x: 0.953125,\n y: 0.578125,\n },\n {\n x: 0.984375,\n y: 0.578125,\n },\n {\n x: 0.984375,\n y: 0.578125,\n },\n {\n x: 0.015625,\n y: 0.609375,\n },\n {\n x: 0.015625,\n y: 0.609375,\n },\n {\n x: 0.046875,\n y: 0.609375,\n },\n {\n x: 0.046875,\n y: 0.609375,\n },\n {\n x: 0.078125,\n y: 0.609375,\n },\n {\n x: 0.078125,\n y: 0.609375,\n },\n {\n x: 0.109375,\n y: 0.609375,\n },\n {\n x: 0.109375,\n y: 0.609375,\n },\n {\n x: 0.140625,\n y: 0.609375,\n },\n {\n x: 0.140625,\n y: 0.609375,\n },\n {\n x: 0.171875,\n y: 0.609375,\n },\n {\n x: 0.171875,\n y: 0.609375,\n },\n {\n x: 0.203125,\n y: 0.609375,\n },\n {\n x: 0.203125,\n y: 0.609375,\n },\n {\n x: 0.234375,\n y: 0.609375,\n },\n {\n x: 0.234375,\n y: 0.609375,\n },\n {\n x: 0.265625,\n y: 0.609375,\n },\n {\n x: 0.265625,\n y: 0.609375,\n },\n {\n x: 0.296875,\n y: 0.609375,\n },\n {\n x: 0.296875,\n y: 0.609375,\n },\n {\n x: 0.328125,\n y: 0.609375,\n },\n {\n x: 0.328125,\n y: 0.609375,\n },\n {\n x: 0.359375,\n y: 0.609375,\n },\n {\n x: 0.359375,\n y: 0.609375,\n },\n {\n x: 0.390625,\n y: 0.609375,\n },\n {\n x: 0.390625,\n y: 0.609375,\n },\n {\n x: 0.421875,\n y: 0.609375,\n },\n {\n x: 0.421875,\n y: 0.609375,\n },\n {\n x: 0.453125,\n y: 0.609375,\n },\n {\n x: 0.453125,\n y: 0.609375,\n },\n {\n x: 0.484375,\n y: 0.609375,\n },\n {\n x: 0.484375,\n y: 0.609375,\n },\n {\n x: 0.515625,\n y: 0.609375,\n },\n {\n x: 0.515625,\n y: 0.609375,\n },\n {\n x: 0.546875,\n y: 0.609375,\n },\n {\n x: 0.546875,\n y: 0.609375,\n },\n {\n x: 0.578125,\n y: 0.609375,\n },\n {\n x: 0.578125,\n y: 0.609375,\n },\n {\n x: 0.609375,\n y: 0.609375,\n },\n {\n x: 0.609375,\n y: 0.609375,\n },\n {\n x: 0.640625,\n y: 0.609375,\n },\n {\n x: 0.640625,\n y: 0.609375,\n },\n {\n x: 0.671875,\n y: 0.609375,\n },\n {\n x: 0.671875,\n y: 0.609375,\n },\n {\n x: 0.703125,\n y: 0.609375,\n },\n {\n x: 0.703125,\n y: 0.609375,\n },\n {\n x: 0.734375,\n y: 0.609375,\n },\n {\n x: 0.734375,\n y: 0.609375,\n },\n {\n x: 0.765625,\n y: 0.609375,\n },\n {\n x: 0.765625,\n y: 0.609375,\n },\n {\n x: 0.796875,\n y: 0.609375,\n },\n {\n x: 0.796875,\n y: 0.609375,\n },\n {\n x: 0.828125,\n y: 0.609375,\n },\n {\n x: 0.828125,\n y: 0.609375,\n },\n {\n x: 0.859375,\n y: 0.609375,\n },\n {\n x: 0.859375,\n y: 0.609375,\n },\n {\n x: 0.890625,\n y: 0.609375,\n },\n {\n x: 0.890625,\n y: 0.609375,\n },\n {\n x: 0.921875,\n y: 0.609375,\n },\n {\n x: 0.921875,\n y: 0.609375,\n },\n {\n x: 0.953125,\n y: 0.609375,\n },\n {\n x: 0.953125,\n y: 0.609375,\n },\n {\n x: 0.984375,\n y: 0.609375,\n },\n {\n x: 0.984375,\n y: 0.609375,\n },\n {\n x: 0.015625,\n y: 0.640625,\n },\n {\n x: 0.015625,\n y: 0.640625,\n },\n {\n x: 0.046875,\n y: 0.640625,\n },\n {\n x: 0.046875,\n y: 0.640625,\n },\n {\n x: 0.078125,\n y: 0.640625,\n },\n {\n x: 0.078125,\n y: 0.640625,\n },\n {\n x: 0.109375,\n y: 0.640625,\n },\n {\n x: 0.109375,\n y: 0.640625,\n },\n {\n x: 0.140625,\n y: 0.640625,\n },\n {\n x: 0.140625,\n y: 0.640625,\n },\n {\n x: 0.171875,\n y: 0.640625,\n },\n {\n x: 0.171875,\n y: 0.640625,\n },\n {\n x: 0.203125,\n y: 0.640625,\n },\n {\n x: 0.203125,\n y: 0.640625,\n },\n {\n x: 0.234375,\n y: 0.640625,\n },\n {\n x: 0.234375,\n y: 0.640625,\n },\n {\n x: 0.265625,\n y: 0.640625,\n },\n {\n x: 0.265625,\n y: 0.640625,\n },\n {\n x: 0.296875,\n y: 0.640625,\n },\n {\n x: 0.296875,\n y: 0.640625,\n },\n {\n x: 0.328125,\n y: 0.640625,\n },\n {\n x: 0.328125,\n y: 0.640625,\n },\n {\n x: 0.359375,\n y: 0.640625,\n },\n {\n x: 0.359375,\n y: 0.640625,\n },\n {\n x: 0.390625,\n y: 0.640625,\n },\n {\n x: 0.390625,\n y: 0.640625,\n },\n {\n x: 0.421875,\n y: 0.640625,\n },\n {\n x: 0.421875,\n y: 0.640625,\n },\n {\n x: 0.453125,\n y: 0.640625,\n },\n {\n x: 0.453125,\n y: 0.640625,\n },\n {\n x: 0.484375,\n y: 0.640625,\n },\n {\n x: 0.484375,\n y: 0.640625,\n },\n {\n x: 0.515625,\n y: 0.640625,\n },\n {\n x: 0.515625,\n y: 0.640625,\n },\n {\n x: 0.546875,\n y: 0.640625,\n },\n {\n x: 0.546875,\n y: 0.640625,\n },\n {\n x: 0.578125,\n y: 0.640625,\n },\n {\n x: 0.578125,\n y: 0.640625,\n },\n {\n x: 0.609375,\n y: 0.640625,\n },\n {\n x: 0.609375,\n y: 0.640625,\n },\n {\n x: 0.640625,\n y: 0.640625,\n },\n {\n x: 0.640625,\n y: 0.640625,\n },\n {\n x: 0.671875,\n y: 0.640625,\n },\n {\n x: 0.671875,\n y: 0.640625,\n },\n {\n x: 0.703125,\n y: 0.640625,\n },\n {\n x: 0.703125,\n y: 0.640625,\n },\n {\n x: 0.734375,\n y: 0.640625,\n },\n {\n x: 0.734375,\n y: 0.640625,\n },\n {\n x: 0.765625,\n y: 0.640625,\n },\n {\n x: 0.765625,\n y: 0.640625,\n },\n {\n x: 0.796875,\n y: 0.640625,\n },\n {\n x: 0.796875,\n y: 0.640625,\n },\n {\n x: 0.828125,\n y: 0.640625,\n },\n {\n x: 0.828125,\n y: 0.640625,\n },\n {\n x: 0.859375,\n y: 0.640625,\n },\n {\n x: 0.859375,\n y: 0.640625,\n },\n {\n x: 0.890625,\n y: 0.640625,\n },\n {\n x: 0.890625,\n y: 0.640625,\n },\n {\n x: 0.921875,\n y: 0.640625,\n },\n {\n x: 0.921875,\n y: 0.640625,\n },\n {\n x: 0.953125,\n y: 0.640625,\n },\n {\n x: 0.953125,\n y: 0.640625,\n },\n {\n x: 0.984375,\n y: 0.640625,\n },\n {\n x: 0.984375,\n y: 0.640625,\n },\n {\n x: 0.015625,\n y: 0.671875,\n },\n {\n x: 0.015625,\n y: 0.671875,\n },\n {\n x: 0.046875,\n y: 0.671875,\n },\n {\n x: 0.046875,\n y: 0.671875,\n },\n {\n x: 0.078125,\n y: 0.671875,\n },\n {\n x: 0.078125,\n y: 0.671875,\n },\n {\n x: 0.109375,\n y: 0.671875,\n },\n {\n x: 0.109375,\n y: 0.671875,\n },\n {\n x: 0.140625,\n y: 0.671875,\n },\n {\n x: 0.140625,\n y: 0.671875,\n },\n {\n x: 0.171875,\n y: 0.671875,\n },\n {\n x: 0.171875,\n y: 0.671875,\n },\n {\n x: 0.203125,\n y: 0.671875,\n },\n {\n x: 0.203125,\n y: 0.671875,\n },\n {\n x: 0.234375,\n y: 0.671875,\n },\n {\n x: 0.234375,\n y: 0.671875,\n },\n {\n x: 0.265625,\n y: 0.671875,\n },\n {\n x: 0.265625,\n y: 0.671875,\n },\n {\n x: 0.296875,\n y: 0.671875,\n },\n {\n x: 0.296875,\n y: 0.671875,\n },\n {\n x: 0.328125,\n y: 0.671875,\n },\n {\n x: 0.328125,\n y: 0.671875,\n },\n {\n x: 0.359375,\n y: 0.671875,\n },\n {\n x: 0.359375,\n y: 0.671875,\n },\n {\n x: 0.390625,\n y: 0.671875,\n },\n {\n x: 0.390625,\n y: 0.671875,\n },\n {\n x: 0.421875,\n y: 0.671875,\n },\n {\n x: 0.421875,\n y: 0.671875,\n },\n {\n x: 0.453125,\n y: 0.671875,\n },\n {\n x: 0.453125,\n y: 0.671875,\n },\n {\n x: 0.484375,\n y: 0.671875,\n },\n {\n x: 0.484375,\n y: 0.671875,\n },\n {\n x: 0.515625,\n y: 0.671875,\n },\n {\n x: 0.515625,\n y: 0.671875,\n },\n {\n x: 0.546875,\n y: 0.671875,\n },\n {\n x: 0.546875,\n y: 0.671875,\n },\n {\n x: 0.578125,\n y: 0.671875,\n },\n {\n x: 0.578125,\n y: 0.671875,\n },\n {\n x: 0.609375,\n y: 0.671875,\n },\n {\n x: 0.609375,\n y: 0.671875,\n },\n {\n x: 0.640625,\n y: 0.671875,\n },\n {\n x: 0.640625,\n y: 0.671875,\n },\n {\n x: 0.671875,\n y: 0.671875,\n },\n {\n x: 0.671875,\n y: 0.671875,\n },\n {\n x: 0.703125,\n y: 0.671875,\n },\n {\n x: 0.703125,\n y: 0.671875,\n },\n {\n x: 0.734375,\n y: 0.671875,\n },\n {\n x: 0.734375,\n y: 0.671875,\n },\n {\n x: 0.765625,\n y: 0.671875,\n },\n {\n x: 0.765625,\n y: 0.671875,\n },\n {\n x: 0.796875,\n y: 0.671875,\n },\n {\n x: 0.796875,\n y: 0.671875,\n },\n {\n x: 0.828125,\n y: 0.671875,\n },\n {\n x: 0.828125,\n y: 0.671875,\n },\n {\n x: 0.859375,\n y: 0.671875,\n },\n {\n x: 0.859375,\n y: 0.671875,\n },\n {\n x: 0.890625,\n y: 0.671875,\n },\n {\n x: 0.890625,\n y: 0.671875,\n },\n {\n x: 0.921875,\n y: 0.671875,\n },\n {\n x: 0.921875,\n y: 0.671875,\n },\n {\n x: 0.953125,\n y: 0.671875,\n },\n {\n x: 0.953125,\n y: 0.671875,\n },\n {\n x: 0.984375,\n y: 0.671875,\n },\n {\n x: 0.984375,\n y: 0.671875,\n },\n {\n x: 0.015625,\n y: 0.703125,\n },\n {\n x: 0.015625,\n y: 0.703125,\n },\n {\n x: 0.046875,\n y: 0.703125,\n },\n {\n x: 0.046875,\n y: 0.703125,\n },\n {\n x: 0.078125,\n y: 0.703125,\n },\n {\n x: 0.078125,\n y: 0.703125,\n },\n {\n x: 0.109375,\n y: 0.703125,\n },\n {\n x: 0.109375,\n y: 0.703125,\n },\n {\n x: 0.140625,\n y: 0.703125,\n },\n {\n x: 0.140625,\n y: 0.703125,\n },\n {\n x: 0.171875,\n y: 0.703125,\n },\n {\n x: 0.171875,\n y: 0.703125,\n },\n {\n x: 0.203125,\n y: 0.703125,\n },\n {\n x: 0.203125,\n y: 0.703125,\n },\n {\n x: 0.234375,\n y: 0.703125,\n },\n {\n x: 0.234375,\n y: 0.703125,\n },\n {\n x: 0.265625,\n y: 0.703125,\n },\n {\n x: 0.265625,\n y: 0.703125,\n },\n {\n x: 0.296875,\n y: 0.703125,\n },\n {\n x: 0.296875,\n y: 0.703125,\n },\n {\n x: 0.328125,\n y: 0.703125,\n },\n {\n x: 0.328125,\n y: 0.703125,\n },\n {\n x: 0.359375,\n y: 0.703125,\n },\n {\n x: 0.359375,\n y: 0.703125,\n },\n {\n x: 0.390625,\n y: 0.703125,\n },\n {\n x: 0.390625,\n y: 0.703125,\n },\n {\n x: 0.421875,\n y: 0.703125,\n },\n {\n x: 0.421875,\n y: 0.703125,\n },\n {\n x: 0.453125,\n y: 0.703125,\n },\n {\n x: 0.453125,\n y: 0.703125,\n },\n {\n x: 0.484375,\n y: 0.703125,\n },\n {\n x: 0.484375,\n y: 0.703125,\n },\n {\n x: 0.515625,\n y: 0.703125,\n },\n {\n x: 0.515625,\n y: 0.703125,\n },\n {\n x: 0.546875,\n y: 0.703125,\n },\n {\n x: 0.546875,\n y: 0.703125,\n },\n {\n x: 0.578125,\n y: 0.703125,\n },\n {\n x: 0.578125,\n y: 0.703125,\n },\n {\n x: 0.609375,\n y: 0.703125,\n },\n {\n x: 0.609375,\n y: 0.703125,\n },\n {\n x: 0.640625,\n y: 0.703125,\n },\n {\n x: 0.640625,\n y: 0.703125,\n },\n {\n x: 0.671875,\n y: 0.703125,\n },\n {\n x: 0.671875,\n y: 0.703125,\n },\n {\n x: 0.703125,\n y: 0.703125,\n },\n {\n x: 0.703125,\n y: 0.703125,\n },\n {\n x: 0.734375,\n y: 0.703125,\n },\n {\n x: 0.734375,\n y: 0.703125,\n },\n {\n x: 0.765625,\n y: 0.703125,\n },\n {\n x: 0.765625,\n y: 0.703125,\n },\n {\n x: 0.796875,\n y: 0.703125,\n },\n {\n x: 0.796875,\n y: 0.703125,\n },\n {\n x: 0.828125,\n y: 0.703125,\n },\n {\n x: 0.828125,\n y: 0.703125,\n },\n {\n x: 0.859375,\n y: 0.703125,\n },\n {\n x: 0.859375,\n y: 0.703125,\n },\n {\n x: 0.890625,\n y: 0.703125,\n },\n {\n x: 0.890625,\n y: 0.703125,\n },\n {\n x: 0.921875,\n y: 0.703125,\n },\n {\n x: 0.921875,\n y: 0.703125,\n },\n {\n x: 0.953125,\n y: 0.703125,\n },\n {\n x: 0.953125,\n y: 0.703125,\n },\n {\n x: 0.984375,\n y: 0.703125,\n },\n {\n x: 0.984375,\n y: 0.703125,\n },\n {\n x: 0.015625,\n y: 0.734375,\n },\n {\n x: 0.015625,\n y: 0.734375,\n },\n {\n x: 0.046875,\n y: 0.734375,\n },\n {\n x: 0.046875,\n y: 0.734375,\n },\n {\n x: 0.078125,\n y: 0.734375,\n },\n {\n x: 0.078125,\n y: 0.734375,\n },\n {\n x: 0.109375,\n y: 0.734375,\n },\n {\n x: 0.109375,\n y: 0.734375,\n },\n {\n x: 0.140625,\n y: 0.734375,\n },\n {\n x: 0.140625,\n y: 0.734375,\n },\n {\n x: 0.171875,\n y: 0.734375,\n },\n {\n x: 0.171875,\n y: 0.734375,\n },\n {\n x: 0.203125,\n y: 0.734375,\n },\n {\n x: 0.203125,\n y: 0.734375,\n },\n {\n x: 0.234375,\n y: 0.734375,\n },\n {\n x: 0.234375,\n y: 0.734375,\n },\n {\n x: 0.265625,\n y: 0.734375,\n },\n {\n x: 0.265625,\n y: 0.734375,\n },\n {\n x: 0.296875,\n y: 0.734375,\n },\n {\n x: 0.296875,\n y: 0.734375,\n },\n {\n x: 0.328125,\n y: 0.734375,\n },\n {\n x: 0.328125,\n y: 0.734375,\n },\n {\n x: 0.359375,\n y: 0.734375,\n },\n {\n x: 0.359375,\n y: 0.734375,\n },\n {\n x: 0.390625,\n y: 0.734375,\n },\n {\n x: 0.390625,\n y: 0.734375,\n },\n {\n x: 0.421875,\n y: 0.734375,\n },\n {\n x: 0.421875,\n y: 0.734375,\n },\n {\n x: 0.453125,\n y: 0.734375,\n },\n {\n x: 0.453125,\n y: 0.734375,\n },\n {\n x: 0.484375,\n y: 0.734375,\n },\n {\n x: 0.484375,\n y: 0.734375,\n },\n {\n x: 0.515625,\n y: 0.734375,\n },\n {\n x: 0.515625,\n y: 0.734375,\n },\n {\n x: 0.546875,\n y: 0.734375,\n },\n {\n x: 0.546875,\n y: 0.734375,\n },\n {\n x: 0.578125,\n y: 0.734375,\n },\n {\n x: 0.578125,\n y: 0.734375,\n },\n {\n x: 0.609375,\n y: 0.734375,\n },\n {\n x: 0.609375,\n y: 0.734375,\n },\n {\n x: 0.640625,\n y: 0.734375,\n },\n {\n x: 0.640625,\n y: 0.734375,\n },\n {\n x: 0.671875,\n y: 0.734375,\n },\n {\n x: 0.671875,\n y: 0.734375,\n },\n {\n x: 0.703125,\n y: 0.734375,\n },\n {\n x: 0.703125,\n y: 0.734375,\n },\n {\n x: 0.734375,\n y: 0.734375,\n },\n {\n x: 0.734375,\n y: 0.734375,\n },\n {\n x: 0.765625,\n y: 0.734375,\n },\n {\n x: 0.765625,\n y: 0.734375,\n },\n {\n x: 0.796875,\n y: 0.734375,\n },\n {\n x: 0.796875,\n y: 0.734375,\n },\n {\n x: 0.828125,\n y: 0.734375,\n },\n {\n x: 0.828125,\n y: 0.734375,\n },\n {\n x: 0.859375,\n y: 0.734375,\n },\n {\n x: 0.859375,\n y: 0.734375,\n },\n {\n x: 0.890625,\n y: 0.734375,\n },\n {\n x: 0.890625,\n y: 0.734375,\n },\n {\n x: 0.921875,\n y: 0.734375,\n },\n {\n x: 0.921875,\n y: 0.734375,\n },\n {\n x: 0.953125,\n y: 0.734375,\n },\n {\n x: 0.953125,\n y: 0.734375,\n },\n {\n x: 0.984375,\n y: 0.734375,\n },\n {\n x: 0.984375,\n y: 0.734375,\n },\n {\n x: 0.015625,\n y: 0.765625,\n },\n {\n x: 0.015625,\n y: 0.765625,\n },\n {\n x: 0.046875,\n y: 0.765625,\n },\n {\n x: 0.046875,\n y: 0.765625,\n },\n {\n x: 0.078125,\n y: 0.765625,\n },\n {\n x: 0.078125,\n y: 0.765625,\n },\n {\n x: 0.109375,\n y: 0.765625,\n },\n {\n x: 0.109375,\n y: 0.765625,\n },\n {\n x: 0.140625,\n y: 0.765625,\n },\n {\n x: 0.140625,\n y: 0.765625,\n },\n {\n x: 0.171875,\n y: 0.765625,\n },\n {\n x: 0.171875,\n y: 0.765625,\n },\n {\n x: 0.203125,\n y: 0.765625,\n },\n {\n x: 0.203125,\n y: 0.765625,\n },\n {\n x: 0.234375,\n y: 0.765625,\n },\n {\n x: 0.234375,\n y: 0.765625,\n },\n {\n x: 0.265625,\n y: 0.765625,\n },\n {\n x: 0.265625,\n y: 0.765625,\n },\n {\n x: 0.296875,\n y: 0.765625,\n },\n {\n x: 0.296875,\n y: 0.765625,\n },\n {\n x: 0.328125,\n y: 0.765625,\n },\n {\n x: 0.328125,\n y: 0.765625,\n },\n {\n x: 0.359375,\n y: 0.765625,\n },\n {\n x: 0.359375,\n y: 0.765625,\n },\n {\n x: 0.390625,\n y: 0.765625,\n },\n {\n x: 0.390625,\n y: 0.765625,\n },\n {\n x: 0.421875,\n y: 0.765625,\n },\n {\n x: 0.421875,\n y: 0.765625,\n },\n {\n x: 0.453125,\n y: 0.765625,\n },\n {\n x: 0.453125,\n y: 0.765625,\n },\n {\n x: 0.484375,\n y: 0.765625,\n },\n {\n x: 0.484375,\n y: 0.765625,\n },\n {\n x: 0.515625,\n y: 0.765625,\n },\n {\n x: 0.515625,\n y: 0.765625,\n },\n {\n x: 0.546875,\n y: 0.765625,\n },\n {\n x: 0.546875,\n y: 0.765625,\n },\n {\n x: 0.578125,\n y: 0.765625,\n },\n {\n x: 0.578125,\n y: 0.765625,\n },\n {\n x: 0.609375,\n y: 0.765625,\n },\n {\n x: 0.609375,\n y: 0.765625,\n },\n {\n x: 0.640625,\n y: 0.765625,\n },\n {\n x: 0.640625,\n y: 0.765625,\n },\n {\n x: 0.671875,\n y: 0.765625,\n },\n {\n x: 0.671875,\n y: 0.765625,\n },\n {\n x: 0.703125,\n y: 0.765625,\n },\n {\n x: 0.703125,\n y: 0.765625,\n },\n {\n x: 0.734375,\n y: 0.765625,\n },\n {\n x: 0.734375,\n y: 0.765625,\n },\n {\n x: 0.765625,\n y: 0.765625,\n },\n {\n x: 0.765625,\n y: 0.765625,\n },\n {\n x: 0.796875,\n y: 0.765625,\n },\n {\n x: 0.796875,\n y: 0.765625,\n },\n {\n x: 0.828125,\n y: 0.765625,\n },\n {\n x: 0.828125,\n y: 0.765625,\n },\n {\n x: 0.859375,\n y: 0.765625,\n },\n {\n x: 0.859375,\n y: 0.765625,\n },\n {\n x: 0.890625,\n y: 0.765625,\n },\n {\n x: 0.890625,\n y: 0.765625,\n },\n {\n x: 0.921875,\n y: 0.765625,\n },\n {\n x: 0.921875,\n y: 0.765625,\n },\n {\n x: 0.953125,\n y: 0.765625,\n },\n {\n x: 0.953125,\n y: 0.765625,\n },\n {\n x: 0.984375,\n y: 0.765625,\n },\n {\n x: 0.984375,\n y: 0.765625,\n },\n {\n x: 0.015625,\n y: 0.796875,\n },\n {\n x: 0.015625,\n y: 0.796875,\n },\n {\n x: 0.046875,\n y: 0.796875,\n },\n {\n x: 0.046875,\n y: 0.796875,\n },\n {\n x: 0.078125,\n y: 0.796875,\n },\n {\n x: 0.078125,\n y: 0.796875,\n },\n {\n x: 0.109375,\n y: 0.796875,\n },\n {\n x: 0.109375,\n y: 0.796875,\n },\n {\n x: 0.140625,\n y: 0.796875,\n },\n {\n x: 0.140625,\n y: 0.796875,\n },\n {\n x: 0.171875,\n y: 0.796875,\n },\n {\n x: 0.171875,\n y: 0.796875,\n },\n {\n x: 0.203125,\n y: 0.796875,\n },\n {\n x: 0.203125,\n y: 0.796875,\n },\n {\n x: 0.234375,\n y: 0.796875,\n },\n {\n x: 0.234375,\n y: 0.796875,\n },\n {\n x: 0.265625,\n y: 0.796875,\n },\n {\n x: 0.265625,\n y: 0.796875,\n },\n {\n x: 0.296875,\n y: 0.796875,\n },\n {\n x: 0.296875,\n y: 0.796875,\n },\n {\n x: 0.328125,\n y: 0.796875,\n },\n {\n x: 0.328125,\n y: 0.796875,\n },\n {\n x: 0.359375,\n y: 0.796875,\n },\n {\n x: 0.359375,\n y: 0.796875,\n },\n {\n x: 0.390625,\n y: 0.796875,\n },\n {\n x: 0.390625,\n y: 0.796875,\n },\n {\n x: 0.421875,\n y: 0.796875,\n },\n {\n x: 0.421875,\n y: 0.796875,\n },\n {\n x: 0.453125,\n y: 0.796875,\n },\n {\n x: 0.453125,\n y: 0.796875,\n },\n {\n x: 0.484375,\n y: 0.796875,\n },\n {\n x: 0.484375,\n y: 0.796875,\n },\n {\n x: 0.515625,\n y: 0.796875,\n },\n {\n x: 0.515625,\n y: 0.796875,\n },\n {\n x: 0.546875,\n y: 0.796875,\n },\n {\n x: 0.546875,\n y: 0.796875,\n },\n {\n x: 0.578125,\n y: 0.796875,\n },\n {\n x: 0.578125,\n y: 0.796875,\n },\n {\n x: 0.609375,\n y: 0.796875,\n },\n {\n x: 0.609375,\n y: 0.796875,\n },\n {\n x: 0.640625,\n y: 0.796875,\n },\n {\n x: 0.640625,\n y: 0.796875,\n },\n {\n x: 0.671875,\n y: 0.796875,\n },\n {\n x: 0.671875,\n y: 0.796875,\n },\n {\n x: 0.703125,\n y: 0.796875,\n },\n {\n x: 0.703125,\n y: 0.796875,\n },\n {\n x: 0.734375,\n y: 0.796875,\n },\n {\n x: 0.734375,\n y: 0.796875,\n },\n {\n x: 0.765625,\n y: 0.796875,\n },\n {\n x: 0.765625,\n y: 0.796875,\n },\n {\n x: 0.796875,\n y: 0.796875,\n },\n {\n x: 0.796875,\n y: 0.796875,\n },\n {\n x: 0.828125,\n y: 0.796875,\n },\n {\n x: 0.828125,\n y: 0.796875,\n },\n {\n x: 0.859375,\n y: 0.796875,\n },\n {\n x: 0.859375,\n y: 0.796875,\n },\n {\n x: 0.890625,\n y: 0.796875,\n },\n {\n x: 0.890625,\n y: 0.796875,\n },\n {\n x: 0.921875,\n y: 0.796875,\n },\n {\n x: 0.921875,\n y: 0.796875,\n },\n {\n x: 0.953125,\n y: 0.796875,\n },\n {\n x: 0.953125,\n y: 0.796875,\n },\n {\n x: 0.984375,\n y: 0.796875,\n },\n {\n x: 0.984375,\n y: 0.796875,\n },\n {\n x: 0.015625,\n y: 0.828125,\n },\n {\n x: 0.015625,\n y: 0.828125,\n },\n {\n x: 0.046875,\n y: 0.828125,\n },\n {\n x: 0.046875,\n y: 0.828125,\n },\n {\n x: 0.078125,\n y: 0.828125,\n },\n {\n x: 0.078125,\n y: 0.828125,\n },\n {\n x: 0.109375,\n y: 0.828125,\n },\n {\n x: 0.109375,\n y: 0.828125,\n },\n {\n x: 0.140625,\n y: 0.828125,\n },\n {\n x: 0.140625,\n y: 0.828125,\n },\n {\n x: 0.171875,\n y: 0.828125,\n },\n {\n x: 0.171875,\n y: 0.828125,\n },\n {\n x: 0.203125,\n y: 0.828125,\n },\n {\n x: 0.203125,\n y: 0.828125,\n },\n {\n x: 0.234375,\n y: 0.828125,\n },\n {\n x: 0.234375,\n y: 0.828125,\n },\n {\n x: 0.265625,\n y: 0.828125,\n },\n {\n x: 0.265625,\n y: 0.828125,\n },\n {\n x: 0.296875,\n y: 0.828125,\n },\n {\n x: 0.296875,\n y: 0.828125,\n },\n {\n x: 0.328125,\n y: 0.828125,\n },\n {\n x: 0.328125,\n y: 0.828125,\n },\n {\n x: 0.359375,\n y: 0.828125,\n },\n {\n x: 0.359375,\n y: 0.828125,\n },\n {\n x: 0.390625,\n y: 0.828125,\n },\n {\n x: 0.390625,\n y: 0.828125,\n },\n {\n x: 0.421875,\n y: 0.828125,\n },\n {\n x: 0.421875,\n y: 0.828125,\n },\n {\n x: 0.453125,\n y: 0.828125,\n },\n {\n x: 0.453125,\n y: 0.828125,\n },\n {\n x: 0.484375,\n y: 0.828125,\n },\n {\n x: 0.484375,\n y: 0.828125,\n },\n {\n x: 0.515625,\n y: 0.828125,\n },\n {\n x: 0.515625,\n y: 0.828125,\n },\n {\n x: 0.546875,\n y: 0.828125,\n },\n {\n x: 0.546875,\n y: 0.828125,\n },\n {\n x: 0.578125,\n y: 0.828125,\n },\n {\n x: 0.578125,\n y: 0.828125,\n },\n {\n x: 0.609375,\n y: 0.828125,\n },\n {\n x: 0.609375,\n y: 0.828125,\n },\n {\n x: 0.640625,\n y: 0.828125,\n },\n {\n x: 0.640625,\n y: 0.828125,\n },\n {\n x: 0.671875,\n y: 0.828125,\n },\n {\n x: 0.671875,\n y: 0.828125,\n },\n {\n x: 0.703125,\n y: 0.828125,\n },\n {\n x: 0.703125,\n y: 0.828125,\n },\n {\n x: 0.734375,\n y: 0.828125,\n },\n {\n x: 0.734375,\n y: 0.828125,\n },\n {\n x: 0.765625,\n y: 0.828125,\n },\n {\n x: 0.765625,\n y: 0.828125,\n },\n {\n x: 0.796875,\n y: 0.828125,\n },\n {\n x: 0.796875,\n y: 0.828125,\n },\n {\n x: 0.828125,\n y: 0.828125,\n },\n {\n x: 0.828125,\n y: 0.828125,\n },\n {\n x: 0.859375,\n y: 0.828125,\n },\n {\n x: 0.859375,\n y: 0.828125,\n },\n {\n x: 0.890625,\n y: 0.828125,\n },\n {\n x: 0.890625,\n y: 0.828125,\n },\n {\n x: 0.921875,\n y: 0.828125,\n },\n {\n x: 0.921875,\n y: 0.828125,\n },\n {\n x: 0.953125,\n y: 0.828125,\n },\n {\n x: 0.953125,\n y: 0.828125,\n },\n {\n x: 0.984375,\n y: 0.828125,\n },\n {\n x: 0.984375,\n y: 0.828125,\n },\n {\n x: 0.015625,\n y: 0.859375,\n },\n {\n x: 0.015625,\n y: 0.859375,\n },\n {\n x: 0.046875,\n y: 0.859375,\n },\n {\n x: 0.046875,\n y: 0.859375,\n },\n {\n x: 0.078125,\n y: 0.859375,\n },\n {\n x: 0.078125,\n y: 0.859375,\n },\n {\n x: 0.109375,\n y: 0.859375,\n },\n {\n x: 0.109375,\n y: 0.859375,\n },\n {\n x: 0.140625,\n y: 0.859375,\n },\n {\n x: 0.140625,\n y: 0.859375,\n },\n {\n x: 0.171875,\n y: 0.859375,\n },\n {\n x: 0.171875,\n y: 0.859375,\n },\n {\n x: 0.203125,\n y: 0.859375,\n },\n {\n x: 0.203125,\n y: 0.859375,\n },\n {\n x: 0.234375,\n y: 0.859375,\n },\n {\n x: 0.234375,\n y: 0.859375,\n },\n {\n x: 0.265625,\n y: 0.859375,\n },\n {\n x: 0.265625,\n y: 0.859375,\n },\n {\n x: 0.296875,\n y: 0.859375,\n },\n {\n x: 0.296875,\n y: 0.859375,\n },\n {\n x: 0.328125,\n y: 0.859375,\n },\n {\n x: 0.328125,\n y: 0.859375,\n },\n {\n x: 0.359375,\n y: 0.859375,\n },\n {\n x: 0.359375,\n y: 0.859375,\n },\n {\n x: 0.390625,\n y: 0.859375,\n },\n {\n x: 0.390625,\n y: 0.859375,\n },\n {\n x: 0.421875,\n y: 0.859375,\n },\n {\n x: 0.421875,\n y: 0.859375,\n },\n {\n x: 0.453125,\n y: 0.859375,\n },\n {\n x: 0.453125,\n y: 0.859375,\n },\n {\n x: 0.484375,\n y: 0.859375,\n },\n {\n x: 0.484375,\n y: 0.859375,\n },\n {\n x: 0.515625,\n y: 0.859375,\n },\n {\n x: 0.515625,\n y: 0.859375,\n },\n {\n x: 0.546875,\n y: 0.859375,\n },\n {\n x: 0.546875,\n y: 0.859375,\n },\n {\n x: 0.578125,\n y: 0.859375,\n },\n {\n x: 0.578125,\n y: 0.859375,\n },\n {\n x: 0.609375,\n y: 0.859375,\n },\n {\n x: 0.609375,\n y: 0.859375,\n },\n {\n x: 0.640625,\n y: 0.859375,\n },\n {\n x: 0.640625,\n y: 0.859375,\n },\n {\n x: 0.671875,\n y: 0.859375,\n },\n {\n x: 0.671875,\n y: 0.859375,\n },\n {\n x: 0.703125,\n y: 0.859375,\n },\n {\n x: 0.703125,\n y: 0.859375,\n },\n {\n x: 0.734375,\n y: 0.859375,\n },\n {\n x: 0.734375,\n y: 0.859375,\n },\n {\n x: 0.765625,\n y: 0.859375,\n },\n {\n x: 0.765625,\n y: 0.859375,\n },\n {\n x: 0.796875,\n y: 0.859375,\n },\n {\n x: 0.796875,\n y: 0.859375,\n },\n {\n x: 0.828125,\n y: 0.859375,\n },\n {\n x: 0.828125,\n y: 0.859375,\n },\n {\n x: 0.859375,\n y: 0.859375,\n },\n {\n x: 0.859375,\n y: 0.859375,\n },\n {\n x: 0.890625,\n y: 0.859375,\n },\n {\n x: 0.890625,\n y: 0.859375,\n },\n {\n x: 0.921875,\n y: 0.859375,\n },\n {\n x: 0.921875,\n y: 0.859375,\n },\n {\n x: 0.953125,\n y: 0.859375,\n },\n {\n x: 0.953125,\n y: 0.859375,\n },\n {\n x: 0.984375,\n y: 0.859375,\n },\n {\n x: 0.984375,\n y: 0.859375,\n },\n {\n x: 0.015625,\n y: 0.890625,\n },\n {\n x: 0.015625,\n y: 0.890625,\n },\n {\n x: 0.046875,\n y: 0.890625,\n },\n {\n x: 0.046875,\n y: 0.890625,\n },\n {\n x: 0.078125,\n y: 0.890625,\n },\n {\n x: 0.078125,\n y: 0.890625,\n },\n {\n x: 0.109375,\n y: 0.890625,\n },\n {\n x: 0.109375,\n y: 0.890625,\n },\n {\n x: 0.140625,\n y: 0.890625,\n },\n {\n x: 0.140625,\n y: 0.890625,\n },\n {\n x: 0.171875,\n y: 0.890625,\n },\n {\n x: 0.171875,\n y: 0.890625,\n },\n {\n x: 0.203125,\n y: 0.890625,\n },\n {\n x: 0.203125,\n y: 0.890625,\n },\n {\n x: 0.234375,\n y: 0.890625,\n },\n {\n x: 0.234375,\n y: 0.890625,\n },\n {\n x: 0.265625,\n y: 0.890625,\n },\n {\n x: 0.265625,\n y: 0.890625,\n },\n {\n x: 0.296875,\n y: 0.890625,\n },\n {\n x: 0.296875,\n y: 0.890625,\n },\n {\n x: 0.328125,\n y: 0.890625,\n },\n {\n x: 0.328125,\n y: 0.890625,\n },\n {\n x: 0.359375,\n y: 0.890625,\n },\n {\n x: 0.359375,\n y: 0.890625,\n },\n {\n x: 0.390625,\n y: 0.890625,\n },\n {\n x: 0.390625,\n y: 0.890625,\n },\n {\n x: 0.421875,\n y: 0.890625,\n },\n {\n x: 0.421875,\n y: 0.890625,\n },\n {\n x: 0.453125,\n y: 0.890625,\n },\n {\n x: 0.453125,\n y: 0.890625,\n },\n {\n x: 0.484375,\n y: 0.890625,\n },\n {\n x: 0.484375,\n y: 0.890625,\n },\n {\n x: 0.515625,\n y: 0.890625,\n },\n {\n x: 0.515625,\n y: 0.890625,\n },\n {\n x: 0.546875,\n y: 0.890625,\n },\n {\n x: 0.546875,\n y: 0.890625,\n },\n {\n x: 0.578125,\n y: 0.890625,\n },\n {\n x: 0.578125,\n y: 0.890625,\n },\n {\n x: 0.609375,\n y: 0.890625,\n },\n {\n x: 0.609375,\n y: 0.890625,\n },\n {\n x: 0.640625,\n y: 0.890625,\n },\n {\n x: 0.640625,\n y: 0.890625,\n },\n {\n x: 0.671875,\n y: 0.890625,\n },\n {\n x: 0.671875,\n y: 0.890625,\n },\n {\n x: 0.703125,\n y: 0.890625,\n },\n {\n x: 0.703125,\n y: 0.890625,\n },\n {\n x: 0.734375,\n y: 0.890625,\n },\n {\n x: 0.734375,\n y: 0.890625,\n },\n {\n x: 0.765625,\n y: 0.890625,\n },\n {\n x: 0.765625,\n y: 0.890625,\n },\n {\n x: 0.796875,\n y: 0.890625,\n },\n {\n x: 0.796875,\n y: 0.890625,\n },\n {\n x: 0.828125,\n y: 0.890625,\n },\n {\n x: 0.828125,\n y: 0.890625,\n },\n {\n x: 0.859375,\n y: 0.890625,\n },\n {\n x: 0.859375,\n y: 0.890625,\n },\n {\n x: 0.890625,\n y: 0.890625,\n },\n {\n x: 0.890625,\n y: 0.890625,\n },\n {\n x: 0.921875,\n y: 0.890625,\n },\n {\n x: 0.921875,\n y: 0.890625,\n },\n {\n x: 0.953125,\n y: 0.890625,\n },\n {\n x: 0.953125,\n y: 0.890625,\n },\n {\n x: 0.984375,\n y: 0.890625,\n },\n {\n x: 0.984375,\n y: 0.890625,\n },\n {\n x: 0.015625,\n y: 0.921875,\n },\n {\n x: 0.015625,\n y: 0.921875,\n },\n {\n x: 0.046875,\n y: 0.921875,\n },\n {\n x: 0.046875,\n y: 0.921875,\n },\n {\n x: 0.078125,\n y: 0.921875,\n },\n {\n x: 0.078125,\n y: 0.921875,\n },\n {\n x: 0.109375,\n y: 0.921875,\n },\n {\n x: 0.109375,\n y: 0.921875,\n },\n {\n x: 0.140625,\n y: 0.921875,\n },\n {\n x: 0.140625,\n y: 0.921875,\n },\n {\n x: 0.171875,\n y: 0.921875,\n },\n {\n x: 0.171875,\n y: 0.921875,\n },\n {\n x: 0.203125,\n y: 0.921875,\n },\n {\n x: 0.203125,\n y: 0.921875,\n },\n {\n x: 0.234375,\n y: 0.921875,\n },\n {\n x: 0.234375,\n y: 0.921875,\n },\n {\n x: 0.265625,\n y: 0.921875,\n },\n {\n x: 0.265625,\n y: 0.921875,\n },\n {\n x: 0.296875,\n y: 0.921875,\n },\n {\n x: 0.296875,\n y: 0.921875,\n },\n {\n x: 0.328125,\n y: 0.921875,\n },\n {\n x: 0.328125,\n y: 0.921875,\n },\n {\n x: 0.359375,\n y: 0.921875,\n },\n {\n x: 0.359375,\n y: 0.921875,\n },\n {\n x: 0.390625,\n y: 0.921875,\n },\n {\n x: 0.390625,\n y: 0.921875,\n },\n {\n x: 0.421875,\n y: 0.921875,\n },\n {\n x: 0.421875,\n y: 0.921875,\n },\n {\n x: 0.453125,\n y: 0.921875,\n },\n {\n x: 0.453125,\n y: 0.921875,\n },\n {\n x: 0.484375,\n y: 0.921875,\n },\n {\n x: 0.484375,\n y: 0.921875,\n },\n {\n x: 0.515625,\n y: 0.921875,\n },\n {\n x: 0.515625,\n y: 0.921875,\n },\n {\n x: 0.546875,\n y: 0.921875,\n },\n {\n x: 0.546875,\n y: 0.921875,\n },\n {\n x: 0.578125,\n y: 0.921875,\n },\n {\n x: 0.578125,\n y: 0.921875,\n },\n {\n x: 0.609375,\n y: 0.921875,\n },\n {\n x: 0.609375,\n y: 0.921875,\n },\n {\n x: 0.640625,\n y: 0.921875,\n },\n {\n x: 0.640625,\n y: 0.921875,\n },\n {\n x: 0.671875,\n y: 0.921875,\n },\n {\n x: 0.671875,\n y: 0.921875,\n },\n {\n x: 0.703125,\n y: 0.921875,\n },\n {\n x: 0.703125,\n y: 0.921875,\n },\n {\n x: 0.734375,\n y: 0.921875,\n },\n {\n x: 0.734375,\n y: 0.921875,\n },\n {\n x: 0.765625,\n y: 0.921875,\n },\n {\n x: 0.765625,\n y: 0.921875,\n },\n {\n x: 0.796875,\n y: 0.921875,\n },\n {\n x: 0.796875,\n y: 0.921875,\n },\n {\n x: 0.828125,\n y: 0.921875,\n },\n {\n x: 0.828125,\n y: 0.921875,\n },\n {\n x: 0.859375,\n y: 0.921875,\n },\n {\n x: 0.859375,\n y: 0.921875,\n },\n {\n x: 0.890625,\n y: 0.921875,\n },\n {\n x: 0.890625,\n y: 0.921875,\n },\n {\n x: 0.921875,\n y: 0.921875,\n },\n {\n x: 0.921875,\n y: 0.921875,\n },\n {\n x: 0.953125,\n y: 0.921875,\n },\n {\n x: 0.953125,\n y: 0.921875,\n },\n {\n x: 0.984375,\n y: 0.921875,\n },\n {\n x: 0.984375,\n y: 0.921875,\n },\n {\n x: 0.015625,\n y: 0.953125,\n },\n {\n x: 0.015625,\n y: 0.953125,\n },\n {\n x: 0.046875,\n y: 0.953125,\n },\n {\n x: 0.046875,\n y: 0.953125,\n },\n {\n x: 0.078125,\n y: 0.953125,\n },\n {\n x: 0.078125,\n y: 0.953125,\n },\n {\n x: 0.109375,\n y: 0.953125,\n },\n {\n x: 0.109375,\n y: 0.953125,\n },\n {\n x: 0.140625,\n y: 0.953125,\n },\n {\n x: 0.140625,\n y: 0.953125,\n },\n {\n x: 0.171875,\n y: 0.953125,\n },\n {\n x: 0.171875,\n y: 0.953125,\n },\n {\n x: 0.203125,\n y: 0.953125,\n },\n {\n x: 0.203125,\n y: 0.953125,\n },\n {\n x: 0.234375,\n y: 0.953125,\n },\n {\n x: 0.234375,\n y: 0.953125,\n },\n {\n x: 0.265625,\n y: 0.953125,\n },\n {\n x: 0.265625,\n y: 0.953125,\n },\n {\n x: 0.296875,\n y: 0.953125,\n },\n {\n x: 0.296875,\n y: 0.953125,\n },\n {\n x: 0.328125,\n y: 0.953125,\n },\n {\n x: 0.328125,\n y: 0.953125,\n },\n {\n x: 0.359375,\n y: 0.953125,\n },\n {\n x: 0.359375,\n y: 0.953125,\n },\n {\n x: 0.390625,\n y: 0.953125,\n },\n {\n x: 0.390625,\n y: 0.953125,\n },\n {\n x: 0.421875,\n y: 0.953125,\n },\n {\n x: 0.421875,\n y: 0.953125,\n },\n {\n x: 0.453125,\n y: 0.953125,\n },\n {\n x: 0.453125,\n y: 0.953125,\n },\n {\n x: 0.484375,\n y: 0.953125,\n },\n {\n x: 0.484375,\n y: 0.953125,\n },\n {\n x: 0.515625,\n y: 0.953125,\n },\n {\n x: 0.515625,\n y: 0.953125,\n },\n {\n x: 0.546875,\n y: 0.953125,\n },\n {\n x: 0.546875,\n y: 0.953125,\n },\n {\n x: 0.578125,\n y: 0.953125,\n },\n {\n x: 0.578125,\n y: 0.953125,\n },\n {\n x: 0.609375,\n y: 0.953125,\n },\n {\n x: 0.609375,\n y: 0.953125,\n },\n {\n x: 0.640625,\n y: 0.953125,\n },\n {\n x: 0.640625,\n y: 0.953125,\n },\n {\n x: 0.671875,\n y: 0.953125,\n },\n {\n x: 0.671875,\n y: 0.953125,\n },\n {\n x: 0.703125,\n y: 0.953125,\n },\n {\n x: 0.703125,\n y: 0.953125,\n },\n {\n x: 0.734375,\n y: 0.953125,\n },\n {\n x: 0.734375,\n y: 0.953125,\n },\n {\n x: 0.765625,\n y: 0.953125,\n },\n {\n x: 0.765625,\n y: 0.953125,\n },\n {\n x: 0.796875,\n y: 0.953125,\n },\n {\n x: 0.796875,\n y: 0.953125,\n },\n {\n x: 0.828125,\n y: 0.953125,\n },\n {\n x: 0.828125,\n y: 0.953125,\n },\n {\n x: 0.859375,\n y: 0.953125,\n },\n {\n x: 0.859375,\n y: 0.953125,\n },\n {\n x: 0.890625,\n y: 0.953125,\n },\n {\n x: 0.890625,\n y: 0.953125,\n },\n {\n x: 0.921875,\n y: 0.953125,\n },\n {\n x: 0.921875,\n y: 0.953125,\n },\n {\n x: 0.953125,\n y: 0.953125,\n },\n {\n x: 0.953125,\n y: 0.953125,\n },\n {\n x: 0.984375,\n y: 0.953125,\n },\n {\n x: 0.984375,\n y: 0.953125,\n },\n {\n x: 0.015625,\n y: 0.984375,\n },\n {\n x: 0.015625,\n y: 0.984375,\n },\n {\n x: 0.046875,\n y: 0.984375,\n },\n {\n x: 0.046875,\n y: 0.984375,\n },\n {\n x: 0.078125,\n y: 0.984375,\n },\n {\n x: 0.078125,\n y: 0.984375,\n },\n {\n x: 0.109375,\n y: 0.984375,\n },\n {\n x: 0.109375,\n y: 0.984375,\n },\n {\n x: 0.140625,\n y: 0.984375,\n },\n {\n x: 0.140625,\n y: 0.984375,\n },\n {\n x: 0.171875,\n y: 0.984375,\n },\n {\n x: 0.171875,\n y: 0.984375,\n },\n {\n x: 0.203125,\n y: 0.984375,\n },\n {\n x: 0.203125,\n y: 0.984375,\n },\n {\n x: 0.234375,\n y: 0.984375,\n },\n {\n x: 0.234375,\n y: 0.984375,\n },\n {\n x: 0.265625,\n y: 0.984375,\n },\n {\n x: 0.265625,\n y: 0.984375,\n },\n {\n x: 0.296875,\n y: 0.984375,\n },\n {\n x: 0.296875,\n y: 0.984375,\n },\n {\n x: 0.328125,\n y: 0.984375,\n },\n {\n x: 0.328125,\n y: 0.984375,\n },\n {\n x: 0.359375,\n y: 0.984375,\n },\n {\n x: 0.359375,\n y: 0.984375,\n },\n {\n x: 0.390625,\n y: 0.984375,\n },\n {\n x: 0.390625,\n y: 0.984375,\n },\n {\n x: 0.421875,\n y: 0.984375,\n },\n {\n x: 0.421875,\n y: 0.984375,\n },\n {\n x: 0.453125,\n y: 0.984375,\n },\n {\n x: 0.453125,\n y: 0.984375,\n },\n {\n x: 0.484375,\n y: 0.984375,\n },\n {\n x: 0.484375,\n y: 0.984375,\n },\n {\n x: 0.515625,\n y: 0.984375,\n },\n {\n x: 0.515625,\n y: 0.984375,\n },\n {\n x: 0.546875,\n y: 0.984375,\n },\n {\n x: 0.546875,\n y: 0.984375,\n },\n {\n x: 0.578125,\n y: 0.984375,\n },\n {\n x: 0.578125,\n y: 0.984375,\n },\n {\n x: 0.609375,\n y: 0.984375,\n },\n {\n x: 0.609375,\n y: 0.984375,\n },\n {\n x: 0.640625,\n y: 0.984375,\n },\n {\n x: 0.640625,\n y: 0.984375,\n },\n {\n x: 0.671875,\n y: 0.984375,\n },\n {\n x: 0.671875,\n y: 0.984375,\n },\n {\n x: 0.703125,\n y: 0.984375,\n },\n {\n x: 0.703125,\n y: 0.984375,\n },\n {\n x: 0.734375,\n y: 0.984375,\n },\n {\n x: 0.734375,\n y: 0.984375,\n },\n {\n x: 0.765625,\n y: 0.984375,\n },\n {\n x: 0.765625,\n y: 0.984375,\n },\n {\n x: 0.796875,\n y: 0.984375,\n },\n {\n x: 0.796875,\n y: 0.984375,\n },\n {\n x: 0.828125,\n y: 0.984375,\n },\n {\n x: 0.828125,\n y: 0.984375,\n },\n {\n x: 0.859375,\n y: 0.984375,\n },\n {\n x: 0.859375,\n y: 0.984375,\n },\n {\n x: 0.890625,\n y: 0.984375,\n },\n {\n x: 0.890625,\n y: 0.984375,\n },\n {\n x: 0.921875,\n y: 0.984375,\n },\n {\n x: 0.921875,\n y: 0.984375,\n },\n {\n x: 0.953125,\n y: 0.984375,\n },\n {\n x: 0.953125,\n y: 0.984375,\n },\n {\n x: 0.984375,\n y: 0.984375,\n },\n {\n x: 0.984375,\n y: 0.984375,\n },\n {\n x: 0.03125,\n y: 0.03125,\n },\n {\n x: 0.03125,\n y: 0.03125,\n },\n {\n x: 0.09375,\n y: 0.03125,\n },\n {\n x: 0.09375,\n y: 0.03125,\n },\n {\n x: 0.15625,\n y: 0.03125,\n },\n {\n x: 0.15625,\n y: 0.03125,\n },\n {\n x: 0.21875,\n y: 0.03125,\n },\n {\n x: 0.21875,\n y: 0.03125,\n },\n {\n x: 0.28125,\n y: 0.03125,\n },\n {\n x: 0.28125,\n y: 0.03125,\n },\n {\n x: 0.34375,\n y: 0.03125,\n },\n {\n x: 0.34375,\n y: 0.03125,\n },\n {\n x: 0.40625,\n y: 0.03125,\n },\n {\n x: 0.40625,\n y: 0.03125,\n },\n {\n x: 0.46875,\n y: 0.03125,\n },\n {\n x: 0.46875,\n y: 0.03125,\n },\n {\n x: 0.53125,\n y: 0.03125,\n },\n {\n x: 0.53125,\n y: 0.03125,\n },\n {\n x: 0.59375,\n y: 0.03125,\n },\n {\n x: 0.59375,\n y: 0.03125,\n },\n {\n x: 0.65625,\n y: 0.03125,\n },\n {\n x: 0.65625,\n y: 0.03125,\n },\n {\n x: 0.71875,\n y: 0.03125,\n },\n {\n x: 0.71875,\n y: 0.03125,\n },\n {\n x: 0.78125,\n y: 0.03125,\n },\n {\n x: 0.78125,\n y: 0.03125,\n },\n {\n x: 0.84375,\n y: 0.03125,\n },\n {\n x: 0.84375,\n y: 0.03125,\n },\n {\n x: 0.90625,\n y: 0.03125,\n },\n {\n x: 0.90625,\n y: 0.03125,\n },\n {\n x: 0.96875,\n y: 0.03125,\n },\n {\n x: 0.96875,\n y: 0.03125,\n },\n {\n x: 0.03125,\n y: 0.09375,\n },\n {\n x: 0.03125,\n y: 0.09375,\n },\n {\n x: 0.09375,\n y: 0.09375,\n },\n {\n x: 0.09375,\n y: 0.09375,\n },\n {\n x: 0.15625,\n y: 0.09375,\n },\n {\n x: 0.15625,\n y: 0.09375,\n },\n {\n x: 0.21875,\n y: 0.09375,\n },\n {\n x: 0.21875,\n y: 0.09375,\n },\n {\n x: 0.28125,\n y: 0.09375,\n },\n {\n x: 0.28125,\n y: 0.09375,\n },\n {\n x: 0.34375,\n y: 0.09375,\n },\n {\n x: 0.34375,\n y: 0.09375,\n },\n {\n x: 0.40625,\n y: 0.09375,\n },\n {\n x: 0.40625,\n y: 0.09375,\n },\n {\n x: 0.46875,\n y: 0.09375,\n },\n {\n x: 0.46875,\n y: 0.09375,\n },\n {\n x: 0.53125,\n y: 0.09375,\n },\n {\n x: 0.53125,\n y: 0.09375,\n },\n {\n x: 0.59375,\n y: 0.09375,\n },\n {\n x: 0.59375,\n y: 0.09375,\n },\n {\n x: 0.65625,\n y: 0.09375,\n },\n {\n x: 0.65625,\n y: 0.09375,\n },\n {\n x: 0.71875,\n y: 0.09375,\n },\n {\n x: 0.71875,\n y: 0.09375,\n },\n {\n x: 0.78125,\n y: 0.09375,\n },\n {\n x: 0.78125,\n y: 0.09375,\n },\n {\n x: 0.84375,\n y: 0.09375,\n },\n {\n x: 0.84375,\n y: 0.09375,\n },\n {\n x: 0.90625,\n y: 0.09375,\n },\n {\n x: 0.90625,\n y: 0.09375,\n },\n {\n x: 0.96875,\n y: 0.09375,\n },\n {\n x: 0.96875,\n y: 0.09375,\n },\n {\n x: 0.03125,\n y: 0.15625,\n },\n {\n x: 0.03125,\n y: 0.15625,\n },\n {\n x: 0.09375,\n y: 0.15625,\n },\n {\n x: 0.09375,\n y: 0.15625,\n },\n {\n x: 0.15625,\n y: 0.15625,\n },\n {\n x: 0.15625,\n y: 0.15625,\n },\n {\n x: 0.21875,\n y: 0.15625,\n },\n {\n x: 0.21875,\n y: 0.15625,\n },\n {\n x: 0.28125,\n y: 0.15625,\n },\n {\n x: 0.28125,\n y: 0.15625,\n },\n {\n x: 0.34375,\n y: 0.15625,\n },\n {\n x: 0.34375,\n y: 0.15625,\n },\n {\n x: 0.40625,\n y: 0.15625,\n },\n {\n x: 0.40625,\n y: 0.15625,\n },\n {\n x: 0.46875,\n y: 0.15625,\n },\n {\n x: 0.46875,\n y: 0.15625,\n },\n {\n x: 0.53125,\n y: 0.15625,\n },\n {\n x: 0.53125,\n y: 0.15625,\n },\n {\n x: 0.59375,\n y: 0.15625,\n },\n {\n x: 0.59375,\n y: 0.15625,\n },\n {\n x: 0.65625,\n y: 0.15625,\n },\n {\n x: 0.65625,\n y: 0.15625,\n },\n {\n x: 0.71875,\n y: 0.15625,\n },\n {\n x: 0.71875,\n y: 0.15625,\n },\n {\n x: 0.78125,\n y: 0.15625,\n },\n {\n x: 0.78125,\n y: 0.15625,\n },\n {\n x: 0.84375,\n y: 0.15625,\n },\n {\n x: 0.84375,\n y: 0.15625,\n },\n {\n x: 0.90625,\n y: 0.15625,\n },\n {\n x: 0.90625,\n y: 0.15625,\n },\n {\n x: 0.96875,\n y: 0.15625,\n },\n {\n x: 0.96875,\n y: 0.15625,\n },\n {\n x: 0.03125,\n y: 0.21875,\n },\n {\n x: 0.03125,\n y: 0.21875,\n },\n {\n x: 0.09375,\n y: 0.21875,\n },\n {\n x: 0.09375,\n y: 0.21875,\n },\n {\n x: 0.15625,\n y: 0.21875,\n },\n {\n x: 0.15625,\n y: 0.21875,\n },\n {\n x: 0.21875,\n y: 0.21875,\n },\n {\n x: 0.21875,\n y: 0.21875,\n },\n {\n x: 0.28125,\n y: 0.21875,\n },\n {\n x: 0.28125,\n y: 0.21875,\n },\n {\n x: 0.34375,\n y: 0.21875,\n },\n {\n x: 0.34375,\n y: 0.21875,\n },\n {\n x: 0.40625,\n y: 0.21875,\n },\n {\n x: 0.40625,\n y: 0.21875,\n },\n {\n x: 0.46875,\n y: 0.21875,\n },\n {\n x: 0.46875,\n y: 0.21875,\n },\n {\n x: 0.53125,\n y: 0.21875,\n },\n {\n x: 0.53125,\n y: 0.21875,\n },\n {\n x: 0.59375,\n y: 0.21875,\n },\n {\n x: 0.59375,\n y: 0.21875,\n },\n {\n x: 0.65625,\n y: 0.21875,\n },\n {\n x: 0.65625,\n y: 0.21875,\n },\n {\n x: 0.71875,\n y: 0.21875,\n },\n {\n x: 0.71875,\n y: 0.21875,\n },\n {\n x: 0.78125,\n y: 0.21875,\n },\n {\n x: 0.78125,\n y: 0.21875,\n },\n {\n x: 0.84375,\n y: 0.21875,\n },\n {\n x: 0.84375,\n y: 0.21875,\n },\n {\n x: 0.90625,\n y: 0.21875,\n },\n {\n x: 0.90625,\n y: 0.21875,\n },\n {\n x: 0.96875,\n y: 0.21875,\n },\n {\n x: 0.96875,\n y: 0.21875,\n },\n {\n x: 0.03125,\n y: 0.28125,\n },\n {\n x: 0.03125,\n y: 0.28125,\n },\n {\n x: 0.09375,\n y: 0.28125,\n },\n {\n x: 0.09375,\n y: 0.28125,\n },\n {\n x: 0.15625,\n y: 0.28125,\n },\n {\n x: 0.15625,\n y: 0.28125,\n },\n {\n x: 0.21875,\n y: 0.28125,\n },\n {\n x: 0.21875,\n y: 0.28125,\n },\n {\n x: 0.28125,\n y: 0.28125,\n },\n {\n x: 0.28125,\n y: 0.28125,\n },\n {\n x: 0.34375,\n y: 0.28125,\n },\n {\n x: 0.34375,\n y: 0.28125,\n },\n {\n x: 0.40625,\n y: 0.28125,\n },\n {\n x: 0.40625,\n y: 0.28125,\n },\n {\n x: 0.46875,\n y: 0.28125,\n },\n {\n x: 0.46875,\n y: 0.28125,\n },\n {\n x: 0.53125,\n y: 0.28125,\n },\n {\n x: 0.53125,\n y: 0.28125,\n },\n {\n x: 0.59375,\n y: 0.28125,\n },\n {\n x: 0.59375,\n y: 0.28125,\n },\n {\n x: 0.65625,\n y: 0.28125,\n },\n {\n x: 0.65625,\n y: 0.28125,\n },\n {\n x: 0.71875,\n y: 0.28125,\n },\n {\n x: 0.71875,\n y: 0.28125,\n },\n {\n x: 0.78125,\n y: 0.28125,\n },\n {\n x: 0.78125,\n y: 0.28125,\n },\n {\n x: 0.84375,\n y: 0.28125,\n },\n {\n x: 0.84375,\n y: 0.28125,\n },\n {\n x: 0.90625,\n y: 0.28125,\n },\n {\n x: 0.90625,\n y: 0.28125,\n },\n {\n x: 0.96875,\n y: 0.28125,\n },\n {\n x: 0.96875,\n y: 0.28125,\n },\n {\n x: 0.03125,\n y: 0.34375,\n },\n {\n x: 0.03125,\n y: 0.34375,\n },\n {\n x: 0.09375,\n y: 0.34375,\n },\n {\n x: 0.09375,\n y: 0.34375,\n },\n {\n x: 0.15625,\n y: 0.34375,\n },\n {\n x: 0.15625,\n y: 0.34375,\n },\n {\n x: 0.21875,\n y: 0.34375,\n },\n {\n x: 0.21875,\n y: 0.34375,\n },\n {\n x: 0.28125,\n y: 0.34375,\n },\n {\n x: 0.28125,\n y: 0.34375,\n },\n {\n x: 0.34375,\n y: 0.34375,\n },\n {\n x: 0.34375,\n y: 0.34375,\n },\n {\n x: 0.40625,\n y: 0.34375,\n },\n {\n x: 0.40625,\n y: 0.34375,\n },\n {\n x: 0.46875,\n y: 0.34375,\n },\n {\n x: 0.46875,\n y: 0.34375,\n },\n {\n x: 0.53125,\n y: 0.34375,\n },\n {\n x: 0.53125,\n y: 0.34375,\n },\n {\n x: 0.59375,\n y: 0.34375,\n },\n {\n x: 0.59375,\n y: 0.34375,\n },\n {\n x: 0.65625,\n y: 0.34375,\n },\n {\n x: 0.65625,\n y: 0.34375,\n },\n {\n x: 0.71875,\n y: 0.34375,\n },\n {\n x: 0.71875,\n y: 0.34375,\n },\n {\n x: 0.78125,\n y: 0.34375,\n },\n {\n x: 0.78125,\n y: 0.34375,\n },\n {\n x: 0.84375,\n y: 0.34375,\n },\n {\n x: 0.84375,\n y: 0.34375,\n },\n {\n x: 0.90625,\n y: 0.34375,\n },\n {\n x: 0.90625,\n y: 0.34375,\n },\n {\n x: 0.96875,\n y: 0.34375,\n },\n {\n x: 0.96875,\n y: 0.34375,\n },\n {\n x: 0.03125,\n y: 0.40625,\n },\n {\n x: 0.03125,\n y: 0.40625,\n },\n {\n x: 0.09375,\n y: 0.40625,\n },\n {\n x: 0.09375,\n y: 0.40625,\n },\n {\n x: 0.15625,\n y: 0.40625,\n },\n {\n x: 0.15625,\n y: 0.40625,\n },\n {\n x: 0.21875,\n y: 0.40625,\n },\n {\n x: 0.21875,\n y: 0.40625,\n },\n {\n x: 0.28125,\n y: 0.40625,\n },\n {\n x: 0.28125,\n y: 0.40625,\n },\n {\n x: 0.34375,\n y: 0.40625,\n },\n {\n x: 0.34375,\n y: 0.40625,\n },\n {\n x: 0.40625,\n y: 0.40625,\n },\n {\n x: 0.40625,\n y: 0.40625,\n },\n {\n x: 0.46875,\n y: 0.40625,\n },\n {\n x: 0.46875,\n y: 0.40625,\n },\n {\n x: 0.53125,\n y: 0.40625,\n },\n {\n x: 0.53125,\n y: 0.40625,\n },\n {\n x: 0.59375,\n y: 0.40625,\n },\n {\n x: 0.59375,\n y: 0.40625,\n },\n {\n x: 0.65625,\n y: 0.40625,\n },\n {\n x: 0.65625,\n y: 0.40625,\n },\n {\n x: 0.71875,\n y: 0.40625,\n },\n {\n x: 0.71875,\n y: 0.40625,\n },\n {\n x: 0.78125,\n y: 0.40625,\n },\n {\n x: 0.78125,\n y: 0.40625,\n },\n {\n x: 0.84375,\n y: 0.40625,\n },\n {\n x: 0.84375,\n y: 0.40625,\n },\n {\n x: 0.90625,\n y: 0.40625,\n },\n {\n x: 0.90625,\n y: 0.40625,\n },\n {\n x: 0.96875,\n y: 0.40625,\n },\n {\n x: 0.96875,\n y: 0.40625,\n },\n {\n x: 0.03125,\n y: 0.46875,\n },\n {\n x: 0.03125,\n y: 0.46875,\n },\n {\n x: 0.09375,\n y: 0.46875,\n },\n {\n x: 0.09375,\n y: 0.46875,\n },\n {\n x: 0.15625,\n y: 0.46875,\n },\n {\n x: 0.15625,\n y: 0.46875,\n },\n {\n x: 0.21875,\n y: 0.46875,\n },\n {\n x: 0.21875,\n y: 0.46875,\n },\n {\n x: 0.28125,\n y: 0.46875,\n },\n {\n x: 0.28125,\n y: 0.46875,\n },\n {\n x: 0.34375,\n y: 0.46875,\n },\n {\n x: 0.34375,\n y: 0.46875,\n },\n {\n x: 0.40625,\n y: 0.46875,\n },\n {\n x: 0.40625,\n y: 0.46875,\n },\n {\n x: 0.46875,\n y: 0.46875,\n },\n {\n x: 0.46875,\n y: 0.46875,\n },\n {\n x: 0.53125,\n y: 0.46875,\n },\n {\n x: 0.53125,\n y: 0.46875,\n },\n {\n x: 0.59375,\n y: 0.46875,\n },\n {\n x: 0.59375,\n y: 0.46875,\n },\n {\n x: 0.65625,\n y: 0.46875,\n },\n {\n x: 0.65625,\n y: 0.46875,\n },\n {\n x: 0.71875,\n y: 0.46875,\n },\n {\n x: 0.71875,\n y: 0.46875,\n },\n {\n x: 0.78125,\n y: 0.46875,\n },\n {\n x: 0.78125,\n y: 0.46875,\n },\n {\n x: 0.84375,\n y: 0.46875,\n },\n {\n x: 0.84375,\n y: 0.46875,\n },\n {\n x: 0.90625,\n y: 0.46875,\n },\n {\n x: 0.90625,\n y: 0.46875,\n },\n {\n x: 0.96875,\n y: 0.46875,\n },\n {\n x: 0.96875,\n y: 0.46875,\n },\n {\n x: 0.03125,\n y: 0.53125,\n },\n {\n x: 0.03125,\n y: 0.53125,\n },\n {\n x: 0.09375,\n y: 0.53125,\n },\n {\n x: 0.09375,\n y: 0.53125,\n },\n {\n x: 0.15625,\n y: 0.53125,\n },\n {\n x: 0.15625,\n y: 0.53125,\n },\n {\n x: 0.21875,\n y: 0.53125,\n },\n {\n x: 0.21875,\n y: 0.53125,\n },\n {\n x: 0.28125,\n y: 0.53125,\n },\n {\n x: 0.28125,\n y: 0.53125,\n },\n {\n x: 0.34375,\n y: 0.53125,\n },\n {\n x: 0.34375,\n y: 0.53125,\n },\n {\n x: 0.40625,\n y: 0.53125,\n },\n {\n x: 0.40625,\n y: 0.53125,\n },\n {\n x: 0.46875,\n y: 0.53125,\n },\n {\n x: 0.46875,\n y: 0.53125,\n },\n {\n x: 0.53125,\n y: 0.53125,\n },\n {\n x: 0.53125,\n y: 0.53125,\n },\n {\n x: 0.59375,\n y: 0.53125,\n },\n {\n x: 0.59375,\n y: 0.53125,\n },\n {\n x: 0.65625,\n y: 0.53125,\n },\n {\n x: 0.65625,\n y: 0.53125,\n },\n {\n x: 0.71875,\n y: 0.53125,\n },\n {\n x: 0.71875,\n y: 0.53125,\n },\n {\n x: 0.78125,\n y: 0.53125,\n },\n {\n x: 0.78125,\n y: 0.53125,\n },\n {\n x: 0.84375,\n y: 0.53125,\n },\n {\n x: 0.84375,\n y: 0.53125,\n },\n {\n x: 0.90625,\n y: 0.53125,\n },\n {\n x: 0.90625,\n y: 0.53125,\n },\n {\n x: 0.96875,\n y: 0.53125,\n },\n {\n x: 0.96875,\n y: 0.53125,\n },\n {\n x: 0.03125,\n y: 0.59375,\n },\n {\n x: 0.03125,\n y: 0.59375,\n },\n {\n x: 0.09375,\n y: 0.59375,\n },\n {\n x: 0.09375,\n y: 0.59375,\n },\n {\n x: 0.15625,\n y: 0.59375,\n },\n {\n x: 0.15625,\n y: 0.59375,\n },\n {\n x: 0.21875,\n y: 0.59375,\n },\n {\n x: 0.21875,\n y: 0.59375,\n },\n {\n x: 0.28125,\n y: 0.59375,\n },\n {\n x: 0.28125,\n y: 0.59375,\n },\n {\n x: 0.34375,\n y: 0.59375,\n },\n {\n x: 0.34375,\n y: 0.59375,\n },\n {\n x: 0.40625,\n y: 0.59375,\n },\n {\n x: 0.40625,\n y: 0.59375,\n },\n {\n x: 0.46875,\n y: 0.59375,\n },\n {\n x: 0.46875,\n y: 0.59375,\n },\n {\n x: 0.53125,\n y: 0.59375,\n },\n {\n x: 0.53125,\n y: 0.59375,\n },\n {\n x: 0.59375,\n y: 0.59375,\n },\n {\n x: 0.59375,\n y: 0.59375,\n },\n {\n x: 0.65625,\n y: 0.59375,\n },\n {\n x: 0.65625,\n y: 0.59375,\n },\n {\n x: 0.71875,\n y: 0.59375,\n },\n {\n x: 0.71875,\n y: 0.59375,\n },\n {\n x: 0.78125,\n y: 0.59375,\n },\n {\n x: 0.78125,\n y: 0.59375,\n },\n {\n x: 0.84375,\n y: 0.59375,\n },\n {\n x: 0.84375,\n y: 0.59375,\n },\n {\n x: 0.90625,\n y: 0.59375,\n },\n {\n x: 0.90625,\n y: 0.59375,\n },\n {\n x: 0.96875,\n y: 0.59375,\n },\n {\n x: 0.96875,\n y: 0.59375,\n },\n {\n x: 0.03125,\n y: 0.65625,\n },\n {\n x: 0.03125,\n y: 0.65625,\n },\n {\n x: 0.09375,\n y: 0.65625,\n },\n {\n x: 0.09375,\n y: 0.65625,\n },\n {\n x: 0.15625,\n y: 0.65625,\n },\n {\n x: 0.15625,\n y: 0.65625,\n },\n {\n x: 0.21875,\n y: 0.65625,\n },\n {\n x: 0.21875,\n y: 0.65625,\n },\n {\n x: 0.28125,\n y: 0.65625,\n },\n {\n x: 0.28125,\n y: 0.65625,\n },\n {\n x: 0.34375,\n y: 0.65625,\n },\n {\n x: 0.34375,\n y: 0.65625,\n },\n {\n x: 0.40625,\n y: 0.65625,\n },\n {\n x: 0.40625,\n y: 0.65625,\n },\n {\n x: 0.46875,\n y: 0.65625,\n },\n {\n x: 0.46875,\n y: 0.65625,\n },\n {\n x: 0.53125,\n y: 0.65625,\n },\n {\n x: 0.53125,\n y: 0.65625,\n },\n {\n x: 0.59375,\n y: 0.65625,\n },\n {\n x: 0.59375,\n y: 0.65625,\n },\n {\n x: 0.65625,\n y: 0.65625,\n },\n {\n x: 0.65625,\n y: 0.65625,\n },\n {\n x: 0.71875,\n y: 0.65625,\n },\n {\n x: 0.71875,\n y: 0.65625,\n },\n {\n x: 0.78125,\n y: 0.65625,\n },\n {\n x: 0.78125,\n y: 0.65625,\n },\n {\n x: 0.84375,\n y: 0.65625,\n },\n {\n x: 0.84375,\n y: 0.65625,\n },\n {\n x: 0.90625,\n y: 0.65625,\n },\n {\n x: 0.90625,\n y: 0.65625,\n },\n {\n x: 0.96875,\n y: 0.65625,\n },\n {\n x: 0.96875,\n y: 0.65625,\n },\n {\n x: 0.03125,\n y: 0.71875,\n },\n {\n x: 0.03125,\n y: 0.71875,\n },\n {\n x: 0.09375,\n y: 0.71875,\n },\n {\n x: 0.09375,\n y: 0.71875,\n },\n {\n x: 0.15625,\n y: 0.71875,\n },\n {\n x: 0.15625,\n y: 0.71875,\n },\n {\n x: 0.21875,\n y: 0.71875,\n },\n {\n x: 0.21875,\n y: 0.71875,\n },\n {\n x: 0.28125,\n y: 0.71875,\n },\n {\n x: 0.28125,\n y: 0.71875,\n },\n {\n x: 0.34375,\n y: 0.71875,\n },\n {\n x: 0.34375,\n y: 0.71875,\n },\n {\n x: 0.40625,\n y: 0.71875,\n },\n {\n x: 0.40625,\n y: 0.71875,\n },\n {\n x: 0.46875,\n y: 0.71875,\n },\n {\n x: 0.46875,\n y: 0.71875,\n },\n {\n x: 0.53125,\n y: 0.71875,\n },\n {\n x: 0.53125,\n y: 0.71875,\n },\n {\n x: 0.59375,\n y: 0.71875,\n },\n {\n x: 0.59375,\n y: 0.71875,\n },\n {\n x: 0.65625,\n y: 0.71875,\n },\n {\n x: 0.65625,\n y: 0.71875,\n },\n {\n x: 0.71875,\n y: 0.71875,\n },\n {\n x: 0.71875,\n y: 0.71875,\n },\n {\n x: 0.78125,\n y: 0.71875,\n },\n {\n x: 0.78125,\n y: 0.71875,\n },\n {\n x: 0.84375,\n y: 0.71875,\n },\n {\n x: 0.84375,\n y: 0.71875,\n },\n {\n x: 0.90625,\n y: 0.71875,\n },\n {\n x: 0.90625,\n y: 0.71875,\n },\n {\n x: 0.96875,\n y: 0.71875,\n },\n {\n x: 0.96875,\n y: 0.71875,\n },\n {\n x: 0.03125,\n y: 0.78125,\n },\n {\n x: 0.03125,\n y: 0.78125,\n },\n {\n x: 0.09375,\n y: 0.78125,\n },\n {\n x: 0.09375,\n y: 0.78125,\n },\n {\n x: 0.15625,\n y: 0.78125,\n },\n {\n x: 0.15625,\n y: 0.78125,\n },\n {\n x: 0.21875,\n y: 0.78125,\n },\n {\n x: 0.21875,\n y: 0.78125,\n },\n {\n x: 0.28125,\n y: 0.78125,\n },\n {\n x: 0.28125,\n y: 0.78125,\n },\n {\n x: 0.34375,\n y: 0.78125,\n },\n {\n x: 0.34375,\n y: 0.78125,\n },\n {\n x: 0.40625,\n y: 0.78125,\n },\n {\n x: 0.40625,\n y: 0.78125,\n },\n {\n x: 0.46875,\n y: 0.78125,\n },\n {\n x: 0.46875,\n y: 0.78125,\n },\n {\n x: 0.53125,\n y: 0.78125,\n },\n {\n x: 0.53125,\n y: 0.78125,\n },\n {\n x: 0.59375,\n y: 0.78125,\n },\n {\n x: 0.59375,\n y: 0.78125,\n },\n {\n x: 0.65625,\n y: 0.78125,\n },\n {\n x: 0.65625,\n y: 0.78125,\n },\n {\n x: 0.71875,\n y: 0.78125,\n },\n {\n x: 0.71875,\n y: 0.78125,\n },\n {\n x: 0.78125,\n y: 0.78125,\n },\n {\n x: 0.78125,\n y: 0.78125,\n },\n {\n x: 0.84375,\n y: 0.78125,\n },\n {\n x: 0.84375,\n y: 0.78125,\n },\n {\n x: 0.90625,\n y: 0.78125,\n },\n {\n x: 0.90625,\n y: 0.78125,\n },\n {\n x: 0.96875,\n y: 0.78125,\n },\n {\n x: 0.96875,\n y: 0.78125,\n },\n {\n x: 0.03125,\n y: 0.84375,\n },\n {\n x: 0.03125,\n y: 0.84375,\n },\n {\n x: 0.09375,\n y: 0.84375,\n },\n {\n x: 0.09375,\n y: 0.84375,\n },\n {\n x: 0.15625,\n y: 0.84375,\n },\n {\n x: 0.15625,\n y: 0.84375,\n },\n {\n x: 0.21875,\n y: 0.84375,\n },\n {\n x: 0.21875,\n y: 0.84375,\n },\n {\n x: 0.28125,\n y: 0.84375,\n },\n {\n x: 0.28125,\n y: 0.84375,\n },\n {\n x: 0.34375,\n y: 0.84375,\n },\n {\n x: 0.34375,\n y: 0.84375,\n },\n {\n x: 0.40625,\n y: 0.84375,\n },\n {\n x: 0.40625,\n y: 0.84375,\n },\n {\n x: 0.46875,\n y: 0.84375,\n },\n {\n x: 0.46875,\n y: 0.84375,\n },\n {\n x: 0.53125,\n y: 0.84375,\n },\n {\n x: 0.53125,\n y: 0.84375,\n },\n {\n x: 0.59375,\n y: 0.84375,\n },\n {\n x: 0.59375,\n y: 0.84375,\n },\n {\n x: 0.65625,\n y: 0.84375,\n },\n {\n x: 0.65625,\n y: 0.84375,\n },\n {\n x: 0.71875,\n y: 0.84375,\n },\n {\n x: 0.71875,\n y: 0.84375,\n },\n {\n x: 0.78125,\n y: 0.84375,\n },\n {\n x: 0.78125,\n y: 0.84375,\n },\n {\n x: 0.84375,\n y: 0.84375,\n },\n {\n x: 0.84375,\n y: 0.84375,\n },\n {\n x: 0.90625,\n y: 0.84375,\n },\n {\n x: 0.90625,\n y: 0.84375,\n },\n {\n x: 0.96875,\n y: 0.84375,\n },\n {\n x: 0.96875,\n y: 0.84375,\n },\n {\n x: 0.03125,\n y: 0.90625,\n },\n {\n x: 0.03125,\n y: 0.90625,\n },\n {\n x: 0.09375,\n y: 0.90625,\n },\n {\n x: 0.09375,\n y: 0.90625,\n },\n {\n x: 0.15625,\n y: 0.90625,\n },\n {\n x: 0.15625,\n y: 0.90625,\n },\n {\n x: 0.21875,\n y: 0.90625,\n },\n {\n x: 0.21875,\n y: 0.90625,\n },\n {\n x: 0.28125,\n y: 0.90625,\n },\n {\n x: 0.28125,\n y: 0.90625,\n },\n {\n x: 0.34375,\n y: 0.90625,\n },\n {\n x: 0.34375,\n y: 0.90625,\n },\n {\n x: 0.40625,\n y: 0.90625,\n },\n {\n x: 0.40625,\n y: 0.90625,\n },\n {\n x: 0.46875,\n y: 0.90625,\n },\n {\n x: 0.46875,\n y: 0.90625,\n },\n {\n x: 0.53125,\n y: 0.90625,\n },\n {\n x: 0.53125,\n y: 0.90625,\n },\n {\n x: 0.59375,\n y: 0.90625,\n },\n {\n x: 0.59375,\n y: 0.90625,\n },\n {\n x: 0.65625,\n y: 0.90625,\n },\n {\n x: 0.65625,\n y: 0.90625,\n },\n {\n x: 0.71875,\n y: 0.90625,\n },\n {\n x: 0.71875,\n y: 0.90625,\n },\n {\n x: 0.78125,\n y: 0.90625,\n },\n {\n x: 0.78125,\n y: 0.90625,\n },\n {\n x: 0.84375,\n y: 0.90625,\n },\n {\n x: 0.84375,\n y: 0.90625,\n },\n {\n x: 0.90625,\n y: 0.90625,\n },\n {\n x: 0.90625,\n y: 0.90625,\n },\n {\n x: 0.96875,\n y: 0.90625,\n },\n {\n x: 0.96875,\n y: 0.90625,\n },\n {\n x: 0.03125,\n y: 0.96875,\n },\n {\n x: 0.03125,\n y: 0.96875,\n },\n {\n x: 0.09375,\n y: 0.96875,\n },\n {\n x: 0.09375,\n y: 0.96875,\n },\n {\n x: 0.15625,\n y: 0.96875,\n },\n {\n x: 0.15625,\n y: 0.96875,\n },\n {\n x: 0.21875,\n y: 0.96875,\n },\n {\n x: 0.21875,\n y: 0.96875,\n },\n {\n x: 0.28125,\n y: 0.96875,\n },\n {\n x: 0.28125,\n y: 0.96875,\n },\n {\n x: 0.34375,\n y: 0.96875,\n },\n {\n x: 0.34375,\n y: 0.96875,\n },\n {\n x: 0.40625,\n y: 0.96875,\n },\n {\n x: 0.40625,\n y: 0.96875,\n },\n {\n x: 0.46875,\n y: 0.96875,\n },\n {\n x: 0.46875,\n y: 0.96875,\n },\n {\n x: 0.53125,\n y: 0.96875,\n },\n {\n x: 0.53125,\n y: 0.96875,\n },\n {\n x: 0.59375,\n y: 0.96875,\n },\n {\n x: 0.59375,\n y: 0.96875,\n },\n {\n x: 0.65625,\n y: 0.96875,\n },\n {\n x: 0.65625,\n y: 0.96875,\n },\n {\n x: 0.71875,\n y: 0.96875,\n },\n {\n x: 0.71875,\n y: 0.96875,\n },\n {\n x: 0.78125,\n y: 0.96875,\n },\n {\n x: 0.78125,\n y: 0.96875,\n },\n {\n x: 0.84375,\n y: 0.96875,\n },\n {\n x: 0.84375,\n y: 0.96875,\n },\n {\n x: 0.90625,\n y: 0.96875,\n },\n {\n x: 0.90625,\n y: 0.96875,\n },\n {\n x: 0.96875,\n y: 0.96875,\n },\n {\n x: 0.96875,\n y: 0.96875,\n },\n {\n x: 0.0625,\n y: 0.0625,\n },\n {\n x: 0.0625,\n y: 0.0625,\n },\n {\n x: 0.0625,\n y: 0.0625,\n },\n {\n x: 0.0625,\n y: 0.0625,\n },\n {\n x: 0.0625,\n y: 0.0625,\n },\n {\n x: 0.0625,\n y: 0.0625,\n },\n {\n x: 0.1875,\n y: 0.0625,\n },\n {\n x: 0.1875,\n y: 0.0625,\n },\n {\n x: 0.1875,\n y: 0.0625,\n },\n {\n x: 0.1875,\n y: 0.0625,\n },\n {\n x: 0.1875,\n y: 0.0625,\n },\n {\n x: 0.1875,\n y: 0.0625,\n },\n {\n x: 0.3125,\n y: 0.0625,\n },\n {\n x: 0.3125,\n y: 0.0625,\n },\n {\n x: 0.3125,\n y: 0.0625,\n },\n {\n x: 0.3125,\n y: 0.0625,\n },\n {\n x: 0.3125,\n y: 0.0625,\n },\n {\n x: 0.3125,\n y: 0.0625,\n },\n {\n x: 0.4375,\n y: 0.0625,\n },\n {\n x: 0.4375,\n y: 0.0625,\n },\n {\n x: 0.4375,\n y: 0.0625,\n },\n {\n x: 0.4375,\n y: 0.0625,\n },\n {\n x: 0.4375,\n y: 0.0625,\n },\n {\n x: 0.4375,\n y: 0.0625,\n },\n {\n x: 0.5625,\n y: 0.0625,\n },\n {\n x: 0.5625,\n y: 0.0625,\n },\n {\n x: 0.5625,\n y: 0.0625,\n },\n {\n x: 0.5625,\n y: 0.0625,\n },\n {\n x: 0.5625,\n y: 0.0625,\n },\n {\n x: 0.5625,\n y: 0.0625,\n },\n {\n x: 0.6875,\n y: 0.0625,\n },\n {\n x: 0.6875,\n y: 0.0625,\n },\n {\n x: 0.6875,\n y: 0.0625,\n },\n {\n x: 0.6875,\n y: 0.0625,\n },\n {\n x: 0.6875,\n y: 0.0625,\n },\n {\n x: 0.6875,\n y: 0.0625,\n },\n {\n x: 0.8125,\n y: 0.0625,\n },\n {\n x: 0.8125,\n y: 0.0625,\n },\n {\n x: 0.8125,\n y: 0.0625,\n },\n {\n x: 0.8125,\n y: 0.0625,\n },\n {\n x: 0.8125,\n y: 0.0625,\n },\n {\n x: 0.8125,\n y: 0.0625,\n },\n {\n x: 0.9375,\n y: 0.0625,\n },\n {\n x: 0.9375,\n y: 0.0625,\n },\n {\n x: 0.9375,\n y: 0.0625,\n },\n {\n x: 0.9375,\n y: 0.0625,\n },\n {\n x: 0.9375,\n y: 0.0625,\n },\n {\n x: 0.9375,\n y: 0.0625,\n },\n {\n x: 0.0625,\n y: 0.1875,\n },\n {\n x: 0.0625,\n y: 0.1875,\n },\n {\n x: 0.0625,\n y: 0.1875,\n },\n {\n x: 0.0625,\n y: 0.1875,\n },\n {\n x: 0.0625,\n y: 0.1875,\n },\n {\n x: 0.0625,\n y: 0.1875,\n },\n {\n x: 0.1875,\n y: 0.1875,\n },\n {\n x: 0.1875,\n y: 0.1875,\n },\n {\n x: 0.1875,\n y: 0.1875,\n },\n {\n x: 0.1875,\n y: 0.1875,\n },\n {\n x: 0.1875,\n y: 0.1875,\n },\n {\n x: 0.1875,\n y: 0.1875,\n },\n {\n x: 0.3125,\n y: 0.1875,\n },\n {\n x: 0.3125,\n y: 0.1875,\n },\n {\n x: 0.3125,\n y: 0.1875,\n },\n {\n x: 0.3125,\n y: 0.1875,\n },\n {\n x: 0.3125,\n y: 0.1875,\n },\n {\n x: 0.3125,\n y: 0.1875,\n },\n {\n x: 0.4375,\n y: 0.1875,\n },\n {\n x: 0.4375,\n y: 0.1875,\n },\n {\n x: 0.4375,\n y: 0.1875,\n },\n {\n x: 0.4375,\n y: 0.1875,\n },\n {\n x: 0.4375,\n y: 0.1875,\n },\n {\n x: 0.4375,\n y: 0.1875,\n },\n {\n x: 0.5625,\n y: 0.1875,\n },\n {\n x: 0.5625,\n y: 0.1875,\n },\n {\n x: 0.5625,\n y: 0.1875,\n },\n {\n x: 0.5625,\n y: 0.1875,\n },\n {\n x: 0.5625,\n y: 0.1875,\n },\n {\n x: 0.5625,\n y: 0.1875,\n },\n {\n x: 0.6875,\n y: 0.1875,\n },\n {\n x: 0.6875,\n y: 0.1875,\n },\n {\n x: 0.6875,\n y: 0.1875,\n },\n {\n x: 0.6875,\n y: 0.1875,\n },\n {\n x: 0.6875,\n y: 0.1875,\n },\n {\n x: 0.6875,\n y: 0.1875,\n },\n {\n x: 0.8125,\n y: 0.1875,\n },\n {\n x: 0.8125,\n y: 0.1875,\n },\n {\n x: 0.8125,\n y: 0.1875,\n },\n {\n x: 0.8125,\n y: 0.1875,\n },\n {\n x: 0.8125,\n y: 0.1875,\n },\n {\n x: 0.8125,\n y: 0.1875,\n },\n {\n x: 0.9375,\n y: 0.1875,\n },\n {\n x: 0.9375,\n y: 0.1875,\n },\n {\n x: 0.9375,\n y: 0.1875,\n },\n {\n x: 0.9375,\n y: 0.1875,\n },\n {\n x: 0.9375,\n y: 0.1875,\n },\n {\n x: 0.9375,\n y: 0.1875,\n },\n {\n x: 0.0625,\n y: 0.3125,\n },\n {\n x: 0.0625,\n y: 0.3125,\n },\n {\n x: 0.0625,\n y: 0.3125,\n },\n {\n x: 0.0625,\n y: 0.3125,\n },\n {\n x: 0.0625,\n y: 0.3125,\n },\n {\n x: 0.0625,\n y: 0.3125,\n },\n {\n x: 0.1875,\n y: 0.3125,\n },\n {\n x: 0.1875,\n y: 0.3125,\n },\n {\n x: 0.1875,\n y: 0.3125,\n },\n {\n x: 0.1875,\n y: 0.3125,\n },\n {\n x: 0.1875,\n y: 0.3125,\n },\n {\n x: 0.1875,\n y: 0.3125,\n },\n {\n x: 0.3125,\n y: 0.3125,\n },\n {\n x: 0.3125,\n y: 0.3125,\n },\n {\n x: 0.3125,\n y: 0.3125,\n },\n {\n x: 0.3125,\n y: 0.3125,\n },\n {\n x: 0.3125,\n y: 0.3125,\n },\n {\n x: 0.3125,\n y: 0.3125,\n },\n {\n x: 0.4375,\n y: 0.3125,\n },\n {\n x: 0.4375,\n y: 0.3125,\n },\n {\n x: 0.4375,\n y: 0.3125,\n },\n {\n x: 0.4375,\n y: 0.3125,\n },\n {\n x: 0.4375,\n y: 0.3125,\n },\n {\n x: 0.4375,\n y: 0.3125,\n },\n {\n x: 0.5625,\n y: 0.3125,\n },\n {\n x: 0.5625,\n y: 0.3125,\n },\n {\n x: 0.5625,\n y: 0.3125,\n },\n {\n x: 0.5625,\n y: 0.3125,\n },\n {\n x: 0.5625,\n y: 0.3125,\n },\n {\n x: 0.5625,\n y: 0.3125,\n },\n {\n x: 0.6875,\n y: 0.3125,\n },\n {\n x: 0.6875,\n y: 0.3125,\n },\n {\n x: 0.6875,\n y: 0.3125,\n },\n {\n x: 0.6875,\n y: 0.3125,\n },\n {\n x: 0.6875,\n y: 0.3125,\n },\n {\n x: 0.6875,\n y: 0.3125,\n },\n {\n x: 0.8125,\n y: 0.3125,\n },\n {\n x: 0.8125,\n y: 0.3125,\n },\n {\n x: 0.8125,\n y: 0.3125,\n },\n {\n x: 0.8125,\n y: 0.3125,\n },\n {\n x: 0.8125,\n y: 0.3125,\n },\n {\n x: 0.8125,\n y: 0.3125,\n },\n {\n x: 0.9375,\n y: 0.3125,\n },\n {\n x: 0.9375,\n y: 0.3125,\n },\n {\n x: 0.9375,\n y: 0.3125,\n },\n {\n x: 0.9375,\n y: 0.3125,\n },\n {\n x: 0.9375,\n y: 0.3125,\n },\n {\n x: 0.9375,\n y: 0.3125,\n },\n {\n x: 0.0625,\n y: 0.4375,\n },\n {\n x: 0.0625,\n y: 0.4375,\n },\n {\n x: 0.0625,\n y: 0.4375,\n },\n {\n x: 0.0625,\n y: 0.4375,\n },\n {\n x: 0.0625,\n y: 0.4375,\n },\n {\n x: 0.0625,\n y: 0.4375,\n },\n {\n x: 0.1875,\n y: 0.4375,\n },\n {\n x: 0.1875,\n y: 0.4375,\n },\n {\n x: 0.1875,\n y: 0.4375,\n },\n {\n x: 0.1875,\n y: 0.4375,\n },\n {\n x: 0.1875,\n y: 0.4375,\n },\n {\n x: 0.1875,\n y: 0.4375,\n },\n {\n x: 0.3125,\n y: 0.4375,\n },\n {\n x: 0.3125,\n y: 0.4375,\n },\n {\n x: 0.3125,\n y: 0.4375,\n },\n {\n x: 0.3125,\n y: 0.4375,\n },\n {\n x: 0.3125,\n y: 0.4375,\n },\n {\n x: 0.3125,\n y: 0.4375,\n },\n {\n x: 0.4375,\n y: 0.4375,\n },\n {\n x: 0.4375,\n y: 0.4375,\n },\n {\n x: 0.4375,\n y: 0.4375,\n },\n {\n x: 0.4375,\n y: 0.4375,\n },\n {\n x: 0.4375,\n y: 0.4375,\n },\n {\n x: 0.4375,\n y: 0.4375,\n },\n {\n x: 0.5625,\n y: 0.4375,\n },\n {\n x: 0.5625,\n y: 0.4375,\n },\n {\n x: 0.5625,\n y: 0.4375,\n },\n {\n x: 0.5625,\n y: 0.4375,\n },\n {\n x: 0.5625,\n y: 0.4375,\n },\n {\n x: 0.5625,\n y: 0.4375,\n },\n {\n x: 0.6875,\n y: 0.4375,\n },\n {\n x: 0.6875,\n y: 0.4375,\n },\n {\n x: 0.6875,\n y: 0.4375,\n },\n {\n x: 0.6875,\n y: 0.4375,\n },\n {\n x: 0.6875,\n y: 0.4375,\n },\n {\n x: 0.6875,\n y: 0.4375,\n },\n {\n x: 0.8125,\n y: 0.4375,\n },\n {\n x: 0.8125,\n y: 0.4375,\n },\n {\n x: 0.8125,\n y: 0.4375,\n },\n {\n x: 0.8125,\n y: 0.4375,\n },\n {\n x: 0.8125,\n y: 0.4375,\n },\n {\n x: 0.8125,\n y: 0.4375,\n },\n {\n x: 0.9375,\n y: 0.4375,\n },\n {\n x: 0.9375,\n y: 0.4375,\n },\n {\n x: 0.9375,\n y: 0.4375,\n },\n {\n x: 0.9375,\n y: 0.4375,\n },\n {\n x: 0.9375,\n y: 0.4375,\n },\n {\n x: 0.9375,\n y: 0.4375,\n },\n {\n x: 0.0625,\n y: 0.5625,\n },\n {\n x: 0.0625,\n y: 0.5625,\n },\n {\n x: 0.0625,\n y: 0.5625,\n },\n {\n x: 0.0625,\n y: 0.5625,\n },\n {\n x: 0.0625,\n y: 0.5625,\n },\n {\n x: 0.0625,\n y: 0.5625,\n },\n {\n x: 0.1875,\n y: 0.5625,\n },\n {\n x: 0.1875,\n y: 0.5625,\n },\n {\n x: 0.1875,\n y: 0.5625,\n },\n {\n x: 0.1875,\n y: 0.5625,\n },\n {\n x: 0.1875,\n y: 0.5625,\n },\n {\n x: 0.1875,\n y: 0.5625,\n },\n {\n x: 0.3125,\n y: 0.5625,\n },\n {\n x: 0.3125,\n y: 0.5625,\n },\n {\n x: 0.3125,\n y: 0.5625,\n },\n {\n x: 0.3125,\n y: 0.5625,\n },\n {\n x: 0.3125,\n y: 0.5625,\n },\n {\n x: 0.3125,\n y: 0.5625,\n },\n {\n x: 0.4375,\n y: 0.5625,\n },\n {\n x: 0.4375,\n y: 0.5625,\n },\n {\n x: 0.4375,\n y: 0.5625,\n },\n {\n x: 0.4375,\n y: 0.5625,\n },\n {\n x: 0.4375,\n y: 0.5625,\n },\n {\n x: 0.4375,\n y: 0.5625,\n },\n {\n x: 0.5625,\n y: 0.5625,\n },\n {\n x: 0.5625,\n y: 0.5625,\n },\n {\n x: 0.5625,\n y: 0.5625,\n },\n {\n x: 0.5625,\n y: 0.5625,\n },\n {\n x: 0.5625,\n y: 0.5625,\n },\n {\n x: 0.5625,\n y: 0.5625,\n },\n {\n x: 0.6875,\n y: 0.5625,\n },\n {\n x: 0.6875,\n y: 0.5625,\n },\n {\n x: 0.6875,\n y: 0.5625,\n },\n {\n x: 0.6875,\n y: 0.5625,\n },\n {\n x: 0.6875,\n y: 0.5625,\n },\n {\n x: 0.6875,\n y: 0.5625,\n },\n {\n x: 0.8125,\n y: 0.5625,\n },\n {\n x: 0.8125,\n y: 0.5625,\n },\n {\n x: 0.8125,\n y: 0.5625,\n },\n {\n x: 0.8125,\n y: 0.5625,\n },\n {\n x: 0.8125,\n y: 0.5625,\n },\n {\n x: 0.8125,\n y: 0.5625,\n },\n {\n x: 0.9375,\n y: 0.5625,\n },\n {\n x: 0.9375,\n y: 0.5625,\n },\n {\n x: 0.9375,\n y: 0.5625,\n },\n {\n x: 0.9375,\n y: 0.5625,\n },\n {\n x: 0.9375,\n y: 0.5625,\n },\n {\n x: 0.9375,\n y: 0.5625,\n },\n {\n x: 0.0625,\n y: 0.6875,\n },\n {\n x: 0.0625,\n y: 0.6875,\n },\n {\n x: 0.0625,\n y: 0.6875,\n },\n {\n x: 0.0625,\n y: 0.6875,\n },\n {\n x: 0.0625,\n y: 0.6875,\n },\n {\n x: 0.0625,\n y: 0.6875,\n },\n {\n x: 0.1875,\n y: 0.6875,\n },\n {\n x: 0.1875,\n y: 0.6875,\n },\n {\n x: 0.1875,\n y: 0.6875,\n },\n {\n x: 0.1875,\n y: 0.6875,\n },\n {\n x: 0.1875,\n y: 0.6875,\n },\n {\n x: 0.1875,\n y: 0.6875,\n },\n {\n x: 0.3125,\n y: 0.6875,\n },\n {\n x: 0.3125,\n y: 0.6875,\n },\n {\n x: 0.3125,\n y: 0.6875,\n },\n {\n x: 0.3125,\n y: 0.6875,\n },\n {\n x: 0.3125,\n y: 0.6875,\n },\n {\n x: 0.3125,\n y: 0.6875,\n },\n {\n x: 0.4375,\n y: 0.6875,\n },\n {\n x: 0.4375,\n y: 0.6875,\n },\n {\n x: 0.4375,\n y: 0.6875,\n },\n {\n x: 0.4375,\n y: 0.6875,\n },\n {\n x: 0.4375,\n y: 0.6875,\n },\n {\n x: 0.4375,\n y: 0.6875,\n },\n {\n x: 0.5625,\n y: 0.6875,\n },\n {\n x: 0.5625,\n y: 0.6875,\n },\n {\n x: 0.5625,\n y: 0.6875,\n },\n {\n x: 0.5625,\n y: 0.6875,\n },\n {\n x: 0.5625,\n y: 0.6875,\n },\n {\n x: 0.5625,\n y: 0.6875,\n },\n {\n x: 0.6875,\n y: 0.6875,\n },\n {\n x: 0.6875,\n y: 0.6875,\n },\n {\n x: 0.6875,\n y: 0.6875,\n },\n {\n x: 0.6875,\n y: 0.6875,\n },\n {\n x: 0.6875,\n y: 0.6875,\n },\n {\n x: 0.6875,\n y: 0.6875,\n },\n {\n x: 0.8125,\n y: 0.6875,\n },\n {\n x: 0.8125,\n y: 0.6875,\n },\n {\n x: 0.8125,\n y: 0.6875,\n },\n {\n x: 0.8125,\n y: 0.6875,\n },\n {\n x: 0.8125,\n y: 0.6875,\n },\n {\n x: 0.8125,\n y: 0.6875,\n },\n {\n x: 0.9375,\n y: 0.6875,\n },\n {\n x: 0.9375,\n y: 0.6875,\n },\n {\n x: 0.9375,\n y: 0.6875,\n },\n {\n x: 0.9375,\n y: 0.6875,\n },\n {\n x: 0.9375,\n y: 0.6875,\n },\n {\n x: 0.9375,\n y: 0.6875,\n },\n {\n x: 0.0625,\n y: 0.8125,\n },\n {\n x: 0.0625,\n y: 0.8125,\n },\n {\n x: 0.0625,\n y: 0.8125,\n },\n {\n x: 0.0625,\n y: 0.8125,\n },\n {\n x: 0.0625,\n y: 0.8125,\n },\n {\n x: 0.0625,\n y: 0.8125,\n },\n {\n x: 0.1875,\n y: 0.8125,\n },\n {\n x: 0.1875,\n y: 0.8125,\n },\n {\n x: 0.1875,\n y: 0.8125,\n },\n {\n x: 0.1875,\n y: 0.8125,\n },\n {\n x: 0.1875,\n y: 0.8125,\n },\n {\n x: 0.1875,\n y: 0.8125,\n },\n {\n x: 0.3125,\n y: 0.8125,\n },\n {\n x: 0.3125,\n y: 0.8125,\n },\n {\n x: 0.3125,\n y: 0.8125,\n },\n {\n x: 0.3125,\n y: 0.8125,\n },\n {\n x: 0.3125,\n y: 0.8125,\n },\n {\n x: 0.3125,\n y: 0.8125,\n },\n {\n x: 0.4375,\n y: 0.8125,\n },\n {\n x: 0.4375,\n y: 0.8125,\n },\n {\n x: 0.4375,\n y: 0.8125,\n },\n {\n x: 0.4375,\n y: 0.8125,\n },\n {\n x: 0.4375,\n y: 0.8125,\n },\n {\n x: 0.4375,\n y: 0.8125,\n },\n {\n x: 0.5625,\n y: 0.8125,\n },\n {\n x: 0.5625,\n y: 0.8125,\n },\n {\n x: 0.5625,\n y: 0.8125,\n },\n {\n x: 0.5625,\n y: 0.8125,\n },\n {\n x: 0.5625,\n y: 0.8125,\n },\n {\n x: 0.5625,\n y: 0.8125,\n },\n {\n x: 0.6875,\n y: 0.8125,\n },\n {\n x: 0.6875,\n y: 0.8125,\n },\n {\n x: 0.6875,\n y: 0.8125,\n },\n {\n x: 0.6875,\n y: 0.8125,\n },\n {\n x: 0.6875,\n y: 0.8125,\n },\n {\n x: 0.6875,\n y: 0.8125,\n },\n {\n x: 0.8125,\n y: 0.8125,\n },\n {\n x: 0.8125,\n y: 0.8125,\n },\n {\n x: 0.8125,\n y: 0.8125,\n },\n {\n x: 0.8125,\n y: 0.8125,\n },\n {\n x: 0.8125,\n y: 0.8125,\n },\n {\n x: 0.8125,\n y: 0.8125,\n },\n {\n x: 0.9375,\n y: 0.8125,\n },\n {\n x: 0.9375,\n y: 0.8125,\n },\n {\n x: 0.9375,\n y: 0.8125,\n },\n {\n x: 0.9375,\n y: 0.8125,\n },\n {\n x: 0.9375,\n y: 0.8125,\n },\n {\n x: 0.9375,\n y: 0.8125,\n },\n {\n x: 0.0625,\n y: 0.9375,\n },\n {\n x: 0.0625,\n y: 0.9375,\n },\n {\n x: 0.0625,\n y: 0.9375,\n },\n {\n x: 0.0625,\n y: 0.9375,\n },\n {\n x: 0.0625,\n y: 0.9375,\n },\n {\n x: 0.0625,\n y: 0.9375,\n },\n {\n x: 0.1875,\n y: 0.9375,\n },\n {\n x: 0.1875,\n y: 0.9375,\n },\n {\n x: 0.1875,\n y: 0.9375,\n },\n {\n x: 0.1875,\n y: 0.9375,\n },\n {\n x: 0.1875,\n y: 0.9375,\n },\n {\n x: 0.1875,\n y: 0.9375,\n },\n {\n x: 0.3125,\n y: 0.9375,\n },\n {\n x: 0.3125,\n y: 0.9375,\n },\n {\n x: 0.3125,\n y: 0.9375,\n },\n {\n x: 0.3125,\n y: 0.9375,\n },\n {\n x: 0.3125,\n y: 0.9375,\n },\n {\n x: 0.3125,\n y: 0.9375,\n },\n {\n x: 0.4375,\n y: 0.9375,\n },\n {\n x: 0.4375,\n y: 0.9375,\n },\n {\n x: 0.4375,\n y: 0.9375,\n },\n {\n x: 0.4375,\n y: 0.9375,\n },\n {\n x: 0.4375,\n y: 0.9375,\n },\n {\n x: 0.4375,\n y: 0.9375,\n },\n {\n x: 0.5625,\n y: 0.9375,\n },\n {\n x: 0.5625,\n y: 0.9375,\n },\n {\n x: 0.5625,\n y: 0.9375,\n },\n {\n x: 0.5625,\n y: 0.9375,\n },\n {\n x: 0.5625,\n y: 0.9375,\n },\n {\n x: 0.5625,\n y: 0.9375,\n },\n {\n x: 0.6875,\n y: 0.9375,\n },\n {\n x: 0.6875,\n y: 0.9375,\n },\n {\n x: 0.6875,\n y: 0.9375,\n },\n {\n x: 0.6875,\n y: 0.9375,\n },\n {\n x: 0.6875,\n y: 0.9375,\n },\n {\n x: 0.6875,\n y: 0.9375,\n },\n {\n x: 0.8125,\n y: 0.9375,\n },\n {\n x: 0.8125,\n y: 0.9375,\n },\n {\n x: 0.8125,\n y: 0.9375,\n },\n {\n x: 0.8125,\n y: 0.9375,\n },\n {\n x: 0.8125,\n y: 0.9375,\n },\n {\n x: 0.8125,\n y: 0.9375,\n },\n {\n x: 0.9375,\n y: 0.9375,\n },\n {\n x: 0.9375,\n y: 0.9375,\n },\n {\n x: 0.9375,\n y: 0.9375,\n },\n {\n x: 0.9375,\n y: 0.9375,\n },\n {\n x: 0.9375,\n y: 0.9375,\n },\n {\n x: 0.9375,\n y: 0.9375,\n },\n];\n", "import * as tf from '../../dist/tfjs.esm.js';\nimport * as box from './box';\nimport * as anchors from './anchors';\n\nexport class HandDetector {\n model: any;\n anchors: any;\n anchorsTensor: any;\n inputSize: number;\n inputSizeTensor: any;\n doubleInputSizeTensor: any;\n\n constructor(model) {\n this.model = model;\n this.anchors = anchors.anchors.map((anchor) => [anchor.x, anchor.y]);\n this.anchorsTensor = tf.tensor2d(this.anchors);\n this.inputSize = this.model?.inputs[0].shape[2];\n this.inputSizeTensor = tf.tensor1d([this.inputSize, this.inputSize]);\n this.doubleInputSizeTensor = tf.tensor1d([this.inputSize * 2, this.inputSize * 2]);\n }\n\n normalizeBoxes(boxes) {\n return tf.tidy(() => {\n const boxOffsets = tf.slice(boxes, [0, 0], [-1, 2]);\n const boxSizes = tf.slice(boxes, [0, 2], [-1, 2]);\n const boxCenterPoints = tf.add(tf.div(boxOffsets, this.inputSizeTensor), this.anchorsTensor);\n const halfBoxSizes = tf.div(boxSizes, this.doubleInputSizeTensor);\n const startPoints = tf.mul(tf.sub(boxCenterPoints, halfBoxSizes), this.inputSizeTensor);\n const endPoints = tf.mul(tf.add(boxCenterPoints, halfBoxSizes), this.inputSizeTensor);\n return tf.concat2d([startPoints, endPoints], 1);\n });\n }\n\n normalizeLandmarks(rawPalmLandmarks, index) {\n return tf.tidy(() => {\n const landmarks = tf.add(tf.div(rawPalmLandmarks.reshape([-1, 7, 2]), this.inputSizeTensor), this.anchors[index]);\n return tf.mul(landmarks, this.inputSizeTensor);\n });\n }\n\n async getBoxes(input, config) {\n const batched = this.model.predict(input);\n const predictions = batched.squeeze();\n batched.dispose();\n const scoresT = tf.tidy(() => tf.sigmoid(tf.slice(predictions, [0, 0], [-1, 1])).squeeze());\n const scores = scoresT.dataSync();\n const rawBoxes = tf.slice(predictions, [0, 1], [-1, 4]);\n const boxes = this.normalizeBoxes(rawBoxes);\n rawBoxes.dispose();\n const filteredT = await tf.image.nonMaxSuppressionAsync(boxes, scores, config.hand.maxDetected, config.hand.iouThreshold, config.hand.minConfidence);\n const filtered = filteredT.arraySync();\n\n scoresT.dispose();\n filteredT.dispose();\n const hands: Array<{ box: any, palmLandmarks: any, confidence: number }> = [];\n for (const index of filtered) {\n if (scores[index] >= config.hand.minConfidence) {\n const matchingBox = tf.slice(boxes, [index, 0], [1, -1]);\n const rawPalmLandmarks = tf.slice(predictions, [index, 5], [1, 14]);\n const palmLandmarks = tf.tidy(() => this.normalizeLandmarks(rawPalmLandmarks, index).reshape([-1, 2]));\n rawPalmLandmarks.dispose();\n hands.push({ box: matchingBox, palmLandmarks, confidence: scores[index] });\n }\n }\n predictions.dispose();\n boxes.dispose();\n return hands;\n }\n\n async estimateHandBounds(input, config) {\n const inputHeight = input.shape[1];\n const inputWidth = input.shape[2];\n const image = tf.tidy(() => input.resizeBilinear([this.inputSize, this.inputSize]).div(127.5).sub(1));\n const predictions = await this.getBoxes(image, config);\n image.dispose();\n const hands: Array<{}> = [];\n if (!predictions || predictions.length === 0) return hands;\n for (const prediction of predictions) {\n const boxes = prediction.box.dataSync();\n const startPoint = boxes.slice(0, 2);\n const endPoint = boxes.slice(2, 4);\n const palmLandmarks = prediction.palmLandmarks.arraySync();\n prediction.box.dispose();\n prediction.palmLandmarks.dispose();\n hands.push(box.scaleBoxCoordinates({ startPoint, endPoint, palmLandmarks, confidence: prediction.confidence }, [inputWidth / this.inputSize, inputHeight / this.inputSize]));\n }\n return hands;\n }\n}\n", "export function normalizeRadians(angle) {\n return angle - 2 * Math.PI * Math.floor((angle + Math.PI) / (2 * Math.PI));\n}\n\nexport function computeRotation(point1, point2) {\n const radians = Math.PI / 2 - Math.atan2(-(point2[1] - point1[1]), point2[0] - point1[0]);\n return normalizeRadians(radians);\n}\n\nexport const buildTranslationMatrix = (x, y) => [[1, 0, x], [0, 1, y], [0, 0, 1]];\n\nexport function dot(v1, v2) {\n let product = 0;\n for (let i = 0; i < v1.length; i++) {\n product += v1[i] * v2[i];\n }\n return product;\n}\n\nexport function getColumnFrom2DArr(arr, columnIndex) {\n const column: Array = [];\n for (let i = 0; i < arr.length; i++) {\n column.push(arr[i][columnIndex]);\n }\n return column;\n}\n\nexport function multiplyTransformMatrices(mat1, mat2) {\n const product: Array = [];\n const size = mat1.length;\n for (let row = 0; row < size; row++) {\n product.push([]);\n for (let col = 0; col < size; col++) {\n product[row].push(dot(mat1[row], getColumnFrom2DArr(mat2, col)));\n }\n }\n return product;\n}\n\nexport function buildRotationMatrix(rotation, center) {\n const cosA = Math.cos(rotation);\n const sinA = Math.sin(rotation);\n const rotationMatrix = [[cosA, -sinA, 0], [sinA, cosA, 0], [0, 0, 1]];\n const translationMatrix = buildTranslationMatrix(center[0], center[1]);\n const translationTimesRotation = multiplyTransformMatrices(translationMatrix, rotationMatrix);\n const negativeTranslationMatrix = buildTranslationMatrix(-center[0], -center[1]);\n return multiplyTransformMatrices(translationTimesRotation, negativeTranslationMatrix);\n}\n\nexport function invertTransformMatrix(matrix) {\n const rotationComponent = [[matrix[0][0], matrix[1][0]], [matrix[0][1], matrix[1][1]]];\n const translationComponent = [matrix[0][2], matrix[1][2]];\n const invertedTranslation = [\n -dot(rotationComponent[0], translationComponent),\n -dot(rotationComponent[1], translationComponent),\n ];\n return [\n rotationComponent[0].concat(invertedTranslation[0]),\n rotationComponent[1].concat(invertedTranslation[1]),\n [0, 0, 1],\n ];\n}\n\nexport function rotatePoint(homogeneousCoordinate, rotationMatrix) {\n return [\n dot(homogeneousCoordinate, rotationMatrix[0]),\n dot(homogeneousCoordinate, rotationMatrix[1]),\n ];\n}\n", "import * as tf from '../../dist/tfjs.esm.js';\nimport * as box from './box';\nimport * as util from './util';\n\nconst palmBoxEnlargeFactor = 5; // default 3\nconst handBoxEnlargeFactor = 1.65; // default 1.65\nconst palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2];\nconst palmLandmarksPalmBase = 0;\nconst palmLandmarksMiddleFingerBase = 2;\n\nexport class HandPipeline {\n handDetector: any;\n landmarkDetector: any;\n inputSize: number;\n storedBoxes: any;\n skipped: number;\n detectedHands: number;\n\n constructor(handDetector, landmarkDetector) {\n this.handDetector = handDetector;\n this.landmarkDetector = landmarkDetector;\n this.inputSize = this.landmarkDetector?.inputs[0].shape[2];\n this.storedBoxes = [];\n this.skipped = 0;\n this.detectedHands = 0;\n }\n\n // eslint-disable-next-line class-methods-use-this\n calculateLandmarksBoundingBox(landmarks) {\n const xs = landmarks.map((d) => d[0]);\n const ys = landmarks.map((d) => d[1]);\n const startPoint = [Math.min(...xs), Math.min(...ys)];\n const endPoint = [Math.max(...xs), Math.max(...ys)];\n return { startPoint, endPoint };\n }\n\n getBoxForPalmLandmarks(palmLandmarks, rotationMatrix) {\n const rotatedPalmLandmarks = palmLandmarks.map((coord) => util.rotatePoint([...coord, 1], rotationMatrix));\n const boxAroundPalm = this.calculateLandmarksBoundingBox(rotatedPalmLandmarks);\n return box.enlargeBox(box.squarifyBox(boxAroundPalm), palmBoxEnlargeFactor);\n }\n\n getBoxForHandLandmarks(landmarks) {\n const boundingBox = this.calculateLandmarksBoundingBox(landmarks);\n const boxAroundHand = box.enlargeBox(box.squarifyBox(boundingBox), handBoxEnlargeFactor);\n boxAroundHand.palmLandmarks = [];\n for (let i = 0; i < palmLandmarkIds.length; i++) {\n boxAroundHand.palmLandmarks.push(landmarks[palmLandmarkIds[i]].slice(0, 2));\n }\n return boxAroundHand;\n }\n\n transformRawCoords(rawCoords, box2, angle, rotationMatrix) {\n const boxSize = box.getBoxSize(box2);\n const scaleFactor = [boxSize[0] / this.inputSize, boxSize[1] / this.inputSize, (boxSize[0] + boxSize[1]) / this.inputSize / 2];\n const coordsScaled = rawCoords.map((coord) => [\n scaleFactor[0] * (coord[0] - this.inputSize / 2),\n scaleFactor[1] * (coord[1] - this.inputSize / 2),\n scaleFactor[2] * coord[2],\n ]);\n const coordsRotationMatrix = util.buildRotationMatrix(angle, [0, 0]);\n const coordsRotated = coordsScaled.map((coord) => {\n const rotated = util.rotatePoint(coord, coordsRotationMatrix);\n return [...rotated, coord[2]];\n });\n const inverseRotationMatrix = util.invertTransformMatrix(rotationMatrix);\n const boxCenter = [...box.getBoxCenter(box2), 1];\n const originalBoxCenter = [\n util.dot(boxCenter, inverseRotationMatrix[0]),\n util.dot(boxCenter, inverseRotationMatrix[1]),\n ];\n return coordsRotated.map((coord) => [\n coord[0] + originalBoxCenter[0],\n coord[1] + originalBoxCenter[1],\n coord[2],\n ]);\n }\n\n async estimateHands(image, config) {\n let useFreshBox = false;\n\n // run new detector every skipFrames unless we only want box to start with\n let boxes;\n if ((this.skipped === 0) || (this.skipped > config.hand.skipFrames) || !config.hand.landmarks || !config.videoOptimized) {\n boxes = await this.handDetector.estimateHandBounds(image, config);\n this.skipped = 0;\n }\n if (config.videoOptimized) this.skipped++;\n\n // if detector result count doesn't match current working set, use it to reset current working set\n if (boxes && (boxes.length > 0) && ((boxes.length !== this.detectedHands) && (this.detectedHands !== config.hand.maxDetected) || !config.hand.landmarks)) {\n this.detectedHands = 0;\n this.storedBoxes = [...boxes];\n // for (const possible of boxes) this.storedBoxes.push(possible);\n if (this.storedBoxes.length > 0) useFreshBox = true;\n }\n const hands: Array<{}> = [];\n\n if (config.hand.skipInitial && this.detectedHands === 0) this.skipped = 0;\n\n // go through working set of boxes\n for (let i = 0; i < this.storedBoxes.length; i++) {\n const currentBox = this.storedBoxes[i];\n if (!currentBox) continue;\n if (config.hand.landmarks) {\n const angle = config.hand.rotation ? util.computeRotation(currentBox.palmLandmarks[palmLandmarksPalmBase], currentBox.palmLandmarks[palmLandmarksMiddleFingerBase]) : 0;\n const palmCenter = box.getBoxCenter(currentBox);\n const palmCenterNormalized = [palmCenter[0] / image.shape[2], palmCenter[1] / image.shape[1]];\n const rotatedImage = config.hand.rotation ? tf.image.rotateWithOffset(image, angle, 0, palmCenterNormalized) : image.clone();\n const rotationMatrix = util.buildRotationMatrix(-angle, palmCenter);\n const newBox = useFreshBox ? this.getBoxForPalmLandmarks(currentBox.palmLandmarks, rotationMatrix) : currentBox;\n const croppedInput = box.cutBoxFromImageAndResize(newBox, rotatedImage, [this.inputSize, this.inputSize]);\n const handImage = croppedInput.div(255);\n croppedInput.dispose();\n rotatedImage.dispose();\n const [confidenceT, keypoints] = await this.landmarkDetector.predict(handImage);\n handImage.dispose();\n const confidence = confidenceT.dataSync()[0];\n confidenceT.dispose();\n if (confidence >= config.hand.minConfidence) {\n const keypointsReshaped = tf.reshape(keypoints, [-1, 3]);\n const rawCoords = keypointsReshaped.arraySync();\n keypoints.dispose();\n keypointsReshaped.dispose();\n const coords = this.transformRawCoords(rawCoords, newBox, angle, rotationMatrix);\n const nextBoundingBox = this.getBoxForHandLandmarks(coords);\n this.storedBoxes[i] = nextBoundingBox;\n const result = {\n landmarks: coords,\n confidence,\n box: { topLeft: nextBoundingBox.startPoint, bottomRight: nextBoundingBox.endPoint },\n };\n hands.push(result);\n } else {\n this.storedBoxes[i] = null;\n }\n keypoints.dispose();\n } else {\n // const enlarged = box.enlargeBox(box.squarifyBox(box.shiftBox(currentBox, HAND_BOX_SHIFT_VECTOR)), handBoxEnlargeFactor);\n const enlarged = box.enlargeBox(box.squarifyBox(currentBox), handBoxEnlargeFactor);\n const result = {\n confidence: currentBox.confidence,\n box: { topLeft: enlarged.startPoint, bottomRight: enlarged.endPoint },\n };\n hands.push(result);\n }\n }\n this.storedBoxes = this.storedBoxes.filter((a) => a !== null);\n this.detectedHands = hands.length;\n return hands;\n }\n}\n", "// paper: https://ai.googleblog.com/2020/08/on-device-real-time-body-pose-tracking.html\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as annotations from './annotations';\n\nlet model;\n\nexport async function load(config) {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.body.modelPath));\n model.width = parseInt(model.signature.inputs['input_1:0'].tensorShape.dim[2].size);\n model.height = parseInt(model.signature.inputs['input_1:0'].tensorShape.dim[1].size);\n if (!model || !model.modelUrl) log('load model failed:', config.body.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n\nexport async function predict(image, config) {\n if (!model) return null;\n if (!config.body.enabled) return null;\n const imgSize = { width: image.shape[2], height: image.shape[1] };\n const resize = tf.image.resizeBilinear(image, [model.width, model.height], false);\n const normalize = tf.div(resize, [255.0]);\n resize.dispose();\n const resT = await model.predict(normalize);\n const points = resT.find((t) => (t.size === 195 || t.size === 155)).dataSync(); // order of output tensors may change between models, full has 195 and upper has 155 items\n resT.forEach((t) => t.dispose());\n normalize.dispose();\n const keypoints: Array<{ id, part, position: { x, y, z }, score, presence }> = [];\n const labels = points.length === 195 ? annotations.full : annotations.upper; // full model has 39 keypoints, upper has 31 keypoints\n const depth = 5; // each points has x,y,z,visibility,presence\n for (let i = 0; i < points.length / depth; i++) {\n keypoints.push({\n id: i,\n part: labels[i],\n position: {\n x: Math.trunc(imgSize.width * points[depth * i + 0] / 255), // return normalized x value istead of 0..255\n y: Math.trunc(imgSize.height * points[depth * i + 1] / 255), // return normalized y value istead of 0..255\n z: Math.trunc(points[depth * i + 2]) + 0, // fix negative zero\n },\n score: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 3])))) / 100, // reverse sigmoid value\n presence: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 4])))) / 100, // reverse sigmoid value\n });\n }\n const score = keypoints.reduce((prev, curr) => (curr.score > prev ? curr.score : prev), 0);\n return [{ score, keypoints }];\n}\n", "export const full = [\n 'nose',\n 'leftEyeInside',\n 'leftEye',\n 'leftEyeOutside',\n 'rightEyeInside',\n 'rightEye',\n 'rightEyeOutside',\n 'leftEar',\n 'rightEar',\n 'leftMouth',\n 'rightMouth',\n 'leftShoulder',\n 'rightShoulder',\n 'leftElbow',\n 'rightElbow',\n 'leftWrist',\n 'rightWrist',\n 'leftPalm',\n 'rightPalm',\n 'leftIndex',\n 'rightIndex',\n 'leftPinky',\n 'rightPinky',\n 'leftHip',\n 'rightHip',\n 'leftKnee',\n 'rightKnee',\n 'leftAnkle',\n 'rightAnkle',\n 'leftHeel',\n 'rightHeel',\n 'leftFoot',\n 'rightFoot',\n 'midHip',\n 'forehead',\n 'leftThumb',\n 'leftHand',\n 'rightThumb',\n 'rightHand',\n];\n\nexport const upper = [\n 'nose',\n 'leftEyeInside',\n 'leftEye',\n 'leftEyeOutside',\n 'rightEyeInside',\n 'rightEye',\n 'rightEyeOutside',\n 'leftEar',\n 'rightEar',\n 'leftMouth',\n 'rightMouth',\n 'leftShoulder',\n 'rightShoulder',\n 'leftElbow',\n 'rightElbow',\n 'left:15',\n 'right:16',\n 'left:17',\n 'right:18',\n 'left:19',\n 'right:20',\n 'left:21',\n 'right:22',\n 'leftChest',\n 'rightChest',\n 'neck',\n 'forehead',\n 'left:27',\n 'right:28',\n 'left:29',\n 'right:30',\n];\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport { labels } from './labels';\n\nlet model;\nlet last: Array<{}> = [];\nlet skipped = Number.MAX_SAFE_INTEGER;\n\nconst scaleBox = 2.5; // increase box size\n\nexport async function load(config) {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.object.modelPath));\n const inputs = Object.values(model.modelSignature['inputs']);\n model.inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : null;\n if (!model.inputSize) throw new Error(`Human: Cannot determine model inputSize: ${config.object.modelPath}`);\n if (!model || !model.modelUrl) log('load model failed:', config.object.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n\nasync function process(res, inputSize, outputShape, config) {\n let id = 0;\n let results: Array<{ score: number, strideSize: number, class: number, label: string, center: number[], centerRaw: number[], box: number[], boxRaw: number[] }> = [];\n for (const strideSize of [1, 2, 4]) { // try each stride size as it detects large/medium/small objects\n // find scores, boxes, classes\n tf.tidy(() => { // wrap in tidy to automatically deallocate temp tensors\n const baseSize = strideSize * 13; // 13x13=169, 26x26=676, 52x52=2704\n // find boxes and scores output depending on stride\n const scoresT = res.find((a) => (a.shape[1] === (baseSize ** 2) && a.shape[2] === labels.length))?.squeeze();\n const featuresT = res.find((a) => (a.shape[1] === (baseSize ** 2) && a.shape[2] < labels.length))?.squeeze();\n const boxesMax = featuresT.reshape([-1, 4, featuresT.shape[1] / 4]); // reshape [output] to [4, output / 4] where number is number of different features inside each stride\n const boxIdx = boxesMax.argMax(2).arraySync(); // what we need is indexes of features with highest scores, not values itself\n const scores = scoresT.arraySync(); // optionally use exponential scores or just as-is\n for (let i = 0; i < scoresT.shape[0]; i++) { // total strides (x * y matrix)\n for (let j = 0; j < scoresT.shape[1]; j++) { // one score for each class\n const score = scores[i][j]; // get score for current position\n if (score > config.object.minConfidence && j !== 61) {\n const cx = (0.5 + Math.trunc(i % baseSize)) / baseSize; // center.x normalized to range 0..1\n const cy = (0.5 + Math.trunc(i / baseSize)) / baseSize; // center.y normalized to range 0..1\n const boxOffset = boxIdx[i].map((a) => a * (baseSize / strideSize / inputSize)); // just grab indexes of features with highest scores\n const [x, y] = [\n cx - (scaleBox / strideSize * boxOffset[0]),\n cy - (scaleBox / strideSize * boxOffset[1]),\n ];\n const [w, h] = [\n cx + (scaleBox / strideSize * boxOffset[2]) - x,\n cy + (scaleBox / strideSize * boxOffset[3]) - y,\n ];\n let boxRaw = [x, y, w, h]; // results normalized to range 0..1\n boxRaw = boxRaw.map((a) => Math.max(0, Math.min(a, 1))); // fix out-of-bounds coords\n const box = [ // results normalized to input image pixels\n boxRaw[0] * outputShape[0],\n boxRaw[1] * outputShape[1],\n boxRaw[2] * outputShape[0],\n boxRaw[3] * outputShape[1],\n ];\n const result = {\n id: id++,\n strideSize,\n score: Math.round(100 * score) / 100,\n class: j + 1,\n label: labels[j].label,\n center: [Math.trunc(outputShape[0] * cx), Math.trunc(outputShape[1] * cy)],\n centerRaw: [cx, cy],\n box: box.map((a) => Math.trunc(a)),\n boxRaw,\n };\n results.push(result);\n }\n }\n }\n });\n }\n // deallocate tensors\n res.forEach((t) => tf.dispose(t));\n\n // normally nms is run on raw results, but since boxes need to be calculated this way we skip calulcation of\n // unnecessary boxes and run nms only on good candidates (basically it just does IOU analysis as scores are already filtered)\n const nmsBoxes = results.map((a) => a.boxRaw);\n const nmsScores = results.map((a) => a.score);\n let nmsIdx: any[] = [];\n if (nmsBoxes && nmsBoxes.length > 0) {\n const nms = await tf.image.nonMaxSuppressionAsync(nmsBoxes, nmsScores, config.object.maxDetected, config.object.iouThreshold, config.object.minConfidence);\n nmsIdx = nms.dataSync();\n tf.dispose(nms);\n }\n\n // filter & sort results\n results = results\n .filter((a, idx) => nmsIdx.includes(idx))\n .sort((a, b) => (b.score - a.score));\n\n return results;\n}\n\nexport async function predict(image, config) {\n if (!model) return null;\n // console.log(skipped, config.object.skipFrames, config.videoOptimized, ((skipped < config.object.skipFrames) && config.videoOptimized && (last.length > 0)));\n if ((skipped < config.object.skipFrames) && config.videoOptimized && (last.length > 0)) {\n skipped++;\n return last;\n }\n if (config.videoOptimized) skipped = 0;\n else skipped = Number.MAX_SAFE_INTEGER;\n return new Promise(async (resolve) => {\n const outputSize = [image.shape[2], image.shape[1]];\n const resize = tf.image.resizeBilinear(image, [model.inputSize, model.inputSize], false);\n const norm = resize.div(255);\n const transpose = norm.transpose([0, 3, 1, 2]);\n norm.dispose();\n resize.dispose();\n\n let objectT;\n if (config.object.enabled) objectT = await model.predict(transpose);\n transpose.dispose();\n\n const obj = await process(objectT, model.inputSize, outputSize, config);\n last = obj;\n resolve(obj);\n });\n}\n", "export const labels = [\n { class: 1, label: 'person' },\n { class: 2, label: 'bicycle' },\n { class: 3, label: 'car' },\n { class: 4, label: 'motorcycle' },\n { class: 5, label: 'airplane' },\n { class: 6, label: 'bus' },\n { class: 7, label: 'train' },\n { class: 8, label: 'truck' },\n { class: 9, label: 'boat' },\n { class: 10, label: 'traffic light' },\n { class: 11, label: 'fire hydrant' },\n { class: 12, label: 'stop sign' },\n { class: 13, label: 'parking meter' },\n { class: 14, label: 'bench' },\n { class: 15, label: 'bird' },\n { class: 16, label: 'cat' },\n { class: 17, label: 'dog' },\n { class: 18, label: 'horse' },\n { class: 19, label: 'sheep' },\n { class: 20, label: 'cow' },\n { class: 21, label: 'elephant' },\n { class: 22, label: 'bear' },\n { class: 23, label: 'zebra' },\n { class: 24, label: 'giraffe' },\n { class: 25, label: 'backpack' },\n { class: 26, label: 'umbrella' },\n { class: 27, label: 'handbag' },\n { class: 28, label: 'tie' },\n { class: 29, label: 'suitcase' },\n { class: 30, label: 'frisbee' },\n { class: 31, label: 'skis' },\n { class: 32, label: 'snowboard' },\n { class: 33, label: 'sports ball' },\n { class: 34, label: 'kite' },\n { class: 35, label: 'baseball bat' },\n { class: 36, label: 'baseball glove' },\n { class: 37, label: 'skateboard' },\n { class: 38, label: 'surfboard' },\n { class: 39, label: 'tennis racket' },\n { class: 40, label: 'bottle' },\n { class: 41, label: 'wine glass' },\n { class: 42, label: 'cup' },\n { class: 43, label: 'fork' },\n { class: 44, label: 'knife' },\n { class: 45, label: 'spoon' },\n { class: 46, label: 'bowl' },\n { class: 47, label: 'banana' },\n { class: 48, label: 'apple' },\n { class: 49, label: 'sandwich' },\n { class: 50, label: 'orange' },\n { class: 51, label: 'broccoli' },\n { class: 52, label: 'carrot' },\n { class: 53, label: 'hot dog' },\n { class: 54, label: 'pizza' },\n { class: 55, label: 'donut' },\n { class: 56, label: 'cake' },\n { class: 57, label: 'chair' },\n { class: 58, label: 'couch' },\n { class: 59, label: 'potted plant' },\n { class: 60, label: 'bed' },\n { class: 61, label: 'dining table' },\n { class: 62, label: 'toilet' },\n { class: 63, label: 'tv' },\n { class: 64, label: 'laptop' },\n { class: 65, label: 'mouse' },\n { class: 66, label: 'remote' },\n { class: 67, label: 'keyboard' },\n { class: 68, label: 'cell phone' },\n { class: 69, label: 'microwave' },\n { class: 70, label: 'oven' },\n { class: 71, label: 'toaster' },\n { class: 72, label: 'sink' },\n { class: 73, label: 'refrigerator' },\n { class: 74, label: 'book' },\n { class: 75, label: 'clock' },\n { class: 76, label: 'vase' },\n { class: 77, label: 'scissors' },\n { class: 78, label: 'teddy bear' },\n { class: 79, label: 'hair drier' },\n { class: 80, label: 'toothbrush' },\n];\n", "export const body = (res) => {\n if (!res) return [];\n const gestures: Array<{ body: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n // raising hands\n const leftWrist = res[i].keypoints.find((a) => (a.part === 'leftWrist'));\n const rightWrist = res[i].keypoints.find((a) => (a.part === 'rightWrist'));\n const nose = res[i].keypoints.find((a) => (a.part === 'nose'));\n if (nose && leftWrist && rightWrist && (leftWrist.position.y < nose.position.y) && (rightWrist.position.y < nose.position.y)) gestures.push({ body: i, gesture: 'i give up' });\n else if (nose && leftWrist && (leftWrist.position.y < nose.position.y)) gestures.push({ body: i, gesture: 'raise left hand' });\n else if (nose && rightWrist && (rightWrist.position.y < nose.position.y)) gestures.push({ body: i, gesture: 'raise right hand' });\n\n // leaning\n const leftShoulder = res[i].keypoints.find((a) => (a.part === 'leftShoulder'));\n const rightShoulder = res[i].keypoints.find((a) => (a.part === 'rightShoulder'));\n if (leftShoulder && rightShoulder) gestures.push({ body: i, gesture: `leaning ${(leftShoulder.position.y > rightShoulder.position.y) ? 'left' : 'right'}` });\n }\n return gestures;\n};\n\nexport const face = (res) => {\n if (!res) return [];\n const gestures: Array<{ face: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n if (res[i].mesh && res[i].mesh.length > 0) {\n const eyeFacing = res[i].mesh[33][2] - res[i].mesh[263][2];\n if (Math.abs(eyeFacing) < 10) gestures.push({ face: i, gesture: 'facing center' });\n else gestures.push({ face: i, gesture: `facing ${eyeFacing < 0 ? 'left' : 'right'}` });\n const openLeft = Math.abs(res[i].mesh[374][1] - res[i].mesh[386][1]) / Math.abs(res[i].mesh[443][1] - res[i].mesh[450][1]); // center of eye inner lid y coord div center of wider eye border y coord\n if (openLeft < 0.2) gestures.push({ face: i, gesture: 'blink left eye' });\n const openRight = Math.abs(res[i].mesh[145][1] - res[i].mesh[159][1]) / Math.abs(res[i].mesh[223][1] - res[i].mesh[230][1]); // center of eye inner lid y coord div center of wider eye border y coord\n if (openRight < 0.2) gestures.push({ face: i, gesture: 'blink right eye' });\n const mouthOpen = Math.min(100, 500 * Math.abs(res[i].mesh[13][1] - res[i].mesh[14][1]) / Math.abs(res[i].mesh[10][1] - res[i].mesh[152][1]));\n if (mouthOpen > 10) gestures.push({ face: i, gesture: `mouth ${Math.trunc(mouthOpen)}% open` });\n const chinDepth = res[i].mesh[152][2];\n if (Math.abs(chinDepth) > 10) gestures.push({ face: i, gesture: `head ${chinDepth < 0 ? 'up' : 'down'}` });\n }\n }\n return gestures;\n};\n\nexport const iris = (res) => {\n if (!res) return [];\n const gestures: Array<{ iris: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n if (!res[i].annotations || !res[i].annotations.leftEyeIris || !res[i].annotations.rightEyeIris) continue;\n const sizeXLeft = res[i].annotations.leftEyeIris[3][0] - res[i].annotations.leftEyeIris[1][0];\n const sizeYLeft = res[i].annotations.leftEyeIris[4][1] - res[i].annotations.leftEyeIris[2][1];\n const areaLeft = Math.abs(sizeXLeft * sizeYLeft);\n\n const sizeXRight = res[i].annotations.rightEyeIris[3][0] - res[i].annotations.rightEyeIris[1][0];\n const sizeYRight = res[i].annotations.rightEyeIris[4][1] - res[i].annotations.rightEyeIris[2][1];\n const areaRight = Math.abs(sizeXRight * sizeYRight);\n\n let center = false;\n const difference = Math.abs(areaLeft - areaRight) / Math.max(areaLeft, areaRight);\n if (difference < 0.25) {\n center = true;\n gestures.push({ iris: i, gesture: 'facing center' });\n }\n\n const rightIrisCenterX = Math.abs(res[i].mesh[33][0] - res[i].annotations.rightEyeIris[0][0]) / res[i].annotations.rightEyeIris[0][0];\n const leftIrisCenterX = Math.abs(res[i].mesh[263][0] - res[i].annotations.leftEyeIris[0][0]) / res[i].annotations.leftEyeIris[0][0];\n if (leftIrisCenterX > 0.033 || rightIrisCenterX > 0.033) center = false;\n if (leftIrisCenterX > 0.033) gestures.push({ iris: i, gesture: 'looking right' });\n if (rightIrisCenterX > 0.033) gestures.push({ iris: i, gesture: 'looking left' });\n\n const rightIrisCenterY = Math.abs(res[i].mesh[145][1] - res[i].annotations.rightEyeIris[0][1]) / res[i].annotations.rightEyeIris[0][1];\n const leftIrisCenterY = Math.abs(res[i].mesh[374][1] - res[i].annotations.leftEyeIris[0][1]) / res[i].annotations.leftEyeIris[0][1];\n if (leftIrisCenterY < 0.015 || rightIrisCenterY < 0.015 || leftIrisCenterY > 0.030 || rightIrisCenterY > 0.030) center = false;\n if (leftIrisCenterY < 0.015 || rightIrisCenterY < 0.015) gestures.push({ iris: i, gesture: 'looking down' });\n if (leftIrisCenterY > 0.030 || rightIrisCenterY > 0.030) gestures.push({ iris: i, gesture: 'looking up' });\n\n // still center;\n if (center) gestures.push({ iris: i, gesture: 'looking center' });\n }\n return gestures;\n};\n\nexport const hand = (res) => {\n if (!res) return [];\n const gestures: Array<{ hand: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n const fingers: Array<{ name: string, position: number }> = [];\n for (const [finger, pos] of Object.entries(res[i]['annotations'])) {\n if (finger !== 'palmBase' && Array.isArray(pos)) fingers.push({ name: finger.toLowerCase(), position: pos[0] }); // get tip of each finger\n }\n if (fingers && fingers.length > 0) {\n const closest = fingers.reduce((best, a) => (best.position[2] < a.position[2] ? best : a));\n const highest = fingers.reduce((best, a) => (best.position[1] < a.position[1] ? best : a));\n gestures.push({ hand: i, gesture: `${closest.name} forward ${highest.name} up` });\n }\n }\n return gestures;\n};\n", "import * as tf from '../../dist/tfjs.esm.js';\nimport * as fxImage from './imagefx';\n\nconst maxSize = 2048;\n// internal temp canvases\nlet inCanvas;\nlet outCanvas;\n// instance of fximage\nlet fx;\n\n// process input image and return tensor\n// input can be tensor, imagedata, htmlimageelement, htmlvideoelement\n// input is resized and run through imagefx filter\nexport function process(input, config): { tensor: typeof tf.Tensor | null, canvas: OffscreenCanvas | HTMLCanvasElement } {\n let tensor;\n if (!input) throw new Error('Human: Input is missing');\n // sanity checks since different browsers do not implement all dom elements\n if (\n !(input instanceof tf.Tensor)\n && !(typeof Image !== 'undefined' && input instanceof Image)\n && !(typeof ImageData !== 'undefined' && input instanceof ImageData)\n && !(typeof ImageBitmap !== 'undefined' && input instanceof ImageBitmap)\n && !(typeof HTMLImageElement !== 'undefined' && input instanceof HTMLImageElement)\n && !(typeof HTMLMediaElement !== 'undefined' && input instanceof HTMLMediaElement)\n && !(typeof HTMLVideoElement !== 'undefined' && input instanceof HTMLVideoElement)\n && !(typeof HTMLCanvasElement !== 'undefined' && input instanceof HTMLCanvasElement)\n && !(typeof OffscreenCanvas !== 'undefined' && input instanceof OffscreenCanvas)\n ) {\n throw new Error('Human: Input type is not recognized');\n }\n if (input instanceof tf.Tensor) {\n // if input is tensor, use as-is\n if (input.shape && input.shape.length === 4 && input.shape[0] === 1 && input.shape[3] === 3) tensor = tf.clone(input);\n else throw new Error(`Human: Input tensor shape must be [1, height, width, 3] and instead was ${input.shape}`);\n } else {\n // check if resizing will be needed\n const originalWidth = input['naturalWidth'] || input['videoWidth'] || input['width'] || (input['shape'] && (input['shape'][1] > 0));\n const originalHeight = input['naturalHeight'] || input['videoHeight'] || input['height'] || (input['shape'] && (input['shape'][2] > 0));\n let targetWidth = originalWidth;\n let targetHeight = originalHeight;\n if (targetWidth > maxSize) {\n targetWidth = maxSize;\n targetHeight = targetWidth * originalHeight / originalWidth;\n }\n if (targetHeight > maxSize) {\n targetHeight = maxSize;\n targetWidth = targetHeight * originalWidth / originalHeight;\n }\n\n // create our canvas and resize it if needed\n if (config.filter.width > 0) targetWidth = config.filter.width;\n else if (config.filter.height > 0) targetWidth = originalWidth * (config.filter.height / originalHeight);\n if (config.filter.height > 0) targetHeight = config.filter.height;\n else if (config.filter.width > 0) targetHeight = originalHeight * (config.filter.width / originalWidth);\n if (!targetWidth || !targetHeight) throw new Error('Human: Input cannot determine dimension');\n if (!inCanvas || (inCanvas?.width !== targetWidth) || (inCanvas?.height !== targetHeight)) {\n inCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(targetWidth, targetHeight) : document.createElement('canvas');\n if (inCanvas?.width !== targetWidth) inCanvas.width = targetWidth;\n if (inCanvas?.height !== targetHeight) inCanvas.height = targetHeight;\n }\n\n // draw input to our canvas\n const ctx = inCanvas.getContext('2d');\n if (input instanceof ImageData) {\n ctx.putImageData(input, 0, 0);\n } else {\n if (config.filter.flip && typeof ctx.translate !== 'undefined') {\n ctx.translate(originalWidth, 0);\n ctx.scale(-1, 1);\n ctx.drawImage(input, 0, 0, originalWidth, originalHeight, 0, 0, inCanvas?.width, inCanvas?.height);\n ctx.setTransform(1, 0, 0, 1, 0, 0); // resets transforms to defaults\n } else {\n ctx.drawImage(input, 0, 0, originalWidth, originalHeight, 0, 0, inCanvas?.width, inCanvas?.height);\n }\n }\n\n // imagefx transforms using gl\n if (config.filter.enabled) {\n if (!fx || !outCanvas || (inCanvas.width !== outCanvas.width) || (inCanvas?.height !== outCanvas?.height)) {\n outCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(inCanvas?.width, inCanvas?.height) : document.createElement('canvas');\n if (outCanvas?.width !== inCanvas?.width) outCanvas.width = inCanvas?.width;\n if (outCanvas?.height !== inCanvas?.height) outCanvas.height = inCanvas?.height;\n // log('created FX filter');\n fx = tf.ENV.flags.IS_BROWSER ? new fxImage.GLImageFilter({ canvas: outCanvas }) : null; // && (typeof document !== 'undefined')\n }\n if (!fx) return { tensor: null, canvas: inCanvas };\n fx.reset();\n fx.addFilter('brightness', config.filter.brightness); // must have at least one filter enabled\n if (config.filter.contrast !== 0) fx.addFilter('contrast', config.filter.contrast);\n if (config.filter.sharpness !== 0) fx.addFilter('sharpen', config.filter.sharpness);\n if (config.filter.blur !== 0) fx.addFilter('blur', config.filter.blur);\n if (config.filter.saturation !== 0) fx.addFilter('saturation', config.filter.saturation);\n if (config.filter.hue !== 0) fx.addFilter('hue', config.filter.hue);\n if (config.filter.negative) fx.addFilter('negative');\n if (config.filter.sepia) fx.addFilter('sepia');\n if (config.filter.vintage) fx.addFilter('brownie');\n if (config.filter.sepia) fx.addFilter('sepia');\n if (config.filter.kodachrome) fx.addFilter('kodachrome');\n if (config.filter.technicolor) fx.addFilter('technicolor');\n if (config.filter.polaroid) fx.addFilter('polaroid');\n if (config.filter.pixelate !== 0) fx.addFilter('pixelate', config.filter.pixelate);\n fx.apply(inCanvas);\n // read pixel data\n /*\n const gl = outCanvas.getContext('webgl');\n if (gl) {\n const glBuffer = new Uint8Array(outCanvas.width * outCanvas.height * 4);\n const pixBuffer = new Uint8Array(outCanvas.width * outCanvas.height * 3);\n gl.readPixels(0, 0, outCanvas.width, outCanvas.height, gl.RGBA, gl.UNSIGNED_BYTE, glBuffer);\n // gl returns rbga while we only need rgb, so discarding alpha channel\n // gl returns starting point as lower left, so need to invert vertical\n let i = 0;\n for (let y = outCanvas.height - 1; y >= 0; y--) {\n for (let x = 0; x < outCanvas.width; x++) {\n const index = (x + y * outCanvas.width) * 4;\n pixBuffer[i++] = glBuffer[index + 0];\n pixBuffer[i++] = glBuffer[index + 1];\n pixBuffer[i++] = glBuffer[index + 2];\n }\n }\n outCanvas.data = pixBuffer;\n }\n */\n } else {\n outCanvas = inCanvas;\n if (fx) fx = null;\n }\n\n // create tensor from image\n let pixels;\n if (outCanvas.data) { // if we have data, just convert to tensor\n const shape = [outCanvas.height, outCanvas.width, 3];\n pixels = tf.tensor3d(outCanvas.data, shape, 'int32');\n } else if (outCanvas instanceof ImageData) { // if input is imagedata, just use it\n pixels = tf.browser.fromPixels(outCanvas);\n } else if (config.backend === 'webgl' || config.backend === 'humangl') { // tf kernel-optimized method to get imagedata\n // we can use canvas as-is as it already has a context, so we do a silly one more canvas\n const tempCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(targetWidth, targetHeight) : document.createElement('canvas');\n tempCanvas.width = targetWidth;\n tempCanvas.height = targetHeight;\n const tempCtx = tempCanvas.getContext('2d');\n tempCtx?.drawImage(outCanvas, 0, 0);\n pixels = tf.browser.fromPixels(tempCanvas);\n } else { // cpu and wasm kernel does not implement efficient fromPixels method\n // we can use canvas as-is as it already has a context, so we do a silly one more canvas\n const tempCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(targetWidth, targetHeight) : document.createElement('canvas');\n tempCanvas.width = targetWidth;\n tempCanvas.height = targetHeight;\n const tempCtx = tempCanvas.getContext('2d');\n tempCtx?.drawImage(outCanvas, 0, 0);\n const data = tempCtx?.getImageData(0, 0, targetWidth, targetHeight);\n pixels = tf.browser.fromPixels(data);\n }\n const casted = pixels.toFloat();\n tensor = casted.expandDims(0);\n pixels.dispose();\n casted.dispose();\n }\n const canvas = config.filter.return ? outCanvas : null;\n return { tensor, canvas };\n}\n", "/*\nWebGLImageFilter - MIT Licensed\n2013, Dominic Szablewski - phoboslab.org\n\n*/\n\nfunction GLProgram(gl, vertexSource, fragmentSource) {\n const _collect = function (source, prefix, collection) {\n const r = new RegExp('\\\\b' + prefix + ' \\\\w+ (\\\\w+)', 'ig');\n source.replace(r, (match, name) => {\n collection[name] = 0;\n return match;\n });\n };\n\n const _compile = function (source, type) {\n const shader = gl.createShader(type);\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) throw new Error('Filter: GL compile failed', gl.getShaderInfoLog(shader));\n return shader;\n };\n\n this.uniform = {};\n this.attribute = {};\n const _vsh = _compile(vertexSource, gl.VERTEX_SHADER);\n const _fsh = _compile(fragmentSource, gl.FRAGMENT_SHADER);\n this.id = gl.createProgram();\n gl.attachShader(this.id, _vsh);\n gl.attachShader(this.id, _fsh);\n gl.linkProgram(this.id);\n\n if (!gl.getProgramParameter(this.id, gl.LINK_STATUS)) throw new Error('Filter: GL link failed', gl.getProgramInfoLog(this.id));\n\n gl.useProgram(this.id);\n // Collect attributes\n _collect(vertexSource, 'attribute', this.attribute);\n for (const a in this.attribute) this.attribute[a] = gl.getAttribLocation(this.id, a);\n // Collect uniforms\n _collect(vertexSource, 'uniform', this.uniform);\n _collect(fragmentSource, 'uniform', this.uniform);\n for (const u in this.uniform) this.uniform[u] = gl.getUniformLocation(this.id, u);\n}\n\n// export const GLImageFilter = function (params) {\nexport function GLImageFilter(params) {\n if (!params) params = { };\n let _drawCount = 0;\n let _sourceTexture = null;\n let _lastInChain = false;\n let _currentFramebufferIndex = -1;\n let _tempFramebuffers = [null, null];\n let _filterChain = [];\n let _width = -1;\n let _height = -1;\n let _vertexBuffer = null;\n let _currentProgram = null;\n const _filter = {};\n const _canvas = params.canvas || document.createElement('canvas');\n // key is the shader program source, value is the compiled program\n const _shaderProgramCache = { };\n const DRAW = { INTERMEDIATE: 1 };\n const gl = _canvas.getContext('webgl');\n if (!gl) throw new Error('Filter: getContext() failed');\n\n this.addFilter = function (name) {\n // eslint-disable-next-line prefer-rest-params\n const args = Array.prototype.slice.call(arguments, 1);\n const filter = _filter[name];\n _filterChain.push({ func: filter, args });\n };\n\n this.reset = function () {\n _filterChain = [];\n };\n\n const _resize = function (width, height) {\n // Same width/height? Nothing to do here\n if (width === _width && height === _height) { return; }\n _canvas.width = width;\n _width = width;\n _canvas.height = height;\n _height = height;\n // Create the context if we don't have it yet\n if (!_vertexBuffer) {\n // Create the vertex buffer for the two triangles [x, y, u, v] * 6\n const vertices = new Float32Array([\n -1, -1, 0, 1, 1, -1, 1, 1, -1, 1, 0, 0,\n -1, 1, 0, 0, 1, -1, 1, 1, 1, 1, 1, 0,\n ]);\n // eslint-disable-next-line no-unused-expressions\n (_vertexBuffer = gl.createBuffer(), gl.bindBuffer(gl.ARRAY_BUFFER, _vertexBuffer));\n gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n }\n gl.viewport(0, 0, _width, _height);\n // Delete old temp framebuffers\n _tempFramebuffers = [null, null];\n };\n\n const _createFramebufferTexture = function (width, height) {\n const fbo = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);\n const renderbuffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer);\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n return { fbo, texture };\n };\n\n const _getTempFramebuffer = function (index) {\n _tempFramebuffers[index] = _tempFramebuffers[index] || _createFramebufferTexture(_width, _height);\n return _tempFramebuffers[index];\n };\n\n const _draw = function (flags = null) {\n let source = null;\n let target = null;\n let flipY = false;\n // Set up the source\n if (_drawCount === 0) {\n // First draw call - use the source texture\n source = _sourceTexture;\n } else {\n // All following draw calls use the temp buffer last drawn to\n source = _getTempFramebuffer(_currentFramebufferIndex)?.texture;\n }\n _drawCount++;\n // Set up the target\n if (_lastInChain && !(flags & DRAW.INTERMEDIATE)) {\n // Last filter in our chain - draw directly to the WebGL Canvas. We may\n // also have to flip the image vertically now\n target = null;\n flipY = _drawCount % 2 === 0;\n } else {\n // Intermediate draw call - get a temp buffer to draw to\n _currentFramebufferIndex = (_currentFramebufferIndex + 1) % 2;\n target = _getTempFramebuffer(_currentFramebufferIndex)?.fbo;\n }\n // Bind the source and target and draw the two triangles\n gl.bindTexture(gl.TEXTURE_2D, source);\n gl.bindFramebuffer(gl.FRAMEBUFFER, target);\n gl.uniform1f(_currentProgram.uniform.flipY, (flipY ? -1 : 1));\n gl.drawArrays(gl.TRIANGLES, 0, 6);\n };\n\n this.apply = function (image) {\n _resize(image.width, image.height);\n _drawCount = 0;\n // Create the texture for the input image if we haven't yet\n if (!_sourceTexture) _sourceTexture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, _sourceTexture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);\n // No filters? Just draw\n if (_filterChain.length === 0) {\n // const program = _compileShader(SHADER.FRAGMENT_IDENTITY);\n _draw();\n return _canvas;\n }\n for (let i = 0; i < _filterChain.length; i++) {\n _lastInChain = (i === _filterChain.length - 1);\n const f = _filterChain[i];\n f.func.apply(this, f.args || []);\n }\n return _canvas;\n };\n\n const _compileShader = function (fragmentSource) {\n if (_shaderProgramCache[fragmentSource]) {\n _currentProgram = _shaderProgramCache[fragmentSource];\n gl.useProgram(_currentProgram.id);\n return _currentProgram;\n }\n // Compile shaders\n const SHADER = {};\n SHADER.VERTEX_IDENTITY = [\n 'precision highp float;',\n 'attribute vec2 pos;',\n 'attribute vec2 uv;',\n 'varying vec2 vUv;',\n 'uniform float flipY;',\n 'void main(void) {',\n 'vUv = uv;',\n 'gl_Position = vec4(pos.x, pos.y*flipY, 0.0, 1.);',\n '}',\n ].join('\\n');\n SHADER.FRAGMENT_IDENTITY = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'void main(void) {',\n 'gl_FragColor = texture2D(texture, vUv);',\n '}',\n ].join('\\n');\n _currentProgram = new GLProgram(gl, SHADER.VERTEX_IDENTITY, fragmentSource);\n const floatSize = Float32Array.BYTES_PER_ELEMENT;\n const vertSize = 4 * floatSize;\n gl.enableVertexAttribArray(_currentProgram.attribute.pos);\n gl.vertexAttribPointer(_currentProgram.attribute.pos, 2, gl.FLOAT, false, vertSize, 0 * floatSize);\n gl.enableVertexAttribArray(_currentProgram.attribute.uv);\n gl.vertexAttribPointer(_currentProgram.attribute.uv, 2, gl.FLOAT, false, vertSize, 2 * floatSize);\n _shaderProgramCache[fragmentSource] = _currentProgram;\n return _currentProgram;\n };\n\n // -------------------------------------------------------------------------\n // Color Matrix Filter\n _filter.colorMatrix = function (matrix) {\n // Create a Float32 Array and normalize the offset component to 0-1\n const m = new Float32Array(matrix);\n m[4] /= 255;\n m[9] /= 255;\n m[14] /= 255;\n m[19] /= 255;\n // Can we ignore the alpha value? Makes things a bit faster.\n const shader = (m[18] === 1 && m[3] === 0 && m[8] === 0 && m[13] === 0 && m[15] === 0 && m[16] === 0 && m[17] === 0 && m[19] === 0)\n ? _filter.colorMatrix.SHADER.WITHOUT_ALPHA\n : _filter.colorMatrix.SHADER.WITH_ALPHA;\n const program = _compileShader(shader);\n gl.uniform1fv(program.uniform.m, m);\n _draw();\n };\n _filter.colorMatrix.SHADER = {};\n _filter.colorMatrix.SHADER.WITH_ALPHA = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform float m[20];',\n 'void main(void) {',\n 'vec4 c = texture2D(texture, vUv);',\n 'gl_FragColor.r = m[0] * c.r + m[1] * c.g + m[2] * c.b + m[3] * c.a + m[4];',\n 'gl_FragColor.g = m[5] * c.r + m[6] * c.g + m[7] * c.b + m[8] * c.a + m[9];',\n 'gl_FragColor.b = m[10] * c.r + m[11] * c.g + m[12] * c.b + m[13] * c.a + m[14];',\n 'gl_FragColor.a = m[15] * c.r + m[16] * c.g + m[17] * c.b + m[18] * c.a + m[19];',\n '}',\n ].join('\\n');\n _filter.colorMatrix.SHADER.WITHOUT_ALPHA = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform float m[20];',\n 'void main(void) {',\n 'vec4 c = texture2D(texture, vUv);',\n 'gl_FragColor.r = m[0] * c.r + m[1] * c.g + m[2] * c.b + m[4];',\n 'gl_FragColor.g = m[5] * c.r + m[6] * c.g + m[7] * c.b + m[9];',\n 'gl_FragColor.b = m[10] * c.r + m[11] * c.g + m[12] * c.b + m[14];',\n 'gl_FragColor.a = c.a;',\n '}',\n ].join('\\n');\n\n _filter.brightness = function (brightness) {\n const b = (brightness || 0) + 1;\n _filter.colorMatrix([\n b, 0, 0, 0, 0,\n 0, b, 0, 0, 0,\n 0, 0, b, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.saturation = function (amount) {\n const x = (amount || 0) * 2 / 3 + 1;\n const y = ((x - 1) * -0.5);\n _filter.colorMatrix([\n x, y, y, 0, 0,\n y, x, y, 0, 0,\n y, y, x, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.desaturate = function () {\n _filter.saturation(-1);\n };\n\n _filter.contrast = function (amount) {\n const v = (amount || 0) + 1;\n const o = -128 * (v - 1);\n\n _filter.colorMatrix([\n v, 0, 0, 0, o,\n 0, v, 0, 0, o,\n 0, 0, v, 0, o,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.negative = function () {\n _filter.contrast(-2);\n };\n\n _filter.hue = function (rotation) {\n rotation = (rotation || 0) / 180 * Math.PI;\n const cos = Math.cos(rotation);\n const sin = Math.sin(rotation);\n const lumR = 0.213;\n const lumG = 0.715;\n const lumB = 0.072;\n\n _filter.colorMatrix([\n lumR + cos * (1 - lumR) + sin * (-lumR), lumG + cos * (-lumG) + sin * (-lumG), lumB + cos * (-lumB) + sin * (1 - lumB), 0, 0,\n lumR + cos * (-lumR) + sin * (0.143), lumG + cos * (1 - lumG) + sin * (0.140), lumB + cos * (-lumB) + sin * (-0.283), 0, 0,\n lumR + cos * (-lumR) + sin * (-(1 - lumR)), lumG + cos * (-lumG) + sin * (lumG), lumB + cos * (1 - lumB) + sin * (lumB), 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.desaturateLuminance = function () {\n _filter.colorMatrix([\n 0.2764723, 0.9297080, 0.0938197, 0, -37.1,\n 0.2764723, 0.9297080, 0.0938197, 0, -37.1,\n 0.2764723, 0.9297080, 0.0938197, 0, -37.1,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.sepia = function () {\n _filter.colorMatrix([\n 0.393, 0.7689999, 0.18899999, 0, 0,\n 0.349, 0.6859999, 0.16799999, 0, 0,\n 0.272, 0.5339999, 0.13099999, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.brownie = function () {\n _filter.colorMatrix([\n 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873,\n -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127,\n 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.vintagePinhole = function () {\n _filter.colorMatrix([\n 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123,\n 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591,\n 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.kodachrome = function () {\n _filter.colorMatrix([\n 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502,\n -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203,\n -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.technicolor = function () {\n _filter.colorMatrix([\n 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337,\n -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398,\n -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.polaroid = function () {\n _filter.colorMatrix([\n 1.438, -0.062, -0.062, 0, 0,\n -0.122, 1.378, -0.122, 0, 0,\n -0.016, -0.016, 1.483, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.shiftToBGR = function () {\n _filter.colorMatrix([\n 0, 0, 1, 0, 0,\n 0, 1, 0, 0, 0,\n 1, 0, 0, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n // -------------------------------------------------------------------------\n // Convolution Filter\n _filter.convolution = function (matrix) {\n const m = new Float32Array(matrix);\n const pixelSizeX = 1 / _width;\n const pixelSizeY = 1 / _height;\n const program = _compileShader(_filter.convolution.SHADER);\n gl.uniform1fv(program.uniform.m, m);\n gl.uniform2f(program.uniform.px, pixelSizeX, pixelSizeY);\n _draw();\n };\n\n _filter.convolution.SHADER = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform vec2 px;',\n 'uniform float m[9];',\n 'void main(void) {',\n 'vec4 c11 = texture2D(texture, vUv - px);', // top left\n 'vec4 c12 = texture2D(texture, vec2(vUv.x, vUv.y - px.y));', // top center\n 'vec4 c13 = texture2D(texture, vec2(vUv.x + px.x, vUv.y - px.y));', // top right\n 'vec4 c21 = texture2D(texture, vec2(vUv.x - px.x, vUv.y) );', // mid left\n 'vec4 c22 = texture2D(texture, vUv);', // mid center\n 'vec4 c23 = texture2D(texture, vec2(vUv.x + px.x, vUv.y) );', // mid right\n 'vec4 c31 = texture2D(texture, vec2(vUv.x - px.x, vUv.y + px.y) );', // bottom left\n 'vec4 c32 = texture2D(texture, vec2(vUv.x, vUv.y + px.y) );', // bottom center\n 'vec4 c33 = texture2D(texture, vUv + px );', // bottom right\n 'gl_FragColor = ',\n 'c11 * m[0] + c12 * m[1] + c22 * m[2] +',\n 'c21 * m[3] + c22 * m[4] + c23 * m[5] +',\n 'c31 * m[6] + c32 * m[7] + c33 * m[8];',\n 'gl_FragColor.a = c22.a;',\n '}',\n ].join('\\n');\n\n _filter.detectEdges = function () {\n _filter.convolution.call(this, [\n 0, 1, 0,\n 1, -4, 1,\n 0, 1, 0,\n ]);\n };\n\n _filter.sobelX = function () {\n _filter.convolution.call(this, [\n -1, 0, 1,\n -2, 0, 2,\n -1, 0, 1,\n ]);\n };\n\n _filter.sobelY = function () {\n _filter.convolution.call(this, [\n -1, -2, -1,\n 0, 0, 0,\n 1, 2, 1,\n ]);\n };\n\n _filter.sharpen = function (amount) {\n const a = amount || 1;\n _filter.convolution.call(this, [\n 0, -1 * a, 0,\n -1 * a, 1 + 4 * a, -1 * a,\n 0, -1 * a, 0,\n ]);\n };\n\n _filter.emboss = function (size) {\n const s = size || 1;\n _filter.convolution.call(this, [\n -2 * s, -1 * s, 0,\n -1 * s, 1, 1 * s,\n 0, 1 * s, 2 * s,\n ]);\n };\n\n // -------------------------------------------------------------------------\n // Blur Filter\n _filter.blur = function (size) {\n const blurSizeX = (size / 7) / _width;\n const blurSizeY = (size / 7) / _height;\n const program = _compileShader(_filter.blur.SHADER);\n // Vertical\n gl.uniform2f(program.uniform.px, 0, blurSizeY);\n _draw(DRAW.INTERMEDIATE);\n // Horizontal\n gl.uniform2f(program.uniform.px, blurSizeX, 0);\n _draw();\n };\n\n _filter.blur.SHADER = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform vec2 px;',\n 'void main(void) {',\n 'gl_FragColor = vec4(0.0);',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-7.0*px.x, -7.0*px.y))*0.0044299121055113265;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-6.0*px.x, -6.0*px.y))*0.00895781211794;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-5.0*px.x, -5.0*px.y))*0.0215963866053;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-4.0*px.x, -4.0*px.y))*0.0443683338718;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-3.0*px.x, -3.0*px.y))*0.0776744219933;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-2.0*px.x, -2.0*px.y))*0.115876621105;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-1.0*px.x, -1.0*px.y))*0.147308056121;',\n 'gl_FragColor += texture2D(texture, vUv )*0.159576912161;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 1.0*px.x, 1.0*px.y))*0.147308056121;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 2.0*px.x, 2.0*px.y))*0.115876621105;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 3.0*px.x, 3.0*px.y))*0.0776744219933;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 4.0*px.x, 4.0*px.y))*0.0443683338718;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 5.0*px.x, 5.0*px.y))*0.0215963866053;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 6.0*px.x, 6.0*px.y))*0.00895781211794;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 7.0*px.x, 7.0*px.y))*0.0044299121055113265;',\n '}',\n ].join('\\n');\n\n // -------------------------------------------------------------------------\n // Pixelate Filter\n _filter.pixelate = function (size) {\n const blurSizeX = (size) / _width;\n const blurSizeY = (size) / _height;\n const program = _compileShader(_filter.pixelate.SHADER);\n // Horizontal\n gl.uniform2f(program.uniform.size, blurSizeX, blurSizeY);\n _draw();\n };\n\n _filter.pixelate.SHADER = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform vec2 size;',\n 'uniform sampler2D texture;',\n 'vec2 pixelate(vec2 coord, vec2 size) {',\n 'return floor( coord / size ) * size;',\n '}',\n 'void main(void) {',\n 'gl_FragColor = vec4(0.0);',\n 'vec2 coord = pixelate(vUv, size);',\n 'gl_FragColor += texture2D(texture, coord);',\n '}',\n ].join('\\n');\n}\n", "import { TRI468 as triangulation } from '../blazeface/coords';\nimport { mergeDeep } from '../helpers';\n\n/**\n * Draw Options\n * Accessed via `human.draw.options` or provided per each draw method as the drawOptions optional parameter\n * -color: draw color\n * -labelColor: color for labels\n * -shadowColor: optional shadow color for labels\n * -font: font for labels\n * -lineHeight: line height for labels, used for multi-line labels,\n * -lineWidth: width of any lines,\n * -pointSize: size of any point,\n * -roundRect: for boxes, round corners by this many pixels,\n * -drawPoints: should points be drawn,\n * -drawLabels: should labels be drawn,\n * -drawBoxes: should boxes be drawn,\n * -drawPolygons: should polygons be drawn,\n * -fillPolygons: should drawn polygons be filled,\n * -useDepth: use z-axis coordinate as color shade,\n * -useCurves: draw polygons as cures or as lines,\n * -bufferedOutput: experimental: allows to call draw methods multiple times for each detection and interpolate results between results thus achieving smoother animations\n * -useRawBoxes: Boolean: internal: use non-normalized coordinates when performing draw methods,\n */\nexport interface DrawOptions {\n color: string,\n labelColor: string,\n shadowColor: string,\n font: string,\n lineHeight: number,\n lineWidth: number,\n pointSize: number,\n roundRect: number,\n drawPoints: Boolean,\n drawLabels: Boolean,\n drawBoxes: Boolean,\n drawPolygons: Boolean,\n fillPolygons: Boolean,\n useDepth: Boolean,\n useCurves: Boolean,\n bufferedOutput: Boolean,\n useRawBoxes: Boolean,\n calculateHandBox: Boolean,\n}\n\nexport const options: DrawOptions = {\n color: 'rgba(173, 216, 230, 0.3)', // 'lightblue' with light alpha channel\n labelColor: 'rgba(173, 216, 230, 1)', // 'lightblue' with dark alpha channel\n shadowColor: 'black',\n font: 'small-caps 16px \"Segoe UI\"',\n lineHeight: 24,\n lineWidth: 6,\n pointSize: 2,\n roundRect: 28,\n drawPoints: false,\n drawLabels: true,\n drawBoxes: false,\n drawPolygons: true,\n fillPolygons: false,\n useDepth: true,\n useCurves: false,\n bufferedOutput: false,\n useRawBoxes: false,\n calculateHandBox: true,\n};\n\nfunction point(ctx, x, y, z = 0, localOptions) {\n ctx.fillStyle = localOptions.useDepth && z ? `rgba(${127.5 + (2 * z)}, ${127.5 - (2 * z)}, 255, 0.3)` : localOptions.color;\n ctx.beginPath();\n ctx.arc(x, y, localOptions.pointSize, 0, 2 * Math.PI);\n ctx.fill();\n}\n\nfunction rect(ctx, x, y, width, height, localOptions) {\n ctx.beginPath();\n if (localOptions.useCurves) {\n const cx = (x + x + width) / 2;\n const cy = (y + y + height) / 2;\n ctx.ellipse(cx, cy, width / 2, height / 2, 0, 0, 2 * Math.PI);\n } else {\n ctx.lineWidth = localOptions.lineWidth;\n ctx.moveTo(x + localOptions.roundRect, y);\n ctx.lineTo(x + width - localOptions.roundRect, y);\n ctx.quadraticCurveTo(x + width, y, x + width, y + localOptions.roundRect);\n ctx.lineTo(x + width, y + height - localOptions.roundRect);\n ctx.quadraticCurveTo(x + width, y + height, x + width - localOptions.roundRect, y + height);\n ctx.lineTo(x + localOptions.roundRect, y + height);\n ctx.quadraticCurveTo(x, y + height, x, y + height - localOptions.roundRect);\n ctx.lineTo(x, y + localOptions.roundRect);\n ctx.quadraticCurveTo(x, y, x + localOptions.roundRect, y);\n ctx.closePath();\n }\n ctx.stroke();\n}\n\nfunction lines(ctx, points: number[] = [], localOptions) {\n if (points === undefined || points.length === 0) return;\n ctx.beginPath();\n ctx.moveTo(points[0][0], points[0][1]);\n for (const pt of points) {\n ctx.strokeStyle = localOptions.useDepth && pt[2] ? `rgba(${127.5 + (2 * pt[2])}, ${127.5 - (2 * pt[2])}, 255, 0.3)` : localOptions.color;\n ctx.fillStyle = localOptions.useDepth && pt[2] ? `rgba(${127.5 + (2 * pt[2])}, ${127.5 - (2 * pt[2])}, 255, 0.3)` : localOptions.color;\n ctx.lineTo(pt[0], parseInt(pt[1]));\n }\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.closePath();\n ctx.fill();\n }\n}\n\nfunction curves(ctx, points: number[] = [], localOptions) {\n if (points === undefined || points.length === 0) return;\n if (!localOptions.useCurves || points.length <= 2) {\n lines(ctx, points, localOptions);\n return;\n }\n ctx.moveTo(points[0][0], points[0][1]);\n for (let i = 0; i < points.length - 2; i++) {\n const xc = (points[i][0] + points[i + 1][0]) / 2;\n const yc = (points[i][1] + points[i + 1][1]) / 2;\n ctx.quadraticCurveTo(points[i][0], points[i][1], xc, yc);\n }\n ctx.quadraticCurveTo(points[points.length - 2][0], points[points.length - 2][1], points[points.length - 1][0], points[points.length - 1][1]);\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.closePath();\n ctx.fill();\n }\n}\n\nexport async function gesture(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.font = localOptions.font;\n ctx.fillStyle = localOptions.color;\n let i = 1;\n for (let j = 0; j < result.length; j++) {\n let where:any[] = [];\n let what:any[] = [];\n [where, what] = Object.entries(result[j]);\n if ((what.length > 1) && (what[1].length > 0)) {\n const person = where[1] > 0 ? `#${where[1]}` : '';\n const label = `${where[0]} ${person}: ${what[1]}`;\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(label, 8, 2 + (i * localOptions.lineHeight));\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(label, 6, 0 + (i * localOptions.lineHeight));\n i += 1;\n }\n }\n}\n\nexport async function face(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n for (const f of result) {\n ctx.font = localOptions.font;\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n if (localOptions.drawBoxes) {\n if (localOptions.useRawBoxes) rect(ctx, inCanvas.width * f.boxRaw[0], inCanvas.height * f.boxRaw[1], inCanvas.width * f.boxRaw[2], inCanvas.height * f.boxRaw[3], localOptions);\n else rect(ctx, f.box[0], f.box[1], f.box[2], f.box[3], localOptions);\n }\n // silly hack since fillText does not suport new line\n const labels:string[] = [];\n labels.push(`face confidence: ${Math.trunc(100 * f.confidence)}%`);\n if (f.genderConfidence) labels.push(`${f.gender || ''} ${Math.trunc(100 * f.genderConfidence)}% confident`);\n // if (f.genderConfidence) labels.push(f.gender);\n if (f.age) labels.push(`age: ${f.age || ''}`);\n if (f.iris) labels.push(`iris distance: ${f.iris}`);\n if (f.emotion && f.emotion.length > 0) {\n const emotion = f.emotion.map((a) => `${Math.trunc(100 * a.score)}% ${a.emotion}`);\n labels.push(emotion.join(' '));\n }\n if (f.rotation && f.rotation.angle && f.rotation.angle.roll) labels.push(`roll: ${Math.trunc(100 * f.rotation.angle.roll) / 100} yaw:${Math.trunc(100 * f.rotation.angle.yaw) / 100} pitch:${Math.trunc(100 * f.rotation.angle.pitch) / 100}`);\n if (labels.length === 0) labels.push('face');\n ctx.fillStyle = localOptions.color;\n for (let i = labels.length - 1; i >= 0; i--) {\n const x = Math.max(f.box[0], 0);\n const y = i * localOptions.lineHeight + f.box[1];\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(labels[i], x + 5, y + 16);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(labels[i], x + 4, y + 15);\n }\n ctx.lineWidth = 1;\n if (f.mesh && f.mesh.length > 0) {\n if (localOptions.drawPoints) {\n for (const pt of f.mesh) point(ctx, pt[0], pt[1], pt[2], localOptions);\n // for (const pt of f.meshRaw) point(ctx, pt[0] * inCanvas.offsetWidth, pt[1] * inCanvas.offsetHeight, pt[2]);\n }\n if (localOptions.drawPolygons) {\n ctx.lineWidth = 1;\n for (let i = 0; i < triangulation.length / 3; i++) {\n const points = [\n triangulation[i * 3 + 0],\n triangulation[i * 3 + 1],\n triangulation[i * 3 + 2],\n ].map((index) => f.mesh[index]);\n lines(ctx, points, localOptions);\n }\n // iris: array[center, left, top, right, bottom]\n if (f.annotations && f.annotations.leftEyeIris) {\n ctx.strokeStyle = localOptions.useDepth ? 'rgba(255, 200, 255, 0.3)' : localOptions.color;\n ctx.beginPath();\n const sizeX = Math.abs(f.annotations.leftEyeIris[3][0] - f.annotations.leftEyeIris[1][0]) / 2;\n const sizeY = Math.abs(f.annotations.leftEyeIris[4][1] - f.annotations.leftEyeIris[2][1]) / 2;\n ctx.ellipse(f.annotations.leftEyeIris[0][0], f.annotations.leftEyeIris[0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.fillStyle = localOptions.useDepth ? 'rgba(255, 255, 200, 0.3)' : localOptions.color;\n ctx.fill();\n }\n }\n if (f.annotations && f.annotations.rightEyeIris) {\n ctx.strokeStyle = localOptions.useDepth ? 'rgba(255, 200, 255, 0.3)' : localOptions.color;\n ctx.beginPath();\n const sizeX = Math.abs(f.annotations.rightEyeIris[3][0] - f.annotations.rightEyeIris[1][0]) / 2;\n const sizeY = Math.abs(f.annotations.rightEyeIris[4][1] - f.annotations.rightEyeIris[2][1]) / 2;\n ctx.ellipse(f.annotations.rightEyeIris[0][0], f.annotations.rightEyeIris[0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.fillStyle = localOptions.useDepth ? 'rgba(255, 255, 200, 0.3)' : localOptions.color;\n ctx.fill();\n }\n }\n }\n }\n }\n}\n\nconst lastDrawnPose:any[] = [];\nexport async function body(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.lineJoin = 'round';\n for (let i = 0; i < result.length; i++) {\n // result[i].keypoints = result[i].keypoints.filter((a) => a.score > 0.5);\n if (!lastDrawnPose[i] && localOptions.bufferedOutput) lastDrawnPose[i] = { ...result[i] };\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n ctx.lineWidth = localOptions.lineWidth;\n ctx.font = localOptions.font;\n if (localOptions.drawBoxes) {\n rect(ctx, result[i].box[0], result[i].box[1], result[i].box[2], result[i].box[3], localOptions);\n if (localOptions.drawLabels) {\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(`body ${100 * result[i].score}%`, result[i].box[0] + 3, 1 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(`body ${100 * result[i].score}%`, result[i].box[0] + 2, 0 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);\n }\n }\n if (localOptions.drawPoints) {\n for (let pt = 0; pt < result[i].keypoints.length; pt++) {\n ctx.fillStyle = localOptions.useDepth && result[i].keypoints[pt].position.z ? `rgba(${127.5 + (2 * result[i].keypoints[pt].position.z)}, ${127.5 - (2 * result[i].keypoints[pt].position.z)}, 255, 0.5)` : localOptions.color;\n if (localOptions.bufferedOutput) {\n lastDrawnPose[i].keypoints[pt][0] = (lastDrawnPose[i].keypoints[pt][0] + result[i].keypoints[pt].position.x) / 2;\n lastDrawnPose[i].keypoints[pt][1] = (lastDrawnPose[i].keypoints[pt][1] + result[i].keypoints[pt].position.y) / 2;\n point(ctx, lastDrawnPose[i].keypoints[pt][0], lastDrawnPose[i].keypoints[pt][1], 0, localOptions);\n } else {\n point(ctx, result[i].keypoints[pt].position.x, result[i].keypoints[pt].position.y, 0, localOptions);\n }\n }\n }\n if (localOptions.drawLabels) {\n ctx.font = localOptions.font;\n if (result[i].keypoints) {\n for (const pt of result[i].keypoints) {\n ctx.fillStyle = localOptions.useDepth && pt.position.z ? `rgba(${127.5 + (2 * pt.position.z)}, ${127.5 - (2 * pt.position.z)}, 255, 0.5)` : localOptions.color;\n ctx.fillText(`${pt.part} ${Math.trunc(100 * pt.score)}%`, pt.position.x + 4, pt.position.y + 4);\n }\n }\n }\n if (localOptions.drawPolygons && result[i].keypoints) {\n let part;\n const points: any[] = [];\n // shoulder line\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'leftShoulder');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightShoulder');\n if (part) points.push([part.position.x, part.position.y]);\n curves(ctx, points, localOptions);\n // torso main\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'rightShoulder');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightHip');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftHip');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftShoulder');\n if (part) points.push([part.position.x, part.position.y]);\n if (points.length === 4) lines(ctx, points, localOptions); // only draw if we have complete torso\n // leg left\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'leftHip');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftKnee');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftAnkle');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftHeel');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftFoot');\n if (part) points.push([part.position.x, part.position.y]);\n curves(ctx, points, localOptions);\n // leg right\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'rightHip');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightKnee');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightAnkle');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightHeel');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightFoot');\n if (part) points.push([part.position.x, part.position.y]);\n curves(ctx, points, localOptions);\n // arm left\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'leftShoulder');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftElbow');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftWrist');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftPalm');\n if (part) points.push([part.position.x, part.position.y]);\n curves(ctx, points, localOptions);\n // arm right\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'rightShoulder');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightElbow');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightWrist');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightPalm');\n if (part) points.push([part.position.x, part.position.y]);\n curves(ctx, points, localOptions);\n // draw all\n }\n }\n}\n\nexport async function hand(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.lineJoin = 'round';\n ctx.font = localOptions.font;\n for (const h of result) {\n if (localOptions.drawBoxes) {\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n let box;\n if (!localOptions.calculateHandBox) {\n box = localOptions.useRawBoxes ? h.boxRaw : h.box;\n } else {\n box = [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, 0, 0];\n if (h.landmarks && h.landmarks.length > 0) {\n for (const pt of h.landmarks) {\n if (pt[0] < box[0]) box[0] = pt[0];\n if (pt[1] < box[1]) box[1] = pt[1];\n if (pt[0] > box[2]) box[2] = pt[0];\n if (pt[1] > box[3]) box[3] = pt[1];\n }\n box[2] -= box[0];\n box[3] -= box[1];\n }\n }\n if (localOptions.useRawBoxes) rect(ctx, inCanvas.width * box[0], inCanvas.height * box[1], inCanvas.width * box[2], inCanvas.height * box[3], localOptions);\n else rect(ctx, box[0], box[1], box[2], box[3], localOptions);\n if (localOptions.drawLabels) {\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText('hand', box[0] + 3, 1 + box[1] + localOptions.lineHeight, box[2]);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText('hand', box[0] + 2, 0 + box[1] + localOptions.lineHeight, box[2]);\n }\n ctx.stroke();\n }\n if (localOptions.drawPoints) {\n if (h.landmarks && h.landmarks.length > 0) {\n for (const pt of h.landmarks) {\n ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + (2 * pt[2])}, ${127.5 - (2 * pt[2])}, 255, 0.5)` : localOptions.color;\n point(ctx, pt[0], pt[1], 0, localOptions);\n }\n }\n }\n if (localOptions.drawLabels) {\n const addHandLabel = (part, title) => {\n ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + (2 * part[part.length - 1][2])}, ${127.5 - (2 * part[part.length - 1][2])}, 255, 0.5)` : localOptions.color;\n ctx.fillText(title, part[part.length - 1][0] + 4, part[part.length - 1][1] + 4);\n };\n ctx.font = localOptions.font;\n addHandLabel(h.annotations.indexFinger, 'index');\n addHandLabel(h.annotations.middleFinger, 'middle');\n addHandLabel(h.annotations.ringFinger, 'ring');\n addHandLabel(h.annotations.pinky, 'pinky');\n addHandLabel(h.annotations.thumb, 'thumb');\n addHandLabel(h.annotations.palmBase, 'palm');\n }\n if (localOptions.drawPolygons) {\n const addHandLine = (part) => {\n if (!part) return;\n for (let i = 0; i < part.length; i++) {\n ctx.beginPath();\n ctx.strokeStyle = localOptions.useDepth ? `rgba(${127.5 + (2 * part[i][2])}, ${127.5 - (2 * part[i][2])}, 255, 0.5)` : localOptions.color;\n ctx.moveTo(part[i > 0 ? i - 1 : 0][0], part[i > 0 ? i - 1 : 0][1]);\n ctx.lineTo(part[i][0], part[i][1]);\n ctx.stroke();\n }\n };\n ctx.lineWidth = localOptions.lineWidth;\n addHandLine(h.annotations.indexFinger);\n addHandLine(h.annotations.middleFinger);\n addHandLine(h.annotations.ringFinger);\n addHandLine(h.annotations.pinky);\n addHandLine(h.annotations.thumb);\n // addPart(h.annotations.palmBase);\n }\n }\n}\n\nexport async function object(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.lineJoin = 'round';\n ctx.font = localOptions.font;\n for (const h of result) {\n if (localOptions.drawBoxes) {\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n if (localOptions.useRawBoxes) rect(ctx, inCanvas.width * h.boxRaw[0], inCanvas.height * h.boxRaw[1], inCanvas.width * h.boxRaw[2], inCanvas.height * h.boxRaw[3], localOptions);\n else rect(ctx, h.box[0], h.box[1], h.box[2], h.box[3], localOptions);\n if (localOptions.drawLabels) {\n const label = `${Math.round(100 * h.score)}% ${h.label}`;\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(label, h.box[0] + 3, 1 + h.box[1] + localOptions.lineHeight, h.box[2]);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(label, h.box[0] + 2, 0 + h.box[1] + localOptions.lineHeight, h.box[2]);\n }\n ctx.stroke();\n }\n }\n}\n\nexport async function canvas(inCanvas: HTMLCanvasElement, outCanvas: HTMLCanvasElement) {\n if (!inCanvas || !outCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement) || !(outCanvas instanceof HTMLCanvasElement)) return;\n const outCtx = inCanvas.getContext('2d');\n outCtx?.drawImage(inCanvas, 0, 0);\n}\n\nexport async function all(inCanvas: HTMLCanvasElement, result:any, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n face(inCanvas, result.face, localOptions);\n body(inCanvas, result.body, localOptions);\n hand(inCanvas, result.hand, localOptions);\n gesture(inCanvas, result.gesture, localOptions);\n object(inCanvas, result.object, localOptions);\n}\n", "// data:image/jpeg;base64,\nexport const face = `\n/9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUA\nAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAARAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQu\nbmV0IDQuMi4xMwAA/9sAQwAGBAUGBQQGBgUGBwcGCAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxob\nIxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEHBwcKCAoTCgoTKBoWGigoKCgoKCgoKCgoKCgo\nKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo/8AAEQgBAAEAAwEhAAIRAQMRAf/E\nAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAE\nEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZH\nSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1\ntre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEB\nAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXET\nIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJ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2AY7J2\nSbAjYZAI2E7AIEgIEgIEgMdkSy2NgY7MdlmyNoBXsxmFuyNgVTVjNV3KjlBRNTlXTVHKCrlIqt5T\nlBhEMohlFerLlBjEMohMVTEARDKCITsAk2AEgAAAkAAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAD/\n2Q==`;\n", "import { log, now, mergeDeep } from './helpers';\nimport { Config, defaults } from './config';\nimport { Result } from './result';\nimport * as sysinfo from './sysinfo';\nimport * as tf from '../dist/tfjs.esm.js';\nimport * as backend from './tfjs/backend';\nimport * as faceall from './faceall';\nimport * as facemesh from './blazeface/facemesh';\nimport * as faceres from './faceres/faceres';\nimport * as emotion from './emotion/emotion';\nimport * as posenet from './posenet/posenet';\nimport * as handpose from './handpose/handpose';\nimport * as blazepose from './blazepose/blazepose';\nimport * as nanodet from './nanodet/nanodet';\nimport * as gesture from './gesture/gesture';\nimport * as image from './image/image';\nimport * as draw from './draw/draw';\nimport * as sample from './sample';\nimport * as app from '../package.json';\n\n/** Generic Tensor object type */\nexport type Tensor = typeof tf.Tensor;\n\nexport type { Config } from './config';\nexport type { Result } from './result';\nexport type { DrawOptions } from './draw/draw';\n\n/** Defines all possible input types for **Human** detection */\nexport type Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;\n\n/** Error message */\nexport type Error = { error: string };\n\n/** Instance of TensorFlow/JS */\nexport type TensorFlow = typeof tf;\n\n/** Generic Model object type, holds instance of individual models */\ntype Model = Object;\n\n/**\n * **Human** library main class\n *\n * All methods and properties are available only as members of Human class\n *\n * - Configuration object definition: {@link Config}\n * - Results object definition: {@link Result}\n * - Possible inputs: {@link Input}\n */\nexport class Human {\n /** Current version of Human library in semver format */\n version: string;\n /** Current configuration\n * - Details: {@link Config}\n */\n config: Config;\n /** Current state of Human library\n * - Can be polled to determine operations that are currently executed\n */\n state: string;\n /** Internal: Instance of current image being processed */\n image: { tensor: Tensor | null, canvas: OffscreenCanvas | HTMLCanvasElement | null };\n /** Internal: Instance of TensorFlow/JS used by Human\n * - Can be embedded or externally provided\n */\n tf: TensorFlow;\n /** Draw helper classes that can draw detected objects on canvas using specified draw styles\n * - options: global settings for all draw operations, can be overriden for each draw method, for details see {@link DrawOptions}\n * - face: draw detected faces\n * - body: draw detected people and body parts\n * - hand: draw detected hands and hand parts\n * - canvas: draw processed canvas which is a processed copy of the input\n * - all: meta-function that performs: canvas, face, body, hand\n */\n draw: {\n options: draw.DrawOptions,\n gesture: typeof draw.gesture,\n face: typeof draw.face,\n body: typeof draw.body,\n hand: typeof draw.hand,\n canvas: typeof draw.canvas,\n all: typeof draw.all,\n };\n /** Internal: Currently loaded models */\n models: {\n face: [Model, Model, Model] | null,\n posenet: Model | null,\n blazepose: Model | null,\n efficientpose: Model | null,\n handpose: [Model, Model] | null,\n iris: Model | null,\n age: Model | null,\n gender: Model | null,\n emotion: Model | null,\n embedding: Model | null,\n nanodet: Model | null,\n faceres: Model | null,\n };\n /** Internal: Currently loaded classes */\n classes: {\n facemesh: typeof facemesh;\n emotion: typeof emotion;\n body: typeof posenet | typeof blazepose;\n hand: typeof handpose;\n nanodet: typeof nanodet;\n faceres: typeof faceres;\n };\n /** Face triangualtion array of 468 points, used for triangle references between points */\n faceTriangulation: typeof facemesh.triangulation;\n /** UV map of 468 values, used for 3D mapping of the face mesh */\n faceUVMap: typeof facemesh.uvmap;\n /** Platform and agent information detected by Human */\n sysinfo: { platform: string, agent: string };\n /** Performance object that contains values for all recently performed operations */\n perf: any;\n #numTensors: number;\n #analyzeMemoryLeaks: boolean;\n #checkSanity: boolean;\n #firstRun: boolean;\n\n // definition end\n\n /**\n * Creates instance of Human library that is futher used for all operations\n * - @param userConfig: {@link Config}\n */\n constructor(userConfig: Config | Object = {}) {\n this.tf = tf;\n this.draw = draw;\n this.version = app.version;\n this.config = mergeDeep(defaults, userConfig);\n this.state = 'idle';\n this.#numTensors = 0;\n this.#analyzeMemoryLeaks = false;\n this.#checkSanity = false;\n this.#firstRun = true;\n this.perf = {};\n // object that contains all initialized models\n this.models = {\n face: null,\n posenet: null,\n blazepose: null,\n efficientpose: null,\n handpose: null,\n iris: null,\n age: null,\n gender: null,\n emotion: null,\n embedding: null,\n nanodet: null,\n faceres: null,\n };\n // export access to image processing\n // @ts-ignore eslint-typescript cannot correctly infer type in anonymous function\n this.image = (input: Input) => image.process(input, this.config);\n // export raw access to underlying models\n this.classes = {\n facemesh,\n emotion,\n faceres,\n body: this.config.body.modelPath.includes('posenet') ? posenet : blazepose,\n hand: handpose,\n nanodet,\n };\n this.faceTriangulation = facemesh.triangulation;\n this.faceUVMap = facemesh.uvmap;\n // include platform info\n this.sysinfo = sysinfo.info();\n }\n\n // helper function: measure tensor leak\n /** @hidden */\n analyze = (...msg) => {\n if (!this.#analyzeMemoryLeaks) return;\n const current = this.tf.engine().state.numTensors;\n const previous = this.#numTensors;\n this.#numTensors = current;\n const leaked = current - previous;\n if (leaked !== 0) log(...msg, leaked);\n }\n\n // quick sanity check on inputs\n /** @hidden */\n #sanity = (input): null | string => {\n if (!this.#checkSanity) return null;\n if (!input) return 'input is not defined';\n if (this.tf.ENV.flags.IS_NODE && !(input instanceof tf.Tensor)) return 'input must be a tensor';\n try {\n this.tf.getBackend();\n } catch {\n return 'backend not loaded';\n }\n return null;\n }\n\n /** Simmilarity method calculates simmilarity between two provided face descriptors (face embeddings)\n * - Calculation is based on normalized Minkowski distance between\n */\n // eslint-disable-next-line class-methods-use-this\n similarity(embedding1: Array, embedding2: Array): number {\n return faceres.similarity(embedding1, embedding2);\n }\n\n /** Enhance method performs additional enhacements to face image previously detected for futher processing\n * @param input Tensor as provided in human.result.face[n].tensor\n * @returns Tensor\n */\n // eslint-disable-next-line class-methods-use-this\n enhance(input: Tensor): Tensor | null {\n return faceres.enhance(input);\n }\n\n /**\n * Math method find best match between provided face descriptor and predefined database of known descriptors\n * @param faceEmbedding: face descriptor previsouly calculated on any face\n * @param db: array of mapping of face descriptors to known values\n * @param threshold: minimum score for matching to be considered in the result\n * @returns best match\n */\n // eslint-disable-next-line class-methods-use-this\n match(faceEmbedding: Array, db: Array<{ name: string, source: string, embedding: number[] }>, threshold = 0): { name: string, source: string, similarity: number, embedding: number[] } {\n return faceres.match(faceEmbedding, db, threshold);\n }\n\n /** Load method preloads all configured models on-demand\n * - Not explicitly required as any required model is load implicitly on it's first run\n */\n async load(userConfig: Config | Object = {}) {\n this.state = 'load';\n const timeStamp = now();\n if (userConfig) this.config = mergeDeep(this.config, userConfig);\n\n if (this.#firstRun) {\n if (this.config.debug) log(`version: ${this.version}`);\n if (this.config.debug) log(`tfjs version: ${this.tf.version_core}`);\n if (this.config.debug) log('platform:', this.sysinfo.platform);\n if (this.config.debug) log('agent:', this.sysinfo.agent);\n\n await this.#checkBackend(true);\n if (this.tf.ENV.flags.IS_BROWSER) {\n if (this.config.debug) log('configuration:', this.config);\n if (this.config.debug) log('tf flags:', this.tf.ENV.flags);\n }\n }\n if (this.config.async) {\n [\n this.models.face,\n this.models.emotion,\n this.models.handpose,\n this.models.posenet,\n this.models.blazepose,\n this.models.nanodet,\n this.models.faceres,\n ] = await Promise.all([\n this.models.face || (this.config.face.enabled ? facemesh.load(this.config) : null),\n this.models.emotion || ((this.config.face.enabled && this.config.face.emotion.enabled) ? emotion.load(this.config) : null),\n this.models.handpose || (this.config.hand.enabled ? handpose.load(this.config) : null),\n this.models.posenet || (this.config.body.enabled && this.config.body.modelPath.includes('posenet') ? posenet.load(this.config) : null),\n this.models.blazepose || (this.config.body.enabled && this.config.body.modelPath.includes('blazepose') ? blazepose.load(this.config) : null),\n this.models.nanodet || (this.config.object.enabled ? nanodet.load(this.config) : null),\n this.models.faceres || ((this.config.face.enabled && this.config.face.description.enabled) ? faceres.load(this.config) : null),\n ]);\n } else {\n if (this.config.face.enabled && !this.models.face) this.models.face = await facemesh.load(this.config);\n if (this.config.face.enabled && this.config.face.emotion.enabled && !this.models.emotion) this.models.emotion = await emotion.load(this.config);\n if (this.config.hand.enabled && !this.models.handpose) this.models.handpose = await handpose.load(this.config);\n if (this.config.body.enabled && !this.models.posenet && this.config.body.modelPath.includes('posenet')) this.models.posenet = await posenet.load(this.config);\n if (this.config.body.enabled && !this.models.blazepose && this.config.body.modelPath.includes('blazepose')) this.models.blazepose = await blazepose.load(this.config);\n if (this.config.object.enabled && !this.models.nanodet) this.models.nanodet = await nanodet.load(this.config);\n if (this.config.face.enabled && this.config.face.description.enabled && !this.models.faceres) this.models.faceres = await faceres.load(this.config);\n }\n\n if (this.#firstRun) {\n if (this.config.debug) log('tf engine state:', this.tf.engine().state.numBytes, 'bytes', this.tf.engine().state.numTensors, 'tensors');\n this.#firstRun = false;\n }\n\n const current = Math.trunc(now() - timeStamp);\n if (current > (this.perf.load || 0)) this.perf.load = current;\n }\n\n // check if backend needs initialization if it changed\n /** @hidden */\n #checkBackend = async (force = false) => {\n if (this.config.backend && (this.config.backend.length > 0) && force || (this.tf.getBackend() !== this.config.backend)) {\n const timeStamp = now();\n this.state = 'backend';\n /* force backend reload\n if (this.config.backend in tf.engine().registry) {\n const backendFactory = tf.findBackendFactory(this.config.backend);\n tf.removeBackend(this.config.backend);\n tf.registerBackend(this.config.backend, backendFactory);\n } else {\n log('Backend not registred:', this.config.backend);\n }\n */\n\n if (this.config.backend && this.config.backend.length > 0) {\n // @ts-ignore ignore missing type for WorkerGlobalScope as that is the point\n if (typeof window === 'undefined' && typeof WorkerGlobalScope !== 'undefined' && this.config.debug) log('running inside web worker');\n\n // force browser vs node backend\n if (this.tf.ENV.flags.IS_BROWSER && this.config.backend === 'tensorflow') this.config.backend = 'webgl';\n if (this.tf.ENV.flags.IS_NODE && (this.config.backend === 'webgl' || this.config.backend === 'humangl')) this.config.backend = 'tensorflow';\n\n if (this.config.debug) log('setting backend:', this.config.backend);\n\n if (this.config.backend === 'wasm') {\n if (this.config.debug) log('wasm path:', this.config.wasmPath);\n if (typeof this.tf?.setWasmPaths !== 'undefined') this.tf.setWasmPaths(this.config.wasmPath);\n else throw new Error('Human: WASM backend is not loaded');\n const simd = await this.tf.env().getAsync('WASM_HAS_SIMD_SUPPORT');\n const mt = await this.tf.env().getAsync('WASM_HAS_MULTITHREAD_SUPPORT');\n if (this.config.debug) log(`wasm execution: ${simd ? 'SIMD' : 'no SIMD'} ${mt ? 'multithreaded' : 'singlethreaded'}`);\n if (this.config.debug && !simd) log('warning: wasm simd support is not enabled');\n }\n\n if (this.config.backend === 'humangl') backend.register();\n try {\n await this.tf.setBackend(this.config.backend);\n } catch (err) {\n log('error: cannot set backend:', this.config.backend, err);\n }\n }\n this.tf.enableProdMode();\n // this.tf.enableDebugMode();\n if (this.tf.getBackend() === 'webgl' || this.tf.getBackend() === 'humangl') {\n this.tf.ENV.set('CHECK_COMPUTATION_FOR_ERRORS', false);\n this.tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);\n if (typeof this.config['deallocate'] !== 'undefined') {\n log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', true);\n this.tf.ENV.set('WEBGL_DELETE_TEXTURE_THRESHOLD', 0);\n }\n const gl = await this.tf.backend().getGPGPUContext().gl;\n if (this.config.debug) log(`gl version:${gl.getParameter(gl.VERSION)} renderer:${gl.getParameter(gl.RENDERER)}`);\n }\n await this.tf.ready();\n this.perf.backend = Math.trunc(now() - timeStamp);\n }\n }\n\n /** Main detection method\n * - Analyze configuration: {@link Config}\n * - Pre-process input: {@link Input}\n * - Run inference for all configured models\n * - Process and return result: {@link Result}\n */\n async detect(input: Input, userConfig: Config | Object = {}): Promise {\n // detection happens inside a promise\n return new Promise(async (resolve) => {\n this.state = 'config';\n let timeStamp;\n\n // update configuration\n this.config = mergeDeep(this.config, userConfig);\n\n // sanity checks\n this.state = 'check';\n const error = this.#sanity(input);\n if (error) {\n log(error, input);\n resolve({ error });\n }\n\n const timeStart = now();\n\n // configure backend\n await this.#checkBackend();\n\n // load models if enabled\n await this.load();\n\n // disable video optimization for inputs of type image, but skip if inside worker thread\n let previousVideoOptimized;\n // @ts-ignore ignore missing type for WorkerGlobalScope as that is the point\n if (input && this.config.videoOptimized && (typeof window !== 'undefined') && (typeof WorkerGlobalScope !== 'undefined') && (\n (typeof HTMLImageElement !== 'undefined' && input instanceof HTMLImageElement)\n || (typeof Image !== 'undefined' && input instanceof Image)\n || (typeof ImageData !== 'undefined' && input instanceof ImageData)\n || (typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap))\n ) {\n log('disabling video optimization');\n previousVideoOptimized = this.config.videoOptimized;\n this.config.videoOptimized = false;\n }\n\n timeStamp = now();\n const process = image.process(input, this.config);\n if (!process || !process.tensor) {\n log('could not convert input to tensor');\n resolve({ error: 'could not convert input to tensor' });\n return;\n }\n this.perf.image = Math.trunc(now() - timeStamp);\n this.analyze('Get Image:');\n\n // prepare where to store model results\n let bodyRes;\n let handRes;\n let faceRes;\n let objectRes;\n let current;\n\n // run face detection followed by all models that rely on face bounding box: face mesh, age, gender, emotion\n if (this.config.async) {\n faceRes = this.config.face.enabled ? faceall.detectFace(this, process.tensor) : [];\n if (this.perf.face) delete this.perf.face;\n } else {\n this.state = 'run:face';\n timeStamp = now();\n faceRes = this.config.face.enabled ? await faceall.detectFace(this, process.tensor) : [];\n current = Math.trunc(now() - timeStamp);\n if (current > 0) this.perf.face = current;\n }\n\n // run body: can be posenet or blazepose\n this.analyze('Start Body:');\n if (this.config.async) {\n if (this.config.body.modelPath.includes('posenet')) bodyRes = this.config.body.enabled ? posenet.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('blazepose')) bodyRes = this.config.body.enabled ? blazepose.predict(process.tensor, this.config) : [];\n if (this.perf.body) delete this.perf.body;\n } else {\n this.state = 'run:body';\n timeStamp = now();\n if (this.config.body.modelPath.includes('posenet')) bodyRes = this.config.body.enabled ? await posenet.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('blazepose')) bodyRes = this.config.body.enabled ? await blazepose.predict(process.tensor, this.config) : [];\n current = Math.trunc(now() - timeStamp);\n if (current > 0) this.perf.body = current;\n }\n this.analyze('End Body:');\n\n // run handpose\n this.analyze('Start Hand:');\n if (this.config.async) {\n handRes = this.config.hand.enabled ? handpose.predict(process.tensor, this.config) : [];\n if (this.perf.hand) delete this.perf.hand;\n } else {\n this.state = 'run:hand';\n timeStamp = now();\n handRes = this.config.hand.enabled ? await handpose.predict(process.tensor, this.config) : [];\n current = Math.trunc(now() - timeStamp);\n if (current > 0) this.perf.hand = current;\n }\n this.analyze('End Hand:');\n\n // run nanodet\n this.analyze('Start Object:');\n if (this.config.async) {\n objectRes = this.config.object.enabled ? nanodet.predict(process.tensor, this.config) : [];\n if (this.perf.object) delete this.perf.object;\n } else {\n this.state = 'run:object';\n timeStamp = now();\n objectRes = this.config.object.enabled ? await nanodet.predict(process.tensor, this.config) : [];\n current = Math.trunc(now() - timeStamp);\n if (current > 0) this.perf.object = current;\n }\n this.analyze('End Object:');\n\n // if async wait for results\n if (this.config.async) {\n [faceRes, bodyRes, handRes, objectRes] = await Promise.all([faceRes, bodyRes, handRes, objectRes]);\n }\n tf.dispose(process.tensor);\n\n // run gesture analysis last\n let gestureRes: any[] = [];\n if (this.config.gesture.enabled) {\n timeStamp = now();\n gestureRes = [...gesture.face(faceRes), ...gesture.body(bodyRes), ...gesture.hand(handRes), ...gesture.iris(faceRes)];\n if (!this.config.async) this.perf.gesture = Math.trunc(now() - timeStamp);\n else if (this.perf.gesture) delete this.perf.gesture;\n }\n\n // restore video optimizations if previously disabled\n if (previousVideoOptimized) this.config.videoOptimized = previousVideoOptimized;\n\n this.perf.total = Math.trunc(now() - timeStart);\n this.state = 'idle';\n const result = {\n face: faceRes,\n body: bodyRes,\n hand: handRes,\n gesture: gestureRes,\n object: objectRes,\n performance: this.perf,\n canvas: process.canvas,\n };\n // log('Result:', result);\n resolve(result);\n });\n }\n\n /** @hidden */\n #warmupBitmap = async () => {\n const b64toBlob = (base64, type = 'application/octet-stream') => fetch(`data:${type};base64,${base64}`).then((res) => res.blob());\n let blob;\n let res;\n switch (this.config.warmup) {\n case 'face': blob = await b64toBlob(sample.face); break;\n case 'full': blob = await b64toBlob(sample.body); break;\n default: blob = null;\n }\n if (blob) {\n const bitmap = await createImageBitmap(blob);\n res = await this.detect(bitmap, this.config);\n bitmap.close();\n }\n return res;\n }\n\n /** @hidden */\n #warmupCanvas = async () => new Promise((resolve) => {\n let src;\n let size = 0;\n switch (this.config.warmup) {\n case 'face':\n size = 256;\n src = 'data:image/jpeg;base64,' + sample.face;\n break;\n case 'full':\n case 'body':\n size = 1200;\n src = 'data:image/jpeg;base64,' + sample.body;\n break;\n default:\n src = null;\n }\n // src = encodeURI('../assets/human-sample-upper.jpg');\n const img = new Image();\n img.onload = async () => {\n const canvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(size, size) : document.createElement('canvas');\n canvas.width = img.naturalWidth;\n canvas.height = img.naturalHeight;\n const ctx = canvas.getContext('2d');\n ctx?.drawImage(img, 0, 0);\n // const data = ctx?.getImageData(0, 0, canvas.height, canvas.width);\n const res = await this.detect(canvas, this.config);\n resolve(res);\n };\n if (src) img.src = src;\n else resolve(null);\n });\n\n /** @hidden */\n #warmupNode = async () => {\n const atob = (str) => Buffer.from(str, 'base64');\n let img;\n if (this.config.warmup === 'face') img = atob(sample.face);\n if (this.config.warmup === 'body' || this.config.warmup === 'full') img = atob(sample.body);\n if (!img) return null;\n let res;\n if (typeof tf['node'] !== 'undefined') {\n const data = tf['node'].decodeJpeg(img);\n const expanded = data.expandDims(0);\n this.tf.dispose(data);\n // log('Input:', expanded);\n res = await this.detect(expanded, this.config);\n this.tf.dispose(expanded);\n } else {\n if (this.config.debug) log('Warmup tfjs-node not loaded');\n /*\n const input = await canvasJS.loadImage(img);\n const canvas = canvasJS.createCanvas(input.width, input.height);\n const ctx = canvas.getContext('2d');\n ctx.drawImage(img, 0, 0, input.width, input.height);\n res = await this.detect(input, this.config);\n */\n }\n return res;\n }\n\n /** Warmup metho pre-initializes all models for faster inference\n * - can take significant time on startup\n * - only used for `webgl` and `humangl` backends\n */\n async warmup(userConfig: Config | Object = {}): Promise {\n const t0 = now();\n if (userConfig) this.config = mergeDeep(this.config, userConfig);\n if (!this.config.warmup || this.config.warmup === 'none') return { error: 'null' };\n const save = this.config.videoOptimized;\n this.config.videoOptimized = false;\n let res;\n if (typeof createImageBitmap === 'function') res = await this.#warmupBitmap();\n else if (typeof Image !== 'undefined') res = await this.#warmupCanvas();\n else res = await this.#warmupNode();\n this.config.videoOptimized = save;\n const t1 = now();\n if (this.config.debug) log('Warmup', this.config.warmup, Math.round(t1 - t0), 'ms', res);\n return res;\n }\n}\n\n/**\n * Class Human is also available as default export\n */\nexport { Human as default };\n"], - "mappings": ";;;;;;;ukBACO,WAAc,EAAgB,EAAsB,CACzD,GAAM,GAAY,EAAO,SAAS,KAAO,GAAK,IAExC,EAAO,AADI,EAAK,WAAW,MAAQ,EAAK,WAAW,MAAQ,EAAK,WAAW,UAAY,EAAK,WAAW,WAAa,EAAK,WAAW,SAClH,GAAG,IAAS,GAAG,IAAS,IAAY,IAC5D,GAAI,CAAC,EAAK,oBAAoB,SAAS,SAAU,KAAM,IAAI,OAAM,2BAA2B,yBAC5F,MAAO,GAIF,cAAgB,EAAK,CAC1B,GAAM,GAAK,GAAI,MACT,EAAK,GAAG,EAAG,WAAW,WAAW,SAAS,EAAG,QAAQ,EAAG,aAAa,WAAW,SAAS,EAAG,QAAQ,EAAG,aAAa,WAAW,SAAS,EAAG,QAAQ,EAAG,kBAAkB,WAAW,SAAS,EAAG,OAErM,AAAI,GAAK,QAAQ,IAAI,EAAI,SAAU,GAAG,GAIjC,GAAM,GAAM,IACb,MAAO,cAAgB,YAAoB,YAAY,MACpD,SAAU,QAAO,QAAQ,OAAO,UAAY,IAAO,KAAM,YAI3D,cAAsB,EAAS,CACpC,GAAM,GAAW,AAAC,GAAQ,GAAO,MAAO,IAAQ,SAChD,MAAO,GAAQ,OAAO,CAAC,EAAM,IAC3B,QAAO,KAAK,GAAO,IAAI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AQ,KAAK,MAAM,EAAK,GAAK,KAAM,GAC7E,IA1dT,eACA,eACA,eACA,eAiEA,eAoGA,eAmNA,eAkBA,eAiCA", + "sourcesContent": ["// helper function: join two paths\nexport function join(folder: string, file: string): string {\n const separator = folder.endsWith('/') ? '' : '/';\n const skipJoin = file.startsWith('.') || file.startsWith('/') || file.startsWith('http:') || file.startsWith('https:') || file.startsWith('file:');\n const path = skipJoin ? `${file}` : `${folder}${separator}${file}`;\n if (!path.toLocaleLowerCase().includes('.json')) throw new Error(`Human: ModelPath Error: ${path} Expecting JSON file`);\n return path;\n}\n\n// helper function: wrapper around console output\nexport function log(...msg) {\n const dt = new Date();\n const ts = `${dt.getHours().toString().padStart(2, '0')}:${dt.getMinutes().toString().padStart(2, '0')}:${dt.getSeconds().toString().padStart(2, '0')}.${dt.getMilliseconds().toString().padStart(3, '0')}`;\n // eslint-disable-next-line no-console\n if (msg) console.log(ts, 'Human:', ...msg);\n}\n\n// helper function: gets elapsed time on both browser and nodejs\nexport const now = () => {\n if (typeof performance !== 'undefined') return performance.now();\n return parseInt((Number(process.hrtime.bigint()) / 1000 / 1000).toString());\n};\n\n// helper function: perform deep merge of multiple objects so it allows full inheriance with overrides\nexport function mergeDeep(...objects) {\n const isObject = (obj) => obj && typeof obj === 'object';\n return objects.reduce((prev, obj) => {\n Object.keys(obj || {}).forEach((key) => {\n const pVal = prev[key];\n const oVal = obj[key];\n if (Array.isArray(pVal) && Array.isArray(oVal)) prev[key] = pVal.concat(...oVal);\n else if (isObject(pVal) && isObject(oVal)) prev[key] = mergeDeep(pVal, oVal);\n else prev[key] = oVal;\n });\n return prev;\n }, {});\n}\n", "/* eslint-disable indent */\n/* eslint-disable no-multi-spaces */\n\n/**\n * Configuration interface definition for **Human** library\n *\n * Contains all configurable parameters\n */\nexport interface Config {\n /** Backend used for TFJS operations */\n backend: null | '' | 'cpu' | 'wasm' | 'webgl' | 'humangl' | 'tensorflow',\n\n /** Path to *.wasm files if backend is set to `wasm` */\n wasmPath: string,\n\n /** Print debug statements to console */\n debug: boolean,\n\n /** Perform model loading and inference concurrently or sequentially */\n async: boolean,\n\n /** Perform additional optimizations when input is video,\n * - must be disabled for images\n * - automatically disabled for Image, ImageData, ImageBitmap and Tensor inputs\n * - skips boundary detection for every `skipFrames` frames specified for each model\n * - while maintaining in-box detection since objects don't change definition as fast */\n videoOptimized: boolean,\n\n /** What to use for `human.warmup()`\n * - warmup pre-initializes all models for faster inference but can take significant time on startup\n * - only used for `webgl` and `humangl` backends\n */\n warmup: 'none' | 'face' | 'full' | 'body',\n\n /** Base model path (typically starting with file://, http:// or https://) for all models\n * - individual modelPath values are relative to this path\n */\n modelBasePath: string,\n\n /** Run input through image filters before inference\n * - image filters run with near-zero latency as they are executed on the GPU\n */\n filter: {\n enabled: boolean,\n /** Resize input width\n * - if both width and height are set to 0, there is no resizing\n * - if just one is set, second one is scaled automatically\n * - if both are set, values are used as-is\n */\n width: number,\n /** Resize input height\n * - if both width and height are set to 0, there is no resizing\n * - if just one is set, second one is scaled automatically\n * - if both are set, values are used as-is\n */\n height: number,\n /** Return processed canvas imagedata in result */\n return: boolean,\n /** Flip input as mirror image */\n flip: boolean,\n /** Range: -1 (darken) to 1 (lighten) */\n brightness: number,\n /** Range: -1 (reduce contrast) to 1 (increase contrast) */\n contrast: number,\n /** Range: 0 (no sharpening) to 1 (maximum sharpening) */\n sharpness: number,\n /** Range: 0 (no blur) to N (blur radius in pixels) */\n blur: number\n /** Range: -1 (reduce saturation) to 1 (increase saturation) */\n saturation: number,\n /** Range: 0 (no change) to 360 (hue rotation in degrees) */\n hue: number,\n /** Image negative */\n negative: boolean,\n /** Image sepia colors */\n sepia: boolean,\n /** Image vintage colors */\n vintage: boolean,\n /** Image kodachrome colors */\n kodachrome: boolean,\n /** Image technicolor colors */\n technicolor: boolean,\n /** Image polaroid camera effect */\n polaroid: boolean,\n /** Range: 0 (no pixelate) to N (number of pixels to pixelate) */\n pixelate: number,\n },\n // type definition end\n\n /** Controlls gesture detection */\n gesture: {\n enabled: boolean,\n },\n\n /** Controlls and configures all face-specific options:\n * - face detection, face mesh detection, age, gender, emotion detection and face description\n * Parameters:\n * - enabled: true/false\n * - modelPath: path for each of face models\n * - minConfidence: threshold for discarding a prediction\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of faces detected in the input, should be set to the minimum number for performance\n * - rotation: use calculated rotated face image or just box with rotation as-is, false means higher performance, but incorrect mesh mapping on higher face angles\n * - skipFrames: how many frames to go without re-running the face detector and just run modified face mesh analysis, only valid if videoOptimized is set to true\n * - skipInitial: if previous detection resulted in no faces detected, should skipFrames be reset immediately to force new detection cycle\n * - return: return extracted face as tensor for futher user processing\n */\n face: {\n enabled: boolean,\n detector: {\n modelPath: string,\n rotation: boolean,\n maxDetected: number,\n skipFrames: number,\n skipInitial: boolean,\n minConfidence: number,\n iouThreshold: number,\n return: boolean,\n },\n mesh: {\n enabled: boolean,\n modelPath: string,\n },\n iris: {\n enabled: boolean,\n modelPath: string,\n },\n description: {\n enabled: boolean,\n modelPath: string,\n skipFrames: number,\n minConfidence: number,\n },\n emotion: {\n enabled: boolean,\n minConfidence: number,\n skipFrames: number,\n modelPath: string,\n },\n },\n\n /** Controlls and configures all body detection specific options\n * - enabled: true/false\n * - modelPath: body pose model, can be absolute path or relative to modelBasePath\n * - minConfidence: threshold for discarding a prediction\n * - maxDetected: maximum number of people detected in the input, should be set to the minimum number for performance\n */\n body: {\n enabled: boolean,\n modelPath: string,\n maxDetected: number,\n minConfidence: number,\n },\n\n /** Controlls and configures all hand detection specific options\n * - enabled: true/false\n * - landmarks: detect hand landmarks or just hand boundary box\n * - modelPath: paths for hand detector and hand skeleton models, can be absolute path or relative to modelBasePath\n * - minConfidence: threshold for discarding a prediction\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of hands detected in the input, should be set to the minimum number for performance\n * - rotation: use best-guess rotated hand image or just box with rotation as-is, false means higher performance, but incorrect finger mapping if hand is inverted\n * - skipFrames: how many frames to go without re-running the hand bounding box detector and just run modified hand skeleton detector, only valid if videoOptimized is set to true\n * - skipInitial: if previous detection resulted in no hands detected, should skipFrames be reset immediately to force new detection cycle\n */\n hand: {\n enabled: boolean,\n rotation: boolean,\n skipFrames: number,\n skipInitial: boolean,\n minConfidence: number,\n iouThreshold: number,\n maxDetected: number,\n landmarks: boolean,\n detector: {\n modelPath: string,\n },\n skeleton: {\n modelPath: string,\n },\n },\n\n /** Controlls and configures all object detection specific options\n * - enabled: true/false\n * - modelPath: object detection model, can be absolute path or relative to modelBasePath\n * - minConfidence: minimum score that detection must have to return as valid object\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of detections to return\n * - skipFrames: run object detection every n input frames, only valid if videoOptimized is set to true\n */\n object: {\n enabled: boolean,\n modelPath: string,\n minConfidence: number,\n iouThreshold: number,\n maxDetected: number,\n skipFrames: number,\n },\n}\n\nconst config: Config = {\n backend: 'webgl', // select tfjs backend to use, leave empty to use default backend\n // can be 'webgl', 'wasm', 'cpu', or 'humangl' which is a custom version of webgl\n modelBasePath: '../models/', // base path for all models\n wasmPath: '../node_modules/@tensorflow/tfjs-backend-wasm/dist//', // path for wasm binaries, only used for backend: wasm\n debug: true, // print additional status messages to console\n async: true, // execute enabled models in parallel\n videoOptimized: true, // perform additional optimizations when input is video,\n // automatically disabled for Image, ImageData, ImageBitmap\n // skips boundary detection for every n frames\n // while maintaining in-box detection since objects cannot move that fast\n warmup: 'full', // what to use for human.warmup(), can be 'none', 'face', 'full'\n // warmup pre-initializes all models for faster inference but can take\n // significant time on startup\n // only used for `webgl` and `humangl` backends\n filter: { // run input through image filters before inference\n // image filters run with near-zero latency as they are executed on the GPU\n enabled: true, // enable image pre-processing filters\n width: 0, // resize input width\n height: 0, // resize input height\n // if both width and height are set to 0, there is no resizing\n // if just one is set, second one is scaled automatically\n // if both are set, values are used as-is\n flip: false, // flip input as mirror image\n return: true, // return processed canvas imagedata in result\n brightness: 0, // range: -1 (darken) to 1 (lighten)\n contrast: 0, // range: -1 (reduce contrast) to 1 (increase contrast)\n sharpness: 0, // range: 0 (no sharpening) to 1 (maximum sharpening)\n blur: 0, // range: 0 (no blur) to N (blur radius in pixels)\n saturation: 0, // range: -1 (reduce saturation) to 1 (increase saturation)\n hue: 0, // range: 0 (no change) to 360 (hue rotation in degrees)\n negative: false, // image negative\n sepia: false, // image sepia colors\n vintage: false, // image vintage colors\n kodachrome: false, // image kodachrome colors\n technicolor: false, // image technicolor colors\n polaroid: false, // image polaroid camera effect\n pixelate: 0, // range: 0 (no pixelate) to N (number of pixels to pixelate)\n },\n\n gesture: {\n enabled: true, // enable gesture recognition based on model results\n },\n\n face: {\n enabled: true, // controls if specified modul is enabled\n // face.enabled is required for all face models:\n // detector, mesh, iris, age, gender, emotion\n // (note: module is not loaded until it is required)\n detector: {\n modelPath: 'blazeface.json', // detector model, can be absolute path or relative to modelBasePath\n rotation: false, // use best-guess rotated face image or just box with rotation as-is\n // false means higher performance, but incorrect mesh mapping if face angle is above 20 degrees\n // this parameter is not valid in nodejs\n maxDetected: 10, // maximum number of faces detected in the input\n // should be set to the minimum number for performance\n skipFrames: 21, // how many frames to go without re-running the face bounding box detector\n // only used for video inputs\n // e.g., if model is running st 25 FPS, we can re-use existing bounding\n // box for updated face analysis as the head probably hasn't moved much\n // in short time (10 * 1/25 = 0.25 sec)\n skipInitial: false, // if previous detection resulted in no faces detected,\n // should skipFrames be reset immediately to force new detection cycle\n minConfidence: 0.2, // threshold for discarding a prediction\n iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed\n return: false, // return extracted face as tensor\n },\n\n mesh: {\n enabled: true,\n modelPath: 'facemesh.json', // facemesh model, can be absolute path or relative to modelBasePath\n },\n\n iris: {\n enabled: true,\n modelPath: 'iris.json', // face iris model\n // can be either absolute path or relative to modelBasePath\n },\n\n description: {\n enabled: true, // to improve accuracy of face description extraction it is\n // recommended to enable detector.rotation and mesh.enabled\n modelPath: 'faceres.json', // face description model\n // can be either absolute path or relative to modelBasePath\n skipFrames: 31, // how many frames to go without re-running the detector\n // only used for video inputs\n minConfidence: 0.1, // threshold for discarding a prediction\n },\n\n emotion: {\n enabled: true,\n minConfidence: 0.1, // threshold for discarding a prediction\n skipFrames: 32, // how many frames to go without re-running the detector\n modelPath: 'emotion.json', // face emotion model, can be absolute path or relative to modelBasePath\n },\n },\n\n body: {\n enabled: true,\n modelPath: 'posenet.json', // body model, can be absolute path or relative to modelBasePath\n // can be 'posenet' or 'blazepose'\n maxDetected: 1, // maximum number of people detected in the input\n // should be set to the minimum number for performance\n // only valid for posenet as blazepose only detects single pose\n minConfidence: 0.1, // threshold for discarding a prediction\n },\n\n hand: {\n enabled: true,\n rotation: false, // use best-guess rotated hand image or just box with rotation as-is\n // false means higher performance, but incorrect finger mapping if hand is inverted\n skipFrames: 12, // how many frames to go without re-running the hand bounding box detector\n // only used for video inputs\n // e.g., if model is running st 25 FPS, we can re-use existing bounding\n // box for updated hand skeleton analysis as the hand probably\n // hasn't moved much in short time (10 * 1/25 = 0.25 sec)\n skipInitial: false, // if previous detection resulted in no hands detected,\n // should skipFrames be reset immediately to force new detection cycle\n minConfidence: 0.1, // threshold for discarding a prediction\n iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed\n maxDetected: 2, // maximum number of hands detected in the input\n // should be set to the minimum number for performance\n landmarks: true, // detect hand landmarks or just hand boundary box\n detector: {\n modelPath: 'handdetect.json', // hand detector model, can be absolute path or relative to modelBasePath\n },\n skeleton: {\n modelPath: 'handskeleton.json', // hand skeleton model, can be absolute path or relative to modelBasePath\n },\n },\n\n object: {\n enabled: false,\n modelPath: 'nanodet.json', // experimental: object detection model, can be absolute path or relative to modelBasePath\n minConfidence: 0.2, // threshold for discarding a prediction\n iouThreshold: 0.4, // ammount of overlap between two detected objects before one object is removed\n maxDetected: 10, // maximum number of objects detected in the input\n skipFrames: 41, // how many frames to go without re-running the detector\n },\n};\nexport { config as defaults };\n", "export function info(): { platform: string, agent: string } {\n let platform;\n let agent;\n if (typeof navigator !== 'undefined') {\n const raw = navigator.userAgent.match(/\\(([^()]+)\\)/g);\n if (raw && raw[0]) {\n const platformMatch = raw[0].match(/\\(([^()]+)\\)/g);\n platform = platformMatch ? platformMatch[0].replace(/\\(|\\)/g, '') : '';\n agent = navigator.userAgent.replace(raw[0], '');\n if (platform[1]) agent = agent.replace(raw[1], '');\n agent = agent.replace(/ /g, ' ');\n }\n } else if (typeof process !== 'undefined') {\n platform = `${process.platform} ${process.arch}`;\n agent = `NodeJS ${process.version}`;\n }\n return { platform, agent };\n}\n", "// wrapper to load tfjs in a single place so version can be changed quickly\n\n// simplified\n// { modules: 1250, moduleBytes: 4013323, imports: 7, importBytes: 2255, outputBytes: 2991826, outputFiles: 'dist/tfjs.esm.js' }\n// export * from '@tensorflow/tfjs/dist/index.js';\n// export * from '@tensorflow/tfjs-backend-wasm';\n\n// modular\n// { modules: 1253, moduleBytes: 4029357, imports: 7, importBytes: 2285, outputBytes: 2998298, outputFiles: 'dist/tfjs.esm.js' }\n\n// get versions of all packages.\nimport * as packageBundle from '@tensorflow/tfjs/package.json';\nimport * as packageCore from '@tensorflow/tfjs-core/package.json';\nimport * as packageData from '@tensorflow/tfjs-data/package.json';\nimport * as packageLayers from '@tensorflow/tfjs-layers/package.json';\nimport * as packageConverter from '@tensorflow/tfjs-converter/package.json';\n// for backends, get version from source so it can register backend during import\nimport { version_cpu } from '@tensorflow/tfjs-backend-cpu/dist/index.js';\nimport { version_webgl } from '@tensorflow/tfjs-backend-webgl/dist/index.js';\nimport { version_wasm } from '@tensorflow/tfjs-backend-wasm/dist/index.js';\n\n// export all - compiled\nexport * from '@tensorflow/tfjs-core/dist/index.js';\nexport * from '@tensorflow/tfjs-layers/dist/index.js';\nexport * from '@tensorflow/tfjs-converter/dist/index.js';\nexport * as data from '@tensorflow/tfjs-data/dist/index.js';\nexport * from '@tensorflow/tfjs-backend-cpu/dist/index.js';\nexport * from '@tensorflow/tfjs-backend-webgl/dist/index.js';\nexport * from '@tensorflow/tfjs-backend-wasm/dist/index.js';\n\n// export all - sources\n/*\nexport * from '@tensorflow/tfjs-core/src/index';\nexport * from '@tensorflow/tfjs-layers/src/index';\nexport * from '@tensorflow/tfjs-converter/src/index';\nexport * as data from '@tensorflow/tfjs-data/src/index';\nexport * from '@tensorflow/tfjs-backend-cpu/src/index';\nexport * from '@tensorflow/tfjs-backend-webgl/src/index';\nexport * from '@tensorflow/tfjs-backend-wasm/src/index';\n*/\n\n// export versions\nexport const version = {\n tfjs: packageBundle?.version || undefined,\n 'tfjs-core': packageCore?.version || undefined,\n 'tfjs-data': packageData?.version || undefined,\n 'tfjs-layers': packageLayers?.version || undefined,\n 'tfjs-converter': packageConverter?.version || undefined,\n 'tfjs-backend-cpu': version_cpu || undefined,\n 'tfjs-backend-webgl': version_webgl || undefined,\n 'tfjs-backend-wasm': version_wasm || undefined,\n};\n// export const version = {};\n", "import { log } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\n\nexport const config = {\n name: 'humangl',\n priority: 99,\n canvas: null,\n gl: null,\n width: 1024,\n height: 1024,\n webGLattr: { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.2\n alpha: false,\n antialias: false,\n premultipliedAlpha: false,\n preserveDrawingBuffer: false,\n depth: false,\n stencil: false,\n failIfMajorPerformanceCaveat: false,\n desynchronized: true,\n },\n};\n\nexport function register(): void {\n if (!tf.findBackend(config.name)) {\n log('backend registration:', config.name);\n try {\n config.canvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(config.width, config.height) : document.createElement('canvas');\n } catch (err) {\n log('error: cannot create canvas:', err);\n return;\n }\n try {\n config.gl = config.canvas.getContext('webgl2', config.webGLattr);\n } catch (err) {\n log('error: cannot get WebGL2 context:', err);\n return;\n }\n try {\n tf.setWebGLContext(2, config.gl);\n } catch (err) {\n log('error: cannot set WebGL2 context:', err);\n return;\n }\n try {\n const ctx = new tf.GPGPUContext(config.gl);\n tf.registerBackend(config.name, () => new tf.MathBackendWebGL(ctx), config.priority);\n } catch (err) {\n log('error: cannot register WebGL backend:', err);\n return;\n }\n try {\n const kernels = tf.getKernelsForBackend('webgl');\n kernels.forEach((kernelConfig) => {\n const newKernelConfig = { ...kernelConfig, backendName: config.name };\n tf.registerKernel(newKernelConfig);\n });\n } catch (err) {\n log('error: cannot update WebGL backend registration:', err);\n return;\n }\n try {\n tf.ENV.set('WEBGL_VERSION', 2);\n // tf.ENV.set('WEBGL_MAX_TEXTURE_SIZE', config.gl.getParameter(config.gl.MAX_TEXTURE_SIZE));\n // tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true);\n // tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);\n } catch (err) {\n log('error: cannot set WebGL backend flags:', err);\n return;\n }\n log('backend registered:', config.name);\n }\n}\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as blazeface from './blazeface';\nimport * as facepipeline from './facepipeline';\nimport * as coords from './coords';\n\nlet faceModels:[any, any, any] = [null, null, null];\nlet facePipeline;\n\nexport async function predict(input, config): Promise<{ confidence, boxConfidence, faceConfidence, box, mesh, boxRaw, meshRaw, annotations, image }[]> {\n const predictions = await facePipeline.predict(input, config);\n const results: Array<{ confidence, boxConfidence, faceConfidence, box, mesh, boxRaw, meshRaw, annotations, image }> = [];\n for (const prediction of (predictions || [])) {\n if (!prediction || prediction.isDisposedInternal) continue; // guard against disposed tensors on long running operations such as pause in middle of processing\n const meshRaw = prediction.mesh.map((pt) => [\n pt[0] / input.shape[2],\n pt[1] / input.shape[1],\n pt[2] / facePipeline.meshSize,\n ]);\n const annotations = {};\n if (prediction.mesh && prediction.mesh.length > 0) {\n for (const key of Object.keys(coords.MESH_ANNOTATIONS)) annotations[key] = coords.MESH_ANNOTATIONS[key].map((index) => prediction.mesh[index]);\n }\n const clampedBox = prediction.box ? [\n Math.max(0, prediction.box.startPoint[0]),\n Math.max(0, prediction.box.startPoint[1]),\n Math.min(input.shape[2], prediction.box.endPoint[0]) - Math.max(0, prediction.box.startPoint[0]),\n Math.min(input.shape[1], prediction.box.endPoint[1]) - Math.max(0, prediction.box.startPoint[1]),\n ] : 0;\n const boxRaw = prediction.box ? [\n prediction.box.startPoint[0] / input.shape[2],\n prediction.box.startPoint[1] / input.shape[1],\n (prediction.box.endPoint[0] - prediction.box.startPoint[0]) / input.shape[2],\n (prediction.box.endPoint[1] - prediction.box.startPoint[1]) / input.shape[1],\n ] : [];\n results.push({\n confidence: Math.round(100 * prediction.faceConfidence || 100 * prediction.boxConfidence || 0) / 100,\n boxConfidence: Math.round(100 * prediction.boxConfidence) / 100,\n faceConfidence: Math.round(100 * prediction.faceConfidence) / 100,\n box: clampedBox,\n boxRaw,\n mesh: prediction.mesh,\n meshRaw,\n annotations,\n image: prediction.image,\n });\n if (prediction.coords) prediction.coords.dispose();\n }\n return results;\n}\n\nexport async function load(config): Promise<[Object, Object, Object]> {\n if ((!faceModels[0] && config.face.enabled) || (!faceModels[1] && config.face.mesh.enabled) || (!faceModels[2] && config.face.iris.enabled)) {\n faceModels = await Promise.all([\n (!faceModels[0] && config.face.enabled) ? blazeface.load(config) : null,\n (!faceModels[1] && config.face.mesh.enabled) ? tf.loadGraphModel(join(config.modelBasePath, config.face.mesh.modelPath), { fromTFHub: config.face.mesh.modelPath.includes('tfhub.dev') }) : null,\n (!faceModels[2] && config.face.iris.enabled) ? tf.loadGraphModel(join(config.modelBasePath, config.face.iris.modelPath), { fromTFHub: config.face.iris.modelPath.includes('tfhub.dev') }) : null,\n ]);\n if (config.face.mesh.enabled) {\n if (!faceModels[1] || !faceModels[1].modelUrl) log('load model failed:', config.face.mesh.modelPath);\n else if (config.debug) log('load model:', faceModels[1].modelUrl);\n }\n if (config.face.iris.enabled) {\n if (!faceModels[2] || !faceModels[1].modelUrl) log('load model failed:', config.face.iris.modelPath);\n else if (config.debug) log('load model:', faceModels[2].modelUrl);\n }\n } else if (config.debug) {\n log('cached model:', faceModels[0].model.modelUrl);\n log('cached model:', faceModels[1].modelUrl);\n log('cached model:', faceModels[2].modelUrl);\n }\n facePipeline = new facepipeline.Pipeline(faceModels[0], faceModels[1], faceModels[2]);\n return faceModels;\n}\n\nexport const triangulation = coords.TRI468;\nexport const uvmap = coords.UV468;\n", "import * as tf from '../../dist/tfjs.esm.js';\n\nexport function scaleBoxCoordinates(box, factor) {\n const startPoint = [box.startPoint[0] * factor[0], box.startPoint[1] * factor[1]];\n const endPoint = [box.endPoint[0] * factor[0], box.endPoint[1] * factor[1]];\n return { startPoint, endPoint };\n}\n\nexport function getBoxSize(box) {\n return [\n Math.abs(box.endPoint[0] - box.startPoint[0]),\n Math.abs(box.endPoint[1] - box.startPoint[1]),\n ];\n}\n\nexport function getBoxCenter(box) {\n return [\n box.startPoint[0] + (box.endPoint[0] - box.startPoint[0]) / 2,\n box.startPoint[1] + (box.endPoint[1] - box.startPoint[1]) / 2,\n ];\n}\n\nexport function cutBoxFromImageAndResize(box, image, cropSize) {\n const h = image.shape[1];\n const w = image.shape[2];\n const boxes = [[\n box.startPoint[1] / h,\n box.startPoint[0] / w,\n box.endPoint[1] / h,\n box.endPoint[0] / w,\n ]];\n return tf.image.cropAndResize(image, boxes, [0], cropSize);\n}\n\nexport function enlargeBox(box, factor = 1.5) {\n const center = getBoxCenter(box);\n const size = getBoxSize(box);\n const newHalfSize = [factor * size[0] / 2, factor * size[1] / 2];\n const startPoint = [center[0] - newHalfSize[0], center[1] - newHalfSize[1]];\n const endPoint = [center[0] + newHalfSize[0], center[1] + newHalfSize[1]];\n return { startPoint, endPoint, landmarks: box.landmarks };\n}\n\nexport function squarifyBox(box) {\n const centers = getBoxCenter(box);\n const size = getBoxSize(box);\n const maxEdge = Math.max(...size);\n const halfSize = maxEdge / 2;\n const startPoint = [Math.round(centers[0] - halfSize), Math.round(centers[1] - halfSize)];\n const endPoint = [Math.round(centers[0] + halfSize), Math.round(centers[1] + halfSize)];\n return { startPoint, endPoint, landmarks: box.landmarks };\n}\n\nexport function calculateLandmarksBoundingBox(landmarks) {\n const xs = landmarks.map((d) => d[0]);\n const ys = landmarks.map((d) => d[1]);\n const startPoint = [Math.min(...xs), Math.min(...ys)];\n const endPoint = [Math.max(...xs), Math.max(...ys)];\n return { startPoint, endPoint, landmarks };\n}\n\nexport const disposeBox = (t) => {\n t.startPoint.dispose();\n t.endPoint.dispose();\n};\n\nexport const createBox = (startEndTensor) => ({\n startPoint: tf.slice(startEndTensor, [0, 0], [-1, 2]),\n endPoint: tf.slice(startEndTensor, [0, 2], [-1, 2]),\n});\n", "export const IDENTITY_MATRIX = [[1, 0, 0], [0, 1, 0], [0, 0, 1]];\n/**\n * Normalizes the provided angle to the range -pi to pi.\n * @param angle The angle in radians to be normalized.\n */\nexport function normalizeRadians(angle) {\n return angle - 2 * Math.PI * Math.floor((angle + Math.PI) / (2 * Math.PI));\n}\n\n/**\n * Computes the angle of rotation between two anchor points.\n * @param point1 First anchor point\n * @param point2 Second anchor point\n */\nexport function computeRotation(point1, point2) {\n const radians = Math.PI / 2 - Math.atan2(-(point2[1] - point1[1]), point2[0] - point1[0]);\n return normalizeRadians(radians);\n}\n\nexport function radToDegrees(rad) {\n return rad * 180 / Math.PI;\n}\n\nexport function buildTranslationMatrix(x, y) {\n return [[1, 0, x], [0, 1, y], [0, 0, 1]];\n}\n\nexport function dot(v1, v2) {\n let product = 0;\n for (let i = 0; i < v1.length; i++) {\n product += v1[i] * v2[i];\n }\n return product;\n}\n\nexport function getColumnFrom2DArr(arr, columnIndex) {\n const column: Array = [];\n for (let i = 0; i < arr.length; i++) {\n column.push(arr[i][columnIndex]);\n }\n return column;\n}\n\nexport function multiplyTransformMatrices(mat1, mat2) {\n const product: Array = [];\n const size = mat1.length;\n for (let row = 0; row < size; row++) {\n product.push([]);\n for (let col = 0; col < size; col++) {\n product[row].push(dot(mat1[row], getColumnFrom2DArr(mat2, col)));\n }\n }\n return product;\n}\n\nexport function buildRotationMatrix(rotation, center) {\n const cosA = Math.cos(rotation);\n const sinA = Math.sin(rotation);\n const rotationMatrix = [[cosA, -sinA, 0], [sinA, cosA, 0], [0, 0, 1]];\n const translationMatrix = buildTranslationMatrix(center[0], center[1]);\n const translationTimesRotation = multiplyTransformMatrices(translationMatrix, rotationMatrix);\n const negativeTranslationMatrix = buildTranslationMatrix(-center[0], -center[1]);\n return multiplyTransformMatrices(translationTimesRotation, negativeTranslationMatrix);\n}\n\nexport function invertTransformMatrix(matrix) {\n const rotationComponent = [[matrix[0][0], matrix[1][0]], [matrix[0][1], matrix[1][1]]];\n const translationComponent = [matrix[0][2], matrix[1][2]];\n const invertedTranslation = [\n -dot(rotationComponent[0], translationComponent),\n -dot(rotationComponent[1], translationComponent),\n ];\n return [\n rotationComponent[0].concat(invertedTranslation[0]),\n rotationComponent[1].concat(invertedTranslation[1]),\n [0, 0, 1],\n ];\n}\n\nexport function rotatePoint(homogeneousCoordinate, rotationMatrix) {\n return [\n dot(homogeneousCoordinate, rotationMatrix[0]),\n dot(homogeneousCoordinate, rotationMatrix[1]),\n ];\n}\n\nexport function xyDistanceBetweenPoints(a, b) {\n return Math.sqrt(((a[0] - b[0]) ** 2) + ((a[1] - b[1]) ** 2));\n}\n\nexport function generateAnchors(inputSize) {\n const spec = { strides: [inputSize / 16, inputSize / 8], anchors: [2, 6] };\n const anchors: Array<[number, number]> = [];\n for (let i = 0; i < spec.strides.length; i++) {\n const stride = spec.strides[i];\n const gridRows = Math.floor((inputSize + stride - 1) / stride);\n const gridCols = Math.floor((inputSize + stride - 1) / stride);\n const anchorsNum = spec.anchors[i];\n for (let gridY = 0; gridY < gridRows; gridY++) {\n const anchorY = stride * (gridY + 0.5);\n for (let gridX = 0; gridX < gridCols; gridX++) {\n const anchorX = stride * (gridX + 0.5);\n for (let n = 0; n < anchorsNum; n++) {\n anchors.push([anchorX, anchorY]);\n }\n }\n }\n }\n return anchors;\n}\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as box from './box';\nimport * as util from './util';\n\nconst keypointsCount = 6;\n\nfunction decodeBounds(boxOutputs, anchors, inputSize) {\n const boxStarts = tf.slice(boxOutputs, [0, 1], [-1, 2]);\n const centers = tf.add(boxStarts, anchors);\n const boxSizes = tf.slice(boxOutputs, [0, 3], [-1, 2]);\n const boxSizesNormalized = tf.div(boxSizes, inputSize);\n const centersNormalized = tf.div(centers, inputSize);\n const halfBoxSize = tf.div(boxSizesNormalized, 2);\n const starts = tf.sub(centersNormalized, halfBoxSize);\n const ends = tf.add(centersNormalized, halfBoxSize);\n const startNormalized = tf.mul(starts, inputSize);\n const endNormalized = tf.mul(ends, inputSize);\n const concatAxis = 1;\n return tf.concat2d([startNormalized, endNormalized], concatAxis);\n}\n\nexport class BlazeFaceModel {\n model: any;\n anchorsData: any;\n anchors: any;\n inputSize: number;\n config: any;\n\n constructor(model, config) {\n this.model = model;\n this.anchorsData = util.generateAnchors(model.inputs[0].shape[1]);\n this.anchors = tf.tensor2d(this.anchorsData);\n this.inputSize = model.inputs[0].shape[2];\n this.config = config;\n }\n\n async getBoundingBoxes(inputImage) {\n // sanity check on input\n if ((!inputImage) || (inputImage.isDisposedInternal) || (inputImage.shape.length !== 4) || (inputImage.shape[1] < 1) || (inputImage.shape[2] < 1)) return null;\n const [batch, boxes, scores] = tf.tidy(() => {\n const resizedImage = inputImage.resizeBilinear([this.inputSize, this.inputSize]);\n const normalizedImage = resizedImage.div(127.5).sub(0.5);\n const res = this.model.execute(normalizedImage);\n let batchOut;\n if (Array.isArray(res)) { // are we using tfhub or pinto converted model?\n const sorted = res.sort((a, b) => a.size - b.size);\n const concat384 = tf.concat([sorted[0], sorted[2]], 2); // dim: 384, 1 + 16\n const concat512 = tf.concat([sorted[1], sorted[3]], 2); // dim: 512, 1 + 16\n const concat = tf.concat([concat512, concat384], 1);\n batchOut = concat.squeeze(0);\n } else {\n batchOut = res.squeeze(); // when using tfhub model\n }\n const boxesOut = decodeBounds(batchOut, this.anchors, [this.inputSize, this.inputSize]);\n const logits = tf.slice(batchOut, [0, 0], [-1, 1]);\n const scoresOut = tf.sigmoid(logits).squeeze().dataSync();\n return [batchOut, boxesOut, scoresOut];\n });\n const nmsTensor = await tf.image.nonMaxSuppressionAsync(boxes, scores, this.config.face.detector.maxDetected, this.config.face.detector.iouThreshold, this.config.face.detector.minConfidence);\n const nms = nmsTensor.arraySync();\n nmsTensor.dispose();\n const annotatedBoxes: Array<{ box: any, landmarks: any, anchor: number[], confidence: number }> = [];\n for (let i = 0; i < nms.length; i++) {\n const confidence = scores[nms[i]];\n if (confidence > this.config.face.detector.minConfidence) {\n const boundingBox = tf.slice(boxes, [nms[i], 0], [1, -1]);\n const localBox = box.createBox(boundingBox);\n boundingBox.dispose();\n const anchor = this.anchorsData[nms[i]];\n const landmarks = tf.tidy(() => tf.slice(batch, [nms[i], keypointsCount - 1], [1, -1]).squeeze().reshape([keypointsCount, -1]));\n annotatedBoxes.push({ box: localBox, landmarks, anchor, confidence });\n }\n }\n // boundingBoxes.forEach((t) => t.dispose());\n batch.dispose();\n boxes.dispose();\n // scores.dispose();\n return {\n boxes: annotatedBoxes,\n scaleFactor: [inputImage.shape[2] / this.inputSize, inputImage.shape[1] / this.inputSize],\n };\n }\n}\n\nexport async function load(config) {\n const model = await tf.loadGraphModel(join(config.modelBasePath, config.face.detector.modelPath), { fromTFHub: config.face.detector.modelPath.includes('tfhub.dev') });\n const blazeFace = new BlazeFaceModel(model, config);\n if (!model || !model.modelUrl) log('load model failed:', config.face.detector.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n return blazeFace;\n}\n", "export const MESH_ANNOTATIONS = {\n silhouette: [\n 10, 338, 297, 332, 284, 251, 389, 356, 454, 323, 361, 288,\n 397, 365, 379, 378, 400, 377, 152, 148, 176, 149, 150, 136,\n 172, 58, 132, 93, 234, 127, 162, 21, 54, 103, 67, 109,\n ],\n lipsUpperOuter: [61, 185, 40, 39, 37, 0, 267, 269, 270, 409, 291],\n lipsLowerOuter: [146, 91, 181, 84, 17, 314, 405, 321, 375, 291],\n lipsUpperInner: [78, 191, 80, 81, 82, 13, 312, 311, 310, 415, 308],\n lipsLowerInner: [78, 95, 88, 178, 87, 14, 317, 402, 318, 324, 308],\n rightEyeUpper0: [246, 161, 160, 159, 158, 157, 173],\n rightEyeLower0: [33, 7, 163, 144, 145, 153, 154, 155, 133],\n rightEyeUpper1: [247, 30, 29, 27, 28, 56, 190],\n rightEyeLower1: [130, 25, 110, 24, 23, 22, 26, 112, 243],\n rightEyeUpper2: [113, 225, 224, 223, 222, 221, 189],\n rightEyeLower2: [226, 31, 228, 229, 230, 231, 232, 233, 244],\n rightEyeLower3: [143, 111, 117, 118, 119, 120, 121, 128, 245],\n rightEyebrowUpper: [156, 70, 63, 105, 66, 107, 55, 193],\n rightEyebrowLower: [35, 124, 46, 53, 52, 65],\n rightEyeIris: [473, 474, 475, 476, 477],\n leftEyeUpper0: [466, 388, 387, 386, 385, 384, 398],\n leftEyeLower0: [263, 249, 390, 373, 374, 380, 381, 382, 362],\n leftEyeUpper1: [467, 260, 259, 257, 258, 286, 414],\n leftEyeLower1: [359, 255, 339, 254, 253, 252, 256, 341, 463],\n leftEyeUpper2: [342, 445, 444, 443, 442, 441, 413],\n leftEyeLower2: [446, 261, 448, 449, 450, 451, 452, 453, 464],\n leftEyeLower3: [372, 340, 346, 347, 348, 349, 350, 357, 465],\n leftEyebrowUpper: [383, 300, 293, 334, 296, 336, 285, 417],\n leftEyebrowLower: [265, 353, 276, 283, 282, 295],\n leftEyeIris: [468, 469, 470, 471, 472],\n midwayBetweenEyes: [168],\n noseTip: [1],\n noseBottom: [2],\n noseRightCorner: [98],\n noseLeftCorner: [327],\n rightCheek: [205],\n leftCheek: [425],\n};\n\nexport const MESH_TO_IRIS_INDICES_MAP = [ // A mapping from facemesh model keypoints to iris model keypoints.\n { key: 'EyeUpper0', indices: [9, 10, 11, 12, 13, 14, 15] },\n { key: 'EyeUpper1', indices: [25, 26, 27, 28, 29, 30, 31] },\n { key: 'EyeUpper2', indices: [41, 42, 43, 44, 45, 46, 47] },\n { key: 'EyeLower0', indices: [0, 1, 2, 3, 4, 5, 6, 7, 8] },\n { key: 'EyeLower1', indices: [16, 17, 18, 19, 20, 21, 22, 23, 24] },\n { key: 'EyeLower2', indices: [32, 33, 34, 35, 36, 37, 38, 39, 40] },\n { key: 'EyeLower3', indices: [54, 55, 56, 57, 58, 59, 60, 61, 62] },\n // { key: 'EyebrowUpper', indices: [63, 64, 65, 66, 67, 68, 69, 70] },\n // { key: 'EyebrowLower', indices: [48, 49, 50, 51, 52, 53] },\n];\n\nexport const UV468 = [\n [0.499976992607117, 0.652534008026123],\n [0.500025987625122, 0.547487020492554],\n [0.499974012374878, 0.602371990680695],\n [0.482113003730774, 0.471979022026062],\n [0.500150978565216, 0.527155995368958],\n [0.499909996986389, 0.498252987861633],\n [0.499523013830185, 0.40106201171875],\n [0.289712011814117, 0.380764007568359],\n [0.499954998493195, 0.312398016452789],\n [0.499987006187439, 0.269918978214264],\n [0.500023007392883, 0.107050001621246],\n [0.500023007392883, 0.666234016418457],\n [0.5000159740448, 0.679224014282227],\n [0.500023007392883, 0.692348003387451],\n [0.499976992607117, 0.695277988910675],\n [0.499976992607117, 0.70593398809433],\n [0.499976992607117, 0.719385027885437],\n [0.499976992607117, 0.737019002437592],\n [0.499967992305756, 0.781370997428894],\n [0.499816000461578, 0.562981009483337],\n [0.473773002624512, 0.573909997940063],\n [0.104906998574734, 0.254140973091125],\n [0.365929991006851, 0.409575998783112],\n [0.338757991790771, 0.41302502155304],\n [0.311120003461838, 0.409460008144379],\n [0.274657994508743, 0.389131009578705],\n [0.393361985683441, 0.403706014156342],\n [0.345234006643295, 0.344011008739471],\n [0.370094001293182, 0.346076011657715],\n [0.319321990013123, 0.347265005111694],\n [0.297903001308441, 0.353591024875641],\n [0.24779200553894, 0.410809993743896],\n [0.396889001131058, 0.842755019664764],\n [0.280097991228104, 0.375599980354309],\n [0.106310002505779, 0.399955987930298],\n [0.2099249958992, 0.391353011131287],\n [0.355807989835739, 0.534406006336212],\n [0.471751004457474, 0.65040397644043],\n [0.474155008792877, 0.680191993713379],\n [0.439785003662109, 0.657229006290436],\n [0.414617002010345, 0.66654098033905],\n [0.450374007225037, 0.680860996246338],\n [0.428770989179611, 0.682690978050232],\n [0.374971002340317, 0.727805018424988],\n [0.486716985702515, 0.547628998756409],\n [0.485300987958908, 0.527395009994507],\n [0.257764995098114, 0.314490020275116],\n [0.401223003864288, 0.455172002315521],\n [0.429818987846375, 0.548614978790283],\n [0.421351999044418, 0.533740997314453],\n [0.276895999908447, 0.532056987285614],\n [0.483370006084442, 0.499586999416351],\n [0.33721199631691, 0.282882988452911],\n [0.296391993761063, 0.293242990970612],\n [0.169294998049736, 0.193813979625702],\n [0.447580009698868, 0.302609980106354],\n [0.392390012741089, 0.353887975215912],\n [0.354490011930466, 0.696784019470215],\n [0.067304998636246, 0.730105042457581],\n [0.442739009857178, 0.572826027870178],\n [0.457098007202148, 0.584792017936707],\n [0.381974011659622, 0.694710969924927],\n [0.392388999462128, 0.694203019142151],\n [0.277076005935669, 0.271932005882263],\n [0.422551989555359, 0.563233017921448],\n [0.385919004678726, 0.281364023685455],\n [0.383103013038635, 0.255840003490448],\n [0.331431001424789, 0.119714021682739],\n [0.229923993349075, 0.232002973556519],\n [0.364500999450684, 0.189113974571228],\n [0.229622006416321, 0.299540996551514],\n [0.173287004232407, 0.278747975826263],\n [0.472878992557526, 0.666198015213013],\n [0.446828007698059, 0.668527007102966],\n [0.422762006521225, 0.673889994621277],\n [0.445307999849319, 0.580065965652466],\n [0.388103008270264, 0.693961024284363],\n [0.403039008378983, 0.706539988517761],\n [0.403629004955292, 0.693953037261963],\n [0.460041999816895, 0.557139039039612],\n [0.431158006191254, 0.692366003990173],\n [0.452181994915009, 0.692366003990173],\n [0.475387006998062, 0.692366003990173],\n [0.465828001499176, 0.779190003871918],\n [0.472328990697861, 0.736225962638855],\n [0.473087012767792, 0.717857003211975],\n [0.473122000694275, 0.704625964164734],\n [0.473033010959625, 0.695277988910675],\n [0.427942007780075, 0.695277988910675],\n [0.426479011774063, 0.703539967536926],\n [0.423162013292313, 0.711845993995667],\n [0.4183090031147, 0.720062971115112],\n [0.390094995498657, 0.639572978019714],\n [0.013953999616206, 0.560034036636353],\n [0.499913990497589, 0.58014702796936],\n [0.413199990987778, 0.69539999961853],\n [0.409626007080078, 0.701822996139526],\n [0.468080013990402, 0.601534962654114],\n [0.422728985548019, 0.585985004901886],\n [0.463079988956451, 0.593783974647522],\n [0.37211999297142, 0.47341400384903],\n [0.334562003612518, 0.496073007583618],\n [0.411671012639999, 0.546965003013611],\n [0.242175996303558, 0.14767599105835],\n [0.290776997804642, 0.201445996761322],\n [0.327338010072708, 0.256527006626129],\n [0.399509996175766, 0.748921036720276],\n [0.441727995872498, 0.261676013469696],\n [0.429764986038208, 0.187834024429321],\n [0.412198007106781, 0.108901023864746],\n [0.288955003023148, 0.398952007293701],\n [0.218936994671822, 0.435410976409912],\n [0.41278201341629, 0.398970007896423],\n [0.257135003805161, 0.355440020561218],\n [0.427684992551804, 0.437960982322693],\n [0.448339998722076, 0.536936044692993],\n [0.178560003638268, 0.45755398273468],\n [0.247308000922203, 0.457193970680237],\n [0.286267012357712, 0.467674970626831],\n [0.332827985286713, 0.460712015628815],\n [0.368755996227264, 0.447206974029541],\n [0.398963987827301, 0.432654976844788],\n [0.476410001516342, 0.405806005001068],\n [0.189241006970406, 0.523923993110657],\n [0.228962004184723, 0.348950982093811],\n [0.490725994110107, 0.562400996685028],\n [0.404670000076294, 0.485132992267609],\n [0.019469000399113, 0.401564002037048],\n [0.426243007183075, 0.420431017875671],\n [0.396993011236191, 0.548797011375427],\n [0.266469985246658, 0.376977026462555],\n [0.439121007919312, 0.51895797252655],\n [0.032313998788595, 0.644356966018677],\n [0.419054001569748, 0.387154996395111],\n [0.462783008813858, 0.505746960639954],\n [0.238978996872902, 0.779744982719421],\n [0.198220998048782, 0.831938028335571],\n [0.107550002634525, 0.540755033493042],\n [0.183610007166862, 0.740257024765015],\n [0.134409993886948, 0.333683013916016],\n [0.385764002799988, 0.883153975009918],\n [0.490967005491257, 0.579378008842468],\n [0.382384985685349, 0.508572995662689],\n [0.174399003386497, 0.397670984268188],\n [0.318785011768341, 0.39623498916626],\n [0.343364000320435, 0.400596976280212],\n [0.396100014448166, 0.710216999053955],\n [0.187885001301765, 0.588537991046906],\n [0.430987000465393, 0.944064974784851],\n [0.318993002176285, 0.898285031318665],\n [0.266247987747192, 0.869701027870178],\n [0.500023007392883, 0.190576016902924],\n [0.499976992607117, 0.954452991485596],\n [0.366169989109039, 0.398822009563446],\n [0.393207013607025, 0.39553701877594],\n [0.410373002290726, 0.391080021858215],\n [0.194993004202843, 0.342101991176605],\n [0.388664990663528, 0.362284004688263],\n [0.365961998701096, 0.355970978736877],\n [0.343364000320435, 0.355356991291046],\n [0.318785011768341, 0.35834002494812],\n [0.301414996385574, 0.363156020641327],\n [0.058132998645306, 0.319076001644135],\n [0.301414996385574, 0.387449026107788],\n [0.499987989664078, 0.618434011936188],\n [0.415838003158569, 0.624195992946625],\n [0.445681989192963, 0.566076993942261],\n [0.465844005346298, 0.620640993118286],\n [0.49992299079895, 0.351523995399475],\n [0.288718998432159, 0.819945991039276],\n [0.335278987884521, 0.852819979190826],\n [0.440512001514435, 0.902418971061707],\n [0.128294005990028, 0.791940987110138],\n [0.408771991729736, 0.373893976211548],\n [0.455606997013092, 0.451801002025604],\n [0.499877005815506, 0.908990025520325],\n [0.375436991453171, 0.924192011356354],\n [0.11421000212431, 0.615022003650665],\n [0.448662012815475, 0.695277988910675],\n [0.4480200111866, 0.704632043838501],\n [0.447111994028091, 0.715808033943176],\n [0.444831997156143, 0.730794012546539],\n [0.430011987686157, 0.766808986663818],\n [0.406787008047104, 0.685672998428345],\n [0.400738000869751, 0.681069016456604],\n [0.392399996519089, 0.677703022956848],\n [0.367855995893478, 0.663918972015381],\n [0.247923001646996, 0.601333022117615],\n [0.452769994735718, 0.420849978923798],\n [0.43639200925827, 0.359887003898621],\n [0.416164010763168, 0.368713974952698],\n [0.413385987281799, 0.692366003990173],\n [0.228018000721931, 0.683571994304657],\n [0.468268007040024, 0.352671027183533],\n [0.411361992359161, 0.804327011108398],\n [0.499989002943039, 0.469825029373169],\n [0.479153990745544, 0.442654013633728],\n [0.499974012374878, 0.439637005329132],\n [0.432112008333206, 0.493588984012604],\n [0.499886006116867, 0.866917014122009],\n [0.49991300702095, 0.821729004383087],\n [0.456548988819122, 0.819200992584229],\n [0.344549000263214, 0.745438992977142],\n [0.37890899181366, 0.574010014533997],\n [0.374292999505997, 0.780184984207153],\n [0.319687992334366, 0.570737957954407],\n [0.357154995203018, 0.604269981384277],\n [0.295284003019333, 0.621580958366394],\n [0.447750002145767, 0.862477004528046],\n [0.410986006259918, 0.508723020553589],\n [0.31395098567009, 0.775308012962341],\n [0.354128003120422, 0.812552988529205],\n [0.324548006057739, 0.703992962837219],\n [0.189096003770828, 0.646299958229065],\n [0.279776990413666, 0.71465802192688],\n [0.1338230073452, 0.682700991630554],\n [0.336768001317978, 0.644733011722565],\n [0.429883986711502, 0.466521978378296],\n [0.455527991056442, 0.548622965812683],\n [0.437114000320435, 0.558896005153656],\n [0.467287987470627, 0.529924988746643],\n [0.414712011814117, 0.335219979286194],\n [0.37704598903656, 0.322777986526489],\n [0.344107985496521, 0.320150971412659],\n [0.312875986099243, 0.32233202457428],\n [0.283526003360748, 0.333190023899078],\n [0.241245999932289, 0.382785975933075],\n [0.102986000478268, 0.468762993812561],\n [0.267612010240555, 0.424560010433197],\n [0.297879010438919, 0.433175981044769],\n [0.333433985710144, 0.433878004550934],\n [0.366427004337311, 0.426115989685059],\n [0.396012008190155, 0.416696012020111],\n [0.420121014118195, 0.41022801399231],\n [0.007561000064015, 0.480777025222778],\n [0.432949006557465, 0.569517970085144],\n [0.458638995885849, 0.479089021682739],\n [0.473466008901596, 0.545744001865387],\n [0.476087987422943, 0.563830018043518],\n [0.468472003936768, 0.555056989192963],\n [0.433990985155106, 0.582361996173859],\n [0.483518004417419, 0.562983989715576],\n [0.482482999563217, 0.57784903049469],\n [0.42645001411438, 0.389798998832703],\n [0.438998997211456, 0.39649498462677],\n [0.450067013502121, 0.400434017181396],\n [0.289712011814117, 0.368252992630005],\n [0.276670008897781, 0.363372981548309],\n [0.517862021923065, 0.471948027610779],\n [0.710287988185883, 0.380764007568359],\n [0.526226997375488, 0.573909997940063],\n [0.895093023777008, 0.254140973091125],\n [0.634069979190826, 0.409575998783112],\n [0.661242008209229, 0.41302502155304],\n [0.688880026340485, 0.409460008144379],\n [0.725341975688934, 0.389131009578705],\n [0.606630027294159, 0.40370500087738],\n [0.654766023159027, 0.344011008739471],\n [0.629905998706818, 0.346076011657715],\n [0.680678009986877, 0.347265005111694],\n [0.702096998691559, 0.353591024875641],\n [0.75221198797226, 0.410804986953735],\n [0.602918028831482, 0.842862963676453],\n [0.719901978969574, 0.375599980354309],\n [0.893692970275879, 0.399959981441498],\n [0.790081977844238, 0.391354024410248],\n [0.643998026847839, 0.534487962722778],\n [0.528249025344849, 0.65040397644043],\n [0.525849997997284, 0.680191040039062],\n [0.560214996337891, 0.657229006290436],\n [0.585384011268616, 0.66654098033905],\n [0.549625992774963, 0.680860996246338],\n [0.57122802734375, 0.682691991329193],\n [0.624852001667023, 0.72809898853302],\n [0.513050019741058, 0.547281980514526],\n [0.51509702205658, 0.527251958847046],\n [0.742246985435486, 0.314507007598877],\n [0.598631024360657, 0.454979002475739],\n [0.570338010787964, 0.548575043678284],\n [0.578631997108459, 0.533622980117798],\n [0.723087012767792, 0.532054007053375],\n [0.516445994377136, 0.499638974666595],\n [0.662801027297974, 0.282917976379395],\n [0.70362401008606, 0.293271005153656],\n [0.830704987049103, 0.193813979625702],\n [0.552385985851288, 0.302568018436432],\n [0.607609987258911, 0.353887975215912],\n [0.645429015159607, 0.696707010269165],\n [0.932694971561432, 0.730105042457581],\n [0.557260990142822, 0.572826027870178],\n [0.542901992797852, 0.584792017936707],\n [0.6180260181427, 0.694710969924927],\n [0.607590973377228, 0.694203019142151],\n [0.722943007946014, 0.271963000297546],\n [0.577413976192474, 0.563166975975037],\n [0.614082992076874, 0.281386971473694],\n [0.616907000541687, 0.255886018276215],\n [0.668509006500244, 0.119913995265961],\n [0.770092010498047, 0.232020974159241],\n [0.635536015033722, 0.189248979091644],\n [0.77039098739624, 0.299556016921997],\n [0.826722025871277, 0.278755009174347],\n [0.527121007442474, 0.666198015213013],\n [0.553171992301941, 0.668527007102966],\n [0.577238023281097, 0.673889994621277],\n [0.554691970348358, 0.580065965652466],\n [0.611896991729736, 0.693961024284363],\n [0.59696102142334, 0.706539988517761],\n [0.596370995044708, 0.693953037261963],\n [0.539958000183105, 0.557139039039612],\n [0.568841993808746, 0.692366003990173],\n [0.547818005084991, 0.692366003990173],\n [0.52461302280426, 0.692366003990173],\n [0.534089982509613, 0.779141008853912],\n [0.527670979499817, 0.736225962638855],\n [0.526912987232208, 0.717857003211975],\n [0.526877999305725, 0.704625964164734],\n [0.526966989040375, 0.695277988910675],\n [0.572058022022247, 0.695277988910675],\n [0.573521018028259, 0.703539967536926],\n [0.57683801651001, 0.711845993995667],\n [0.581691026687622, 0.720062971115112],\n [0.609944999217987, 0.639909982681274],\n [0.986046016216278, 0.560034036636353],\n [0.5867999792099, 0.69539999961853],\n [0.590372025966644, 0.701822996139526],\n [0.531915009021759, 0.601536989212036],\n [0.577268004417419, 0.585934996604919],\n [0.536915004253387, 0.593786001205444],\n [0.627542972564697, 0.473352015018463],\n [0.665585994720459, 0.495950996875763],\n [0.588353991508484, 0.546862006187439],\n [0.757824003696442, 0.14767599105835],\n [0.709249973297119, 0.201507985591888],\n [0.672684013843536, 0.256581008434296],\n [0.600408971309662, 0.74900496006012],\n [0.55826598405838, 0.261672019958496],\n [0.570303976535797, 0.187870979309082],\n [0.588165998458862, 0.109044015407562],\n [0.711045026779175, 0.398952007293701],\n [0.781069993972778, 0.435405015945435],\n [0.587247014045715, 0.398931980133057],\n [0.742869973182678, 0.355445981025696],\n [0.572156012058258, 0.437651991844177],\n [0.55186802148819, 0.536570012569427],\n [0.821442008018494, 0.457556009292603],\n [0.752701997756958, 0.457181990146637],\n [0.71375697851181, 0.467626988887787],\n [0.66711300611496, 0.460672974586487],\n [0.631101012229919, 0.447153985500336],\n [0.6008620262146, 0.432473003864288],\n [0.523481011390686, 0.405627012252808],\n [0.810747981071472, 0.523926019668579],\n [0.771045982837677, 0.348959028720856],\n [0.509127020835876, 0.562718033790588],\n [0.595292985439301, 0.485023975372314],\n [0.980530977249146, 0.401564002037048],\n [0.573499977588654, 0.420000016689301],\n [0.602994978427887, 0.548687994480133],\n [0.733529984951019, 0.376977026462555],\n [0.560611009597778, 0.519016981124878],\n [0.967685997486115, 0.644356966018677],\n [0.580985009670258, 0.387160003185272],\n [0.537728011608124, 0.505385041236877],\n [0.760966002941132, 0.779752969741821],\n [0.801778972148895, 0.831938028335571],\n [0.892440974712372, 0.54076099395752],\n [0.816350996494293, 0.740260004997253],\n [0.865594983100891, 0.333687007427216],\n [0.614073991775513, 0.883246004581451],\n [0.508952975273132, 0.579437971115112],\n [0.617941975593567, 0.508316040039062],\n [0.825608015060425, 0.397674977779388],\n [0.681214988231659, 0.39623498916626],\n [0.656635999679565, 0.400596976280212],\n [0.603900015354156, 0.710216999053955],\n [0.81208598613739, 0.588539004325867],\n [0.56801301240921, 0.944564998149872],\n [0.681007981300354, 0.898285031318665],\n [0.733752012252808, 0.869701027870178],\n [0.633830010890961, 0.398822009563446],\n [0.606792986392975, 0.39553701877594],\n [0.589659988880157, 0.391062021255493],\n [0.805015981197357, 0.342108011245728],\n [0.611334979534149, 0.362284004688263],\n [0.634037971496582, 0.355970978736877],\n [0.656635999679565, 0.355356991291046],\n [0.681214988231659, 0.35834002494812],\n [0.698584973812103, 0.363156020641327],\n [0.941866993904114, 0.319076001644135],\n [0.698584973812103, 0.387449026107788],\n [0.584177017211914, 0.624107003211975],\n [0.554318010807037, 0.566076993942261],\n [0.534153997898102, 0.62064003944397],\n [0.711217999458313, 0.819975018501282],\n [0.664629995822906, 0.852871000766754],\n [0.559099972248077, 0.902631998062134],\n [0.871706008911133, 0.791940987110138],\n [0.591234028339386, 0.373893976211548],\n [0.544341027736664, 0.451583981513977],\n [0.624562978744507, 0.924192011356354],\n [0.88577002286911, 0.615028977394104],\n [0.551338016986847, 0.695277988910675],\n [0.551980018615723, 0.704632043838501],\n [0.552887976169586, 0.715808033943176],\n [0.555167973041534, 0.730794012546539],\n [0.569944024085999, 0.767035007476807],\n [0.593203008174896, 0.685675978660583],\n [0.599261999130249, 0.681069016456604],\n [0.607599973678589, 0.677703022956848],\n [0.631937980651855, 0.663500010967255],\n [0.752032995223999, 0.601315021514893],\n [0.547226011753082, 0.420395016670227],\n [0.563543975353241, 0.359827995300293],\n [0.583841025829315, 0.368713974952698],\n [0.586614012718201, 0.692366003990173],\n [0.771915018558502, 0.683578014373779],\n [0.531597018241882, 0.352482974529266],\n [0.588370978832245, 0.804440975189209],\n [0.52079701423645, 0.442565023899078],\n [0.567984998226166, 0.493479013442993],\n [0.543282985687256, 0.819254994392395],\n [0.655317008495331, 0.745514988899231],\n [0.621008992195129, 0.574018001556396],\n [0.625559985637665, 0.78031200170517],\n [0.680198013782501, 0.570719003677368],\n [0.64276397228241, 0.604337990283966],\n [0.704662978649139, 0.621529996395111],\n [0.552012026309967, 0.862591981887817],\n [0.589071989059448, 0.508637011051178],\n [0.685944974422455, 0.775357007980347],\n [0.645735025405884, 0.812640011310577],\n [0.675342977046967, 0.703978002071381],\n [0.810858011245728, 0.646304965019226],\n [0.72012197971344, 0.714666962623596],\n [0.866151988506317, 0.682704985141754],\n [0.663187026977539, 0.644596993923187],\n [0.570082008838654, 0.466325998306274],\n [0.544561982154846, 0.548375964164734],\n [0.562758982181549, 0.558784961700439],\n [0.531987011432648, 0.530140042304993],\n [0.585271000862122, 0.335177004337311],\n [0.622952997684479, 0.32277899980545],\n [0.655896008014679, 0.320163011550903],\n [0.687132000923157, 0.322345972061157],\n [0.716481983661652, 0.333200991153717],\n [0.758756995201111, 0.382786989212036],\n [0.897013008594513, 0.468769013881683],\n [0.732392013072968, 0.424547016620636],\n [0.70211398601532, 0.433162987232208],\n [0.66652500629425, 0.433866024017334],\n [0.633504986763, 0.426087975502014],\n [0.603875994682312, 0.416586995124817],\n [0.579657971858978, 0.409945011138916],\n [0.992439985275269, 0.480777025222778],\n [0.567192018032074, 0.569419980049133],\n [0.54136598110199, 0.478899002075195],\n [0.526564002037048, 0.546118021011353],\n [0.523913025856018, 0.563830018043518],\n [0.531529009342194, 0.555056989192963],\n [0.566035985946655, 0.582329034805298],\n [0.51631098985672, 0.563053965568542],\n [0.5174720287323, 0.577877044677734],\n [0.573594987392426, 0.389806985855103],\n [0.560697972774506, 0.395331978797913],\n [0.549755990505219, 0.399751007556915],\n [0.710287988185883, 0.368252992630005],\n [0.723330020904541, 0.363372981548309],\n];\n\nexport const TRI468 = [\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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,\n 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];\n\nexport const TRI68 = [0, 1, 36, 0, 36, 17, 1, 2, 41, 1, 41, 36, 2, 3, 31, 2, 31, 41, 3, 4, 48, 3, 48, 31, 4, 5, 48, 5, 6, 48, 6, 7, 59, 6, 59, 48, 7, 8, 58, 7, 58, 59,\n 8, 9, 56, 8, 56, 57, 8, 57, 58, 9, 10, 55, 9, 55, 56, 10, 11, 54, 10, 54, 55, 11, 12, 54, 12, 13, 54, 13, 14, 35, 13, 35, 54, 14, 15, 46, 14, 46, 35, 15, 16,\n 45, 15, 45, 46, 16, 26, 45, 17, 36, 18, 18, 37, 19, 18, 36, 37, 19, 38, 20, 19, 37, 38, 20, 39, 21, 20, 38, 39, 21, 39, 27, 22, 42, 23, 22, 27, 42, 23, 43, 24,\n 23, 42, 43, 24, 44, 25, 24, 43, 44, 25, 45, 26, 25, 44, 45, 27, 39, 28, 27, 28, 42, 28, 39, 29, 28, 29, 42, 29, 31, 30, 29, 30, 35, 29, 40, 31, 29, 35, 47, 29,\n 39, 40, 29, 47, 42, 30, 31, 32, 30, 32, 33, 30, 33, 34, 30, 34, 35, 31, 50, 32, 31, 40, 41, 31, 48, 49, 31, 49, 50, 32, 51, 33, 32, 50, 51, 33, 51, 34, 34, 52,\n 35, 34, 51, 52, 35, 46, 47, 35, 52, 53, 35, 53, 54, 36, 41, 37, 37, 40, 38, 37, 41, 40, 38, 40, 39, 42, 47, 43, 43, 47, 44, 44, 46, 45, 44, 47, 46, 48, 60, 49,\n 48, 59, 60, 49, 61, 50, 49, 60, 61, 50, 62, 51, 50, 61, 62, 51, 62, 52, 52, 63, 53, 52, 62, 63, 53, 64, 54, 53, 63, 64, 54, 64, 55, 55, 65, 56, 55, 64, 65, 56,\n 66, 57, 56, 65, 66, 57, 66, 58, 58, 67, 59, 58, 66, 67, 59, 67, 60, 60, 67, 61, 61, 66, 62, 61, 67, 66, 62, 66, 63, 63, 65, 64, 63, 66, 65, 21, 27, 22];\n\nexport const TRI33 = [\n /* eyes */ 0, 8, 7, 7, 8, 1, 2, 10, 9, 9, 10, 3,\n /* brows */ 17, 0, 18, 18, 0, 7, 18, 7, 19, 19, 7, 1, 19, 1, 11, 19, 11, 20, 21, 3, 22, 21, 9, 3, 20, 9, 21, 20, 2, 9, 20, 11, 2,\n /* 4head */ 23, 17, 18, 25, 21, 22, 24, 19, 20, 24, 18, 19, 24, 20, 21, 24, 23, 18, 24, 21, 25,\n /* nose */ 11, 12, 4, 11, 4, 13, 1, 12, 11, 11, 13, 2, 12, 14, 4, 4, 14, 13,\n /* up-lip */ 14, 5, 15, 14, 15, 6, 12, 5, 14, 14, 6, 13,\n /* cheeks */ 8, 12, 1, 2, 13, 10, 8, 26, 12, 10, 13, 27, 26, 5, 12, 13, 6, 27, 0, 26, 8, 10, 27, 3,\n /* chin */ 5, 32, 16, 16, 32, 6, 5, 30, 32, 6, 32, 31,\n /* cont */ 26, 30, 5, 27, 6, 31, 0, 28, 26, 3, 27, 29, 17, 28, 0, 3, 29, 22, 23, 28, 17, 22, 29, 25, 28, 30, 26, 27, 31, 29,\n];\n\nexport const TRI7 = [0, 4, 1, 2, 4, 3, 4, 5, 6];\n\nexport const VTX68 = [\n /* cont */ 127, 234, 132, 58, 172, 150, 149, 148, 152, 377, 378, 379, 397, 288, 361, 454, 356,\n /* brows */ 70, 63, 105, 66, 107, 336, 296, 334, 293, 300,\n /* nose */ 168, 6, 195, 4, 98, 97, 2, 326, 327,\n /* eyes */ 33, 160, 158, 133, 153, 144, 362, 385, 387, 263, 373, 380,\n /* lip */ 57, 40, 37, 0, 267, 270, 287, 321, 314, 17, 84, 91,\n /* mouth */ 78, 81, 13, 311, 308, 402, 14, 178,\n];\n\nexport const VTX33 = [33, 133, 362, 263, 1, 62, 308, 159, 145, 386, 374, 6, 102, 331, 2, 13, 14, 70, 105, 107, 336, 334, 300, 54, 10, 284, 50, 280, 234, 454, 58, 288, 152];\n\nexport const VTX7 = [33, 133, 362, 263, 1, 78, 308];\n\nexport const UV68 = VTX68.map((x) => UV468[x]);\n\nexport const UV33 = VTX33.map((x) => UV468[x]);\n\nexport const UV7 = VTX7.map((x) => UV468[x]);\n", "import * as tf from '../../dist/tfjs.esm.js';\nimport * as bounding from './box';\nimport * as util from './util';\nimport * as coords from './coords';\n\nconst leftOutline = coords.MESH_ANNOTATIONS['leftEyeLower0'];\nconst rightOutline = coords.MESH_ANNOTATIONS['rightEyeLower0'];\n\nconst eyeLandmarks = {\n leftBounds: [leftOutline[0], leftOutline[leftOutline.length - 1]],\n rightBounds: [rightOutline[0], rightOutline[rightOutline.length - 1]],\n};\n\nconst meshLandmarks = {\n count: 468,\n mouth: 13,\n symmetryLine: [13, coords.MESH_ANNOTATIONS['midwayBetweenEyes'][0]],\n};\n\nconst blazeFaceLandmarks = {\n leftEye: 0,\n rightEye: 1,\n nose: 2,\n mouth: 3,\n leftEar: 4,\n rightEar: 5,\n symmetryLine: [3, 2],\n};\n\nconst irisLandmarks = {\n upperCenter: 3,\n lowerCenter: 4,\n index: 71,\n numCoordinates: 76,\n};\n\n// Replace the raw coordinates returned by facemesh with refined iris model coordinates\n// Update the z coordinate to be an average of the original and the new.\nfunction replaceRawCoordinates(rawCoords, newCoords, prefix, keys) {\n for (let i = 0; i < coords.MESH_TO_IRIS_INDICES_MAP.length; i++) {\n const { key, indices } = coords.MESH_TO_IRIS_INDICES_MAP[i];\n const originalIndices = coords.MESH_ANNOTATIONS[`${prefix}${key}`];\n if (!keys || keys.includes(key)) {\n for (let j = 0; j < indices.length; j++) {\n const index = indices[j];\n rawCoords[originalIndices[j]] = [\n newCoords[index][0], newCoords[index][1],\n (newCoords[index][2] + rawCoords[originalIndices[j]][2]) / 2,\n ];\n }\n }\n }\n}\n// The Pipeline coordinates between the bounding box and skeleton models.\nexport class Pipeline {\n storedBoxes: any;\n boundingBoxDetector: any;\n meshDetector: any;\n irisModel: any;\n boxSize: number;\n meshSize: number;\n irisSize: number;\n irisEnlarge: number;\n skipped: number;\n detectedFaces: number;\n\n constructor(boundingBoxDetector, meshDetector, irisModel) {\n // An array of facial bounding boxes.\n this.storedBoxes = [];\n this.boundingBoxDetector = boundingBoxDetector;\n this.meshDetector = meshDetector;\n this.irisModel = irisModel;\n this.boxSize = boundingBoxDetector?.model?.inputs[0].shape[2] || 0;\n this.meshSize = meshDetector?.inputs[0].shape[2] || boundingBoxDetector?.model?.inputs[0].shape[2];\n this.irisSize = irisModel?.inputs[0].shape[1] || 0;\n this.irisEnlarge = 2.3;\n this.skipped = 0;\n this.detectedFaces = 0;\n }\n\n transformRawCoords(rawCoords, box, angle, rotationMatrix) {\n const boxSize = bounding.getBoxSize({ startPoint: box.startPoint, endPoint: box.endPoint });\n const coordsScaled = rawCoords.map((coord) => ([\n boxSize[0] / this.meshSize * (coord[0] - this.meshSize / 2),\n boxSize[1] / this.meshSize * (coord[1] - this.meshSize / 2),\n coord[2],\n ]));\n const coordsRotationMatrix = (angle !== 0) ? util.buildRotationMatrix(angle, [0, 0]) : util.IDENTITY_MATRIX;\n const coordsRotated = (angle !== 0) ? coordsScaled.map((coord) => ([...util.rotatePoint(coord, coordsRotationMatrix), coord[2]])) : coordsScaled;\n const inverseRotationMatrix = (angle !== 0) ? util.invertTransformMatrix(rotationMatrix) : util.IDENTITY_MATRIX;\n const boxCenter = [...bounding.getBoxCenter({ startPoint: box.startPoint, endPoint: box.endPoint }), 1];\n return coordsRotated.map((coord) => ([\n Math.round(coord[0] + util.dot(boxCenter, inverseRotationMatrix[0])),\n Math.round(coord[1] + util.dot(boxCenter, inverseRotationMatrix[1])),\n Math.round(coord[2]),\n ]));\n }\n\n // eslint-disable-next-line class-methods-use-this\n getLeftToRightEyeDepthDifference(rawCoords) {\n const leftEyeZ = rawCoords[eyeLandmarks.leftBounds[0]][2];\n const rightEyeZ = rawCoords[eyeLandmarks.rightBounds[0]][2];\n return leftEyeZ - rightEyeZ;\n }\n\n // Returns a box describing a cropped region around the eye fit for passing to the iris model.\n getEyeBox(rawCoords, face, eyeInnerCornerIndex, eyeOuterCornerIndex, flip = false) {\n const box = bounding.squarifyBox(bounding.enlargeBox(bounding.calculateLandmarksBoundingBox([rawCoords[eyeInnerCornerIndex], rawCoords[eyeOuterCornerIndex]]), this.irisEnlarge));\n const boxSize = bounding.getBoxSize(box);\n let crop = tf.image.cropAndResize(face, [[\n box.startPoint[1] / this.meshSize,\n box.startPoint[0] / this.meshSize, box.endPoint[1] / this.meshSize,\n box.endPoint[0] / this.meshSize,\n ]], [0], [this.irisSize, this.irisSize]);\n if (flip && tf.ENV.flags.IS_BROWSER) {\n crop = tf.image.flipLeftRight(crop); // flipLeftRight is not defined for tfjs-node\n }\n return { box, boxSize, crop };\n }\n\n // Given a cropped image of an eye, returns the coordinates of the contours surrounding the eye and the iris.\n getEyeCoords(eyeData, eyeBox, eyeBoxSize, flip = false) {\n const eyeRawCoords: Array = [];\n for (let i = 0; i < irisLandmarks.numCoordinates; i++) {\n const x = eyeData[i * 3];\n const y = eyeData[i * 3 + 1];\n const z = eyeData[i * 3 + 2];\n eyeRawCoords.push([\n (flip ? (1 - (x / this.irisSize)) : (x / this.irisSize)) * eyeBoxSize[0] + eyeBox.startPoint[0],\n (y / this.irisSize) * eyeBoxSize[1] + eyeBox.startPoint[1], z,\n ]);\n }\n return { rawCoords: eyeRawCoords, iris: eyeRawCoords.slice(irisLandmarks.index) };\n }\n\n // The z-coordinates returned for the iris are unreliable, so we take the z values from the surrounding keypoints.\n // eslint-disable-next-line class-methods-use-this\n getAdjustedIrisCoords(rawCoords, irisCoords, direction) {\n const upperCenterZ = rawCoords[coords.MESH_ANNOTATIONS[`${direction}EyeUpper0`][irisLandmarks.upperCenter]][2];\n const lowerCenterZ = rawCoords[coords.MESH_ANNOTATIONS[`${direction}EyeLower0`][irisLandmarks.lowerCenter]][2];\n const averageZ = (upperCenterZ + lowerCenterZ) / 2;\n // Iris indices: 0: center | 1: right | 2: above | 3: left | 4: below\n return irisCoords.map((coord, i) => {\n let z = averageZ;\n if (i === 2) {\n z = upperCenterZ;\n } else if (i === 4) {\n z = lowerCenterZ;\n }\n return [coord[0], coord[1], z];\n });\n }\n\n async predict(input, config) {\n let useFreshBox = false;\n // run new detector every skipFrames unless we only want box to start with\n let detector;\n if ((this.skipped === 0) || (this.skipped > config.face.detector.skipFrames) || !config.face.mesh.enabled || !config.videoOptimized) {\n detector = await this.boundingBoxDetector.getBoundingBoxes(input);\n this.skipped = 0;\n }\n if (config.videoOptimized) this.skipped++;\n\n // if detector result count doesn't match current working set, use it to reset current working set\n if (!config.videoOptimized || (detector && detector.boxes && (!config.face.mesh.enabled || (detector.boxes.length !== this.detectedFaces) && (this.detectedFaces !== config.face.detector.maxDetected)))) {\n this.storedBoxes = [];\n this.detectedFaces = 0;\n for (const possible of detector.boxes) {\n this.storedBoxes.push({ startPoint: possible.box.startPoint.dataSync(), endPoint: possible.box.endPoint.dataSync(), landmarks: possible.landmarks, confidence: possible.confidence });\n }\n if (this.storedBoxes.length > 0) useFreshBox = true;\n }\n\n if (config.face.detector.skipInitial && this.detectedFaces === 0) this.skipped = 0;\n\n if (useFreshBox) {\n if (!detector || !detector.boxes || (detector.boxes.length === 0)) {\n this.storedBoxes = [];\n this.detectedFaces = 0;\n return null;\n }\n for (let i = 0; i < this.storedBoxes.length; i++) {\n const scaledBox = bounding.scaleBoxCoordinates({ startPoint: this.storedBoxes[i].startPoint, endPoint: this.storedBoxes[i].endPoint }, detector.scaleFactor);\n const enlargedBox = bounding.enlargeBox(scaledBox);\n const squarifiedBox = bounding.squarifyBox(enlargedBox);\n const landmarks = this.storedBoxes[i].landmarks.arraySync();\n const confidence = this.storedBoxes[i].confidence;\n this.storedBoxes[i] = { ...squarifiedBox, confidence, landmarks };\n }\n }\n if (detector && detector.boxes) {\n detector.boxes.forEach((prediction) => {\n prediction.box.startPoint.dispose();\n prediction.box.endPoint.dispose();\n prediction.landmarks.dispose();\n });\n }\n const results = tf.tidy(() => this.storedBoxes.map((box, i) => {\n // The facial bounding box landmarks could come either from blazeface (if we are using a fresh box), or from the mesh model (if we are reusing an old box).\n let face;\n let angle = 0;\n let rotationMatrix;\n\n if (config.face.detector.rotation && config.face.mesh.enabled && tf.ENV.flags.IS_BROWSER) {\n const [indexOfMouth, indexOfForehead] = (box.landmarks.length >= meshLandmarks.count) ? meshLandmarks.symmetryLine : blazeFaceLandmarks.symmetryLine;\n angle = util.computeRotation(box.landmarks[indexOfMouth], box.landmarks[indexOfForehead]);\n const faceCenter = bounding.getBoxCenter({ startPoint: box.startPoint, endPoint: box.endPoint });\n const faceCenterNormalized = [faceCenter[0] / input.shape[2], faceCenter[1] / input.shape[1]];\n const rotatedImage = tf.image.rotateWithOffset(input, angle, 0, faceCenterNormalized); // rotateWithOffset is not defined for tfjs-node\n rotationMatrix = util.buildRotationMatrix(-angle, faceCenter);\n if (config.face.mesh.enabled) face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, rotatedImage, [this.meshSize, this.meshSize]).div(255);\n else face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, rotatedImage, [this.boxSize, this.boxSize]).div(255);\n } else {\n rotationMatrix = util.IDENTITY_MATRIX;\n const clonedImage = input.clone();\n if (config.face.mesh.enabled) face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, clonedImage, [this.meshSize, this.meshSize]).div(255);\n else face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, clonedImage, [this.boxSize, this.boxSize]).div(255);\n }\n\n // if we're not going to produce mesh, don't spend time with further processing\n if (!config.face.mesh.enabled) {\n const prediction = {\n mesh: [],\n box,\n faceConfidence: null,\n boxConfidence: box.confidence,\n confidence: box.confidence,\n image: face,\n };\n return prediction;\n }\n\n const [, confidence, contourCoords] = this.meshDetector.execute(face); // The first returned tensor represents facial contours which are already included in the coordinates.\n const faceConfidence = confidence.dataSync()[0];\n if (faceConfidence < config.face.detector.minConfidence) {\n this.storedBoxes[i].confidence = faceConfidence; // reset confidence of cached box\n return null; // if below confidence just exit\n }\n const coordsReshaped = tf.reshape(contourCoords, [-1, 3]);\n let rawCoords = coordsReshaped.arraySync();\n\n if (config.face.iris.enabled) {\n const { box: leftEyeBox, boxSize: leftEyeBoxSize, crop: leftEyeCrop } = this.getEyeBox(rawCoords, face, eyeLandmarks.leftBounds[0], eyeLandmarks.leftBounds[1], true);\n const { box: rightEyeBox, boxSize: rightEyeBoxSize, crop: rightEyeCrop } = this.getEyeBox(rawCoords, face, eyeLandmarks.rightBounds[0], eyeLandmarks.rightBounds[1]);\n const eyePredictions = this.irisModel.predict(tf.concat([leftEyeCrop, rightEyeCrop]));\n const eyePredictionsData = eyePredictions.dataSync();\n const leftEyeData = eyePredictionsData.slice(0, irisLandmarks.numCoordinates * 3);\n const { rawCoords: leftEyeRawCoords, iris: leftIrisRawCoords } = this.getEyeCoords(leftEyeData, leftEyeBox, leftEyeBoxSize, true);\n const rightEyeData = eyePredictionsData.slice(irisLandmarks.numCoordinates * 3);\n const { rawCoords: rightEyeRawCoords, iris: rightIrisRawCoords } = this.getEyeCoords(rightEyeData, rightEyeBox, rightEyeBoxSize);\n const leftToRightEyeDepthDifference = this.getLeftToRightEyeDepthDifference(rawCoords);\n if (Math.abs(leftToRightEyeDepthDifference) < 30) { // User is looking straight ahead.\n replaceRawCoordinates(rawCoords, leftEyeRawCoords, 'left', null);\n replaceRawCoordinates(rawCoords, rightEyeRawCoords, 'right', null);\n // If the user is looking to the left or to the right, the iris coordinates tend to diverge too much from the mesh coordinates for them to be merged\n // So we only update a single contour line above and below the eye.\n } else if (leftToRightEyeDepthDifference < 1) { // User is looking towards the right.\n replaceRawCoordinates(rawCoords, leftEyeRawCoords, 'left', ['EyeUpper0', 'EyeLower0']);\n } else { // User is looking towards the left.\n replaceRawCoordinates(rawCoords, rightEyeRawCoords, 'right', ['EyeUpper0', 'EyeLower0']);\n }\n const adjustedLeftIrisCoords = this.getAdjustedIrisCoords(rawCoords, leftIrisRawCoords, 'left');\n const adjustedRightIrisCoords = this.getAdjustedIrisCoords(rawCoords, rightIrisRawCoords, 'right');\n rawCoords = rawCoords.concat(adjustedLeftIrisCoords).concat(adjustedRightIrisCoords);\n }\n\n // override box from detection with one calculated from mesh\n const mesh = this.transformRawCoords(rawCoords, box, angle, rotationMatrix);\n const storeConfidence = box.confidence;\n box = bounding.enlargeBox(bounding.calculateLandmarksBoundingBox(mesh), 1.5); // redefine box with mesh calculated one\n box.confidence = storeConfidence;\n\n // do rotation one more time with mesh keypoints if we want to return perfect image\n if (config.face.detector.rotation && config.face.mesh.enabled && config.face.description.enabled && tf.ENV.flags.IS_BROWSER) {\n const [indexOfMouth, indexOfForehead] = (box.landmarks.length >= meshLandmarks.count) ? meshLandmarks.symmetryLine : blazeFaceLandmarks.symmetryLine;\n angle = util.computeRotation(box.landmarks[indexOfMouth], box.landmarks[indexOfForehead]);\n const faceCenter = bounding.getBoxCenter({ startPoint: box.startPoint, endPoint: box.endPoint });\n const faceCenterNormalized = [faceCenter[0] / input.shape[2], faceCenter[1] / input.shape[1]];\n const rotatedImage = tf.image.rotateWithOffset(input.toFloat(), angle, 0, faceCenterNormalized); // rotateWithOffset is not defined for tfjs-node\n rotationMatrix = util.buildRotationMatrix(-angle, faceCenter);\n face = bounding.cutBoxFromImageAndResize({ startPoint: box.startPoint, endPoint: box.endPoint }, rotatedImage, [this.meshSize, this.meshSize]).div(255);\n }\n\n const prediction = {\n mesh,\n box,\n faceConfidence,\n boxConfidence: box.confidence,\n image: face,\n };\n\n // updated stored cache values\n const storedBox = bounding.squarifyBox(box);\n // @ts-ignore box itself doesn't have those properties, but we stored them for future use\n storedBox.confidence = box.confidence;\n // @ts-ignore box itself doesn't have those properties, but we stored them for future use\n storedBox.faceConfidence = faceConfidence;\n // this.storedBoxes[i] = { ...squarifiedLandmarksBox, confidence: box.confidence, faceConfidence };\n this.storedBoxes[i] = storedBox;\n\n return prediction;\n }));\n\n // results = results.filter((a) => a !== null);\n // remove cache entries for detected boxes on low confidence\n if (config.face.mesh.enabled) this.storedBoxes = this.storedBoxes.filter((a) => a.confidence > config.face.detector.minConfidence);\n this.detectedFaces = results.length;\n\n return results;\n }\n}\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\n\nconst annotations = ['angry', 'disgust', 'fear', 'happy', 'sad', 'surprise', 'neutral'];\nlet model;\nlet last: Array<{ score: number, emotion: string }> = [];\nlet skipped = Number.MAX_SAFE_INTEGER;\n\n// tuning values\nconst rgb = [0.2989, 0.5870, 0.1140]; // factors for red/green/blue colors when converting to grayscale\n\nexport async function load(config) {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.face.emotion.modelPath));\n if (!model || !model.modelUrl) log('load model failed:', config.face.emotion.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n\nexport async function predict(image, config) {\n if (!model) return null;\n if ((skipped < config.face.emotion.skipFrames) && config.videoOptimized && (last.length > 0)) {\n skipped++;\n return last;\n }\n if (config.videoOptimized) skipped = 0;\n else skipped = Number.MAX_SAFE_INTEGER;\n return new Promise(async (resolve) => {\n const resize = tf.image.resizeBilinear(image, [model.inputs[0].shape[2], model.inputs[0].shape[1]], false);\n const [red, green, blue] = tf.split(resize, 3, 3);\n resize.dispose();\n // weighted rgb to grayscale: https://www.mathworks.com/help/matlab/ref/rgb2gray.html\n const redNorm = tf.mul(red, rgb[0]);\n const greenNorm = tf.mul(green, rgb[1]);\n const blueNorm = tf.mul(blue, rgb[2]);\n red.dispose();\n green.dispose();\n blue.dispose();\n const grayscale = tf.addN([redNorm, greenNorm, blueNorm]);\n redNorm.dispose();\n greenNorm.dispose();\n blueNorm.dispose();\n const normalize = tf.tidy(() => grayscale.sub(0.5).mul(2));\n grayscale.dispose();\n const obj: Array<{ score: number, emotion: string }> = [];\n if (config.face.emotion.enabled) {\n const emotionT = await model.predict(normalize); // result is already in range 0..1, no need for additional activation\n const data = emotionT.dataSync();\n tf.dispose(emotionT);\n for (let i = 0; i < data.length; i++) {\n if (data[i] > config.face.emotion.minConfidence) obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] });\n }\n obj.sort((a, b) => b.score - a.score);\n }\n normalize.dispose();\n last = obj;\n resolve(obj);\n });\n}\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\n\nlet model;\nlet last = { age: 0 };\nlet skipped = Number.MAX_SAFE_INTEGER;\n\ntype Tensor = typeof tf.Tensor;\ntype DB = Array<{ name: string, source: string, embedding: number[] }>;\n\nexport async function load(config) {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.face.description.modelPath));\n if (!model || !model.modelUrl) log('load model failed:', config.face.description.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n\nexport function similarity(embedding1, embedding2, order = 2): number {\n if (!embedding1 || !embedding2) return 0;\n if (embedding1?.length === 0 || embedding2?.length === 0) return 0;\n if (embedding1?.length !== embedding2?.length) return 0;\n // general minkowski distance, euclidean distance is limited case where order is 2\n const distance = 5.0 * embedding1\n .map((val, i) => (Math.abs(embedding1[i] - embedding2[i]) ** order)) // distance squared\n .reduce((sum, now) => (sum + now), 0) // sum all distances\n ** (1 / order); // get root of\n const res = Math.max(0, 100 - distance) / 100.0;\n return res;\n}\n\nexport function match(embedding: Array, db: DB, threshold = 0) {\n let best = { similarity: 0, name: '', source: '', embedding: [] as number[] };\n if (!embedding || !db || !Array.isArray(embedding) || !Array.isArray(db)) return best;\n for (const f of db) {\n if (f.embedding && f.name) {\n const perc = similarity(embedding, f.embedding);\n if (perc > threshold && perc > best.similarity) best = { ...f, similarity: perc };\n }\n }\n return best;\n}\n\nexport function enhance(input): Tensor {\n const image = tf.tidy(() => {\n // input received from detector is already normalized to 0..1\n // input is also assumed to be straightened\n const tensor = input.image || input.tensor || input;\n if (!(tensor instanceof tf.Tensor)) return null;\n // do a tight crop of image and resize it to fit the model\n const box = [[0.05, 0.15, 0.85, 0.85]]; // empyrical values for top, left, bottom, right\n // const box = [[0.0, 0.0, 1.0, 1.0]]; // basically no crop for test\n const crop = (tensor.shape.length === 3)\n ? tf.image.cropAndResize(tf.expandDims(tensor, 0), box, [0], [model.inputs[0].shape[2], model.inputs[0].shape[1]]) // add batch dimension if missing\n : tf.image.cropAndResize(tensor, box, [0], [model.inputs[0].shape[2], model.inputs[0].shape[1]]);\n // const crop = tf.image.resizeBilinear(tensor, [model.inputs[0].shape[2], model.inputs[0].shape[1]], false); // just resize to fit the embedding model\n\n /*\n // convert to black&white to avoid colorization impact\n const rgb = [0.2989, 0.5870, 0.1140]; // factors for red/green/blue colors when converting to grayscale: https://www.mathworks.com/help/matlab/ref/rgb2gray.html\n const [red, green, blue] = tf.split(crop, 3, 3);\n const redNorm = tf.mul(red, rgb[0]);\n const greenNorm = tf.mul(green, rgb[1]);\n const blueNorm = tf.mul(blue, rgb[2]);\n const grayscale = tf.addN([redNorm, greenNorm, blueNorm]);\n const merge = tf.stack([grayscale, grayscale, grayscale], 3).squeeze(4);\n */\n\n /*\n // optional increase image contrast\n // or do it per-channel so mean is done on each channel\n // or do it based on histogram\n const mean = merge.mean();\n const factor = 5;\n const contrast = merge.sub(mean).mul(factor).add(mean);\n */\n\n /*\n // normalize brightness from 0..1\n const darken = crop.sub(crop.min());\n const lighten = darken.div(darken.max());\n */\n\n const norm = crop.mul(255);\n\n return norm;\n });\n return image;\n}\n\nexport async function predict(image, config) {\n if (!model) return null;\n if ((skipped < config.face.description.skipFrames) && config.videoOptimized && last.age && (last.age > 0)) {\n skipped++;\n return last;\n }\n if (config.videoOptimized) skipped = 0;\n else skipped = Number.MAX_SAFE_INTEGER;\n return new Promise(async (resolve) => {\n const enhanced = enhance(image);\n\n let resT;\n const obj = {\n age: 0,\n gender: 'unknown',\n genderConfidence: 0,\n descriptor: [] };\n\n if (config.face.description.enabled) resT = await model.predict(enhanced);\n tf.dispose(enhanced);\n\n if (resT) {\n tf.tidy(() => {\n const gender = resT.find((t) => t.shape[1] === 1).dataSync();\n const confidence = Math.trunc(200 * Math.abs((gender[0] - 0.5))) / 100;\n if (confidence > config.face.description.minConfidence) {\n obj.gender = gender[0] <= 0.5 ? 'female' : 'male';\n obj.genderConfidence = Math.min(0.99, confidence);\n }\n const age = resT.find((t) => t.shape[1] === 100).argMax(1).dataSync()[0];\n const all = resT.find((t) => t.shape[1] === 100).dataSync();\n obj.age = Math.round(all[age - 1] > all[age + 1] ? 10 * age - 100 * all[age - 1] : 10 * age + 100 * all[age + 1]) / 10;\n\n const desc = resT.find((t) => t.shape[1] === 1024);\n // const reshape = desc.reshape([128, 8]);\n // const reduce = reshape.logSumExp(1); // reduce 2nd dimension by calculating logSumExp on it\n\n obj.descriptor = [...desc.dataSync()];\n });\n resT.forEach((t) => tf.dispose(t));\n }\n\n last = obj;\n resolve(obj);\n });\n}\n", "import { log, now } from './helpers';\nimport * as tf from '../dist/tfjs.esm.js';\nimport * as facemesh from './blazeface/facemesh';\nimport * as emotion from './emotion/emotion';\nimport * as faceres from './faceres/faceres';\n\ntype Tensor = typeof tf.Tensor;\n\nconst calculateFaceAngle = (face, image_size): { angle: { pitch: number, yaw: number, roll: number }, matrix: [number, number, number, number, number, number, number, number, number] } => {\n // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\n const degrees = (theta) => (theta * 180) / Math.PI;\n // const degrees = (theta) => Math.abs(((theta * 180) / Math.PI) % 360);\n const normalize = (v) => { // normalize vector\n const length = Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);\n v[0] /= length;\n v[1] /= length;\n v[2] /= length;\n return v;\n };\n const subVectors = (a, b) => { // vector subtraction (a - b)\n const x = a[0] - b[0];\n const y = a[1] - b[1];\n const z = a[2] - b[2];\n return [x, y, z];\n };\n const crossVectors = (a, b) => { // vector cross product (a x b)\n const x = a[1] * b[2] - a[2] * b[1];\n const y = a[2] * b[0] - a[0] * b[2];\n const z = a[0] * b[1] - a[1] * b[0];\n return [x, y, z];\n };\n // 3x3 rotation matrix to Euler angles based on https://www.geometrictools.com/Documentation/EulerAngles.pdf\n const rotationMatrixToEulerAngle = (r) => {\n // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\n const [r00, r01, r02, r10, r11, r12, r20, r21, r22] = r;\n let thetaX; let thetaY; let thetaZ;\n if (r10 < 1) { // YZX calculation\n if (r10 > -1) {\n thetaZ = Math.asin(r10);\n thetaY = Math.atan2(-r20, r00);\n thetaX = Math.atan2(-r12, r11);\n } else {\n thetaZ = -Math.PI / 2;\n thetaY = -Math.atan2(r21, r22);\n thetaX = 0;\n }\n } else {\n thetaZ = Math.PI / 2;\n thetaY = Math.atan2(r21, r22);\n thetaX = 0;\n }\n return { pitch: 2 * -thetaX, yaw: 2 * -thetaY, roll: 2 * -thetaZ };\n };\n // simple Euler angle calculation based existing 3D mesh\n // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\n const meshToEulerAngle = (mesh) => {\n const radians = (a1, a2, b1, b2) => Math.atan2(b2 - a2, b1 - a1);\n // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\n const angle = {\n // values are in radians in range of -pi/2 to pi/2 which is -90 to +90 degrees\n // value of 0 means center\n // pitch is face move up/down\n pitch: radians(mesh[10][1], mesh[10][2], mesh[152][1], mesh[152][2]), // looking at y,z of top and bottom points of the face\n // yaw is face turn left/right\n yaw: radians(mesh[33][0], mesh[33][2], mesh[263][0], mesh[263][2]), // looking at x,z of outside corners of leftEye and rightEye\n // roll is face lean left/right\n roll: radians(mesh[33][0], mesh[33][1], mesh[263][0], mesh[263][1]), // looking at x,y of outside corners of leftEye and rightEye\n };\n return angle;\n };\n\n const mesh = face.meshRaw;\n if (!mesh || mesh.length < 300) return { angle: { pitch: 0, yaw: 0, roll: 0 }, matrix: [1, 0, 0, 0, 1, 0, 0, 0, 1] };\n\n const size = Math.max(face.boxRaw[2] * image_size[0], face.boxRaw[3] * image_size[1]) / 1.5;\n // top, bottom, left, right\n const pts = [mesh[10], mesh[152], mesh[234], mesh[454]].map((pt) => [\n // make the xyz coordinates proportional, independent of the image/box size\n pt[0] * image_size[0] / size,\n pt[1] * image_size[1] / size,\n pt[2],\n ]);\n\n const y_axis = normalize(subVectors(pts[1], pts[0]));\n let x_axis = normalize(subVectors(pts[3], pts[2]));\n const z_axis = normalize(crossVectors(x_axis, y_axis));\n // adjust x_axis to make sure that all axes are perpendicular to each other\n x_axis = crossVectors(y_axis, z_axis);\n\n // Rotation Matrix from Axis Vectors - http://renderdan.blogspot.com/2006/05/rotation-matrix-from-axis-vectors.html\n // 3x3 rotation matrix is flatten to array in row-major order. Note that the rotation represented by this matrix is inverted.\n const matrix: [number, number, number, number, number, number, number, number, number] = [\n x_axis[0], x_axis[1], x_axis[2],\n y_axis[0], y_axis[1], y_axis[2],\n z_axis[0], z_axis[1], z_axis[2],\n ];\n const angle = rotationMatrixToEulerAngle(matrix);\n // const angle = meshToEulerAngle(mesh);\n return { angle, matrix };\n};\n\nexport const detectFace = async (parent, input): Promise => {\n // run facemesh, includes blazeface and iris\n // eslint-disable-next-line no-async-promise-executor\n let timeStamp;\n let ageRes;\n let genderRes;\n let emotionRes;\n let embeddingRes;\n let descRes;\n const faceRes: Array<{\n confidence: number,\n boxConfidence: number,\n faceConfidence: number,\n box: [number, number, number, number],\n mesh: Array<[number, number, number]>\n meshRaw: Array<[number, number, number]>\n boxRaw: [number, number, number, number],\n annotations: Array<{ part: string, points: Array<[number, number, number]>[] }>,\n age: number,\n gender: string,\n genderConfidence: number,\n emotion: string,\n embedding: number[],\n iris: number,\n rotation: {\n angle: { pitch: number, yaw: number, roll: number },\n matrix: [number, number, number, number, number, number, number, number, number]\n },\n tensor: Tensor,\n }> = [];\n parent.state = 'run:face';\n timeStamp = now();\n const faces = await facemesh.predict(input, parent.config);\n parent.perf.face = Math.trunc(now() - timeStamp);\n if (!faces) return [];\n for (const face of faces) {\n parent.analyze('Get Face');\n\n // is something went wrong, skip the face\n if (!face.image || face.image.isDisposedInternal) {\n log('Face object is disposed:', face.image);\n continue;\n }\n\n const rotation = calculateFaceAngle(face, [input.shape[2], input.shape[1]]);\n\n // run emotion, inherits face from blazeface\n parent.analyze('Start Emotion:');\n if (parent.config.async) {\n emotionRes = parent.config.face.emotion.enabled ? emotion.predict(face.image, parent.config) : {};\n } else {\n parent.state = 'run:emotion';\n timeStamp = now();\n emotionRes = parent.config.face.emotion.enabled ? await emotion.predict(face.image, parent.config) : {};\n parent.perf.emotion = Math.trunc(now() - timeStamp);\n }\n parent.analyze('End Emotion:');\n\n // run emotion, inherits face from blazeface\n parent.analyze('Start Description:');\n if (parent.config.async) {\n descRes = parent.config.face.description.enabled ? faceres.predict(face, parent.config) : [];\n } else {\n parent.state = 'run:description';\n timeStamp = now();\n descRes = parent.config.face.description.enabled ? await faceres.predict(face.image, parent.config) : [];\n parent.perf.embedding = Math.trunc(now() - timeStamp);\n }\n parent.analyze('End Description:');\n\n // if async wait for results\n if (parent.config.async) {\n [ageRes, genderRes, emotionRes, embeddingRes, descRes] = await Promise.all([ageRes, genderRes, emotionRes, embeddingRes, descRes]);\n }\n\n parent.analyze('Finish Face:');\n\n // calculate iris distance\n // iris: array[ center, left, top, right, bottom]\n if (!parent.config.face.iris.enabled && face?.annotations?.leftEyeIris && face?.annotations?.rightEyeIris) {\n delete face.annotations.leftEyeIris;\n delete face.annotations.rightEyeIris;\n }\n const irisSize = (face.annotations?.leftEyeIris && face.annotations?.rightEyeIris)\n /* average human iris size is 11.7mm */\n ? 11.7 * Math.max(Math.abs(face.annotations.leftEyeIris[3][0] - face.annotations.leftEyeIris[1][0]), Math.abs(face.annotations.rightEyeIris[4][1] - face.annotations.rightEyeIris[2][1]))\n : 0;\n\n // combine results\n faceRes.push({\n ...face,\n age: descRes.age,\n gender: descRes.gender,\n genderConfidence: descRes.genderConfidence,\n embedding: descRes.descriptor,\n emotion: emotionRes,\n iris: (irisSize !== 0) ? Math.trunc(irisSize) / 100 : 0,\n rotation,\n tensor: parent.config.face.detector.return ? face.image?.squeeze() : null,\n });\n // dispose original face tensor\n face.image?.dispose();\n\n parent.analyze('End Face');\n }\n parent.analyze('End FaceMesh:');\n if (parent.config.async) {\n if (parent.perf.face) delete parent.perf.face;\n if (parent.perf.age) delete parent.perf.age;\n if (parent.perf.gender) delete parent.perf.gender;\n if (parent.perf.emotion) delete parent.perf.emotion;\n }\n return faceRes;\n};\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as poses from './poses';\nimport * as util from './utils';\n\nlet model;\nconst poseNetOutputs = ['MobilenetV1/offset_2/BiasAdd'/* offsets */, 'MobilenetV1/heatmap_2/BiasAdd'/* heatmapScores */, 'MobilenetV1/displacement_fwd_2/BiasAdd'/* displacementFwd */, 'MobilenetV1/displacement_bwd_2/BiasAdd'/* displacementBwd */];\n\nexport async function predict(input, config) {\n const res = tf.tidy(() => {\n const resized = input.resizeBilinear([model.inputs[0].shape[2], model.inputs[0].shape[1]]);\n const normalized = resized.toFloat().div(127.5).sub(1.0);\n const results = model.execute(normalized, poseNetOutputs);\n const results3d = results.map((y) => y.squeeze([0]));\n results3d[1] = results3d[1].sigmoid(); // apply sigmoid on scores\n return results3d;\n });\n\n const buffers = await Promise.all(res.map((tensor) => tensor.buffer()));\n for (const t of res) t.dispose();\n\n const decoded = await poses.decode(buffers[0], buffers[1], buffers[2], buffers[3], config.body.maxDetected, config.body.minConfidence);\n const scaled = util.scalePoses(decoded, [input.shape[1], input.shape[2]], [model.inputs[0].shape[2], model.inputs[0].shape[1]]);\n return scaled;\n}\n\nexport async function load(config) {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.body.modelPath));\n if (!model || !model.modelUrl) log('load model failed:', config.body.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n", "export const partNames = [\n 'nose', 'leftEye', 'rightEye', 'leftEar', 'rightEar', 'leftShoulder',\n 'rightShoulder', 'leftElbow', 'rightElbow', 'leftWrist', 'rightWrist',\n 'leftHip', 'rightHip', 'leftKnee', 'rightKnee', 'leftAnkle', 'rightAnkle',\n];\n\nexport const count = partNames.length; // 17 keypoints\n\nexport const partIds = partNames.reduce((result, jointName, i) => {\n result[jointName] = i;\n return result;\n}, {});\n\nconst connectedPartNames = [\n ['leftHip', 'leftShoulder'], ['leftElbow', 'leftShoulder'],\n ['leftElbow', 'leftWrist'], ['leftHip', 'leftKnee'],\n ['leftKnee', 'leftAnkle'], ['rightHip', 'rightShoulder'],\n ['rightElbow', 'rightShoulder'], ['rightElbow', 'rightWrist'],\n ['rightHip', 'rightKnee'], ['rightKnee', 'rightAnkle'],\n ['leftShoulder', 'rightShoulder'], ['leftHip', 'rightHip'],\n];\nexport const connectedPartIndices = connectedPartNames.map(([jointNameA, jointNameB]) => ([partIds[jointNameA], partIds[jointNameB]]));\n\nexport const poseChain = [\n ['nose', 'leftEye'], ['leftEye', 'leftEar'], ['nose', 'rightEye'],\n ['rightEye', 'rightEar'], ['nose', 'leftShoulder'],\n ['leftShoulder', 'leftElbow'], ['leftElbow', 'leftWrist'],\n ['leftShoulder', 'leftHip'], ['leftHip', 'leftKnee'],\n ['leftKnee', 'leftAnkle'], ['nose', 'rightShoulder'],\n ['rightShoulder', 'rightElbow'], ['rightElbow', 'rightWrist'],\n ['rightShoulder', 'rightHip'], ['rightHip', 'rightKnee'],\n ['rightKnee', 'rightAnkle'],\n];\n", "import * as kpt from './keypoints';\n\nexport function eitherPointDoesntMeetConfidence(a, b, minConfidence) {\n return (a < minConfidence || b < minConfidence);\n}\n\nexport function getAdjacentKeyPoints(keypoints, minConfidence) {\n return kpt.connectedPartIndices.reduce((result, [leftJoint, rightJoint]) => {\n if (eitherPointDoesntMeetConfidence(keypoints[leftJoint].score, keypoints[rightJoint].score, minConfidence)) {\n return result;\n }\n result.push([keypoints[leftJoint], keypoints[rightJoint]]);\n return result;\n }, []);\n}\n\nexport function getBoundingBox(keypoints) {\n const coord = keypoints.reduce(({ maxX, maxY, minX, minY }, { position: { x, y } }) => ({\n maxX: Math.max(maxX, x),\n maxY: Math.max(maxY, y),\n minX: Math.min(minX, x),\n minY: Math.min(minY, y),\n }), {\n maxX: Number.NEGATIVE_INFINITY,\n maxY: Number.NEGATIVE_INFINITY,\n minX: Number.POSITIVE_INFINITY,\n minY: Number.POSITIVE_INFINITY,\n });\n return [coord.minX, coord.minY, coord.maxX - coord.minX, coord.maxY - coord.minY];\n}\n\nexport function scalePoses(poses, [height, width], [inputResolutionHeight, inputResolutionWidth]) {\n const scalePose = (pose, scaleY, scaleX) => ({\n score: pose.score,\n box: [Math.trunc(pose.box[0] * scaleX), Math.trunc(pose.box[1] * scaleY), Math.trunc(pose.box[2] * scaleX), Math.trunc(pose.box[3] * scaleY)],\n keypoints: pose.keypoints.map(({ score, part, position }) => ({\n score,\n part,\n position: { x: Math.trunc(position.x * scaleX), y: Math.trunc(position.y * scaleY) },\n })),\n });\n const scaledPoses = poses.map((pose) => scalePose(pose, height / inputResolutionHeight, width / inputResolutionWidth));\n return scaledPoses;\n}\n\n// algorithm based on Coursera Lecture from Algorithms, Part 1: https://www.coursera.org/learn/algorithms-part1/lecture/ZjoSM/heapsort\nexport class MaxHeap {\n priorityQueue: any;\n numberOfElements: number;\n getElementValue: any;\n\n constructor(maxSize, getElementValue) {\n this.priorityQueue = new Array(maxSize);\n this.numberOfElements = -1;\n this.getElementValue = getElementValue;\n }\n\n enqueue(x) {\n this.priorityQueue[++this.numberOfElements] = x;\n this.swim(this.numberOfElements);\n }\n\n dequeue() {\n const max = this.priorityQueue[0];\n this.exchange(0, this.numberOfElements--);\n this.sink(0);\n this.priorityQueue[this.numberOfElements + 1] = null;\n return max;\n }\n\n empty() { return this.numberOfElements === -1; }\n\n size() { return this.numberOfElements + 1; }\n\n all() { return this.priorityQueue.slice(0, this.numberOfElements + 1); }\n\n max() { return this.priorityQueue[0]; }\n\n swim(k) {\n while (k > 0 && this.less(Math.floor(k / 2), k)) {\n this.exchange(k, Math.floor(k / 2));\n k = Math.floor(k / 2);\n }\n }\n\n sink(k) {\n while (2 * k <= this.numberOfElements) {\n let j = 2 * k;\n if (j < this.numberOfElements && this.less(j, j + 1)) j++;\n if (!this.less(k, j)) break;\n this.exchange(k, j);\n k = j;\n }\n }\n\n getValueAt(i) {\n return this.getElementValue(this.priorityQueue[i]);\n }\n\n less(i, j) {\n return this.getValueAt(i) < this.getValueAt(j);\n }\n\n exchange(i, j) {\n const t = this.priorityQueue[i];\n this.priorityQueue[i] = this.priorityQueue[j];\n this.priorityQueue[j] = t;\n }\n}\n\nexport function getOffsetPoint(y, x, keypoint, offsets) {\n return {\n y: offsets.get(y, x, keypoint),\n x: offsets.get(y, x, keypoint + kpt.count),\n };\n}\n\nexport function getImageCoords(part, outputStride, offsets) {\n const { heatmapY, heatmapX, id: keypoint } = part;\n const { y, x } = getOffsetPoint(heatmapY, heatmapX, keypoint, offsets);\n return {\n x: part.heatmapX * outputStride + x,\n y: part.heatmapY * outputStride + y,\n };\n}\n\nexport function fillArray(element, size) {\n const result = new Array(size);\n for (let i = 0; i < size; i++) {\n result[i] = element;\n }\n return result;\n}\n\nexport function clamp(a, min, max) {\n if (a < min) return min;\n if (a > max) return max;\n return a;\n}\n\nexport function squaredDistance(y1, x1, y2, x2) {\n const dy = y2 - y1;\n const dx = x2 - x1;\n return dy * dy + dx * dx;\n}\n\nexport function addVectors(a, b) {\n return { x: a.x + b.x, y: a.y + b.y };\n}\n\nexport function clampVector(a, min, max) {\n return { y: clamp(a.y, min, max), x: clamp(a.x, min, max) };\n}\n", "import * as utils from './utils';\nimport * as kpt from './keypoints';\n\nconst localMaximumRadius = 1;\nconst outputStride = 16;\nconst squaredNmsRadius = 50 ** 2;\n\nfunction traverse(edgeId, sourceKeypoint, targetId, scores, offsets, displacements, offsetRefineStep = 2) {\n const getDisplacement = (point) => ({\n y: displacements.get(point.y, point.x, edgeId),\n x: displacements.get(point.y, point.x, (displacements.shape[2] / 2) + edgeId),\n });\n const getStridedIndexNearPoint = (point, height, width) => ({\n y: utils.clamp(Math.round(point.y / outputStride), 0, height - 1),\n x: utils.clamp(Math.round(point.x / outputStride), 0, width - 1),\n });\n\n const [height, width] = scores.shape;\n // Nearest neighbor interpolation for the source->target displacements.\n const sourceKeypointIndices = getStridedIndexNearPoint(sourceKeypoint.position, height, width);\n const displacement = getDisplacement(sourceKeypointIndices);\n const displacedPoint = utils.addVectors(sourceKeypoint.position, displacement);\n let targetKeypoint = displacedPoint;\n for (let i = 0; i < offsetRefineStep; i++) {\n const targetKeypointIndices = getStridedIndexNearPoint(targetKeypoint, height, width);\n const offsetPoint = utils.getOffsetPoint(targetKeypointIndices.y, targetKeypointIndices.x, targetId, offsets);\n targetKeypoint = utils.addVectors(\n { x: targetKeypointIndices.x * outputStride, y: targetKeypointIndices.y * outputStride },\n { x: offsetPoint.x, y: offsetPoint.y },\n );\n }\n const targetKeyPointIndices = getStridedIndexNearPoint(targetKeypoint, height, width);\n const score = scores.get(targetKeyPointIndices.y, targetKeyPointIndices.x, targetId);\n return { position: targetKeypoint, part: kpt.partNames[targetId], score };\n}\n\nexport function decodePose(root, scores, offsets, displacementsFwd, displacementsBwd) {\n const tuples = kpt.poseChain.map(([parentJoinName, childJoinName]) => ([kpt.partIds[parentJoinName], kpt.partIds[childJoinName]]));\n const edgesFwd = tuples.map(([, childJointId]) => childJointId);\n const edgesBwd = tuples.map(([parentJointId]) => parentJointId);\n const numParts = scores.shape[2]; // [21,21,17]\n const numEdges = edgesFwd.length;\n const keypoints = new Array(numParts);\n // Start a new detection instance at the position of the root.\n const rootPoint = utils.getImageCoords(root.part, outputStride, offsets);\n keypoints[root.part.id] = {\n score: root.score,\n part: kpt.partNames[root.part.id],\n position: rootPoint,\n };\n // Decode the part positions upwards in the tree, following the backward displacements.\n for (let edge = numEdges - 1; edge >= 0; --edge) {\n const sourceId = edgesFwd[edge];\n const targetId = edgesBwd[edge];\n if (keypoints[sourceId] && !keypoints[targetId]) {\n keypoints[targetId] = traverse(edge, keypoints[sourceId], targetId, scores, offsets, displacementsBwd);\n }\n }\n // Decode the part positions downwards in the tree, following the forward displacements.\n for (let edge = 0; edge < numEdges; ++edge) {\n const sourceId = edgesBwd[edge];\n const targetId = edgesFwd[edge];\n if (keypoints[sourceId] && !keypoints[targetId]) {\n keypoints[targetId] = traverse(edge, keypoints[sourceId], targetId, scores, offsets, displacementsFwd);\n }\n }\n return keypoints;\n}\n\nfunction scoreIsMaximumInLocalWindow(keypointId, score, heatmapY, heatmapX, scores) {\n const [height, width] = scores.shape;\n let localMaximum = true;\n const yStart = Math.max(heatmapY - localMaximumRadius, 0);\n const yEnd = Math.min(heatmapY + localMaximumRadius + 1, height);\n for (let yCurrent = yStart; yCurrent < yEnd; ++yCurrent) {\n const xStart = Math.max(heatmapX - localMaximumRadius, 0);\n const xEnd = Math.min(heatmapX + localMaximumRadius + 1, width);\n for (let xCurrent = xStart; xCurrent < xEnd; ++xCurrent) {\n if (scores.get(yCurrent, xCurrent, keypointId) > score) {\n localMaximum = false;\n break;\n }\n }\n if (!localMaximum) break;\n }\n return localMaximum;\n}\n\nexport function buildPartWithScoreQueue(minConfidence, scores) {\n const [height, width, numKeypoints] = scores.shape;\n const queue = new utils.MaxHeap(height * width * numKeypoints, ({ score }) => score);\n for (let heatmapY = 0; heatmapY < height; ++heatmapY) {\n for (let heatmapX = 0; heatmapX < width; ++heatmapX) {\n for (let keypointId = 0; keypointId < numKeypoints; ++keypointId) {\n const score = scores.get(heatmapY, heatmapX, keypointId);\n // Only consider parts with score greater or equal to threshold as root candidates.\n if (score < minConfidence) continue;\n // Only consider keypoints whose score is maximum in a local window.\n if (scoreIsMaximumInLocalWindow(keypointId, score, heatmapY, heatmapX, scores)) queue.enqueue({ score, part: { heatmapY, heatmapX, id: keypointId } });\n }\n }\n }\n return queue;\n}\n\nfunction withinRadius(poses, { x, y }, keypointId) {\n return poses.some(({ keypoints }) => {\n const correspondingKeypoint = keypoints[keypointId]?.position;\n if (!correspondingKeypoint) return false;\n return utils.squaredDistance(y, x, correspondingKeypoint.y, correspondingKeypoint.x) <= squaredNmsRadius;\n });\n}\n\nfunction getInstanceScore(existingPoses, keypoints) {\n const notOverlappedKeypointScores = keypoints.reduce((result, { position, score }, keypointId) => {\n if (!withinRadius(existingPoses, position, keypointId)) result += score;\n return result;\n }, 0.0);\n return notOverlappedKeypointScores / keypoints.length;\n}\n\nexport function decode(offsets, scores, displacementsFwd, displacementsBwd, maxDetected, minConfidence) {\n const poses: Array<{ keypoints: any, box: any, score: number }> = [];\n const queue = buildPartWithScoreQueue(minConfidence, scores);\n // Generate at most maxDetected object instances per image in decreasing root part score order.\n while (poses.length < maxDetected && !queue.empty()) {\n // The top element in the queue is the next root candidate.\n const root = queue.dequeue();\n // Part-based non-maximum suppression: We reject a root candidate if it is within a disk of `nmsRadius` pixels from the corresponding part of a previously detected instance.\n const rootImageCoords = utils.getImageCoords(root.part, outputStride, offsets);\n if (withinRadius(poses, rootImageCoords, root.part.id)) continue;\n // Else start a new detection instance at the position of the root.\n let keypoints = decodePose(root, scores, offsets, displacementsFwd, displacementsBwd);\n keypoints = keypoints.filter((a) => a.score > minConfidence);\n const score = getInstanceScore(poses, keypoints);\n const box = utils.getBoundingBox(keypoints);\n if (score > minConfidence) poses.push({ keypoints, box, score: Math.round(100 * score) / 100 });\n }\n return poses;\n}\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as handdetector from './handdetector';\nimport * as handpipeline from './handpipeline';\n\nconst meshAnnotations = {\n thumb: [1, 2, 3, 4],\n indexFinger: [5, 6, 7, 8],\n middleFinger: [9, 10, 11, 12],\n ringFinger: [13, 14, 15, 16],\n pinky: [17, 18, 19, 20],\n palmBase: [0],\n};\n\nlet handDetectorModel;\nlet handPoseModel;\nlet handPipeline;\n\nexport async function predict(input, config) {\n const predictions = await handPipeline.estimateHands(input, config);\n if (!predictions) return [];\n const hands: Array<{ confidence: number, box: any, boxRaw: any, landmarks: any, annotations: any }> = [];\n for (const prediction of predictions) {\n const annotations = {};\n if (prediction.landmarks) {\n for (const key of Object.keys(meshAnnotations)) {\n annotations[key] = meshAnnotations[key].map((index) => prediction.landmarks[index]);\n }\n }\n const box = prediction.box ? [\n Math.max(0, prediction.box.topLeft[0]),\n Math.max(0, prediction.box.topLeft[1]),\n Math.min(input.shape[2], prediction.box.bottomRight[0]) - Math.max(0, prediction.box.topLeft[0]),\n Math.min(input.shape[1], prediction.box.bottomRight[1]) - Math.max(0, prediction.box.topLeft[1]),\n ] : [];\n const boxRaw = [\n (prediction.box.topLeft[0]) / input.shape[2],\n (prediction.box.topLeft[1]) / input.shape[1],\n (prediction.box.bottomRight[0] - prediction.box.topLeft[0]) / input.shape[2],\n (prediction.box.bottomRight[1] - prediction.box.topLeft[1]) / input.shape[1],\n ];\n hands.push({ confidence: Math.round(100 * prediction.confidence) / 100, box, boxRaw, landmarks: prediction.landmarks, annotations });\n }\n return hands;\n}\n\nexport async function load(config): Promise<[Object, Object]> {\n if (!handDetectorModel || !handPoseModel) {\n [handDetectorModel, handPoseModel] = await Promise.all([\n config.hand.enabled ? tf.loadGraphModel(join(config.modelBasePath, config.hand.detector.modelPath), { fromTFHub: config.hand.detector.modelPath.includes('tfhub.dev') }) : null,\n config.hand.landmarks ? tf.loadGraphModel(join(config.modelBasePath, config.hand.skeleton.modelPath), { fromTFHub: config.hand.skeleton.modelPath.includes('tfhub.dev') }) : null,\n ]);\n if (config.hand.enabled) {\n if (!handDetectorModel || !handDetectorModel.modelUrl) log('load model failed:', config.hand.detector.modelPath);\n else if (config.debug) log('load model:', handDetectorModel.modelUrl);\n if (!handPoseModel || !handPoseModel.modelUrl) log('load model failed:', config.hand.skeleton.modelPath);\n else if (config.debug) log('load model:', handPoseModel.modelUrl);\n }\n } else {\n if (config.debug) log('cached model:', handDetectorModel.modelUrl);\n if (config.debug) log('cached model:', handPoseModel.modelUrl);\n }\n const handDetector = new handdetector.HandDetector(handDetectorModel);\n handPipeline = new handpipeline.HandPipeline(handDetector, handPoseModel);\n return [handDetectorModel, handPoseModel];\n}\n", "import * as tf from '../../dist/tfjs.esm.js';\n\nexport function getBoxSize(box) {\n return [\n Math.abs(box.endPoint[0] - box.startPoint[0]),\n Math.abs(box.endPoint[1] - box.startPoint[1]),\n ];\n}\n\nexport function getBoxCenter(box) {\n return [\n box.startPoint[0] + (box.endPoint[0] - box.startPoint[0]) / 2,\n box.startPoint[1] + (box.endPoint[1] - box.startPoint[1]) / 2,\n ];\n}\n\nexport function cutBoxFromImageAndResize(box, image, cropSize) {\n const h = image.shape[1];\n const w = image.shape[2];\n const boxes = [[\n box.startPoint[1] / h,\n box.startPoint[0] / w,\n box.endPoint[1] / h,\n box.endPoint[0] / w,\n ]];\n return tf.image.cropAndResize(image, boxes, [0], cropSize);\n}\n\nexport function scaleBoxCoordinates(box, factor) {\n const startPoint = [box.startPoint[0] * factor[0], box.startPoint[1] * factor[1]];\n const endPoint = [box.endPoint[0] * factor[0], box.endPoint[1] * factor[1]];\n const palmLandmarks = box.palmLandmarks.map((coord) => {\n const scaledCoord = [coord[0] * factor[0], coord[1] * factor[1]];\n return scaledCoord;\n });\n return { startPoint, endPoint, palmLandmarks, confidence: box.confidence };\n}\n\nexport function enlargeBox(box, factor = 1.5) {\n const center = getBoxCenter(box);\n const size = getBoxSize(box);\n const newHalfSize = [factor * size[0] / 2, factor * size[1] / 2];\n const startPoint = [center[0] - newHalfSize[0], center[1] - newHalfSize[1]];\n const endPoint = [center[0] + newHalfSize[0], center[1] + newHalfSize[1]];\n return { startPoint, endPoint, palmLandmarks: box.palmLandmarks };\n}\n\nexport function squarifyBox(box) {\n const centers = getBoxCenter(box);\n const size = getBoxSize(box);\n const maxEdge = Math.max(...size);\n const halfSize = maxEdge / 2;\n const startPoint = [centers[0] - halfSize, centers[1] - halfSize];\n const endPoint = [centers[0] + halfSize, centers[1] + halfSize];\n return { startPoint, endPoint, palmLandmarks: box.palmLandmarks };\n}\n\nexport function shiftBox(box, shiftFactor) {\n const boxSize = [\n box.endPoint[0] - box.startPoint[0],\n box.endPoint[1] - box.startPoint[1],\n ];\n const shiftVector = [boxSize[0] * shiftFactor[0], boxSize[1] * shiftFactor[1]];\n const startPoint = [box.startPoint[0] + shiftVector[0], box.startPoint[1] + shiftVector[1]];\n const endPoint = [box.endPoint[0] + shiftVector[0], box.endPoint[1] + shiftVector[1]];\n return { startPoint, endPoint, palmLandmarks: box.palmLandmarks };\n}\n", "export const anchors = [\n {\n x: 0.015625,\n y: 0.015625,\n },\n {\n x: 0.015625,\n y: 0.015625,\n },\n {\n x: 0.046875,\n y: 0.015625,\n },\n {\n x: 0.046875,\n y: 0.015625,\n },\n {\n x: 0.078125,\n y: 0.015625,\n },\n {\n x: 0.078125,\n y: 0.015625,\n },\n {\n x: 0.109375,\n y: 0.015625,\n },\n {\n x: 0.109375,\n y: 0.015625,\n },\n {\n x: 0.140625,\n y: 0.015625,\n },\n {\n x: 0.140625,\n y: 0.015625,\n },\n {\n x: 0.171875,\n y: 0.015625,\n },\n {\n x: 0.171875,\n y: 0.015625,\n },\n {\n x: 0.203125,\n y: 0.015625,\n },\n {\n x: 0.203125,\n y: 0.015625,\n },\n {\n x: 0.234375,\n y: 0.015625,\n },\n {\n x: 0.234375,\n y: 0.015625,\n },\n {\n x: 0.265625,\n y: 0.015625,\n },\n {\n x: 0.265625,\n y: 0.015625,\n },\n {\n x: 0.296875,\n y: 0.015625,\n },\n {\n x: 0.296875,\n y: 0.015625,\n },\n {\n x: 0.328125,\n y: 0.015625,\n },\n {\n x: 0.328125,\n y: 0.015625,\n },\n {\n x: 0.359375,\n y: 0.015625,\n },\n {\n x: 0.359375,\n y: 0.015625,\n },\n {\n x: 0.390625,\n y: 0.015625,\n },\n {\n x: 0.390625,\n y: 0.015625,\n },\n {\n x: 0.421875,\n y: 0.015625,\n },\n {\n x: 0.421875,\n y: 0.015625,\n },\n {\n x: 0.453125,\n y: 0.015625,\n },\n {\n x: 0.453125,\n y: 0.015625,\n },\n {\n x: 0.484375,\n y: 0.015625,\n },\n {\n x: 0.484375,\n y: 0.015625,\n },\n {\n x: 0.515625,\n y: 0.015625,\n },\n {\n x: 0.515625,\n y: 0.015625,\n },\n {\n x: 0.546875,\n y: 0.015625,\n },\n {\n x: 0.546875,\n y: 0.015625,\n },\n {\n x: 0.578125,\n y: 0.015625,\n },\n {\n x: 0.578125,\n y: 0.015625,\n },\n {\n x: 0.609375,\n y: 0.015625,\n },\n {\n x: 0.609375,\n y: 0.015625,\n },\n {\n x: 0.640625,\n y: 0.015625,\n },\n {\n x: 0.640625,\n y: 0.015625,\n },\n {\n x: 0.671875,\n y: 0.015625,\n },\n {\n x: 0.671875,\n y: 0.015625,\n },\n {\n x: 0.703125,\n y: 0.015625,\n },\n {\n x: 0.703125,\n y: 0.015625,\n },\n {\n x: 0.734375,\n y: 0.015625,\n },\n {\n x: 0.734375,\n y: 0.015625,\n },\n {\n x: 0.765625,\n y: 0.015625,\n },\n {\n x: 0.765625,\n y: 0.015625,\n },\n {\n x: 0.796875,\n y: 0.015625,\n },\n {\n x: 0.796875,\n y: 0.015625,\n },\n {\n x: 0.828125,\n y: 0.015625,\n },\n {\n x: 0.828125,\n y: 0.015625,\n },\n {\n x: 0.859375,\n y: 0.015625,\n },\n {\n x: 0.859375,\n y: 0.015625,\n },\n {\n x: 0.890625,\n y: 0.015625,\n },\n {\n x: 0.890625,\n y: 0.015625,\n },\n {\n x: 0.921875,\n y: 0.015625,\n },\n {\n x: 0.921875,\n y: 0.015625,\n },\n {\n x: 0.953125,\n y: 0.015625,\n },\n {\n x: 0.953125,\n y: 0.015625,\n },\n {\n x: 0.984375,\n y: 0.015625,\n },\n {\n x: 0.984375,\n y: 0.015625,\n },\n {\n x: 0.015625,\n y: 0.046875,\n },\n {\n x: 0.015625,\n y: 0.046875,\n },\n {\n x: 0.046875,\n y: 0.046875,\n },\n {\n x: 0.046875,\n y: 0.046875,\n },\n {\n x: 0.078125,\n y: 0.046875,\n },\n {\n x: 0.078125,\n y: 0.046875,\n },\n {\n x: 0.109375,\n y: 0.046875,\n },\n {\n x: 0.109375,\n y: 0.046875,\n },\n {\n x: 0.140625,\n y: 0.046875,\n },\n {\n x: 0.140625,\n y: 0.046875,\n },\n {\n x: 0.171875,\n y: 0.046875,\n },\n {\n x: 0.171875,\n y: 0.046875,\n },\n {\n x: 0.203125,\n y: 0.046875,\n },\n {\n x: 0.203125,\n y: 0.046875,\n },\n {\n x: 0.234375,\n y: 0.046875,\n },\n {\n x: 0.234375,\n y: 0.046875,\n },\n {\n x: 0.265625,\n y: 0.046875,\n },\n {\n x: 0.265625,\n y: 0.046875,\n },\n {\n x: 0.296875,\n y: 0.046875,\n },\n {\n x: 0.296875,\n y: 0.046875,\n },\n {\n x: 0.328125,\n y: 0.046875,\n },\n {\n x: 0.328125,\n y: 0.046875,\n },\n {\n x: 0.359375,\n y: 0.046875,\n },\n {\n x: 0.359375,\n y: 0.046875,\n },\n {\n x: 0.390625,\n y: 0.046875,\n },\n {\n x: 0.390625,\n y: 0.046875,\n },\n {\n x: 0.421875,\n y: 0.046875,\n },\n {\n x: 0.421875,\n y: 0.046875,\n },\n {\n x: 0.453125,\n y: 0.046875,\n },\n {\n x: 0.453125,\n y: 0.046875,\n },\n {\n x: 0.484375,\n y: 0.046875,\n },\n {\n x: 0.484375,\n y: 0.046875,\n },\n {\n x: 0.515625,\n y: 0.046875,\n },\n {\n x: 0.515625,\n y: 0.046875,\n },\n {\n x: 0.546875,\n y: 0.046875,\n },\n {\n x: 0.546875,\n y: 0.046875,\n },\n {\n x: 0.578125,\n y: 0.046875,\n },\n {\n x: 0.578125,\n y: 0.046875,\n },\n {\n x: 0.609375,\n y: 0.046875,\n },\n {\n x: 0.609375,\n y: 0.046875,\n },\n {\n x: 0.640625,\n y: 0.046875,\n },\n {\n x: 0.640625,\n y: 0.046875,\n },\n {\n x: 0.671875,\n y: 0.046875,\n },\n {\n x: 0.671875,\n y: 0.046875,\n },\n {\n x: 0.703125,\n y: 0.046875,\n },\n {\n x: 0.703125,\n y: 0.046875,\n },\n {\n x: 0.734375,\n y: 0.046875,\n },\n {\n x: 0.734375,\n y: 0.046875,\n },\n {\n x: 0.765625,\n y: 0.046875,\n },\n {\n x: 0.765625,\n y: 0.046875,\n },\n {\n x: 0.796875,\n y: 0.046875,\n },\n {\n x: 0.796875,\n y: 0.046875,\n },\n {\n x: 0.828125,\n y: 0.046875,\n },\n {\n x: 0.828125,\n y: 0.046875,\n },\n {\n x: 0.859375,\n y: 0.046875,\n },\n {\n x: 0.859375,\n y: 0.046875,\n },\n {\n x: 0.890625,\n y: 0.046875,\n },\n {\n x: 0.890625,\n y: 0.046875,\n },\n {\n x: 0.921875,\n y: 0.046875,\n },\n {\n x: 0.921875,\n y: 0.046875,\n },\n {\n x: 0.953125,\n y: 0.046875,\n },\n {\n x: 0.953125,\n y: 0.046875,\n },\n {\n x: 0.984375,\n y: 0.046875,\n },\n {\n x: 0.984375,\n y: 0.046875,\n },\n {\n x: 0.015625,\n y: 0.078125,\n },\n {\n x: 0.015625,\n y: 0.078125,\n },\n {\n x: 0.046875,\n y: 0.078125,\n },\n {\n x: 0.046875,\n y: 0.078125,\n },\n {\n x: 0.078125,\n y: 0.078125,\n },\n {\n x: 0.078125,\n y: 0.078125,\n },\n {\n x: 0.109375,\n y: 0.078125,\n },\n {\n x: 0.109375,\n y: 0.078125,\n },\n {\n x: 0.140625,\n y: 0.078125,\n },\n {\n x: 0.140625,\n y: 0.078125,\n },\n {\n x: 0.171875,\n y: 0.078125,\n },\n {\n x: 0.171875,\n y: 0.078125,\n },\n {\n x: 0.203125,\n y: 0.078125,\n },\n {\n x: 0.203125,\n y: 0.078125,\n },\n {\n x: 0.234375,\n y: 0.078125,\n },\n {\n x: 0.234375,\n y: 0.078125,\n },\n {\n x: 0.265625,\n y: 0.078125,\n },\n {\n x: 0.265625,\n y: 0.078125,\n },\n {\n x: 0.296875,\n y: 0.078125,\n },\n {\n x: 0.296875,\n y: 0.078125,\n },\n {\n x: 0.328125,\n y: 0.078125,\n },\n {\n x: 0.328125,\n y: 0.078125,\n },\n {\n x: 0.359375,\n y: 0.078125,\n },\n {\n x: 0.359375,\n y: 0.078125,\n },\n {\n x: 0.390625,\n y: 0.078125,\n },\n {\n x: 0.390625,\n y: 0.078125,\n },\n {\n x: 0.421875,\n y: 0.078125,\n },\n {\n x: 0.421875,\n y: 0.078125,\n },\n {\n x: 0.453125,\n y: 0.078125,\n },\n {\n x: 0.453125,\n y: 0.078125,\n },\n {\n x: 0.484375,\n y: 0.078125,\n },\n {\n x: 0.484375,\n y: 0.078125,\n },\n {\n x: 0.515625,\n y: 0.078125,\n },\n {\n x: 0.515625,\n y: 0.078125,\n },\n {\n x: 0.546875,\n y: 0.078125,\n },\n {\n x: 0.546875,\n y: 0.078125,\n },\n {\n x: 0.578125,\n y: 0.078125,\n },\n {\n x: 0.578125,\n y: 0.078125,\n },\n {\n x: 0.609375,\n y: 0.078125,\n },\n {\n x: 0.609375,\n y: 0.078125,\n },\n {\n x: 0.640625,\n y: 0.078125,\n },\n {\n x: 0.640625,\n y: 0.078125,\n },\n {\n x: 0.671875,\n y: 0.078125,\n },\n {\n x: 0.671875,\n y: 0.078125,\n },\n {\n x: 0.703125,\n y: 0.078125,\n },\n {\n x: 0.703125,\n y: 0.078125,\n },\n {\n x: 0.734375,\n y: 0.078125,\n },\n {\n x: 0.734375,\n y: 0.078125,\n },\n {\n x: 0.765625,\n y: 0.078125,\n },\n {\n x: 0.765625,\n y: 0.078125,\n },\n {\n x: 0.796875,\n y: 0.078125,\n },\n {\n x: 0.796875,\n y: 0.078125,\n },\n {\n x: 0.828125,\n y: 0.078125,\n },\n {\n x: 0.828125,\n y: 0.078125,\n },\n {\n x: 0.859375,\n y: 0.078125,\n },\n {\n x: 0.859375,\n y: 0.078125,\n },\n {\n x: 0.890625,\n y: 0.078125,\n },\n {\n x: 0.890625,\n y: 0.078125,\n },\n {\n x: 0.921875,\n y: 0.078125,\n },\n {\n x: 0.921875,\n y: 0.078125,\n },\n {\n x: 0.953125,\n y: 0.078125,\n },\n {\n x: 0.953125,\n y: 0.078125,\n },\n {\n x: 0.984375,\n y: 0.078125,\n },\n {\n x: 0.984375,\n y: 0.078125,\n },\n {\n x: 0.015625,\n y: 0.109375,\n },\n {\n x: 0.015625,\n y: 0.109375,\n },\n {\n x: 0.046875,\n y: 0.109375,\n },\n {\n x: 0.046875,\n y: 0.109375,\n },\n {\n x: 0.078125,\n y: 0.109375,\n },\n {\n x: 0.078125,\n y: 0.109375,\n },\n {\n x: 0.109375,\n y: 0.109375,\n },\n {\n x: 0.109375,\n y: 0.109375,\n },\n {\n x: 0.140625,\n y: 0.109375,\n },\n {\n x: 0.140625,\n y: 0.109375,\n },\n {\n x: 0.171875,\n y: 0.109375,\n },\n {\n x: 0.171875,\n y: 0.109375,\n },\n {\n x: 0.203125,\n y: 0.109375,\n },\n {\n x: 0.203125,\n y: 0.109375,\n },\n {\n x: 0.234375,\n y: 0.109375,\n },\n {\n x: 0.234375,\n y: 0.109375,\n },\n {\n x: 0.265625,\n y: 0.109375,\n },\n {\n x: 0.265625,\n y: 0.109375,\n },\n {\n x: 0.296875,\n y: 0.109375,\n },\n {\n x: 0.296875,\n y: 0.109375,\n },\n {\n x: 0.328125,\n y: 0.109375,\n },\n {\n x: 0.328125,\n y: 0.109375,\n },\n {\n x: 0.359375,\n y: 0.109375,\n },\n {\n x: 0.359375,\n y: 0.109375,\n },\n {\n x: 0.390625,\n y: 0.109375,\n },\n {\n x: 0.390625,\n y: 0.109375,\n },\n {\n x: 0.421875,\n y: 0.109375,\n },\n {\n x: 0.421875,\n y: 0.109375,\n },\n {\n x: 0.453125,\n y: 0.109375,\n },\n {\n x: 0.453125,\n y: 0.109375,\n },\n {\n x: 0.484375,\n y: 0.109375,\n },\n {\n x: 0.484375,\n y: 0.109375,\n },\n {\n x: 0.515625,\n y: 0.109375,\n },\n {\n x: 0.515625,\n y: 0.109375,\n },\n {\n x: 0.546875,\n y: 0.109375,\n },\n {\n x: 0.546875,\n y: 0.109375,\n },\n {\n x: 0.578125,\n y: 0.109375,\n },\n {\n x: 0.578125,\n y: 0.109375,\n },\n {\n x: 0.609375,\n y: 0.109375,\n },\n {\n x: 0.609375,\n y: 0.109375,\n },\n {\n x: 0.640625,\n y: 0.109375,\n },\n {\n x: 0.640625,\n y: 0.109375,\n },\n {\n x: 0.671875,\n y: 0.109375,\n },\n {\n x: 0.671875,\n y: 0.109375,\n },\n {\n x: 0.703125,\n y: 0.109375,\n },\n {\n x: 0.703125,\n y: 0.109375,\n },\n {\n x: 0.734375,\n y: 0.109375,\n },\n {\n x: 0.734375,\n y: 0.109375,\n },\n {\n x: 0.765625,\n y: 0.109375,\n },\n {\n x: 0.765625,\n y: 0.109375,\n },\n {\n x: 0.796875,\n y: 0.109375,\n },\n {\n x: 0.796875,\n y: 0.109375,\n },\n {\n x: 0.828125,\n y: 0.109375,\n },\n {\n x: 0.828125,\n y: 0.109375,\n },\n {\n x: 0.859375,\n y: 0.109375,\n },\n {\n x: 0.859375,\n y: 0.109375,\n },\n {\n x: 0.890625,\n y: 0.109375,\n },\n {\n x: 0.890625,\n y: 0.109375,\n },\n {\n x: 0.921875,\n y: 0.109375,\n },\n {\n x: 0.921875,\n y: 0.109375,\n },\n {\n x: 0.953125,\n y: 0.109375,\n },\n {\n x: 0.953125,\n y: 0.109375,\n },\n {\n x: 0.984375,\n y: 0.109375,\n },\n {\n x: 0.984375,\n y: 0.109375,\n },\n {\n x: 0.015625,\n y: 0.140625,\n },\n {\n x: 0.015625,\n y: 0.140625,\n },\n {\n x: 0.046875,\n y: 0.140625,\n },\n {\n x: 0.046875,\n y: 0.140625,\n },\n {\n x: 0.078125,\n y: 0.140625,\n },\n {\n x: 0.078125,\n y: 0.140625,\n },\n {\n x: 0.109375,\n y: 0.140625,\n },\n {\n x: 0.109375,\n y: 0.140625,\n },\n {\n x: 0.140625,\n y: 0.140625,\n },\n {\n x: 0.140625,\n y: 0.140625,\n },\n {\n x: 0.171875,\n y: 0.140625,\n },\n {\n x: 0.171875,\n y: 0.140625,\n },\n {\n x: 0.203125,\n y: 0.140625,\n },\n {\n x: 0.203125,\n y: 0.140625,\n },\n {\n x: 0.234375,\n y: 0.140625,\n },\n {\n x: 0.234375,\n y: 0.140625,\n },\n {\n x: 0.265625,\n y: 0.140625,\n },\n {\n x: 0.265625,\n y: 0.140625,\n },\n {\n x: 0.296875,\n y: 0.140625,\n },\n {\n x: 0.296875,\n y: 0.140625,\n },\n {\n x: 0.328125,\n y: 0.140625,\n },\n {\n x: 0.328125,\n y: 0.140625,\n },\n {\n x: 0.359375,\n y: 0.140625,\n },\n {\n x: 0.359375,\n y: 0.140625,\n },\n {\n x: 0.390625,\n y: 0.140625,\n },\n {\n x: 0.390625,\n y: 0.140625,\n },\n {\n x: 0.421875,\n y: 0.140625,\n },\n {\n x: 0.421875,\n y: 0.140625,\n },\n {\n x: 0.453125,\n y: 0.140625,\n },\n {\n x: 0.453125,\n y: 0.140625,\n },\n {\n x: 0.484375,\n y: 0.140625,\n },\n {\n x: 0.484375,\n y: 0.140625,\n },\n {\n x: 0.515625,\n y: 0.140625,\n },\n {\n x: 0.515625,\n y: 0.140625,\n },\n {\n x: 0.546875,\n y: 0.140625,\n },\n {\n x: 0.546875,\n y: 0.140625,\n },\n {\n x: 0.578125,\n y: 0.140625,\n },\n {\n x: 0.578125,\n y: 0.140625,\n },\n {\n x: 0.609375,\n y: 0.140625,\n },\n {\n x: 0.609375,\n y: 0.140625,\n },\n {\n x: 0.640625,\n y: 0.140625,\n },\n {\n x: 0.640625,\n y: 0.140625,\n },\n {\n x: 0.671875,\n y: 0.140625,\n },\n {\n x: 0.671875,\n y: 0.140625,\n },\n {\n x: 0.703125,\n y: 0.140625,\n },\n {\n x: 0.703125,\n y: 0.140625,\n },\n {\n x: 0.734375,\n y: 0.140625,\n },\n {\n x: 0.734375,\n y: 0.140625,\n },\n {\n x: 0.765625,\n y: 0.140625,\n },\n {\n x: 0.765625,\n y: 0.140625,\n },\n {\n x: 0.796875,\n y: 0.140625,\n },\n {\n x: 0.796875,\n y: 0.140625,\n },\n {\n x: 0.828125,\n y: 0.140625,\n },\n {\n x: 0.828125,\n y: 0.140625,\n },\n {\n x: 0.859375,\n y: 0.140625,\n },\n {\n x: 0.859375,\n y: 0.140625,\n },\n {\n x: 0.890625,\n y: 0.140625,\n },\n {\n x: 0.890625,\n y: 0.140625,\n },\n {\n x: 0.921875,\n y: 0.140625,\n },\n {\n x: 0.921875,\n y: 0.140625,\n },\n {\n x: 0.953125,\n y: 0.140625,\n },\n {\n x: 0.953125,\n y: 0.140625,\n },\n {\n x: 0.984375,\n y: 0.140625,\n },\n {\n x: 0.984375,\n y: 0.140625,\n },\n {\n x: 0.015625,\n y: 0.171875,\n },\n {\n x: 0.015625,\n y: 0.171875,\n },\n {\n x: 0.046875,\n y: 0.171875,\n },\n {\n x: 0.046875,\n y: 0.171875,\n },\n {\n x: 0.078125,\n y: 0.171875,\n },\n {\n x: 0.078125,\n y: 0.171875,\n },\n {\n x: 0.109375,\n y: 0.171875,\n },\n {\n x: 0.109375,\n y: 0.171875,\n },\n {\n x: 0.140625,\n y: 0.171875,\n },\n {\n x: 0.140625,\n y: 0.171875,\n },\n {\n x: 0.171875,\n y: 0.171875,\n },\n {\n x: 0.171875,\n y: 0.171875,\n },\n {\n x: 0.203125,\n y: 0.171875,\n },\n {\n x: 0.203125,\n y: 0.171875,\n },\n {\n x: 0.234375,\n y: 0.171875,\n },\n {\n x: 0.234375,\n y: 0.171875,\n },\n {\n x: 0.265625,\n y: 0.171875,\n },\n {\n x: 0.265625,\n y: 0.171875,\n },\n {\n x: 0.296875,\n y: 0.171875,\n },\n {\n x: 0.296875,\n y: 0.171875,\n },\n {\n x: 0.328125,\n y: 0.171875,\n },\n {\n x: 0.328125,\n y: 0.171875,\n },\n {\n x: 0.359375,\n y: 0.171875,\n },\n {\n x: 0.359375,\n y: 0.171875,\n },\n {\n x: 0.390625,\n y: 0.171875,\n },\n {\n x: 0.390625,\n y: 0.171875,\n },\n {\n x: 0.421875,\n y: 0.171875,\n },\n {\n x: 0.421875,\n y: 0.171875,\n },\n {\n x: 0.453125,\n y: 0.171875,\n },\n {\n x: 0.453125,\n y: 0.171875,\n },\n {\n x: 0.484375,\n y: 0.171875,\n },\n {\n x: 0.484375,\n y: 0.171875,\n },\n {\n x: 0.515625,\n y: 0.171875,\n },\n {\n x: 0.515625,\n y: 0.171875,\n },\n {\n x: 0.546875,\n y: 0.171875,\n },\n {\n x: 0.546875,\n y: 0.171875,\n },\n {\n x: 0.578125,\n y: 0.171875,\n },\n {\n x: 0.578125,\n y: 0.171875,\n },\n {\n x: 0.609375,\n y: 0.171875,\n },\n {\n x: 0.609375,\n y: 0.171875,\n },\n {\n x: 0.640625,\n y: 0.171875,\n },\n {\n x: 0.640625,\n y: 0.171875,\n },\n {\n x: 0.671875,\n y: 0.171875,\n },\n {\n x: 0.671875,\n y: 0.171875,\n },\n {\n x: 0.703125,\n y: 0.171875,\n },\n {\n x: 0.703125,\n y: 0.171875,\n },\n {\n x: 0.734375,\n y: 0.171875,\n },\n {\n x: 0.734375,\n y: 0.171875,\n },\n {\n x: 0.765625,\n y: 0.171875,\n },\n {\n x: 0.765625,\n y: 0.171875,\n },\n {\n x: 0.796875,\n y: 0.171875,\n },\n {\n x: 0.796875,\n y: 0.171875,\n },\n {\n x: 0.828125,\n y: 0.171875,\n },\n {\n x: 0.828125,\n y: 0.171875,\n },\n {\n x: 0.859375,\n y: 0.171875,\n },\n {\n x: 0.859375,\n y: 0.171875,\n },\n {\n x: 0.890625,\n y: 0.171875,\n },\n {\n x: 0.890625,\n y: 0.171875,\n },\n {\n x: 0.921875,\n y: 0.171875,\n },\n {\n x: 0.921875,\n y: 0.171875,\n },\n {\n x: 0.953125,\n y: 0.171875,\n },\n {\n x: 0.953125,\n y: 0.171875,\n },\n {\n x: 0.984375,\n y: 0.171875,\n },\n {\n x: 0.984375,\n y: 0.171875,\n },\n {\n x: 0.015625,\n y: 0.203125,\n },\n {\n x: 0.015625,\n y: 0.203125,\n },\n {\n x: 0.046875,\n y: 0.203125,\n },\n {\n x: 0.046875,\n y: 0.203125,\n },\n {\n x: 0.078125,\n y: 0.203125,\n },\n {\n x: 0.078125,\n y: 0.203125,\n },\n {\n x: 0.109375,\n y: 0.203125,\n },\n {\n x: 0.109375,\n y: 0.203125,\n },\n {\n x: 0.140625,\n y: 0.203125,\n },\n {\n x: 0.140625,\n y: 0.203125,\n },\n {\n x: 0.171875,\n y: 0.203125,\n },\n {\n x: 0.171875,\n y: 0.203125,\n },\n {\n x: 0.203125,\n y: 0.203125,\n },\n {\n x: 0.203125,\n y: 0.203125,\n },\n {\n x: 0.234375,\n y: 0.203125,\n },\n {\n x: 0.234375,\n y: 0.203125,\n },\n {\n x: 0.265625,\n y: 0.203125,\n },\n {\n x: 0.265625,\n y: 0.203125,\n },\n {\n x: 0.296875,\n y: 0.203125,\n },\n {\n x: 0.296875,\n y: 0.203125,\n },\n {\n x: 0.328125,\n y: 0.203125,\n },\n {\n x: 0.328125,\n y: 0.203125,\n },\n {\n x: 0.359375,\n y: 0.203125,\n },\n {\n x: 0.359375,\n y: 0.203125,\n },\n {\n x: 0.390625,\n y: 0.203125,\n },\n {\n x: 0.390625,\n y: 0.203125,\n },\n {\n x: 0.421875,\n y: 0.203125,\n },\n {\n x: 0.421875,\n y: 0.203125,\n },\n {\n x: 0.453125,\n y: 0.203125,\n },\n {\n x: 0.453125,\n y: 0.203125,\n },\n {\n x: 0.484375,\n y: 0.203125,\n },\n {\n x: 0.484375,\n y: 0.203125,\n },\n {\n x: 0.515625,\n y: 0.203125,\n },\n {\n x: 0.515625,\n y: 0.203125,\n },\n {\n x: 0.546875,\n y: 0.203125,\n },\n {\n x: 0.546875,\n y: 0.203125,\n },\n {\n x: 0.578125,\n y: 0.203125,\n },\n {\n x: 0.578125,\n y: 0.203125,\n },\n {\n x: 0.609375,\n y: 0.203125,\n },\n {\n x: 0.609375,\n y: 0.203125,\n },\n {\n x: 0.640625,\n y: 0.203125,\n },\n {\n x: 0.640625,\n y: 0.203125,\n },\n {\n x: 0.671875,\n y: 0.203125,\n },\n {\n x: 0.671875,\n y: 0.203125,\n },\n {\n x: 0.703125,\n y: 0.203125,\n },\n {\n x: 0.703125,\n y: 0.203125,\n },\n {\n x: 0.734375,\n y: 0.203125,\n },\n {\n x: 0.734375,\n y: 0.203125,\n },\n {\n x: 0.765625,\n y: 0.203125,\n },\n {\n x: 0.765625,\n y: 0.203125,\n },\n {\n x: 0.796875,\n y: 0.203125,\n },\n {\n x: 0.796875,\n y: 0.203125,\n },\n {\n x: 0.828125,\n y: 0.203125,\n },\n {\n x: 0.828125,\n y: 0.203125,\n },\n {\n x: 0.859375,\n y: 0.203125,\n },\n {\n x: 0.859375,\n y: 0.203125,\n },\n {\n x: 0.890625,\n y: 0.203125,\n },\n {\n x: 0.890625,\n y: 0.203125,\n },\n {\n x: 0.921875,\n y: 0.203125,\n },\n {\n x: 0.921875,\n y: 0.203125,\n },\n {\n x: 0.953125,\n y: 0.203125,\n },\n {\n x: 0.953125,\n y: 0.203125,\n },\n {\n x: 0.984375,\n y: 0.203125,\n },\n {\n x: 0.984375,\n y: 0.203125,\n },\n {\n x: 0.015625,\n y: 0.234375,\n },\n {\n x: 0.015625,\n y: 0.234375,\n },\n {\n x: 0.046875,\n y: 0.234375,\n },\n {\n x: 0.046875,\n y: 0.234375,\n },\n {\n x: 0.078125,\n y: 0.234375,\n },\n {\n x: 0.078125,\n y: 0.234375,\n },\n {\n x: 0.109375,\n y: 0.234375,\n },\n {\n x: 0.109375,\n y: 0.234375,\n },\n {\n x: 0.140625,\n y: 0.234375,\n },\n {\n x: 0.140625,\n y: 0.234375,\n },\n {\n x: 0.171875,\n y: 0.234375,\n },\n {\n x: 0.171875,\n y: 0.234375,\n },\n {\n x: 0.203125,\n y: 0.234375,\n },\n {\n x: 0.203125,\n y: 0.234375,\n },\n {\n x: 0.234375,\n y: 0.234375,\n },\n {\n x: 0.234375,\n y: 0.234375,\n },\n {\n x: 0.265625,\n y: 0.234375,\n },\n {\n x: 0.265625,\n y: 0.234375,\n },\n {\n x: 0.296875,\n y: 0.234375,\n },\n {\n x: 0.296875,\n y: 0.234375,\n },\n {\n x: 0.328125,\n y: 0.234375,\n },\n {\n x: 0.328125,\n y: 0.234375,\n },\n {\n x: 0.359375,\n y: 0.234375,\n },\n {\n x: 0.359375,\n y: 0.234375,\n },\n {\n x: 0.390625,\n y: 0.234375,\n },\n {\n x: 0.390625,\n y: 0.234375,\n },\n {\n x: 0.421875,\n y: 0.234375,\n },\n {\n x: 0.421875,\n y: 0.234375,\n },\n {\n x: 0.453125,\n y: 0.234375,\n },\n {\n x: 0.453125,\n y: 0.234375,\n },\n {\n x: 0.484375,\n y: 0.234375,\n },\n {\n x: 0.484375,\n y: 0.234375,\n },\n {\n x: 0.515625,\n y: 0.234375,\n },\n {\n x: 0.515625,\n y: 0.234375,\n },\n {\n x: 0.546875,\n y: 0.234375,\n },\n {\n x: 0.546875,\n y: 0.234375,\n },\n {\n x: 0.578125,\n y: 0.234375,\n },\n {\n x: 0.578125,\n y: 0.234375,\n },\n {\n x: 0.609375,\n y: 0.234375,\n },\n {\n x: 0.609375,\n y: 0.234375,\n },\n {\n x: 0.640625,\n y: 0.234375,\n },\n {\n x: 0.640625,\n y: 0.234375,\n },\n {\n x: 0.671875,\n y: 0.234375,\n },\n {\n x: 0.671875,\n y: 0.234375,\n },\n {\n x: 0.703125,\n y: 0.234375,\n },\n {\n x: 0.703125,\n y: 0.234375,\n },\n {\n x: 0.734375,\n y: 0.234375,\n },\n {\n x: 0.734375,\n y: 0.234375,\n },\n {\n x: 0.765625,\n y: 0.234375,\n },\n {\n x: 0.765625,\n y: 0.234375,\n },\n {\n x: 0.796875,\n y: 0.234375,\n },\n {\n x: 0.796875,\n y: 0.234375,\n },\n {\n x: 0.828125,\n y: 0.234375,\n },\n {\n x: 0.828125,\n y: 0.234375,\n },\n {\n x: 0.859375,\n y: 0.234375,\n },\n {\n x: 0.859375,\n y: 0.234375,\n },\n {\n x: 0.890625,\n y: 0.234375,\n },\n {\n x: 0.890625,\n y: 0.234375,\n },\n {\n x: 0.921875,\n y: 0.234375,\n },\n {\n x: 0.921875,\n y: 0.234375,\n },\n {\n x: 0.953125,\n y: 0.234375,\n },\n {\n x: 0.953125,\n y: 0.234375,\n },\n {\n x: 0.984375,\n y: 0.234375,\n },\n {\n x: 0.984375,\n y: 0.234375,\n },\n {\n x: 0.015625,\n y: 0.265625,\n },\n {\n x: 0.015625,\n y: 0.265625,\n },\n {\n x: 0.046875,\n y: 0.265625,\n },\n {\n x: 0.046875,\n y: 0.265625,\n },\n {\n x: 0.078125,\n y: 0.265625,\n },\n {\n x: 0.078125,\n y: 0.265625,\n },\n {\n x: 0.109375,\n y: 0.265625,\n },\n {\n x: 0.109375,\n y: 0.265625,\n },\n {\n x: 0.140625,\n y: 0.265625,\n },\n {\n x: 0.140625,\n y: 0.265625,\n },\n {\n x: 0.171875,\n y: 0.265625,\n },\n {\n x: 0.171875,\n y: 0.265625,\n },\n {\n x: 0.203125,\n y: 0.265625,\n },\n {\n x: 0.203125,\n y: 0.265625,\n },\n {\n x: 0.234375,\n y: 0.265625,\n },\n {\n x: 0.234375,\n y: 0.265625,\n },\n {\n x: 0.265625,\n y: 0.265625,\n },\n {\n x: 0.265625,\n y: 0.265625,\n },\n {\n x: 0.296875,\n y: 0.265625,\n },\n {\n x: 0.296875,\n y: 0.265625,\n },\n {\n x: 0.328125,\n y: 0.265625,\n },\n {\n x: 0.328125,\n y: 0.265625,\n },\n {\n x: 0.359375,\n y: 0.265625,\n },\n {\n x: 0.359375,\n y: 0.265625,\n },\n {\n x: 0.390625,\n y: 0.265625,\n },\n {\n x: 0.390625,\n y: 0.265625,\n },\n {\n x: 0.421875,\n y: 0.265625,\n },\n {\n x: 0.421875,\n y: 0.265625,\n },\n {\n x: 0.453125,\n y: 0.265625,\n },\n {\n x: 0.453125,\n y: 0.265625,\n },\n {\n x: 0.484375,\n y: 0.265625,\n },\n {\n x: 0.484375,\n y: 0.265625,\n },\n {\n x: 0.515625,\n y: 0.265625,\n },\n {\n x: 0.515625,\n y: 0.265625,\n },\n {\n x: 0.546875,\n y: 0.265625,\n },\n {\n x: 0.546875,\n y: 0.265625,\n },\n {\n x: 0.578125,\n y: 0.265625,\n },\n {\n x: 0.578125,\n y: 0.265625,\n },\n {\n x: 0.609375,\n y: 0.265625,\n },\n {\n x: 0.609375,\n y: 0.265625,\n },\n {\n x: 0.640625,\n y: 0.265625,\n },\n {\n x: 0.640625,\n y: 0.265625,\n },\n {\n x: 0.671875,\n y: 0.265625,\n },\n {\n x: 0.671875,\n y: 0.265625,\n },\n {\n x: 0.703125,\n y: 0.265625,\n },\n {\n x: 0.703125,\n y: 0.265625,\n },\n {\n x: 0.734375,\n y: 0.265625,\n },\n {\n x: 0.734375,\n y: 0.265625,\n },\n {\n x: 0.765625,\n y: 0.265625,\n },\n {\n x: 0.765625,\n y: 0.265625,\n },\n {\n x: 0.796875,\n y: 0.265625,\n },\n {\n x: 0.796875,\n y: 0.265625,\n },\n {\n x: 0.828125,\n y: 0.265625,\n },\n {\n x: 0.828125,\n y: 0.265625,\n },\n {\n x: 0.859375,\n y: 0.265625,\n },\n {\n x: 0.859375,\n y: 0.265625,\n },\n {\n x: 0.890625,\n y: 0.265625,\n },\n {\n x: 0.890625,\n y: 0.265625,\n },\n {\n x: 0.921875,\n y: 0.265625,\n },\n {\n x: 0.921875,\n y: 0.265625,\n },\n {\n x: 0.953125,\n y: 0.265625,\n },\n {\n x: 0.953125,\n y: 0.265625,\n },\n {\n x: 0.984375,\n y: 0.265625,\n },\n {\n x: 0.984375,\n y: 0.265625,\n },\n {\n x: 0.015625,\n y: 0.296875,\n },\n {\n x: 0.015625,\n y: 0.296875,\n },\n {\n x: 0.046875,\n y: 0.296875,\n },\n {\n x: 0.046875,\n y: 0.296875,\n },\n {\n x: 0.078125,\n y: 0.296875,\n },\n {\n x: 0.078125,\n y: 0.296875,\n },\n {\n x: 0.109375,\n y: 0.296875,\n },\n {\n x: 0.109375,\n y: 0.296875,\n },\n {\n x: 0.140625,\n y: 0.296875,\n },\n {\n x: 0.140625,\n y: 0.296875,\n },\n {\n x: 0.171875,\n y: 0.296875,\n },\n {\n x: 0.171875,\n y: 0.296875,\n },\n {\n x: 0.203125,\n y: 0.296875,\n },\n {\n x: 0.203125,\n y: 0.296875,\n },\n {\n x: 0.234375,\n y: 0.296875,\n },\n {\n x: 0.234375,\n y: 0.296875,\n },\n {\n x: 0.265625,\n y: 0.296875,\n },\n {\n x: 0.265625,\n y: 0.296875,\n },\n {\n x: 0.296875,\n y: 0.296875,\n },\n {\n x: 0.296875,\n y: 0.296875,\n },\n {\n x: 0.328125,\n y: 0.296875,\n },\n {\n x: 0.328125,\n y: 0.296875,\n },\n {\n x: 0.359375,\n y: 0.296875,\n },\n {\n x: 0.359375,\n y: 0.296875,\n },\n {\n x: 0.390625,\n y: 0.296875,\n },\n {\n x: 0.390625,\n y: 0.296875,\n },\n {\n x: 0.421875,\n y: 0.296875,\n },\n {\n x: 0.421875,\n y: 0.296875,\n },\n {\n x: 0.453125,\n y: 0.296875,\n },\n {\n x: 0.453125,\n y: 0.296875,\n },\n {\n x: 0.484375,\n y: 0.296875,\n },\n {\n x: 0.484375,\n y: 0.296875,\n },\n {\n x: 0.515625,\n y: 0.296875,\n },\n {\n x: 0.515625,\n y: 0.296875,\n },\n {\n x: 0.546875,\n y: 0.296875,\n },\n {\n x: 0.546875,\n y: 0.296875,\n },\n {\n x: 0.578125,\n y: 0.296875,\n },\n {\n x: 0.578125,\n y: 0.296875,\n },\n {\n x: 0.609375,\n y: 0.296875,\n },\n {\n x: 0.609375,\n y: 0.296875,\n },\n {\n x: 0.640625,\n y: 0.296875,\n },\n {\n x: 0.640625,\n y: 0.296875,\n },\n {\n x: 0.671875,\n y: 0.296875,\n },\n {\n x: 0.671875,\n y: 0.296875,\n },\n {\n x: 0.703125,\n y: 0.296875,\n },\n {\n x: 0.703125,\n y: 0.296875,\n },\n {\n x: 0.734375,\n y: 0.296875,\n },\n {\n x: 0.734375,\n y: 0.296875,\n },\n {\n x: 0.765625,\n y: 0.296875,\n },\n {\n x: 0.765625,\n y: 0.296875,\n },\n {\n x: 0.796875,\n y: 0.296875,\n },\n {\n x: 0.796875,\n y: 0.296875,\n },\n {\n x: 0.828125,\n y: 0.296875,\n },\n {\n x: 0.828125,\n y: 0.296875,\n },\n {\n x: 0.859375,\n y: 0.296875,\n },\n {\n x: 0.859375,\n y: 0.296875,\n },\n {\n x: 0.890625,\n y: 0.296875,\n },\n {\n x: 0.890625,\n y: 0.296875,\n },\n {\n x: 0.921875,\n y: 0.296875,\n },\n {\n x: 0.921875,\n y: 0.296875,\n },\n {\n x: 0.953125,\n y: 0.296875,\n },\n {\n x: 0.953125,\n y: 0.296875,\n },\n {\n x: 0.984375,\n y: 0.296875,\n },\n {\n x: 0.984375,\n y: 0.296875,\n },\n {\n x: 0.015625,\n y: 0.328125,\n },\n {\n x: 0.015625,\n y: 0.328125,\n },\n {\n x: 0.046875,\n y: 0.328125,\n },\n {\n x: 0.046875,\n y: 0.328125,\n },\n {\n x: 0.078125,\n y: 0.328125,\n },\n {\n x: 0.078125,\n y: 0.328125,\n },\n {\n x: 0.109375,\n y: 0.328125,\n },\n {\n x: 0.109375,\n y: 0.328125,\n },\n {\n x: 0.140625,\n y: 0.328125,\n },\n {\n x: 0.140625,\n y: 0.328125,\n },\n {\n x: 0.171875,\n y: 0.328125,\n },\n {\n x: 0.171875,\n y: 0.328125,\n },\n {\n x: 0.203125,\n y: 0.328125,\n },\n {\n x: 0.203125,\n y: 0.328125,\n },\n {\n x: 0.234375,\n y: 0.328125,\n },\n {\n x: 0.234375,\n y: 0.328125,\n },\n {\n x: 0.265625,\n y: 0.328125,\n },\n {\n x: 0.265625,\n y: 0.328125,\n },\n {\n x: 0.296875,\n y: 0.328125,\n },\n {\n x: 0.296875,\n y: 0.328125,\n },\n {\n x: 0.328125,\n y: 0.328125,\n },\n {\n x: 0.328125,\n y: 0.328125,\n },\n {\n x: 0.359375,\n y: 0.328125,\n },\n {\n x: 0.359375,\n y: 0.328125,\n },\n {\n x: 0.390625,\n y: 0.328125,\n },\n {\n x: 0.390625,\n y: 0.328125,\n },\n {\n x: 0.421875,\n y: 0.328125,\n },\n {\n x: 0.421875,\n y: 0.328125,\n },\n {\n x: 0.453125,\n y: 0.328125,\n },\n {\n x: 0.453125,\n y: 0.328125,\n },\n {\n x: 0.484375,\n y: 0.328125,\n },\n {\n x: 0.484375,\n y: 0.328125,\n },\n {\n x: 0.515625,\n y: 0.328125,\n },\n {\n x: 0.515625,\n y: 0.328125,\n },\n {\n x: 0.546875,\n y: 0.328125,\n },\n {\n x: 0.546875,\n y: 0.328125,\n },\n {\n x: 0.578125,\n y: 0.328125,\n },\n {\n x: 0.578125,\n y: 0.328125,\n },\n {\n x: 0.609375,\n y: 0.328125,\n },\n {\n x: 0.609375,\n y: 0.328125,\n },\n {\n x: 0.640625,\n y: 0.328125,\n },\n {\n x: 0.640625,\n y: 0.328125,\n },\n {\n x: 0.671875,\n y: 0.328125,\n },\n {\n x: 0.671875,\n y: 0.328125,\n },\n {\n x: 0.703125,\n y: 0.328125,\n },\n {\n x: 0.703125,\n y: 0.328125,\n },\n {\n x: 0.734375,\n y: 0.328125,\n },\n {\n x: 0.734375,\n y: 0.328125,\n },\n {\n x: 0.765625,\n y: 0.328125,\n },\n {\n x: 0.765625,\n y: 0.328125,\n },\n {\n x: 0.796875,\n y: 0.328125,\n },\n {\n x: 0.796875,\n y: 0.328125,\n },\n {\n x: 0.828125,\n y: 0.328125,\n },\n {\n x: 0.828125,\n y: 0.328125,\n },\n {\n x: 0.859375,\n y: 0.328125,\n },\n {\n x: 0.859375,\n y: 0.328125,\n },\n {\n x: 0.890625,\n y: 0.328125,\n },\n {\n x: 0.890625,\n y: 0.328125,\n },\n {\n x: 0.921875,\n y: 0.328125,\n },\n {\n x: 0.921875,\n y: 0.328125,\n },\n {\n x: 0.953125,\n y: 0.328125,\n },\n {\n x: 0.953125,\n y: 0.328125,\n },\n {\n x: 0.984375,\n y: 0.328125,\n },\n {\n x: 0.984375,\n y: 0.328125,\n },\n {\n x: 0.015625,\n y: 0.359375,\n },\n {\n x: 0.015625,\n y: 0.359375,\n },\n {\n x: 0.046875,\n y: 0.359375,\n },\n {\n x: 0.046875,\n y: 0.359375,\n },\n {\n x: 0.078125,\n y: 0.359375,\n },\n {\n x: 0.078125,\n y: 0.359375,\n },\n {\n x: 0.109375,\n y: 0.359375,\n },\n {\n x: 0.109375,\n y: 0.359375,\n },\n {\n x: 0.140625,\n y: 0.359375,\n },\n {\n x: 0.140625,\n y: 0.359375,\n },\n {\n x: 0.171875,\n y: 0.359375,\n },\n {\n x: 0.171875,\n y: 0.359375,\n },\n {\n x: 0.203125,\n y: 0.359375,\n },\n {\n x: 0.203125,\n y: 0.359375,\n },\n {\n x: 0.234375,\n y: 0.359375,\n },\n {\n x: 0.234375,\n y: 0.359375,\n },\n {\n x: 0.265625,\n y: 0.359375,\n },\n {\n x: 0.265625,\n y: 0.359375,\n },\n {\n x: 0.296875,\n y: 0.359375,\n },\n {\n x: 0.296875,\n y: 0.359375,\n },\n {\n x: 0.328125,\n y: 0.359375,\n },\n {\n x: 0.328125,\n y: 0.359375,\n },\n {\n x: 0.359375,\n y: 0.359375,\n },\n {\n x: 0.359375,\n y: 0.359375,\n },\n {\n x: 0.390625,\n y: 0.359375,\n },\n {\n x: 0.390625,\n y: 0.359375,\n },\n {\n x: 0.421875,\n y: 0.359375,\n },\n {\n x: 0.421875,\n y: 0.359375,\n },\n {\n x: 0.453125,\n y: 0.359375,\n },\n {\n x: 0.453125,\n y: 0.359375,\n },\n {\n x: 0.484375,\n y: 0.359375,\n },\n {\n x: 0.484375,\n y: 0.359375,\n },\n {\n x: 0.515625,\n y: 0.359375,\n },\n {\n x: 0.515625,\n y: 0.359375,\n },\n {\n x: 0.546875,\n y: 0.359375,\n },\n {\n x: 0.546875,\n y: 0.359375,\n },\n {\n x: 0.578125,\n y: 0.359375,\n },\n {\n x: 0.578125,\n y: 0.359375,\n },\n {\n x: 0.609375,\n y: 0.359375,\n },\n {\n x: 0.609375,\n y: 0.359375,\n },\n {\n x: 0.640625,\n y: 0.359375,\n },\n {\n x: 0.640625,\n y: 0.359375,\n },\n {\n x: 0.671875,\n y: 0.359375,\n },\n {\n x: 0.671875,\n y: 0.359375,\n },\n {\n x: 0.703125,\n y: 0.359375,\n },\n {\n x: 0.703125,\n y: 0.359375,\n },\n {\n x: 0.734375,\n y: 0.359375,\n },\n {\n x: 0.734375,\n y: 0.359375,\n },\n {\n x: 0.765625,\n y: 0.359375,\n },\n {\n x: 0.765625,\n y: 0.359375,\n },\n {\n x: 0.796875,\n y: 0.359375,\n },\n {\n x: 0.796875,\n y: 0.359375,\n },\n {\n x: 0.828125,\n y: 0.359375,\n },\n {\n x: 0.828125,\n y: 0.359375,\n },\n {\n x: 0.859375,\n y: 0.359375,\n },\n {\n x: 0.859375,\n y: 0.359375,\n },\n {\n x: 0.890625,\n y: 0.359375,\n },\n {\n x: 0.890625,\n y: 0.359375,\n },\n {\n x: 0.921875,\n y: 0.359375,\n },\n {\n x: 0.921875,\n y: 0.359375,\n },\n {\n x: 0.953125,\n y: 0.359375,\n },\n {\n x: 0.953125,\n y: 0.359375,\n },\n {\n x: 0.984375,\n y: 0.359375,\n },\n {\n x: 0.984375,\n y: 0.359375,\n },\n {\n x: 0.015625,\n y: 0.390625,\n },\n {\n x: 0.015625,\n y: 0.390625,\n },\n {\n x: 0.046875,\n y: 0.390625,\n },\n {\n x: 0.046875,\n y: 0.390625,\n },\n {\n x: 0.078125,\n y: 0.390625,\n },\n {\n x: 0.078125,\n y: 0.390625,\n },\n {\n x: 0.109375,\n y: 0.390625,\n },\n {\n x: 0.109375,\n y: 0.390625,\n },\n {\n x: 0.140625,\n y: 0.390625,\n },\n {\n x: 0.140625,\n y: 0.390625,\n },\n {\n x: 0.171875,\n y: 0.390625,\n },\n {\n x: 0.171875,\n y: 0.390625,\n },\n {\n x: 0.203125,\n y: 0.390625,\n },\n {\n x: 0.203125,\n y: 0.390625,\n },\n {\n x: 0.234375,\n y: 0.390625,\n },\n {\n x: 0.234375,\n y: 0.390625,\n },\n {\n x: 0.265625,\n y: 0.390625,\n },\n {\n x: 0.265625,\n y: 0.390625,\n },\n {\n x: 0.296875,\n y: 0.390625,\n },\n {\n x: 0.296875,\n y: 0.390625,\n },\n {\n x: 0.328125,\n y: 0.390625,\n },\n {\n x: 0.328125,\n y: 0.390625,\n },\n {\n x: 0.359375,\n y: 0.390625,\n },\n {\n x: 0.359375,\n y: 0.390625,\n },\n {\n x: 0.390625,\n y: 0.390625,\n },\n {\n x: 0.390625,\n y: 0.390625,\n },\n {\n x: 0.421875,\n y: 0.390625,\n },\n {\n x: 0.421875,\n y: 0.390625,\n },\n {\n x: 0.453125,\n y: 0.390625,\n },\n {\n x: 0.453125,\n y: 0.390625,\n },\n {\n x: 0.484375,\n y: 0.390625,\n },\n {\n x: 0.484375,\n y: 0.390625,\n },\n {\n x: 0.515625,\n y: 0.390625,\n },\n {\n x: 0.515625,\n y: 0.390625,\n },\n {\n x: 0.546875,\n y: 0.390625,\n },\n {\n x: 0.546875,\n y: 0.390625,\n },\n {\n x: 0.578125,\n y: 0.390625,\n },\n {\n x: 0.578125,\n y: 0.390625,\n },\n {\n x: 0.609375,\n y: 0.390625,\n },\n {\n x: 0.609375,\n y: 0.390625,\n },\n {\n x: 0.640625,\n y: 0.390625,\n },\n {\n x: 0.640625,\n y: 0.390625,\n },\n {\n x: 0.671875,\n y: 0.390625,\n },\n {\n x: 0.671875,\n y: 0.390625,\n },\n {\n x: 0.703125,\n y: 0.390625,\n },\n {\n x: 0.703125,\n y: 0.390625,\n },\n {\n x: 0.734375,\n y: 0.390625,\n },\n {\n x: 0.734375,\n y: 0.390625,\n },\n {\n x: 0.765625,\n y: 0.390625,\n },\n {\n x: 0.765625,\n y: 0.390625,\n },\n {\n x: 0.796875,\n y: 0.390625,\n },\n {\n x: 0.796875,\n y: 0.390625,\n },\n {\n x: 0.828125,\n y: 0.390625,\n },\n {\n x: 0.828125,\n y: 0.390625,\n },\n {\n x: 0.859375,\n y: 0.390625,\n },\n {\n x: 0.859375,\n y: 0.390625,\n },\n {\n x: 0.890625,\n y: 0.390625,\n },\n {\n x: 0.890625,\n y: 0.390625,\n },\n {\n x: 0.921875,\n y: 0.390625,\n },\n {\n x: 0.921875,\n y: 0.390625,\n },\n {\n x: 0.953125,\n y: 0.390625,\n },\n {\n x: 0.953125,\n y: 0.390625,\n },\n {\n x: 0.984375,\n y: 0.390625,\n },\n {\n x: 0.984375,\n y: 0.390625,\n },\n {\n x: 0.015625,\n y: 0.421875,\n },\n {\n x: 0.015625,\n y: 0.421875,\n },\n {\n x: 0.046875,\n y: 0.421875,\n },\n {\n x: 0.046875,\n y: 0.421875,\n },\n {\n x: 0.078125,\n y: 0.421875,\n },\n {\n x: 0.078125,\n y: 0.421875,\n },\n {\n x: 0.109375,\n y: 0.421875,\n },\n {\n x: 0.109375,\n y: 0.421875,\n },\n {\n x: 0.140625,\n y: 0.421875,\n },\n {\n x: 0.140625,\n y: 0.421875,\n },\n {\n x: 0.171875,\n y: 0.421875,\n },\n {\n x: 0.171875,\n y: 0.421875,\n },\n {\n x: 0.203125,\n y: 0.421875,\n },\n {\n x: 0.203125,\n y: 0.421875,\n },\n {\n x: 0.234375,\n y: 0.421875,\n },\n {\n x: 0.234375,\n y: 0.421875,\n },\n {\n x: 0.265625,\n y: 0.421875,\n },\n {\n x: 0.265625,\n y: 0.421875,\n },\n {\n x: 0.296875,\n y: 0.421875,\n },\n {\n x: 0.296875,\n y: 0.421875,\n },\n {\n x: 0.328125,\n y: 0.421875,\n },\n {\n x: 0.328125,\n y: 0.421875,\n },\n {\n x: 0.359375,\n y: 0.421875,\n },\n {\n x: 0.359375,\n y: 0.421875,\n },\n {\n x: 0.390625,\n y: 0.421875,\n },\n {\n x: 0.390625,\n y: 0.421875,\n },\n {\n x: 0.421875,\n y: 0.421875,\n },\n {\n x: 0.421875,\n y: 0.421875,\n },\n {\n x: 0.453125,\n y: 0.421875,\n },\n {\n x: 0.453125,\n y: 0.421875,\n },\n {\n x: 0.484375,\n y: 0.421875,\n },\n {\n x: 0.484375,\n y: 0.421875,\n },\n {\n x: 0.515625,\n y: 0.421875,\n },\n {\n x: 0.515625,\n y: 0.421875,\n },\n {\n x: 0.546875,\n y: 0.421875,\n },\n {\n x: 0.546875,\n y: 0.421875,\n },\n {\n x: 0.578125,\n y: 0.421875,\n },\n {\n x: 0.578125,\n y: 0.421875,\n },\n {\n x: 0.609375,\n y: 0.421875,\n },\n {\n x: 0.609375,\n y: 0.421875,\n },\n {\n x: 0.640625,\n y: 0.421875,\n },\n {\n x: 0.640625,\n y: 0.421875,\n },\n {\n x: 0.671875,\n y: 0.421875,\n },\n {\n x: 0.671875,\n y: 0.421875,\n },\n {\n x: 0.703125,\n y: 0.421875,\n },\n {\n x: 0.703125,\n y: 0.421875,\n },\n {\n x: 0.734375,\n y: 0.421875,\n },\n {\n x: 0.734375,\n y: 0.421875,\n },\n {\n x: 0.765625,\n y: 0.421875,\n },\n {\n x: 0.765625,\n y: 0.421875,\n },\n {\n x: 0.796875,\n y: 0.421875,\n },\n {\n x: 0.796875,\n y: 0.421875,\n },\n {\n x: 0.828125,\n y: 0.421875,\n },\n {\n x: 0.828125,\n y: 0.421875,\n },\n {\n x: 0.859375,\n y: 0.421875,\n },\n {\n x: 0.859375,\n y: 0.421875,\n },\n {\n x: 0.890625,\n y: 0.421875,\n },\n {\n x: 0.890625,\n y: 0.421875,\n },\n {\n x: 0.921875,\n y: 0.421875,\n },\n {\n x: 0.921875,\n y: 0.421875,\n },\n {\n x: 0.953125,\n y: 0.421875,\n },\n {\n x: 0.953125,\n y: 0.421875,\n },\n {\n x: 0.984375,\n y: 0.421875,\n },\n {\n x: 0.984375,\n y: 0.421875,\n },\n {\n x: 0.015625,\n y: 0.453125,\n },\n {\n x: 0.015625,\n y: 0.453125,\n },\n {\n x: 0.046875,\n y: 0.453125,\n },\n {\n x: 0.046875,\n y: 0.453125,\n },\n {\n x: 0.078125,\n y: 0.453125,\n },\n {\n x: 0.078125,\n y: 0.453125,\n },\n {\n x: 0.109375,\n y: 0.453125,\n },\n {\n x: 0.109375,\n y: 0.453125,\n },\n {\n x: 0.140625,\n y: 0.453125,\n },\n {\n x: 0.140625,\n y: 0.453125,\n },\n {\n x: 0.171875,\n y: 0.453125,\n },\n {\n x: 0.171875,\n y: 0.453125,\n },\n {\n x: 0.203125,\n y: 0.453125,\n },\n {\n x: 0.203125,\n y: 0.453125,\n },\n {\n x: 0.234375,\n y: 0.453125,\n },\n {\n x: 0.234375,\n y: 0.453125,\n },\n {\n x: 0.265625,\n y: 0.453125,\n },\n {\n x: 0.265625,\n y: 0.453125,\n },\n {\n x: 0.296875,\n y: 0.453125,\n },\n {\n x: 0.296875,\n y: 0.453125,\n },\n {\n x: 0.328125,\n y: 0.453125,\n },\n {\n x: 0.328125,\n y: 0.453125,\n },\n {\n x: 0.359375,\n y: 0.453125,\n },\n {\n x: 0.359375,\n y: 0.453125,\n },\n {\n x: 0.390625,\n y: 0.453125,\n },\n {\n x: 0.390625,\n y: 0.453125,\n },\n {\n x: 0.421875,\n y: 0.453125,\n },\n {\n x: 0.421875,\n y: 0.453125,\n },\n {\n x: 0.453125,\n y: 0.453125,\n },\n {\n x: 0.453125,\n y: 0.453125,\n },\n {\n x: 0.484375,\n y: 0.453125,\n },\n {\n x: 0.484375,\n y: 0.453125,\n },\n {\n x: 0.515625,\n y: 0.453125,\n },\n {\n x: 0.515625,\n y: 0.453125,\n },\n {\n x: 0.546875,\n y: 0.453125,\n },\n {\n x: 0.546875,\n y: 0.453125,\n },\n {\n x: 0.578125,\n y: 0.453125,\n },\n {\n x: 0.578125,\n y: 0.453125,\n },\n {\n x: 0.609375,\n y: 0.453125,\n },\n {\n x: 0.609375,\n y: 0.453125,\n },\n {\n x: 0.640625,\n y: 0.453125,\n },\n {\n x: 0.640625,\n y: 0.453125,\n },\n {\n x: 0.671875,\n y: 0.453125,\n },\n {\n x: 0.671875,\n y: 0.453125,\n },\n {\n x: 0.703125,\n y: 0.453125,\n },\n {\n x: 0.703125,\n y: 0.453125,\n },\n {\n x: 0.734375,\n y: 0.453125,\n },\n {\n x: 0.734375,\n y: 0.453125,\n },\n {\n x: 0.765625,\n y: 0.453125,\n },\n {\n x: 0.765625,\n y: 0.453125,\n },\n {\n x: 0.796875,\n y: 0.453125,\n },\n {\n x: 0.796875,\n y: 0.453125,\n },\n {\n x: 0.828125,\n y: 0.453125,\n },\n {\n x: 0.828125,\n y: 0.453125,\n },\n {\n x: 0.859375,\n y: 0.453125,\n },\n {\n x: 0.859375,\n y: 0.453125,\n },\n {\n x: 0.890625,\n y: 0.453125,\n },\n {\n x: 0.890625,\n y: 0.453125,\n },\n {\n x: 0.921875,\n y: 0.453125,\n },\n {\n x: 0.921875,\n y: 0.453125,\n },\n {\n x: 0.953125,\n y: 0.453125,\n },\n {\n x: 0.953125,\n y: 0.453125,\n },\n {\n x: 0.984375,\n y: 0.453125,\n },\n {\n x: 0.984375,\n y: 0.453125,\n },\n {\n x: 0.015625,\n y: 0.484375,\n },\n {\n x: 0.015625,\n y: 0.484375,\n },\n {\n x: 0.046875,\n y: 0.484375,\n },\n {\n x: 0.046875,\n y: 0.484375,\n },\n {\n x: 0.078125,\n y: 0.484375,\n },\n {\n x: 0.078125,\n y: 0.484375,\n },\n {\n x: 0.109375,\n y: 0.484375,\n },\n {\n x: 0.109375,\n y: 0.484375,\n },\n {\n x: 0.140625,\n y: 0.484375,\n },\n {\n x: 0.140625,\n y: 0.484375,\n },\n {\n x: 0.171875,\n y: 0.484375,\n },\n {\n x: 0.171875,\n y: 0.484375,\n },\n {\n x: 0.203125,\n y: 0.484375,\n },\n {\n x: 0.203125,\n y: 0.484375,\n },\n {\n x: 0.234375,\n y: 0.484375,\n },\n {\n x: 0.234375,\n y: 0.484375,\n },\n {\n x: 0.265625,\n y: 0.484375,\n },\n {\n x: 0.265625,\n y: 0.484375,\n },\n {\n x: 0.296875,\n y: 0.484375,\n },\n {\n x: 0.296875,\n y: 0.484375,\n },\n {\n x: 0.328125,\n y: 0.484375,\n },\n {\n x: 0.328125,\n y: 0.484375,\n },\n {\n x: 0.359375,\n y: 0.484375,\n },\n {\n x: 0.359375,\n y: 0.484375,\n },\n {\n x: 0.390625,\n y: 0.484375,\n },\n {\n x: 0.390625,\n y: 0.484375,\n },\n {\n x: 0.421875,\n y: 0.484375,\n },\n {\n x: 0.421875,\n y: 0.484375,\n },\n {\n x: 0.453125,\n y: 0.484375,\n },\n {\n x: 0.453125,\n y: 0.484375,\n },\n {\n x: 0.484375,\n y: 0.484375,\n },\n {\n x: 0.484375,\n y: 0.484375,\n },\n {\n x: 0.515625,\n y: 0.484375,\n },\n {\n x: 0.515625,\n y: 0.484375,\n },\n {\n x: 0.546875,\n y: 0.484375,\n },\n {\n x: 0.546875,\n y: 0.484375,\n },\n {\n x: 0.578125,\n y: 0.484375,\n },\n {\n x: 0.578125,\n y: 0.484375,\n },\n {\n x: 0.609375,\n y: 0.484375,\n },\n {\n x: 0.609375,\n y: 0.484375,\n },\n {\n x: 0.640625,\n y: 0.484375,\n },\n {\n x: 0.640625,\n y: 0.484375,\n },\n {\n x: 0.671875,\n y: 0.484375,\n },\n {\n x: 0.671875,\n y: 0.484375,\n },\n {\n x: 0.703125,\n y: 0.484375,\n },\n {\n x: 0.703125,\n y: 0.484375,\n },\n {\n x: 0.734375,\n y: 0.484375,\n },\n {\n x: 0.734375,\n y: 0.484375,\n },\n {\n x: 0.765625,\n y: 0.484375,\n },\n {\n x: 0.765625,\n y: 0.484375,\n },\n {\n x: 0.796875,\n y: 0.484375,\n },\n {\n x: 0.796875,\n y: 0.484375,\n },\n {\n x: 0.828125,\n y: 0.484375,\n },\n {\n x: 0.828125,\n y: 0.484375,\n },\n {\n x: 0.859375,\n y: 0.484375,\n },\n {\n x: 0.859375,\n y: 0.484375,\n },\n {\n x: 0.890625,\n y: 0.484375,\n },\n {\n x: 0.890625,\n y: 0.484375,\n },\n {\n x: 0.921875,\n y: 0.484375,\n },\n {\n x: 0.921875,\n y: 0.484375,\n },\n {\n x: 0.953125,\n y: 0.484375,\n },\n {\n x: 0.953125,\n y: 0.484375,\n },\n {\n x: 0.984375,\n y: 0.484375,\n },\n {\n x: 0.984375,\n y: 0.484375,\n },\n {\n x: 0.015625,\n y: 0.515625,\n },\n {\n x: 0.015625,\n y: 0.515625,\n },\n {\n x: 0.046875,\n y: 0.515625,\n },\n {\n x: 0.046875,\n y: 0.515625,\n },\n {\n x: 0.078125,\n y: 0.515625,\n },\n {\n x: 0.078125,\n y: 0.515625,\n },\n {\n x: 0.109375,\n y: 0.515625,\n },\n {\n x: 0.109375,\n y: 0.515625,\n },\n {\n x: 0.140625,\n y: 0.515625,\n },\n {\n x: 0.140625,\n y: 0.515625,\n },\n {\n x: 0.171875,\n y: 0.515625,\n },\n {\n x: 0.171875,\n y: 0.515625,\n },\n {\n x: 0.203125,\n y: 0.515625,\n },\n {\n x: 0.203125,\n y: 0.515625,\n },\n {\n x: 0.234375,\n y: 0.515625,\n },\n {\n x: 0.234375,\n y: 0.515625,\n },\n {\n x: 0.265625,\n y: 0.515625,\n },\n {\n x: 0.265625,\n y: 0.515625,\n },\n {\n x: 0.296875,\n y: 0.515625,\n },\n {\n x: 0.296875,\n y: 0.515625,\n },\n {\n x: 0.328125,\n y: 0.515625,\n },\n {\n x: 0.328125,\n y: 0.515625,\n },\n {\n x: 0.359375,\n y: 0.515625,\n },\n {\n x: 0.359375,\n y: 0.515625,\n },\n {\n x: 0.390625,\n y: 0.515625,\n },\n {\n x: 0.390625,\n y: 0.515625,\n },\n {\n x: 0.421875,\n y: 0.515625,\n },\n {\n x: 0.421875,\n y: 0.515625,\n },\n {\n x: 0.453125,\n y: 0.515625,\n },\n {\n x: 0.453125,\n y: 0.515625,\n },\n {\n x: 0.484375,\n y: 0.515625,\n },\n {\n x: 0.484375,\n y: 0.515625,\n },\n {\n x: 0.515625,\n y: 0.515625,\n },\n {\n x: 0.515625,\n y: 0.515625,\n },\n {\n x: 0.546875,\n y: 0.515625,\n },\n {\n x: 0.546875,\n y: 0.515625,\n },\n {\n x: 0.578125,\n y: 0.515625,\n },\n {\n x: 0.578125,\n y: 0.515625,\n },\n {\n x: 0.609375,\n y: 0.515625,\n },\n {\n x: 0.609375,\n y: 0.515625,\n },\n {\n x: 0.640625,\n y: 0.515625,\n },\n {\n x: 0.640625,\n y: 0.515625,\n },\n {\n x: 0.671875,\n y: 0.515625,\n },\n {\n x: 0.671875,\n y: 0.515625,\n },\n {\n x: 0.703125,\n y: 0.515625,\n },\n {\n x: 0.703125,\n y: 0.515625,\n },\n {\n x: 0.734375,\n y: 0.515625,\n },\n {\n x: 0.734375,\n y: 0.515625,\n },\n {\n x: 0.765625,\n y: 0.515625,\n },\n {\n x: 0.765625,\n y: 0.515625,\n },\n {\n x: 0.796875,\n y: 0.515625,\n },\n {\n x: 0.796875,\n y: 0.515625,\n },\n {\n x: 0.828125,\n y: 0.515625,\n },\n {\n x: 0.828125,\n y: 0.515625,\n },\n {\n x: 0.859375,\n y: 0.515625,\n },\n {\n x: 0.859375,\n y: 0.515625,\n },\n {\n x: 0.890625,\n y: 0.515625,\n },\n {\n x: 0.890625,\n y: 0.515625,\n },\n {\n x: 0.921875,\n y: 0.515625,\n },\n {\n x: 0.921875,\n y: 0.515625,\n },\n {\n x: 0.953125,\n y: 0.515625,\n },\n {\n x: 0.953125,\n y: 0.515625,\n },\n {\n x: 0.984375,\n y: 0.515625,\n },\n {\n x: 0.984375,\n y: 0.515625,\n },\n {\n x: 0.015625,\n y: 0.546875,\n },\n {\n x: 0.015625,\n y: 0.546875,\n },\n {\n x: 0.046875,\n y: 0.546875,\n },\n {\n x: 0.046875,\n y: 0.546875,\n },\n {\n x: 0.078125,\n y: 0.546875,\n },\n {\n x: 0.078125,\n y: 0.546875,\n },\n {\n x: 0.109375,\n y: 0.546875,\n },\n {\n x: 0.109375,\n y: 0.546875,\n },\n {\n x: 0.140625,\n y: 0.546875,\n },\n {\n x: 0.140625,\n y: 0.546875,\n },\n {\n x: 0.171875,\n y: 0.546875,\n },\n {\n x: 0.171875,\n y: 0.546875,\n },\n {\n x: 0.203125,\n y: 0.546875,\n },\n {\n x: 0.203125,\n y: 0.546875,\n },\n {\n x: 0.234375,\n y: 0.546875,\n },\n {\n x: 0.234375,\n y: 0.546875,\n },\n {\n x: 0.265625,\n y: 0.546875,\n },\n {\n x: 0.265625,\n y: 0.546875,\n },\n {\n x: 0.296875,\n y: 0.546875,\n },\n {\n x: 0.296875,\n y: 0.546875,\n },\n {\n x: 0.328125,\n y: 0.546875,\n },\n {\n x: 0.328125,\n y: 0.546875,\n },\n {\n x: 0.359375,\n y: 0.546875,\n },\n {\n x: 0.359375,\n y: 0.546875,\n },\n {\n x: 0.390625,\n y: 0.546875,\n },\n {\n x: 0.390625,\n y: 0.546875,\n },\n {\n x: 0.421875,\n y: 0.546875,\n },\n {\n x: 0.421875,\n y: 0.546875,\n },\n {\n x: 0.453125,\n y: 0.546875,\n },\n {\n x: 0.453125,\n y: 0.546875,\n },\n {\n x: 0.484375,\n y: 0.546875,\n },\n {\n x: 0.484375,\n y: 0.546875,\n },\n {\n x: 0.515625,\n y: 0.546875,\n },\n {\n x: 0.515625,\n y: 0.546875,\n },\n {\n x: 0.546875,\n y: 0.546875,\n },\n {\n x: 0.546875,\n y: 0.546875,\n },\n {\n x: 0.578125,\n y: 0.546875,\n },\n {\n x: 0.578125,\n y: 0.546875,\n },\n {\n x: 0.609375,\n y: 0.546875,\n },\n {\n x: 0.609375,\n y: 0.546875,\n },\n {\n x: 0.640625,\n y: 0.546875,\n },\n {\n x: 0.640625,\n y: 0.546875,\n },\n {\n x: 0.671875,\n y: 0.546875,\n },\n {\n x: 0.671875,\n y: 0.546875,\n },\n {\n x: 0.703125,\n y: 0.546875,\n },\n {\n x: 0.703125,\n y: 0.546875,\n },\n {\n x: 0.734375,\n y: 0.546875,\n },\n {\n x: 0.734375,\n y: 0.546875,\n },\n {\n x: 0.765625,\n y: 0.546875,\n },\n {\n x: 0.765625,\n y: 0.546875,\n },\n {\n x: 0.796875,\n y: 0.546875,\n },\n {\n x: 0.796875,\n y: 0.546875,\n },\n {\n x: 0.828125,\n y: 0.546875,\n },\n {\n x: 0.828125,\n y: 0.546875,\n },\n {\n x: 0.859375,\n y: 0.546875,\n },\n {\n x: 0.859375,\n y: 0.546875,\n },\n {\n x: 0.890625,\n y: 0.546875,\n },\n {\n x: 0.890625,\n y: 0.546875,\n },\n {\n x: 0.921875,\n y: 0.546875,\n },\n {\n x: 0.921875,\n y: 0.546875,\n },\n {\n x: 0.953125,\n y: 0.546875,\n },\n {\n x: 0.953125,\n y: 0.546875,\n },\n {\n x: 0.984375,\n y: 0.546875,\n },\n {\n x: 0.984375,\n y: 0.546875,\n },\n {\n x: 0.015625,\n y: 0.578125,\n },\n {\n x: 0.015625,\n y: 0.578125,\n },\n {\n x: 0.046875,\n y: 0.578125,\n },\n {\n x: 0.046875,\n y: 0.578125,\n },\n {\n x: 0.078125,\n y: 0.578125,\n },\n {\n x: 0.078125,\n y: 0.578125,\n },\n {\n x: 0.109375,\n y: 0.578125,\n },\n {\n x: 0.109375,\n y: 0.578125,\n },\n {\n x: 0.140625,\n y: 0.578125,\n },\n {\n x: 0.140625,\n y: 0.578125,\n },\n {\n x: 0.171875,\n y: 0.578125,\n },\n {\n x: 0.171875,\n y: 0.578125,\n },\n {\n x: 0.203125,\n y: 0.578125,\n },\n {\n x: 0.203125,\n y: 0.578125,\n },\n {\n x: 0.234375,\n y: 0.578125,\n },\n {\n x: 0.234375,\n y: 0.578125,\n },\n {\n x: 0.265625,\n y: 0.578125,\n },\n {\n x: 0.265625,\n y: 0.578125,\n },\n {\n x: 0.296875,\n y: 0.578125,\n },\n {\n x: 0.296875,\n y: 0.578125,\n },\n {\n x: 0.328125,\n y: 0.578125,\n },\n {\n x: 0.328125,\n y: 0.578125,\n },\n {\n x: 0.359375,\n y: 0.578125,\n },\n {\n x: 0.359375,\n y: 0.578125,\n },\n {\n x: 0.390625,\n y: 0.578125,\n },\n {\n x: 0.390625,\n y: 0.578125,\n },\n {\n x: 0.421875,\n y: 0.578125,\n },\n {\n x: 0.421875,\n y: 0.578125,\n },\n {\n x: 0.453125,\n y: 0.578125,\n },\n {\n x: 0.453125,\n y: 0.578125,\n },\n {\n x: 0.484375,\n y: 0.578125,\n },\n {\n x: 0.484375,\n y: 0.578125,\n },\n {\n x: 0.515625,\n y: 0.578125,\n },\n {\n x: 0.515625,\n y: 0.578125,\n },\n {\n x: 0.546875,\n y: 0.578125,\n },\n {\n x: 0.546875,\n y: 0.578125,\n },\n {\n x: 0.578125,\n y: 0.578125,\n },\n {\n x: 0.578125,\n y: 0.578125,\n },\n {\n x: 0.609375,\n y: 0.578125,\n },\n {\n x: 0.609375,\n y: 0.578125,\n },\n {\n x: 0.640625,\n y: 0.578125,\n },\n {\n x: 0.640625,\n y: 0.578125,\n },\n {\n x: 0.671875,\n y: 0.578125,\n },\n {\n x: 0.671875,\n y: 0.578125,\n },\n {\n x: 0.703125,\n y: 0.578125,\n },\n {\n x: 0.703125,\n y: 0.578125,\n },\n {\n x: 0.734375,\n y: 0.578125,\n },\n {\n x: 0.734375,\n y: 0.578125,\n },\n {\n x: 0.765625,\n y: 0.578125,\n },\n {\n x: 0.765625,\n y: 0.578125,\n },\n {\n x: 0.796875,\n y: 0.578125,\n },\n {\n x: 0.796875,\n y: 0.578125,\n },\n {\n x: 0.828125,\n y: 0.578125,\n },\n {\n x: 0.828125,\n y: 0.578125,\n },\n {\n x: 0.859375,\n y: 0.578125,\n },\n {\n x: 0.859375,\n y: 0.578125,\n },\n {\n x: 0.890625,\n y: 0.578125,\n },\n {\n x: 0.890625,\n y: 0.578125,\n },\n {\n x: 0.921875,\n y: 0.578125,\n },\n {\n x: 0.921875,\n y: 0.578125,\n },\n {\n x: 0.953125,\n y: 0.578125,\n },\n {\n x: 0.953125,\n y: 0.578125,\n },\n {\n x: 0.984375,\n y: 0.578125,\n },\n {\n x: 0.984375,\n y: 0.578125,\n },\n {\n x: 0.015625,\n y: 0.609375,\n },\n {\n x: 0.015625,\n y: 0.609375,\n },\n {\n x: 0.046875,\n y: 0.609375,\n },\n {\n x: 0.046875,\n y: 0.609375,\n },\n {\n x: 0.078125,\n y: 0.609375,\n },\n {\n x: 0.078125,\n y: 0.609375,\n },\n {\n x: 0.109375,\n y: 0.609375,\n },\n {\n x: 0.109375,\n y: 0.609375,\n },\n {\n x: 0.140625,\n y: 0.609375,\n },\n {\n x: 0.140625,\n y: 0.609375,\n },\n {\n x: 0.171875,\n y: 0.609375,\n },\n {\n x: 0.171875,\n y: 0.609375,\n },\n {\n x: 0.203125,\n y: 0.609375,\n },\n {\n x: 0.203125,\n y: 0.609375,\n },\n {\n x: 0.234375,\n y: 0.609375,\n },\n {\n x: 0.234375,\n y: 0.609375,\n },\n {\n x: 0.265625,\n y: 0.609375,\n },\n {\n x: 0.265625,\n y: 0.609375,\n },\n {\n x: 0.296875,\n y: 0.609375,\n },\n {\n x: 0.296875,\n y: 0.609375,\n },\n {\n x: 0.328125,\n y: 0.609375,\n },\n {\n x: 0.328125,\n y: 0.609375,\n },\n {\n x: 0.359375,\n y: 0.609375,\n },\n {\n x: 0.359375,\n y: 0.609375,\n },\n {\n x: 0.390625,\n y: 0.609375,\n },\n {\n x: 0.390625,\n y: 0.609375,\n },\n {\n x: 0.421875,\n y: 0.609375,\n },\n {\n x: 0.421875,\n y: 0.609375,\n },\n {\n x: 0.453125,\n y: 0.609375,\n },\n {\n x: 0.453125,\n y: 0.609375,\n },\n {\n x: 0.484375,\n y: 0.609375,\n },\n {\n x: 0.484375,\n y: 0.609375,\n },\n {\n x: 0.515625,\n y: 0.609375,\n },\n {\n x: 0.515625,\n y: 0.609375,\n },\n {\n x: 0.546875,\n y: 0.609375,\n },\n {\n x: 0.546875,\n y: 0.609375,\n },\n {\n x: 0.578125,\n y: 0.609375,\n },\n {\n x: 0.578125,\n y: 0.609375,\n },\n {\n x: 0.609375,\n y: 0.609375,\n },\n {\n x: 0.609375,\n y: 0.609375,\n },\n {\n x: 0.640625,\n y: 0.609375,\n },\n {\n x: 0.640625,\n y: 0.609375,\n },\n {\n x: 0.671875,\n y: 0.609375,\n },\n {\n x: 0.671875,\n y: 0.609375,\n },\n {\n x: 0.703125,\n y: 0.609375,\n },\n {\n x: 0.703125,\n y: 0.609375,\n },\n {\n x: 0.734375,\n y: 0.609375,\n },\n {\n x: 0.734375,\n y: 0.609375,\n },\n {\n x: 0.765625,\n y: 0.609375,\n },\n {\n x: 0.765625,\n y: 0.609375,\n },\n {\n x: 0.796875,\n y: 0.609375,\n },\n {\n x: 0.796875,\n y: 0.609375,\n },\n {\n x: 0.828125,\n y: 0.609375,\n },\n {\n x: 0.828125,\n y: 0.609375,\n },\n {\n x: 0.859375,\n y: 0.609375,\n },\n {\n x: 0.859375,\n y: 0.609375,\n },\n {\n x: 0.890625,\n y: 0.609375,\n },\n {\n x: 0.890625,\n y: 0.609375,\n },\n {\n x: 0.921875,\n y: 0.609375,\n },\n {\n x: 0.921875,\n y: 0.609375,\n },\n {\n x: 0.953125,\n y: 0.609375,\n },\n {\n x: 0.953125,\n y: 0.609375,\n },\n {\n x: 0.984375,\n y: 0.609375,\n },\n {\n x: 0.984375,\n y: 0.609375,\n },\n {\n x: 0.015625,\n y: 0.640625,\n },\n {\n x: 0.015625,\n y: 0.640625,\n },\n {\n x: 0.046875,\n y: 0.640625,\n },\n {\n x: 0.046875,\n y: 0.640625,\n },\n {\n x: 0.078125,\n y: 0.640625,\n },\n {\n x: 0.078125,\n y: 0.640625,\n },\n {\n x: 0.109375,\n y: 0.640625,\n },\n {\n x: 0.109375,\n y: 0.640625,\n },\n {\n x: 0.140625,\n y: 0.640625,\n },\n {\n x: 0.140625,\n y: 0.640625,\n },\n {\n x: 0.171875,\n y: 0.640625,\n },\n {\n x: 0.171875,\n y: 0.640625,\n },\n {\n x: 0.203125,\n y: 0.640625,\n },\n {\n x: 0.203125,\n y: 0.640625,\n },\n {\n x: 0.234375,\n y: 0.640625,\n },\n {\n x: 0.234375,\n y: 0.640625,\n },\n {\n x: 0.265625,\n y: 0.640625,\n },\n {\n x: 0.265625,\n y: 0.640625,\n },\n {\n x: 0.296875,\n y: 0.640625,\n },\n {\n x: 0.296875,\n y: 0.640625,\n },\n {\n x: 0.328125,\n y: 0.640625,\n },\n {\n x: 0.328125,\n y: 0.640625,\n },\n {\n x: 0.359375,\n y: 0.640625,\n },\n {\n x: 0.359375,\n y: 0.640625,\n },\n {\n x: 0.390625,\n y: 0.640625,\n },\n {\n x: 0.390625,\n y: 0.640625,\n },\n {\n x: 0.421875,\n y: 0.640625,\n },\n {\n x: 0.421875,\n y: 0.640625,\n },\n {\n x: 0.453125,\n y: 0.640625,\n },\n {\n x: 0.453125,\n y: 0.640625,\n },\n {\n x: 0.484375,\n y: 0.640625,\n },\n {\n x: 0.484375,\n y: 0.640625,\n },\n {\n x: 0.515625,\n y: 0.640625,\n },\n {\n x: 0.515625,\n y: 0.640625,\n },\n {\n x: 0.546875,\n y: 0.640625,\n },\n {\n x: 0.546875,\n y: 0.640625,\n },\n {\n x: 0.578125,\n y: 0.640625,\n },\n {\n x: 0.578125,\n y: 0.640625,\n },\n {\n x: 0.609375,\n y: 0.640625,\n },\n {\n x: 0.609375,\n y: 0.640625,\n },\n {\n x: 0.640625,\n y: 0.640625,\n },\n {\n x: 0.640625,\n y: 0.640625,\n },\n {\n x: 0.671875,\n y: 0.640625,\n },\n {\n x: 0.671875,\n y: 0.640625,\n },\n {\n x: 0.703125,\n y: 0.640625,\n },\n {\n x: 0.703125,\n y: 0.640625,\n },\n {\n x: 0.734375,\n y: 0.640625,\n },\n {\n x: 0.734375,\n y: 0.640625,\n },\n {\n x: 0.765625,\n y: 0.640625,\n },\n {\n x: 0.765625,\n y: 0.640625,\n },\n {\n x: 0.796875,\n y: 0.640625,\n },\n {\n x: 0.796875,\n y: 0.640625,\n },\n {\n x: 0.828125,\n y: 0.640625,\n },\n {\n x: 0.828125,\n y: 0.640625,\n },\n {\n x: 0.859375,\n y: 0.640625,\n },\n {\n x: 0.859375,\n y: 0.640625,\n },\n {\n x: 0.890625,\n y: 0.640625,\n },\n {\n x: 0.890625,\n y: 0.640625,\n },\n {\n x: 0.921875,\n y: 0.640625,\n },\n {\n x: 0.921875,\n y: 0.640625,\n },\n {\n x: 0.953125,\n y: 0.640625,\n },\n {\n x: 0.953125,\n y: 0.640625,\n },\n {\n x: 0.984375,\n y: 0.640625,\n },\n {\n x: 0.984375,\n y: 0.640625,\n },\n {\n x: 0.015625,\n y: 0.671875,\n },\n {\n x: 0.015625,\n y: 0.671875,\n },\n {\n x: 0.046875,\n y: 0.671875,\n },\n {\n x: 0.046875,\n y: 0.671875,\n },\n {\n x: 0.078125,\n y: 0.671875,\n },\n {\n x: 0.078125,\n y: 0.671875,\n },\n {\n x: 0.109375,\n y: 0.671875,\n },\n {\n x: 0.109375,\n y: 0.671875,\n },\n {\n x: 0.140625,\n y: 0.671875,\n },\n {\n x: 0.140625,\n y: 0.671875,\n },\n {\n x: 0.171875,\n y: 0.671875,\n },\n {\n x: 0.171875,\n y: 0.671875,\n },\n {\n x: 0.203125,\n y: 0.671875,\n },\n {\n x: 0.203125,\n y: 0.671875,\n },\n {\n x: 0.234375,\n y: 0.671875,\n },\n {\n x: 0.234375,\n y: 0.671875,\n },\n {\n x: 0.265625,\n y: 0.671875,\n },\n {\n x: 0.265625,\n y: 0.671875,\n },\n {\n x: 0.296875,\n y: 0.671875,\n },\n {\n x: 0.296875,\n y: 0.671875,\n },\n {\n x: 0.328125,\n y: 0.671875,\n },\n {\n x: 0.328125,\n y: 0.671875,\n },\n {\n x: 0.359375,\n y: 0.671875,\n },\n {\n x: 0.359375,\n y: 0.671875,\n },\n {\n x: 0.390625,\n y: 0.671875,\n },\n {\n x: 0.390625,\n y: 0.671875,\n },\n {\n x: 0.421875,\n y: 0.671875,\n },\n {\n x: 0.421875,\n y: 0.671875,\n },\n {\n x: 0.453125,\n y: 0.671875,\n },\n {\n x: 0.453125,\n y: 0.671875,\n },\n {\n x: 0.484375,\n y: 0.671875,\n },\n {\n x: 0.484375,\n y: 0.671875,\n },\n {\n x: 0.515625,\n y: 0.671875,\n },\n {\n x: 0.515625,\n y: 0.671875,\n },\n {\n x: 0.546875,\n y: 0.671875,\n },\n {\n x: 0.546875,\n y: 0.671875,\n },\n {\n x: 0.578125,\n y: 0.671875,\n },\n {\n x: 0.578125,\n y: 0.671875,\n },\n {\n x: 0.609375,\n y: 0.671875,\n },\n {\n x: 0.609375,\n y: 0.671875,\n },\n {\n x: 0.640625,\n y: 0.671875,\n },\n {\n x: 0.640625,\n y: 0.671875,\n },\n {\n x: 0.671875,\n y: 0.671875,\n },\n {\n x: 0.671875,\n y: 0.671875,\n },\n {\n x: 0.703125,\n y: 0.671875,\n },\n {\n x: 0.703125,\n y: 0.671875,\n },\n {\n x: 0.734375,\n y: 0.671875,\n },\n {\n x: 0.734375,\n y: 0.671875,\n },\n {\n x: 0.765625,\n y: 0.671875,\n },\n {\n x: 0.765625,\n y: 0.671875,\n },\n {\n x: 0.796875,\n y: 0.671875,\n },\n {\n x: 0.796875,\n y: 0.671875,\n },\n {\n x: 0.828125,\n y: 0.671875,\n },\n {\n x: 0.828125,\n y: 0.671875,\n },\n {\n x: 0.859375,\n y: 0.671875,\n },\n {\n x: 0.859375,\n y: 0.671875,\n },\n {\n x: 0.890625,\n y: 0.671875,\n },\n {\n x: 0.890625,\n y: 0.671875,\n },\n {\n x: 0.921875,\n y: 0.671875,\n },\n {\n x: 0.921875,\n y: 0.671875,\n },\n {\n x: 0.953125,\n y: 0.671875,\n },\n {\n x: 0.953125,\n y: 0.671875,\n },\n {\n x: 0.984375,\n y: 0.671875,\n },\n {\n x: 0.984375,\n y: 0.671875,\n },\n {\n x: 0.015625,\n y: 0.703125,\n },\n {\n x: 0.015625,\n y: 0.703125,\n },\n {\n x: 0.046875,\n y: 0.703125,\n },\n {\n x: 0.046875,\n y: 0.703125,\n },\n {\n x: 0.078125,\n y: 0.703125,\n },\n {\n x: 0.078125,\n y: 0.703125,\n },\n {\n x: 0.109375,\n y: 0.703125,\n },\n {\n x: 0.109375,\n y: 0.703125,\n },\n {\n x: 0.140625,\n y: 0.703125,\n },\n {\n x: 0.140625,\n y: 0.703125,\n },\n {\n x: 0.171875,\n y: 0.703125,\n },\n {\n x: 0.171875,\n y: 0.703125,\n },\n {\n x: 0.203125,\n y: 0.703125,\n },\n {\n x: 0.203125,\n y: 0.703125,\n },\n {\n x: 0.234375,\n y: 0.703125,\n },\n {\n x: 0.234375,\n y: 0.703125,\n },\n {\n x: 0.265625,\n y: 0.703125,\n },\n {\n x: 0.265625,\n y: 0.703125,\n },\n {\n x: 0.296875,\n y: 0.703125,\n },\n {\n x: 0.296875,\n y: 0.703125,\n },\n {\n x: 0.328125,\n y: 0.703125,\n },\n {\n x: 0.328125,\n y: 0.703125,\n },\n {\n x: 0.359375,\n y: 0.703125,\n },\n {\n x: 0.359375,\n y: 0.703125,\n },\n {\n x: 0.390625,\n y: 0.703125,\n },\n {\n x: 0.390625,\n y: 0.703125,\n },\n {\n x: 0.421875,\n y: 0.703125,\n },\n {\n x: 0.421875,\n y: 0.703125,\n },\n {\n x: 0.453125,\n y: 0.703125,\n },\n {\n x: 0.453125,\n y: 0.703125,\n },\n {\n x: 0.484375,\n y: 0.703125,\n },\n {\n x: 0.484375,\n y: 0.703125,\n },\n {\n x: 0.515625,\n y: 0.703125,\n },\n {\n x: 0.515625,\n y: 0.703125,\n },\n {\n x: 0.546875,\n y: 0.703125,\n },\n {\n x: 0.546875,\n y: 0.703125,\n },\n {\n x: 0.578125,\n y: 0.703125,\n },\n {\n x: 0.578125,\n y: 0.703125,\n },\n {\n x: 0.609375,\n y: 0.703125,\n },\n {\n x: 0.609375,\n y: 0.703125,\n },\n {\n x: 0.640625,\n y: 0.703125,\n },\n {\n x: 0.640625,\n y: 0.703125,\n },\n {\n x: 0.671875,\n y: 0.703125,\n },\n {\n x: 0.671875,\n y: 0.703125,\n },\n {\n x: 0.703125,\n y: 0.703125,\n },\n {\n x: 0.703125,\n y: 0.703125,\n },\n {\n x: 0.734375,\n y: 0.703125,\n },\n {\n x: 0.734375,\n y: 0.703125,\n },\n {\n x: 0.765625,\n y: 0.703125,\n },\n {\n x: 0.765625,\n y: 0.703125,\n },\n {\n x: 0.796875,\n y: 0.703125,\n },\n {\n x: 0.796875,\n y: 0.703125,\n },\n {\n x: 0.828125,\n y: 0.703125,\n },\n {\n x: 0.828125,\n y: 0.703125,\n },\n {\n x: 0.859375,\n y: 0.703125,\n },\n {\n x: 0.859375,\n y: 0.703125,\n },\n {\n x: 0.890625,\n y: 0.703125,\n },\n {\n x: 0.890625,\n y: 0.703125,\n },\n {\n x: 0.921875,\n y: 0.703125,\n },\n {\n x: 0.921875,\n y: 0.703125,\n },\n {\n x: 0.953125,\n y: 0.703125,\n },\n {\n x: 0.953125,\n y: 0.703125,\n },\n {\n x: 0.984375,\n y: 0.703125,\n },\n {\n x: 0.984375,\n y: 0.703125,\n },\n {\n x: 0.015625,\n y: 0.734375,\n },\n {\n x: 0.015625,\n y: 0.734375,\n },\n {\n x: 0.046875,\n y: 0.734375,\n },\n {\n x: 0.046875,\n y: 0.734375,\n },\n {\n x: 0.078125,\n y: 0.734375,\n },\n {\n x: 0.078125,\n y: 0.734375,\n },\n {\n x: 0.109375,\n y: 0.734375,\n },\n {\n x: 0.109375,\n y: 0.734375,\n },\n {\n x: 0.140625,\n y: 0.734375,\n },\n {\n x: 0.140625,\n y: 0.734375,\n },\n {\n x: 0.171875,\n y: 0.734375,\n },\n {\n x: 0.171875,\n y: 0.734375,\n },\n {\n x: 0.203125,\n y: 0.734375,\n },\n {\n x: 0.203125,\n y: 0.734375,\n },\n {\n x: 0.234375,\n y: 0.734375,\n },\n {\n x: 0.234375,\n y: 0.734375,\n },\n {\n x: 0.265625,\n y: 0.734375,\n },\n {\n x: 0.265625,\n y: 0.734375,\n },\n {\n x: 0.296875,\n y: 0.734375,\n },\n {\n x: 0.296875,\n y: 0.734375,\n },\n {\n x: 0.328125,\n y: 0.734375,\n },\n {\n x: 0.328125,\n y: 0.734375,\n },\n {\n x: 0.359375,\n y: 0.734375,\n },\n {\n x: 0.359375,\n y: 0.734375,\n },\n {\n x: 0.390625,\n y: 0.734375,\n },\n {\n x: 0.390625,\n y: 0.734375,\n },\n {\n x: 0.421875,\n y: 0.734375,\n },\n {\n x: 0.421875,\n y: 0.734375,\n },\n {\n x: 0.453125,\n y: 0.734375,\n },\n {\n x: 0.453125,\n y: 0.734375,\n },\n {\n x: 0.484375,\n y: 0.734375,\n },\n {\n x: 0.484375,\n y: 0.734375,\n },\n {\n x: 0.515625,\n y: 0.734375,\n },\n {\n x: 0.515625,\n y: 0.734375,\n },\n {\n x: 0.546875,\n y: 0.734375,\n },\n {\n x: 0.546875,\n y: 0.734375,\n },\n {\n x: 0.578125,\n y: 0.734375,\n },\n {\n x: 0.578125,\n y: 0.734375,\n },\n {\n x: 0.609375,\n y: 0.734375,\n },\n {\n x: 0.609375,\n y: 0.734375,\n },\n {\n x: 0.640625,\n y: 0.734375,\n },\n {\n x: 0.640625,\n y: 0.734375,\n },\n {\n x: 0.671875,\n y: 0.734375,\n },\n {\n x: 0.671875,\n y: 0.734375,\n },\n {\n x: 0.703125,\n y: 0.734375,\n },\n {\n x: 0.703125,\n y: 0.734375,\n },\n {\n x: 0.734375,\n y: 0.734375,\n },\n {\n x: 0.734375,\n y: 0.734375,\n },\n {\n x: 0.765625,\n y: 0.734375,\n },\n {\n x: 0.765625,\n y: 0.734375,\n },\n {\n x: 0.796875,\n y: 0.734375,\n },\n {\n x: 0.796875,\n y: 0.734375,\n },\n {\n x: 0.828125,\n y: 0.734375,\n },\n {\n x: 0.828125,\n y: 0.734375,\n },\n {\n x: 0.859375,\n y: 0.734375,\n },\n {\n x: 0.859375,\n y: 0.734375,\n },\n {\n x: 0.890625,\n y: 0.734375,\n },\n {\n x: 0.890625,\n y: 0.734375,\n },\n {\n x: 0.921875,\n y: 0.734375,\n },\n {\n x: 0.921875,\n y: 0.734375,\n },\n {\n x: 0.953125,\n y: 0.734375,\n },\n {\n x: 0.953125,\n y: 0.734375,\n },\n {\n x: 0.984375,\n y: 0.734375,\n },\n {\n x: 0.984375,\n y: 0.734375,\n },\n {\n x: 0.015625,\n y: 0.765625,\n },\n {\n x: 0.015625,\n y: 0.765625,\n },\n {\n x: 0.046875,\n y: 0.765625,\n },\n {\n x: 0.046875,\n y: 0.765625,\n },\n {\n x: 0.078125,\n y: 0.765625,\n },\n {\n x: 0.078125,\n y: 0.765625,\n },\n {\n x: 0.109375,\n y: 0.765625,\n },\n {\n x: 0.109375,\n y: 0.765625,\n },\n {\n x: 0.140625,\n y: 0.765625,\n },\n {\n x: 0.140625,\n y: 0.765625,\n },\n {\n x: 0.171875,\n y: 0.765625,\n },\n {\n x: 0.171875,\n y: 0.765625,\n },\n {\n x: 0.203125,\n y: 0.765625,\n },\n {\n x: 0.203125,\n y: 0.765625,\n },\n {\n x: 0.234375,\n y: 0.765625,\n },\n {\n x: 0.234375,\n y: 0.765625,\n },\n {\n x: 0.265625,\n y: 0.765625,\n },\n {\n x: 0.265625,\n y: 0.765625,\n },\n {\n x: 0.296875,\n y: 0.765625,\n },\n {\n x: 0.296875,\n y: 0.765625,\n },\n {\n x: 0.328125,\n y: 0.765625,\n },\n {\n x: 0.328125,\n y: 0.765625,\n },\n {\n x: 0.359375,\n y: 0.765625,\n },\n {\n x: 0.359375,\n y: 0.765625,\n },\n {\n x: 0.390625,\n y: 0.765625,\n },\n {\n x: 0.390625,\n y: 0.765625,\n },\n {\n x: 0.421875,\n y: 0.765625,\n },\n {\n x: 0.421875,\n y: 0.765625,\n },\n {\n x: 0.453125,\n y: 0.765625,\n },\n {\n x: 0.453125,\n y: 0.765625,\n },\n {\n x: 0.484375,\n y: 0.765625,\n },\n {\n x: 0.484375,\n y: 0.765625,\n },\n {\n x: 0.515625,\n y: 0.765625,\n },\n {\n x: 0.515625,\n y: 0.765625,\n },\n {\n x: 0.546875,\n y: 0.765625,\n },\n {\n x: 0.546875,\n y: 0.765625,\n },\n {\n x: 0.578125,\n y: 0.765625,\n },\n {\n x: 0.578125,\n y: 0.765625,\n },\n {\n x: 0.609375,\n y: 0.765625,\n },\n {\n x: 0.609375,\n y: 0.765625,\n },\n {\n x: 0.640625,\n y: 0.765625,\n },\n {\n x: 0.640625,\n y: 0.765625,\n },\n {\n x: 0.671875,\n y: 0.765625,\n },\n {\n x: 0.671875,\n y: 0.765625,\n },\n {\n x: 0.703125,\n y: 0.765625,\n },\n {\n x: 0.703125,\n y: 0.765625,\n },\n {\n x: 0.734375,\n y: 0.765625,\n },\n {\n x: 0.734375,\n y: 0.765625,\n },\n {\n x: 0.765625,\n y: 0.765625,\n },\n {\n x: 0.765625,\n y: 0.765625,\n },\n {\n x: 0.796875,\n y: 0.765625,\n },\n {\n x: 0.796875,\n y: 0.765625,\n },\n {\n x: 0.828125,\n y: 0.765625,\n },\n {\n x: 0.828125,\n y: 0.765625,\n },\n {\n x: 0.859375,\n y: 0.765625,\n },\n {\n x: 0.859375,\n y: 0.765625,\n },\n {\n x: 0.890625,\n y: 0.765625,\n },\n {\n x: 0.890625,\n y: 0.765625,\n },\n {\n x: 0.921875,\n y: 0.765625,\n },\n {\n x: 0.921875,\n y: 0.765625,\n },\n {\n x: 0.953125,\n y: 0.765625,\n },\n {\n x: 0.953125,\n y: 0.765625,\n },\n {\n x: 0.984375,\n y: 0.765625,\n },\n {\n x: 0.984375,\n y: 0.765625,\n },\n {\n x: 0.015625,\n y: 0.796875,\n },\n {\n x: 0.015625,\n y: 0.796875,\n },\n {\n x: 0.046875,\n y: 0.796875,\n },\n {\n x: 0.046875,\n y: 0.796875,\n },\n {\n x: 0.078125,\n y: 0.796875,\n },\n {\n x: 0.078125,\n y: 0.796875,\n },\n {\n x: 0.109375,\n y: 0.796875,\n },\n {\n x: 0.109375,\n y: 0.796875,\n },\n {\n x: 0.140625,\n y: 0.796875,\n },\n {\n x: 0.140625,\n y: 0.796875,\n },\n {\n x: 0.171875,\n y: 0.796875,\n },\n {\n x: 0.171875,\n y: 0.796875,\n },\n {\n x: 0.203125,\n y: 0.796875,\n },\n {\n x: 0.203125,\n y: 0.796875,\n },\n {\n x: 0.234375,\n y: 0.796875,\n },\n {\n x: 0.234375,\n y: 0.796875,\n },\n {\n x: 0.265625,\n y: 0.796875,\n },\n {\n x: 0.265625,\n y: 0.796875,\n },\n {\n x: 0.296875,\n y: 0.796875,\n },\n {\n x: 0.296875,\n y: 0.796875,\n },\n {\n x: 0.328125,\n y: 0.796875,\n },\n {\n x: 0.328125,\n y: 0.796875,\n },\n {\n x: 0.359375,\n y: 0.796875,\n },\n {\n x: 0.359375,\n y: 0.796875,\n },\n {\n x: 0.390625,\n y: 0.796875,\n },\n {\n x: 0.390625,\n y: 0.796875,\n },\n {\n x: 0.421875,\n y: 0.796875,\n },\n {\n x: 0.421875,\n y: 0.796875,\n },\n {\n x: 0.453125,\n y: 0.796875,\n },\n {\n x: 0.453125,\n y: 0.796875,\n },\n {\n x: 0.484375,\n y: 0.796875,\n },\n {\n x: 0.484375,\n y: 0.796875,\n },\n {\n x: 0.515625,\n y: 0.796875,\n },\n {\n x: 0.515625,\n y: 0.796875,\n },\n {\n x: 0.546875,\n y: 0.796875,\n },\n {\n x: 0.546875,\n y: 0.796875,\n },\n {\n x: 0.578125,\n y: 0.796875,\n },\n {\n x: 0.578125,\n y: 0.796875,\n },\n {\n x: 0.609375,\n y: 0.796875,\n },\n {\n x: 0.609375,\n y: 0.796875,\n },\n {\n x: 0.640625,\n y: 0.796875,\n },\n {\n x: 0.640625,\n y: 0.796875,\n },\n {\n x: 0.671875,\n y: 0.796875,\n },\n {\n x: 0.671875,\n y: 0.796875,\n },\n {\n x: 0.703125,\n y: 0.796875,\n },\n {\n x: 0.703125,\n y: 0.796875,\n },\n {\n x: 0.734375,\n y: 0.796875,\n },\n {\n x: 0.734375,\n y: 0.796875,\n },\n {\n x: 0.765625,\n y: 0.796875,\n },\n {\n x: 0.765625,\n y: 0.796875,\n },\n {\n x: 0.796875,\n y: 0.796875,\n },\n {\n x: 0.796875,\n y: 0.796875,\n },\n {\n x: 0.828125,\n y: 0.796875,\n },\n {\n x: 0.828125,\n y: 0.796875,\n },\n {\n x: 0.859375,\n y: 0.796875,\n },\n {\n x: 0.859375,\n y: 0.796875,\n },\n {\n x: 0.890625,\n y: 0.796875,\n },\n {\n x: 0.890625,\n y: 0.796875,\n },\n {\n x: 0.921875,\n y: 0.796875,\n },\n {\n x: 0.921875,\n y: 0.796875,\n },\n {\n x: 0.953125,\n y: 0.796875,\n },\n {\n x: 0.953125,\n y: 0.796875,\n },\n {\n x: 0.984375,\n y: 0.796875,\n },\n {\n x: 0.984375,\n y: 0.796875,\n },\n {\n x: 0.015625,\n y: 0.828125,\n },\n {\n x: 0.015625,\n y: 0.828125,\n },\n {\n x: 0.046875,\n y: 0.828125,\n },\n {\n x: 0.046875,\n y: 0.828125,\n },\n {\n x: 0.078125,\n y: 0.828125,\n },\n {\n x: 0.078125,\n y: 0.828125,\n },\n {\n x: 0.109375,\n y: 0.828125,\n },\n {\n x: 0.109375,\n y: 0.828125,\n },\n {\n x: 0.140625,\n y: 0.828125,\n },\n {\n x: 0.140625,\n y: 0.828125,\n },\n {\n x: 0.171875,\n y: 0.828125,\n },\n {\n x: 0.171875,\n y: 0.828125,\n },\n {\n x: 0.203125,\n y: 0.828125,\n },\n {\n x: 0.203125,\n y: 0.828125,\n },\n {\n x: 0.234375,\n y: 0.828125,\n },\n {\n x: 0.234375,\n y: 0.828125,\n },\n {\n x: 0.265625,\n y: 0.828125,\n },\n {\n x: 0.265625,\n y: 0.828125,\n },\n {\n x: 0.296875,\n y: 0.828125,\n },\n {\n x: 0.296875,\n y: 0.828125,\n },\n {\n x: 0.328125,\n y: 0.828125,\n },\n {\n x: 0.328125,\n y: 0.828125,\n },\n {\n x: 0.359375,\n y: 0.828125,\n },\n {\n x: 0.359375,\n y: 0.828125,\n },\n {\n x: 0.390625,\n y: 0.828125,\n },\n {\n x: 0.390625,\n y: 0.828125,\n },\n {\n x: 0.421875,\n y: 0.828125,\n },\n {\n x: 0.421875,\n y: 0.828125,\n },\n {\n x: 0.453125,\n y: 0.828125,\n },\n {\n x: 0.453125,\n y: 0.828125,\n },\n {\n x: 0.484375,\n y: 0.828125,\n },\n {\n x: 0.484375,\n y: 0.828125,\n },\n {\n x: 0.515625,\n y: 0.828125,\n },\n {\n x: 0.515625,\n y: 0.828125,\n },\n {\n x: 0.546875,\n y: 0.828125,\n },\n {\n x: 0.546875,\n y: 0.828125,\n },\n {\n x: 0.578125,\n y: 0.828125,\n },\n {\n x: 0.578125,\n y: 0.828125,\n },\n {\n x: 0.609375,\n y: 0.828125,\n },\n {\n x: 0.609375,\n y: 0.828125,\n },\n {\n x: 0.640625,\n y: 0.828125,\n },\n {\n x: 0.640625,\n y: 0.828125,\n },\n {\n x: 0.671875,\n y: 0.828125,\n },\n {\n x: 0.671875,\n y: 0.828125,\n },\n {\n x: 0.703125,\n y: 0.828125,\n },\n {\n x: 0.703125,\n y: 0.828125,\n },\n {\n x: 0.734375,\n y: 0.828125,\n },\n {\n x: 0.734375,\n y: 0.828125,\n },\n {\n x: 0.765625,\n y: 0.828125,\n },\n {\n x: 0.765625,\n y: 0.828125,\n },\n {\n x: 0.796875,\n y: 0.828125,\n },\n {\n x: 0.796875,\n y: 0.828125,\n },\n {\n x: 0.828125,\n y: 0.828125,\n },\n {\n x: 0.828125,\n y: 0.828125,\n },\n {\n x: 0.859375,\n y: 0.828125,\n },\n {\n x: 0.859375,\n y: 0.828125,\n },\n {\n x: 0.890625,\n y: 0.828125,\n },\n {\n x: 0.890625,\n y: 0.828125,\n },\n {\n x: 0.921875,\n y: 0.828125,\n },\n {\n x: 0.921875,\n y: 0.828125,\n },\n {\n x: 0.953125,\n y: 0.828125,\n },\n {\n x: 0.953125,\n y: 0.828125,\n },\n {\n x: 0.984375,\n y: 0.828125,\n },\n {\n x: 0.984375,\n y: 0.828125,\n },\n {\n x: 0.015625,\n y: 0.859375,\n },\n {\n x: 0.015625,\n y: 0.859375,\n },\n {\n x: 0.046875,\n y: 0.859375,\n },\n {\n x: 0.046875,\n y: 0.859375,\n },\n {\n x: 0.078125,\n y: 0.859375,\n },\n {\n x: 0.078125,\n y: 0.859375,\n },\n {\n x: 0.109375,\n y: 0.859375,\n },\n {\n x: 0.109375,\n y: 0.859375,\n },\n {\n x: 0.140625,\n y: 0.859375,\n },\n {\n x: 0.140625,\n y: 0.859375,\n },\n {\n x: 0.171875,\n y: 0.859375,\n },\n {\n x: 0.171875,\n y: 0.859375,\n },\n {\n x: 0.203125,\n y: 0.859375,\n },\n {\n x: 0.203125,\n y: 0.859375,\n },\n {\n x: 0.234375,\n y: 0.859375,\n },\n {\n x: 0.234375,\n y: 0.859375,\n },\n {\n x: 0.265625,\n y: 0.859375,\n },\n {\n x: 0.265625,\n y: 0.859375,\n },\n {\n x: 0.296875,\n y: 0.859375,\n },\n {\n x: 0.296875,\n y: 0.859375,\n },\n {\n x: 0.328125,\n y: 0.859375,\n },\n {\n x: 0.328125,\n y: 0.859375,\n },\n {\n x: 0.359375,\n y: 0.859375,\n },\n {\n x: 0.359375,\n y: 0.859375,\n },\n {\n x: 0.390625,\n y: 0.859375,\n },\n {\n x: 0.390625,\n y: 0.859375,\n },\n {\n x: 0.421875,\n y: 0.859375,\n },\n {\n x: 0.421875,\n y: 0.859375,\n },\n {\n x: 0.453125,\n y: 0.859375,\n },\n {\n x: 0.453125,\n y: 0.859375,\n },\n {\n x: 0.484375,\n y: 0.859375,\n },\n {\n x: 0.484375,\n y: 0.859375,\n },\n {\n x: 0.515625,\n y: 0.859375,\n },\n {\n x: 0.515625,\n y: 0.859375,\n },\n {\n x: 0.546875,\n y: 0.859375,\n },\n {\n x: 0.546875,\n y: 0.859375,\n },\n {\n x: 0.578125,\n y: 0.859375,\n },\n {\n x: 0.578125,\n y: 0.859375,\n },\n {\n x: 0.609375,\n y: 0.859375,\n },\n {\n x: 0.609375,\n y: 0.859375,\n },\n {\n x: 0.640625,\n y: 0.859375,\n },\n {\n x: 0.640625,\n y: 0.859375,\n },\n {\n x: 0.671875,\n y: 0.859375,\n },\n {\n x: 0.671875,\n y: 0.859375,\n },\n {\n x: 0.703125,\n y: 0.859375,\n },\n {\n x: 0.703125,\n y: 0.859375,\n },\n {\n x: 0.734375,\n y: 0.859375,\n },\n {\n x: 0.734375,\n y: 0.859375,\n },\n {\n x: 0.765625,\n y: 0.859375,\n },\n {\n x: 0.765625,\n y: 0.859375,\n },\n {\n x: 0.796875,\n y: 0.859375,\n },\n {\n x: 0.796875,\n y: 0.859375,\n },\n {\n x: 0.828125,\n y: 0.859375,\n },\n {\n x: 0.828125,\n y: 0.859375,\n },\n {\n x: 0.859375,\n y: 0.859375,\n },\n {\n x: 0.859375,\n y: 0.859375,\n },\n {\n x: 0.890625,\n y: 0.859375,\n },\n {\n x: 0.890625,\n y: 0.859375,\n },\n {\n x: 0.921875,\n y: 0.859375,\n },\n {\n x: 0.921875,\n y: 0.859375,\n },\n {\n x: 0.953125,\n y: 0.859375,\n },\n {\n x: 0.953125,\n y: 0.859375,\n },\n {\n x: 0.984375,\n y: 0.859375,\n },\n {\n x: 0.984375,\n y: 0.859375,\n },\n {\n x: 0.015625,\n y: 0.890625,\n },\n {\n x: 0.015625,\n y: 0.890625,\n },\n {\n x: 0.046875,\n y: 0.890625,\n },\n {\n x: 0.046875,\n y: 0.890625,\n },\n {\n x: 0.078125,\n y: 0.890625,\n },\n {\n x: 0.078125,\n y: 0.890625,\n },\n {\n x: 0.109375,\n y: 0.890625,\n },\n {\n x: 0.109375,\n y: 0.890625,\n },\n {\n x: 0.140625,\n y: 0.890625,\n },\n {\n x: 0.140625,\n y: 0.890625,\n },\n {\n x: 0.171875,\n y: 0.890625,\n },\n {\n x: 0.171875,\n y: 0.890625,\n },\n {\n x: 0.203125,\n y: 0.890625,\n },\n {\n x: 0.203125,\n y: 0.890625,\n },\n {\n x: 0.234375,\n y: 0.890625,\n },\n {\n x: 0.234375,\n y: 0.890625,\n },\n {\n x: 0.265625,\n y: 0.890625,\n },\n {\n x: 0.265625,\n y: 0.890625,\n },\n {\n x: 0.296875,\n y: 0.890625,\n },\n {\n x: 0.296875,\n y: 0.890625,\n },\n {\n x: 0.328125,\n y: 0.890625,\n },\n {\n x: 0.328125,\n y: 0.890625,\n },\n {\n x: 0.359375,\n y: 0.890625,\n },\n {\n x: 0.359375,\n y: 0.890625,\n },\n {\n x: 0.390625,\n y: 0.890625,\n },\n {\n x: 0.390625,\n y: 0.890625,\n },\n {\n x: 0.421875,\n y: 0.890625,\n },\n {\n x: 0.421875,\n y: 0.890625,\n },\n {\n x: 0.453125,\n y: 0.890625,\n },\n {\n x: 0.453125,\n y: 0.890625,\n },\n {\n x: 0.484375,\n y: 0.890625,\n },\n {\n x: 0.484375,\n y: 0.890625,\n },\n {\n x: 0.515625,\n y: 0.890625,\n },\n {\n x: 0.515625,\n y: 0.890625,\n },\n {\n x: 0.546875,\n y: 0.890625,\n },\n {\n x: 0.546875,\n y: 0.890625,\n },\n {\n x: 0.578125,\n y: 0.890625,\n },\n {\n x: 0.578125,\n y: 0.890625,\n },\n {\n x: 0.609375,\n y: 0.890625,\n },\n {\n x: 0.609375,\n y: 0.890625,\n },\n {\n x: 0.640625,\n y: 0.890625,\n },\n {\n x: 0.640625,\n y: 0.890625,\n },\n {\n x: 0.671875,\n y: 0.890625,\n },\n {\n x: 0.671875,\n y: 0.890625,\n },\n {\n x: 0.703125,\n y: 0.890625,\n },\n {\n x: 0.703125,\n y: 0.890625,\n },\n {\n x: 0.734375,\n y: 0.890625,\n },\n {\n x: 0.734375,\n y: 0.890625,\n },\n {\n x: 0.765625,\n y: 0.890625,\n },\n {\n x: 0.765625,\n y: 0.890625,\n },\n {\n x: 0.796875,\n y: 0.890625,\n },\n {\n x: 0.796875,\n y: 0.890625,\n },\n {\n x: 0.828125,\n y: 0.890625,\n },\n {\n x: 0.828125,\n y: 0.890625,\n },\n {\n x: 0.859375,\n y: 0.890625,\n },\n {\n x: 0.859375,\n y: 0.890625,\n },\n {\n x: 0.890625,\n y: 0.890625,\n },\n {\n x: 0.890625,\n y: 0.890625,\n },\n {\n x: 0.921875,\n y: 0.890625,\n },\n {\n x: 0.921875,\n y: 0.890625,\n },\n {\n x: 0.953125,\n y: 0.890625,\n },\n {\n x: 0.953125,\n y: 0.890625,\n },\n {\n x: 0.984375,\n y: 0.890625,\n },\n {\n x: 0.984375,\n y: 0.890625,\n },\n {\n x: 0.015625,\n y: 0.921875,\n },\n {\n x: 0.015625,\n y: 0.921875,\n },\n {\n x: 0.046875,\n y: 0.921875,\n },\n {\n x: 0.046875,\n y: 0.921875,\n },\n {\n x: 0.078125,\n y: 0.921875,\n },\n {\n x: 0.078125,\n y: 0.921875,\n },\n {\n x: 0.109375,\n y: 0.921875,\n },\n {\n x: 0.109375,\n y: 0.921875,\n },\n {\n x: 0.140625,\n y: 0.921875,\n },\n {\n x: 0.140625,\n y: 0.921875,\n },\n {\n x: 0.171875,\n y: 0.921875,\n },\n {\n x: 0.171875,\n y: 0.921875,\n },\n {\n x: 0.203125,\n y: 0.921875,\n },\n {\n x: 0.203125,\n y: 0.921875,\n },\n {\n x: 0.234375,\n y: 0.921875,\n },\n {\n x: 0.234375,\n y: 0.921875,\n },\n {\n x: 0.265625,\n y: 0.921875,\n },\n {\n x: 0.265625,\n y: 0.921875,\n },\n {\n x: 0.296875,\n y: 0.921875,\n },\n {\n x: 0.296875,\n y: 0.921875,\n },\n {\n x: 0.328125,\n y: 0.921875,\n },\n {\n x: 0.328125,\n y: 0.921875,\n },\n {\n x: 0.359375,\n y: 0.921875,\n },\n {\n x: 0.359375,\n y: 0.921875,\n },\n {\n x: 0.390625,\n y: 0.921875,\n },\n {\n x: 0.390625,\n y: 0.921875,\n },\n {\n x: 0.421875,\n y: 0.921875,\n },\n {\n x: 0.421875,\n y: 0.921875,\n },\n {\n x: 0.453125,\n y: 0.921875,\n },\n {\n x: 0.453125,\n y: 0.921875,\n },\n {\n x: 0.484375,\n y: 0.921875,\n },\n {\n x: 0.484375,\n y: 0.921875,\n },\n {\n x: 0.515625,\n y: 0.921875,\n },\n {\n x: 0.515625,\n y: 0.921875,\n },\n {\n x: 0.546875,\n y: 0.921875,\n },\n {\n x: 0.546875,\n y: 0.921875,\n },\n {\n x: 0.578125,\n y: 0.921875,\n },\n {\n x: 0.578125,\n y: 0.921875,\n },\n {\n x: 0.609375,\n y: 0.921875,\n },\n {\n x: 0.609375,\n y: 0.921875,\n },\n {\n x: 0.640625,\n y: 0.921875,\n },\n {\n x: 0.640625,\n y: 0.921875,\n },\n {\n x: 0.671875,\n y: 0.921875,\n },\n {\n x: 0.671875,\n y: 0.921875,\n },\n {\n x: 0.703125,\n y: 0.921875,\n },\n {\n x: 0.703125,\n y: 0.921875,\n },\n {\n x: 0.734375,\n y: 0.921875,\n },\n {\n x: 0.734375,\n y: 0.921875,\n },\n {\n x: 0.765625,\n y: 0.921875,\n },\n {\n x: 0.765625,\n y: 0.921875,\n },\n {\n x: 0.796875,\n y: 0.921875,\n },\n {\n x: 0.796875,\n y: 0.921875,\n },\n {\n x: 0.828125,\n y: 0.921875,\n },\n {\n x: 0.828125,\n y: 0.921875,\n },\n {\n x: 0.859375,\n y: 0.921875,\n },\n {\n x: 0.859375,\n y: 0.921875,\n },\n {\n x: 0.890625,\n y: 0.921875,\n },\n {\n x: 0.890625,\n y: 0.921875,\n },\n {\n x: 0.921875,\n y: 0.921875,\n },\n {\n x: 0.921875,\n y: 0.921875,\n },\n {\n x: 0.953125,\n y: 0.921875,\n },\n {\n x: 0.953125,\n y: 0.921875,\n },\n {\n x: 0.984375,\n y: 0.921875,\n },\n {\n x: 0.984375,\n y: 0.921875,\n },\n {\n x: 0.015625,\n y: 0.953125,\n },\n {\n x: 0.015625,\n y: 0.953125,\n },\n {\n x: 0.046875,\n y: 0.953125,\n },\n {\n x: 0.046875,\n y: 0.953125,\n },\n {\n x: 0.078125,\n y: 0.953125,\n },\n {\n x: 0.078125,\n y: 0.953125,\n },\n {\n x: 0.109375,\n y: 0.953125,\n },\n {\n x: 0.109375,\n y: 0.953125,\n },\n {\n x: 0.140625,\n y: 0.953125,\n },\n {\n x: 0.140625,\n y: 0.953125,\n },\n {\n x: 0.171875,\n y: 0.953125,\n },\n {\n x: 0.171875,\n y: 0.953125,\n },\n {\n x: 0.203125,\n y: 0.953125,\n },\n {\n x: 0.203125,\n y: 0.953125,\n },\n {\n x: 0.234375,\n y: 0.953125,\n },\n {\n x: 0.234375,\n y: 0.953125,\n },\n {\n x: 0.265625,\n y: 0.953125,\n },\n {\n x: 0.265625,\n y: 0.953125,\n },\n {\n x: 0.296875,\n y: 0.953125,\n },\n {\n x: 0.296875,\n y: 0.953125,\n },\n {\n x: 0.328125,\n y: 0.953125,\n },\n {\n x: 0.328125,\n y: 0.953125,\n },\n {\n x: 0.359375,\n y: 0.953125,\n },\n {\n x: 0.359375,\n y: 0.953125,\n },\n {\n x: 0.390625,\n y: 0.953125,\n },\n {\n x: 0.390625,\n y: 0.953125,\n },\n {\n x: 0.421875,\n y: 0.953125,\n },\n {\n x: 0.421875,\n y: 0.953125,\n },\n {\n x: 0.453125,\n y: 0.953125,\n },\n {\n x: 0.453125,\n y: 0.953125,\n },\n {\n x: 0.484375,\n y: 0.953125,\n },\n {\n x: 0.484375,\n y: 0.953125,\n },\n {\n x: 0.515625,\n y: 0.953125,\n },\n {\n x: 0.515625,\n y: 0.953125,\n },\n {\n x: 0.546875,\n y: 0.953125,\n },\n {\n x: 0.546875,\n y: 0.953125,\n },\n {\n x: 0.578125,\n y: 0.953125,\n },\n {\n x: 0.578125,\n y: 0.953125,\n },\n {\n x: 0.609375,\n y: 0.953125,\n },\n {\n x: 0.609375,\n y: 0.953125,\n },\n {\n x: 0.640625,\n y: 0.953125,\n },\n {\n x: 0.640625,\n y: 0.953125,\n },\n {\n x: 0.671875,\n y: 0.953125,\n },\n {\n x: 0.671875,\n y: 0.953125,\n },\n {\n x: 0.703125,\n y: 0.953125,\n },\n {\n x: 0.703125,\n y: 0.953125,\n },\n {\n x: 0.734375,\n y: 0.953125,\n },\n {\n x: 0.734375,\n y: 0.953125,\n },\n {\n x: 0.765625,\n y: 0.953125,\n },\n {\n x: 0.765625,\n y: 0.953125,\n },\n {\n x: 0.796875,\n y: 0.953125,\n },\n {\n x: 0.796875,\n y: 0.953125,\n },\n {\n x: 0.828125,\n y: 0.953125,\n },\n {\n x: 0.828125,\n y: 0.953125,\n },\n {\n x: 0.859375,\n y: 0.953125,\n },\n {\n x: 0.859375,\n y: 0.953125,\n },\n {\n x: 0.890625,\n y: 0.953125,\n },\n {\n x: 0.890625,\n y: 0.953125,\n },\n {\n x: 0.921875,\n y: 0.953125,\n },\n {\n x: 0.921875,\n y: 0.953125,\n },\n {\n x: 0.953125,\n y: 0.953125,\n },\n {\n x: 0.953125,\n y: 0.953125,\n },\n {\n x: 0.984375,\n y: 0.953125,\n },\n {\n x: 0.984375,\n y: 0.953125,\n },\n {\n x: 0.015625,\n y: 0.984375,\n },\n {\n x: 0.015625,\n y: 0.984375,\n },\n {\n x: 0.046875,\n y: 0.984375,\n },\n {\n x: 0.046875,\n y: 0.984375,\n },\n {\n x: 0.078125,\n y: 0.984375,\n },\n {\n x: 0.078125,\n y: 0.984375,\n },\n {\n x: 0.109375,\n y: 0.984375,\n },\n {\n x: 0.109375,\n y: 0.984375,\n },\n {\n x: 0.140625,\n y: 0.984375,\n },\n {\n x: 0.140625,\n y: 0.984375,\n },\n {\n x: 0.171875,\n y: 0.984375,\n },\n {\n x: 0.171875,\n y: 0.984375,\n },\n {\n x: 0.203125,\n y: 0.984375,\n },\n {\n x: 0.203125,\n y: 0.984375,\n },\n {\n x: 0.234375,\n y: 0.984375,\n },\n {\n x: 0.234375,\n y: 0.984375,\n },\n {\n x: 0.265625,\n y: 0.984375,\n },\n {\n x: 0.265625,\n y: 0.984375,\n },\n {\n x: 0.296875,\n y: 0.984375,\n },\n {\n x: 0.296875,\n y: 0.984375,\n },\n {\n x: 0.328125,\n y: 0.984375,\n },\n {\n x: 0.328125,\n y: 0.984375,\n },\n {\n x: 0.359375,\n y: 0.984375,\n },\n {\n x: 0.359375,\n y: 0.984375,\n },\n {\n x: 0.390625,\n y: 0.984375,\n },\n {\n x: 0.390625,\n y: 0.984375,\n },\n {\n x: 0.421875,\n y: 0.984375,\n },\n {\n x: 0.421875,\n y: 0.984375,\n },\n {\n x: 0.453125,\n y: 0.984375,\n },\n {\n x: 0.453125,\n y: 0.984375,\n },\n {\n x: 0.484375,\n y: 0.984375,\n },\n {\n x: 0.484375,\n y: 0.984375,\n },\n {\n x: 0.515625,\n y: 0.984375,\n },\n {\n x: 0.515625,\n y: 0.984375,\n },\n {\n x: 0.546875,\n y: 0.984375,\n },\n {\n x: 0.546875,\n y: 0.984375,\n },\n {\n x: 0.578125,\n y: 0.984375,\n },\n {\n x: 0.578125,\n y: 0.984375,\n },\n {\n x: 0.609375,\n y: 0.984375,\n },\n {\n x: 0.609375,\n y: 0.984375,\n },\n {\n x: 0.640625,\n y: 0.984375,\n },\n {\n x: 0.640625,\n y: 0.984375,\n },\n {\n x: 0.671875,\n y: 0.984375,\n },\n {\n x: 0.671875,\n y: 0.984375,\n },\n {\n x: 0.703125,\n y: 0.984375,\n },\n {\n x: 0.703125,\n y: 0.984375,\n },\n {\n x: 0.734375,\n y: 0.984375,\n },\n {\n x: 0.734375,\n y: 0.984375,\n },\n {\n x: 0.765625,\n y: 0.984375,\n },\n {\n x: 0.765625,\n y: 0.984375,\n },\n {\n x: 0.796875,\n y: 0.984375,\n },\n {\n x: 0.796875,\n y: 0.984375,\n },\n {\n x: 0.828125,\n y: 0.984375,\n },\n {\n x: 0.828125,\n y: 0.984375,\n },\n {\n x: 0.859375,\n y: 0.984375,\n },\n {\n x: 0.859375,\n y: 0.984375,\n },\n {\n x: 0.890625,\n y: 0.984375,\n },\n {\n x: 0.890625,\n y: 0.984375,\n },\n {\n x: 0.921875,\n y: 0.984375,\n },\n {\n x: 0.921875,\n y: 0.984375,\n },\n {\n x: 0.953125,\n y: 0.984375,\n },\n {\n x: 0.953125,\n y: 0.984375,\n },\n {\n x: 0.984375,\n y: 0.984375,\n },\n {\n x: 0.984375,\n y: 0.984375,\n },\n {\n x: 0.03125,\n y: 0.03125,\n },\n {\n x: 0.03125,\n y: 0.03125,\n },\n {\n x: 0.09375,\n y: 0.03125,\n },\n {\n x: 0.09375,\n y: 0.03125,\n },\n {\n x: 0.15625,\n y: 0.03125,\n },\n {\n x: 0.15625,\n y: 0.03125,\n },\n {\n x: 0.21875,\n y: 0.03125,\n },\n {\n x: 0.21875,\n y: 0.03125,\n },\n {\n x: 0.28125,\n y: 0.03125,\n },\n {\n x: 0.28125,\n y: 0.03125,\n },\n {\n x: 0.34375,\n y: 0.03125,\n },\n {\n x: 0.34375,\n y: 0.03125,\n },\n {\n x: 0.40625,\n y: 0.03125,\n },\n {\n x: 0.40625,\n y: 0.03125,\n },\n {\n x: 0.46875,\n y: 0.03125,\n },\n {\n x: 0.46875,\n y: 0.03125,\n },\n {\n x: 0.53125,\n y: 0.03125,\n },\n {\n x: 0.53125,\n y: 0.03125,\n },\n {\n x: 0.59375,\n y: 0.03125,\n },\n {\n x: 0.59375,\n y: 0.03125,\n },\n {\n x: 0.65625,\n y: 0.03125,\n },\n {\n x: 0.65625,\n y: 0.03125,\n },\n {\n x: 0.71875,\n y: 0.03125,\n },\n {\n x: 0.71875,\n y: 0.03125,\n },\n {\n x: 0.78125,\n y: 0.03125,\n },\n {\n x: 0.78125,\n y: 0.03125,\n },\n {\n x: 0.84375,\n y: 0.03125,\n },\n {\n x: 0.84375,\n y: 0.03125,\n },\n {\n x: 0.90625,\n y: 0.03125,\n },\n {\n x: 0.90625,\n y: 0.03125,\n },\n {\n x: 0.96875,\n y: 0.03125,\n },\n {\n x: 0.96875,\n y: 0.03125,\n },\n {\n x: 0.03125,\n y: 0.09375,\n },\n {\n x: 0.03125,\n y: 0.09375,\n },\n {\n x: 0.09375,\n y: 0.09375,\n },\n {\n x: 0.09375,\n y: 0.09375,\n },\n {\n x: 0.15625,\n y: 0.09375,\n },\n {\n x: 0.15625,\n y: 0.09375,\n },\n {\n x: 0.21875,\n y: 0.09375,\n },\n {\n x: 0.21875,\n y: 0.09375,\n },\n {\n x: 0.28125,\n y: 0.09375,\n },\n {\n x: 0.28125,\n y: 0.09375,\n },\n {\n x: 0.34375,\n y: 0.09375,\n },\n {\n x: 0.34375,\n y: 0.09375,\n },\n {\n x: 0.40625,\n y: 0.09375,\n },\n {\n x: 0.40625,\n y: 0.09375,\n },\n {\n x: 0.46875,\n y: 0.09375,\n },\n {\n x: 0.46875,\n y: 0.09375,\n },\n {\n x: 0.53125,\n y: 0.09375,\n },\n {\n x: 0.53125,\n y: 0.09375,\n },\n {\n x: 0.59375,\n y: 0.09375,\n },\n {\n x: 0.59375,\n y: 0.09375,\n },\n {\n x: 0.65625,\n y: 0.09375,\n },\n {\n x: 0.65625,\n y: 0.09375,\n },\n {\n x: 0.71875,\n y: 0.09375,\n },\n {\n x: 0.71875,\n y: 0.09375,\n },\n {\n x: 0.78125,\n y: 0.09375,\n },\n {\n x: 0.78125,\n y: 0.09375,\n },\n {\n x: 0.84375,\n y: 0.09375,\n },\n {\n x: 0.84375,\n y: 0.09375,\n },\n {\n x: 0.90625,\n y: 0.09375,\n },\n {\n x: 0.90625,\n y: 0.09375,\n },\n {\n x: 0.96875,\n y: 0.09375,\n },\n {\n x: 0.96875,\n y: 0.09375,\n },\n {\n x: 0.03125,\n y: 0.15625,\n },\n {\n x: 0.03125,\n y: 0.15625,\n },\n {\n x: 0.09375,\n y: 0.15625,\n },\n {\n x: 0.09375,\n y: 0.15625,\n },\n {\n x: 0.15625,\n y: 0.15625,\n },\n {\n x: 0.15625,\n y: 0.15625,\n },\n {\n x: 0.21875,\n y: 0.15625,\n },\n {\n x: 0.21875,\n y: 0.15625,\n },\n {\n x: 0.28125,\n y: 0.15625,\n },\n {\n x: 0.28125,\n y: 0.15625,\n },\n {\n x: 0.34375,\n y: 0.15625,\n },\n {\n x: 0.34375,\n y: 0.15625,\n },\n {\n x: 0.40625,\n y: 0.15625,\n },\n {\n x: 0.40625,\n y: 0.15625,\n },\n {\n x: 0.46875,\n y: 0.15625,\n },\n {\n x: 0.46875,\n y: 0.15625,\n },\n {\n x: 0.53125,\n y: 0.15625,\n },\n {\n x: 0.53125,\n y: 0.15625,\n },\n {\n x: 0.59375,\n y: 0.15625,\n },\n {\n x: 0.59375,\n y: 0.15625,\n },\n {\n x: 0.65625,\n y: 0.15625,\n },\n {\n x: 0.65625,\n y: 0.15625,\n },\n {\n x: 0.71875,\n y: 0.15625,\n },\n {\n x: 0.71875,\n y: 0.15625,\n },\n {\n x: 0.78125,\n y: 0.15625,\n },\n {\n x: 0.78125,\n y: 0.15625,\n },\n {\n x: 0.84375,\n y: 0.15625,\n },\n {\n x: 0.84375,\n y: 0.15625,\n },\n {\n x: 0.90625,\n y: 0.15625,\n },\n {\n x: 0.90625,\n y: 0.15625,\n },\n {\n x: 0.96875,\n y: 0.15625,\n },\n {\n x: 0.96875,\n y: 0.15625,\n },\n {\n x: 0.03125,\n y: 0.21875,\n },\n {\n x: 0.03125,\n y: 0.21875,\n },\n {\n x: 0.09375,\n y: 0.21875,\n },\n {\n x: 0.09375,\n y: 0.21875,\n },\n {\n x: 0.15625,\n y: 0.21875,\n },\n {\n x: 0.15625,\n y: 0.21875,\n },\n {\n x: 0.21875,\n y: 0.21875,\n },\n {\n x: 0.21875,\n y: 0.21875,\n },\n {\n x: 0.28125,\n y: 0.21875,\n },\n {\n x: 0.28125,\n y: 0.21875,\n },\n {\n x: 0.34375,\n y: 0.21875,\n },\n {\n x: 0.34375,\n y: 0.21875,\n },\n {\n x: 0.40625,\n y: 0.21875,\n },\n {\n x: 0.40625,\n y: 0.21875,\n },\n {\n x: 0.46875,\n y: 0.21875,\n },\n {\n x: 0.46875,\n y: 0.21875,\n },\n {\n x: 0.53125,\n y: 0.21875,\n },\n {\n x: 0.53125,\n y: 0.21875,\n },\n {\n x: 0.59375,\n y: 0.21875,\n },\n {\n x: 0.59375,\n y: 0.21875,\n },\n {\n x: 0.65625,\n y: 0.21875,\n },\n {\n x: 0.65625,\n y: 0.21875,\n },\n {\n x: 0.71875,\n y: 0.21875,\n },\n {\n x: 0.71875,\n y: 0.21875,\n },\n {\n x: 0.78125,\n y: 0.21875,\n },\n {\n x: 0.78125,\n y: 0.21875,\n },\n {\n x: 0.84375,\n y: 0.21875,\n },\n {\n x: 0.84375,\n y: 0.21875,\n },\n {\n x: 0.90625,\n y: 0.21875,\n },\n {\n x: 0.90625,\n y: 0.21875,\n },\n {\n x: 0.96875,\n y: 0.21875,\n },\n {\n x: 0.96875,\n y: 0.21875,\n },\n {\n x: 0.03125,\n y: 0.28125,\n },\n {\n x: 0.03125,\n y: 0.28125,\n },\n {\n x: 0.09375,\n y: 0.28125,\n },\n {\n x: 0.09375,\n y: 0.28125,\n },\n {\n x: 0.15625,\n y: 0.28125,\n },\n {\n x: 0.15625,\n y: 0.28125,\n },\n {\n x: 0.21875,\n y: 0.28125,\n },\n {\n x: 0.21875,\n y: 0.28125,\n },\n {\n x: 0.28125,\n y: 0.28125,\n },\n {\n x: 0.28125,\n y: 0.28125,\n },\n {\n x: 0.34375,\n y: 0.28125,\n },\n {\n x: 0.34375,\n y: 0.28125,\n },\n {\n x: 0.40625,\n y: 0.28125,\n },\n {\n x: 0.40625,\n y: 0.28125,\n },\n {\n x: 0.46875,\n y: 0.28125,\n },\n {\n x: 0.46875,\n y: 0.28125,\n },\n {\n x: 0.53125,\n y: 0.28125,\n },\n {\n x: 0.53125,\n y: 0.28125,\n },\n {\n x: 0.59375,\n y: 0.28125,\n },\n {\n x: 0.59375,\n y: 0.28125,\n },\n {\n x: 0.65625,\n y: 0.28125,\n },\n {\n x: 0.65625,\n y: 0.28125,\n },\n {\n x: 0.71875,\n y: 0.28125,\n },\n {\n x: 0.71875,\n y: 0.28125,\n },\n {\n x: 0.78125,\n y: 0.28125,\n },\n {\n x: 0.78125,\n y: 0.28125,\n },\n {\n x: 0.84375,\n y: 0.28125,\n },\n {\n x: 0.84375,\n y: 0.28125,\n },\n {\n x: 0.90625,\n y: 0.28125,\n },\n {\n x: 0.90625,\n y: 0.28125,\n },\n {\n x: 0.96875,\n y: 0.28125,\n },\n {\n x: 0.96875,\n y: 0.28125,\n },\n {\n x: 0.03125,\n y: 0.34375,\n },\n {\n x: 0.03125,\n y: 0.34375,\n },\n {\n x: 0.09375,\n y: 0.34375,\n },\n {\n x: 0.09375,\n y: 0.34375,\n },\n {\n x: 0.15625,\n y: 0.34375,\n },\n {\n x: 0.15625,\n y: 0.34375,\n },\n {\n x: 0.21875,\n y: 0.34375,\n },\n {\n x: 0.21875,\n y: 0.34375,\n },\n {\n x: 0.28125,\n y: 0.34375,\n },\n {\n x: 0.28125,\n y: 0.34375,\n },\n {\n x: 0.34375,\n y: 0.34375,\n },\n {\n x: 0.34375,\n y: 0.34375,\n },\n {\n x: 0.40625,\n y: 0.34375,\n },\n {\n x: 0.40625,\n y: 0.34375,\n },\n {\n x: 0.46875,\n y: 0.34375,\n },\n {\n x: 0.46875,\n y: 0.34375,\n },\n {\n x: 0.53125,\n y: 0.34375,\n },\n {\n x: 0.53125,\n y: 0.34375,\n },\n {\n x: 0.59375,\n y: 0.34375,\n },\n {\n x: 0.59375,\n y: 0.34375,\n },\n {\n x: 0.65625,\n y: 0.34375,\n },\n {\n x: 0.65625,\n y: 0.34375,\n },\n {\n x: 0.71875,\n y: 0.34375,\n },\n {\n x: 0.71875,\n y: 0.34375,\n },\n {\n x: 0.78125,\n y: 0.34375,\n },\n {\n x: 0.78125,\n y: 0.34375,\n },\n {\n x: 0.84375,\n y: 0.34375,\n },\n {\n x: 0.84375,\n y: 0.34375,\n },\n {\n x: 0.90625,\n y: 0.34375,\n },\n {\n x: 0.90625,\n y: 0.34375,\n },\n {\n x: 0.96875,\n y: 0.34375,\n },\n {\n x: 0.96875,\n y: 0.34375,\n },\n {\n x: 0.03125,\n y: 0.40625,\n },\n {\n x: 0.03125,\n y: 0.40625,\n },\n {\n x: 0.09375,\n y: 0.40625,\n },\n {\n x: 0.09375,\n y: 0.40625,\n },\n {\n x: 0.15625,\n y: 0.40625,\n },\n {\n x: 0.15625,\n y: 0.40625,\n },\n {\n x: 0.21875,\n y: 0.40625,\n },\n {\n x: 0.21875,\n y: 0.40625,\n },\n {\n x: 0.28125,\n y: 0.40625,\n },\n {\n x: 0.28125,\n y: 0.40625,\n },\n {\n x: 0.34375,\n y: 0.40625,\n },\n {\n x: 0.34375,\n y: 0.40625,\n },\n {\n x: 0.40625,\n y: 0.40625,\n },\n {\n x: 0.40625,\n y: 0.40625,\n },\n {\n x: 0.46875,\n y: 0.40625,\n },\n {\n x: 0.46875,\n y: 0.40625,\n },\n {\n x: 0.53125,\n y: 0.40625,\n },\n {\n x: 0.53125,\n y: 0.40625,\n },\n {\n x: 0.59375,\n y: 0.40625,\n },\n {\n x: 0.59375,\n y: 0.40625,\n },\n {\n x: 0.65625,\n y: 0.40625,\n },\n {\n x: 0.65625,\n y: 0.40625,\n },\n {\n x: 0.71875,\n y: 0.40625,\n },\n {\n x: 0.71875,\n y: 0.40625,\n },\n {\n x: 0.78125,\n y: 0.40625,\n },\n {\n x: 0.78125,\n y: 0.40625,\n },\n {\n x: 0.84375,\n y: 0.40625,\n },\n {\n x: 0.84375,\n y: 0.40625,\n },\n {\n x: 0.90625,\n y: 0.40625,\n },\n {\n x: 0.90625,\n y: 0.40625,\n },\n {\n x: 0.96875,\n y: 0.40625,\n },\n {\n x: 0.96875,\n y: 0.40625,\n },\n {\n x: 0.03125,\n y: 0.46875,\n },\n {\n x: 0.03125,\n y: 0.46875,\n },\n {\n x: 0.09375,\n y: 0.46875,\n },\n {\n x: 0.09375,\n y: 0.46875,\n },\n {\n x: 0.15625,\n y: 0.46875,\n },\n {\n x: 0.15625,\n y: 0.46875,\n },\n {\n x: 0.21875,\n y: 0.46875,\n },\n {\n x: 0.21875,\n y: 0.46875,\n },\n {\n x: 0.28125,\n y: 0.46875,\n },\n {\n x: 0.28125,\n y: 0.46875,\n },\n {\n x: 0.34375,\n y: 0.46875,\n },\n {\n x: 0.34375,\n y: 0.46875,\n },\n {\n x: 0.40625,\n y: 0.46875,\n },\n {\n x: 0.40625,\n y: 0.46875,\n },\n {\n x: 0.46875,\n y: 0.46875,\n },\n {\n x: 0.46875,\n y: 0.46875,\n },\n {\n x: 0.53125,\n y: 0.46875,\n },\n {\n x: 0.53125,\n y: 0.46875,\n },\n {\n x: 0.59375,\n y: 0.46875,\n },\n {\n x: 0.59375,\n y: 0.46875,\n },\n {\n x: 0.65625,\n y: 0.46875,\n },\n {\n x: 0.65625,\n y: 0.46875,\n },\n {\n x: 0.71875,\n y: 0.46875,\n },\n {\n x: 0.71875,\n y: 0.46875,\n },\n {\n x: 0.78125,\n y: 0.46875,\n },\n {\n x: 0.78125,\n y: 0.46875,\n },\n {\n x: 0.84375,\n y: 0.46875,\n },\n {\n x: 0.84375,\n y: 0.46875,\n },\n {\n x: 0.90625,\n y: 0.46875,\n },\n {\n x: 0.90625,\n y: 0.46875,\n },\n {\n x: 0.96875,\n y: 0.46875,\n },\n {\n x: 0.96875,\n y: 0.46875,\n },\n {\n x: 0.03125,\n y: 0.53125,\n },\n {\n x: 0.03125,\n y: 0.53125,\n },\n {\n x: 0.09375,\n y: 0.53125,\n },\n {\n x: 0.09375,\n y: 0.53125,\n },\n {\n x: 0.15625,\n y: 0.53125,\n },\n {\n x: 0.15625,\n y: 0.53125,\n },\n {\n x: 0.21875,\n y: 0.53125,\n },\n {\n x: 0.21875,\n y: 0.53125,\n },\n {\n x: 0.28125,\n y: 0.53125,\n },\n {\n x: 0.28125,\n y: 0.53125,\n },\n {\n x: 0.34375,\n y: 0.53125,\n },\n {\n x: 0.34375,\n y: 0.53125,\n },\n {\n x: 0.40625,\n y: 0.53125,\n },\n {\n x: 0.40625,\n y: 0.53125,\n },\n {\n x: 0.46875,\n y: 0.53125,\n },\n {\n x: 0.46875,\n y: 0.53125,\n },\n {\n x: 0.53125,\n y: 0.53125,\n },\n {\n x: 0.53125,\n y: 0.53125,\n },\n {\n x: 0.59375,\n y: 0.53125,\n },\n {\n x: 0.59375,\n y: 0.53125,\n },\n {\n x: 0.65625,\n y: 0.53125,\n },\n {\n x: 0.65625,\n y: 0.53125,\n },\n {\n x: 0.71875,\n y: 0.53125,\n },\n {\n x: 0.71875,\n y: 0.53125,\n },\n {\n x: 0.78125,\n y: 0.53125,\n },\n {\n x: 0.78125,\n y: 0.53125,\n },\n {\n x: 0.84375,\n y: 0.53125,\n },\n {\n x: 0.84375,\n y: 0.53125,\n },\n {\n x: 0.90625,\n y: 0.53125,\n },\n {\n x: 0.90625,\n y: 0.53125,\n },\n {\n x: 0.96875,\n y: 0.53125,\n },\n {\n x: 0.96875,\n y: 0.53125,\n },\n {\n x: 0.03125,\n y: 0.59375,\n },\n {\n x: 0.03125,\n y: 0.59375,\n },\n {\n x: 0.09375,\n y: 0.59375,\n },\n {\n x: 0.09375,\n y: 0.59375,\n },\n {\n x: 0.15625,\n y: 0.59375,\n },\n {\n x: 0.15625,\n y: 0.59375,\n },\n {\n x: 0.21875,\n y: 0.59375,\n },\n {\n x: 0.21875,\n y: 0.59375,\n },\n {\n x: 0.28125,\n y: 0.59375,\n },\n {\n x: 0.28125,\n y: 0.59375,\n },\n {\n x: 0.34375,\n y: 0.59375,\n },\n {\n x: 0.34375,\n y: 0.59375,\n },\n {\n x: 0.40625,\n y: 0.59375,\n },\n {\n x: 0.40625,\n y: 0.59375,\n },\n {\n x: 0.46875,\n y: 0.59375,\n },\n {\n x: 0.46875,\n y: 0.59375,\n },\n {\n x: 0.53125,\n y: 0.59375,\n },\n {\n x: 0.53125,\n y: 0.59375,\n },\n {\n x: 0.59375,\n y: 0.59375,\n },\n {\n x: 0.59375,\n y: 0.59375,\n },\n {\n x: 0.65625,\n y: 0.59375,\n },\n {\n x: 0.65625,\n y: 0.59375,\n },\n {\n x: 0.71875,\n y: 0.59375,\n },\n {\n x: 0.71875,\n y: 0.59375,\n },\n {\n x: 0.78125,\n y: 0.59375,\n },\n {\n x: 0.78125,\n y: 0.59375,\n },\n {\n x: 0.84375,\n y: 0.59375,\n },\n {\n x: 0.84375,\n y: 0.59375,\n },\n {\n x: 0.90625,\n y: 0.59375,\n },\n {\n x: 0.90625,\n y: 0.59375,\n },\n {\n x: 0.96875,\n y: 0.59375,\n },\n {\n x: 0.96875,\n y: 0.59375,\n },\n {\n x: 0.03125,\n y: 0.65625,\n },\n {\n x: 0.03125,\n y: 0.65625,\n },\n {\n x: 0.09375,\n y: 0.65625,\n },\n {\n x: 0.09375,\n y: 0.65625,\n },\n {\n x: 0.15625,\n y: 0.65625,\n },\n {\n x: 0.15625,\n y: 0.65625,\n },\n {\n x: 0.21875,\n y: 0.65625,\n },\n {\n x: 0.21875,\n y: 0.65625,\n },\n {\n x: 0.28125,\n y: 0.65625,\n },\n {\n x: 0.28125,\n y: 0.65625,\n },\n {\n x: 0.34375,\n y: 0.65625,\n },\n {\n x: 0.34375,\n y: 0.65625,\n },\n {\n x: 0.40625,\n y: 0.65625,\n },\n {\n x: 0.40625,\n y: 0.65625,\n },\n {\n x: 0.46875,\n y: 0.65625,\n },\n {\n x: 0.46875,\n y: 0.65625,\n },\n {\n x: 0.53125,\n y: 0.65625,\n },\n {\n x: 0.53125,\n y: 0.65625,\n },\n {\n x: 0.59375,\n y: 0.65625,\n },\n {\n x: 0.59375,\n y: 0.65625,\n },\n {\n x: 0.65625,\n y: 0.65625,\n },\n {\n x: 0.65625,\n y: 0.65625,\n },\n {\n x: 0.71875,\n y: 0.65625,\n },\n {\n x: 0.71875,\n y: 0.65625,\n },\n {\n x: 0.78125,\n y: 0.65625,\n },\n {\n x: 0.78125,\n y: 0.65625,\n },\n {\n x: 0.84375,\n y: 0.65625,\n },\n {\n x: 0.84375,\n y: 0.65625,\n },\n {\n x: 0.90625,\n y: 0.65625,\n },\n {\n x: 0.90625,\n y: 0.65625,\n },\n {\n x: 0.96875,\n y: 0.65625,\n },\n {\n x: 0.96875,\n y: 0.65625,\n },\n {\n x: 0.03125,\n y: 0.71875,\n },\n {\n x: 0.03125,\n y: 0.71875,\n },\n {\n x: 0.09375,\n y: 0.71875,\n },\n {\n x: 0.09375,\n y: 0.71875,\n },\n {\n x: 0.15625,\n y: 0.71875,\n },\n {\n x: 0.15625,\n y: 0.71875,\n },\n {\n x: 0.21875,\n y: 0.71875,\n },\n {\n x: 0.21875,\n y: 0.71875,\n },\n {\n x: 0.28125,\n y: 0.71875,\n },\n {\n x: 0.28125,\n y: 0.71875,\n },\n {\n x: 0.34375,\n y: 0.71875,\n },\n {\n x: 0.34375,\n y: 0.71875,\n },\n {\n x: 0.40625,\n y: 0.71875,\n },\n {\n x: 0.40625,\n y: 0.71875,\n },\n {\n x: 0.46875,\n y: 0.71875,\n },\n {\n x: 0.46875,\n y: 0.71875,\n },\n {\n x: 0.53125,\n y: 0.71875,\n },\n {\n x: 0.53125,\n y: 0.71875,\n },\n {\n x: 0.59375,\n y: 0.71875,\n },\n {\n x: 0.59375,\n y: 0.71875,\n },\n {\n x: 0.65625,\n y: 0.71875,\n },\n {\n x: 0.65625,\n y: 0.71875,\n },\n {\n x: 0.71875,\n y: 0.71875,\n },\n {\n x: 0.71875,\n y: 0.71875,\n },\n {\n x: 0.78125,\n y: 0.71875,\n },\n {\n x: 0.78125,\n y: 0.71875,\n },\n {\n x: 0.84375,\n y: 0.71875,\n },\n {\n x: 0.84375,\n y: 0.71875,\n },\n {\n x: 0.90625,\n y: 0.71875,\n },\n {\n x: 0.90625,\n y: 0.71875,\n },\n {\n x: 0.96875,\n y: 0.71875,\n },\n {\n x: 0.96875,\n y: 0.71875,\n },\n {\n x: 0.03125,\n y: 0.78125,\n },\n {\n x: 0.03125,\n y: 0.78125,\n },\n {\n x: 0.09375,\n y: 0.78125,\n },\n {\n x: 0.09375,\n y: 0.78125,\n },\n {\n x: 0.15625,\n y: 0.78125,\n },\n {\n x: 0.15625,\n y: 0.78125,\n },\n {\n x: 0.21875,\n y: 0.78125,\n },\n {\n x: 0.21875,\n y: 0.78125,\n },\n {\n x: 0.28125,\n y: 0.78125,\n },\n {\n x: 0.28125,\n y: 0.78125,\n },\n {\n x: 0.34375,\n y: 0.78125,\n },\n {\n x: 0.34375,\n y: 0.78125,\n },\n {\n x: 0.40625,\n y: 0.78125,\n },\n {\n x: 0.40625,\n y: 0.78125,\n },\n {\n x: 0.46875,\n y: 0.78125,\n },\n {\n x: 0.46875,\n y: 0.78125,\n },\n {\n x: 0.53125,\n y: 0.78125,\n },\n {\n x: 0.53125,\n y: 0.78125,\n },\n {\n x: 0.59375,\n y: 0.78125,\n },\n {\n x: 0.59375,\n y: 0.78125,\n },\n {\n x: 0.65625,\n y: 0.78125,\n },\n {\n x: 0.65625,\n y: 0.78125,\n },\n {\n x: 0.71875,\n y: 0.78125,\n },\n {\n x: 0.71875,\n y: 0.78125,\n },\n {\n x: 0.78125,\n y: 0.78125,\n },\n {\n x: 0.78125,\n y: 0.78125,\n },\n {\n x: 0.84375,\n y: 0.78125,\n },\n {\n x: 0.84375,\n y: 0.78125,\n },\n {\n x: 0.90625,\n y: 0.78125,\n },\n {\n x: 0.90625,\n y: 0.78125,\n },\n {\n x: 0.96875,\n y: 0.78125,\n },\n {\n x: 0.96875,\n y: 0.78125,\n },\n {\n x: 0.03125,\n y: 0.84375,\n },\n {\n x: 0.03125,\n y: 0.84375,\n },\n {\n x: 0.09375,\n y: 0.84375,\n },\n {\n x: 0.09375,\n y: 0.84375,\n },\n {\n x: 0.15625,\n y: 0.84375,\n },\n {\n x: 0.15625,\n y: 0.84375,\n },\n {\n x: 0.21875,\n y: 0.84375,\n },\n {\n x: 0.21875,\n y: 0.84375,\n },\n {\n x: 0.28125,\n y: 0.84375,\n },\n {\n x: 0.28125,\n y: 0.84375,\n },\n {\n x: 0.34375,\n y: 0.84375,\n },\n {\n x: 0.34375,\n y: 0.84375,\n },\n {\n x: 0.40625,\n y: 0.84375,\n },\n {\n x: 0.40625,\n y: 0.84375,\n },\n {\n x: 0.46875,\n y: 0.84375,\n },\n {\n x: 0.46875,\n y: 0.84375,\n },\n {\n x: 0.53125,\n y: 0.84375,\n },\n {\n x: 0.53125,\n y: 0.84375,\n },\n {\n x: 0.59375,\n y: 0.84375,\n },\n {\n x: 0.59375,\n y: 0.84375,\n },\n {\n x: 0.65625,\n y: 0.84375,\n },\n {\n x: 0.65625,\n y: 0.84375,\n },\n {\n x: 0.71875,\n y: 0.84375,\n },\n {\n x: 0.71875,\n y: 0.84375,\n },\n {\n x: 0.78125,\n y: 0.84375,\n },\n {\n x: 0.78125,\n y: 0.84375,\n },\n {\n x: 0.84375,\n y: 0.84375,\n },\n {\n x: 0.84375,\n y: 0.84375,\n },\n {\n x: 0.90625,\n y: 0.84375,\n },\n {\n x: 0.90625,\n y: 0.84375,\n },\n {\n x: 0.96875,\n y: 0.84375,\n },\n {\n x: 0.96875,\n y: 0.84375,\n },\n {\n x: 0.03125,\n y: 0.90625,\n },\n {\n x: 0.03125,\n y: 0.90625,\n },\n {\n x: 0.09375,\n y: 0.90625,\n },\n {\n x: 0.09375,\n y: 0.90625,\n },\n {\n x: 0.15625,\n y: 0.90625,\n },\n {\n x: 0.15625,\n y: 0.90625,\n },\n {\n x: 0.21875,\n y: 0.90625,\n },\n {\n x: 0.21875,\n y: 0.90625,\n },\n {\n x: 0.28125,\n y: 0.90625,\n },\n {\n x: 0.28125,\n y: 0.90625,\n },\n {\n x: 0.34375,\n y: 0.90625,\n },\n {\n x: 0.34375,\n y: 0.90625,\n },\n {\n x: 0.40625,\n y: 0.90625,\n },\n {\n x: 0.40625,\n y: 0.90625,\n },\n {\n x: 0.46875,\n y: 0.90625,\n },\n {\n x: 0.46875,\n y: 0.90625,\n },\n {\n x: 0.53125,\n y: 0.90625,\n },\n {\n x: 0.53125,\n y: 0.90625,\n },\n {\n x: 0.59375,\n y: 0.90625,\n },\n {\n x: 0.59375,\n y: 0.90625,\n },\n {\n x: 0.65625,\n y: 0.90625,\n },\n {\n x: 0.65625,\n y: 0.90625,\n },\n {\n x: 0.71875,\n y: 0.90625,\n },\n {\n x: 0.71875,\n y: 0.90625,\n },\n {\n x: 0.78125,\n y: 0.90625,\n },\n {\n x: 0.78125,\n y: 0.90625,\n },\n {\n x: 0.84375,\n y: 0.90625,\n },\n {\n x: 0.84375,\n y: 0.90625,\n },\n {\n x: 0.90625,\n y: 0.90625,\n },\n {\n x: 0.90625,\n y: 0.90625,\n },\n {\n x: 0.96875,\n y: 0.90625,\n },\n {\n x: 0.96875,\n y: 0.90625,\n },\n {\n x: 0.03125,\n y: 0.96875,\n },\n {\n x: 0.03125,\n y: 0.96875,\n },\n {\n x: 0.09375,\n y: 0.96875,\n },\n {\n x: 0.09375,\n y: 0.96875,\n },\n {\n x: 0.15625,\n y: 0.96875,\n },\n {\n x: 0.15625,\n y: 0.96875,\n },\n {\n x: 0.21875,\n y: 0.96875,\n },\n {\n x: 0.21875,\n y: 0.96875,\n },\n {\n x: 0.28125,\n y: 0.96875,\n },\n {\n x: 0.28125,\n y: 0.96875,\n },\n {\n x: 0.34375,\n y: 0.96875,\n },\n {\n x: 0.34375,\n y: 0.96875,\n },\n {\n x: 0.40625,\n y: 0.96875,\n },\n {\n x: 0.40625,\n y: 0.96875,\n },\n {\n x: 0.46875,\n y: 0.96875,\n },\n {\n x: 0.46875,\n y: 0.96875,\n },\n {\n x: 0.53125,\n y: 0.96875,\n },\n {\n x: 0.53125,\n y: 0.96875,\n },\n {\n x: 0.59375,\n y: 0.96875,\n },\n {\n x: 0.59375,\n y: 0.96875,\n },\n {\n x: 0.65625,\n y: 0.96875,\n },\n {\n x: 0.65625,\n y: 0.96875,\n },\n {\n x: 0.71875,\n y: 0.96875,\n },\n {\n x: 0.71875,\n y: 0.96875,\n },\n {\n x: 0.78125,\n y: 0.96875,\n },\n {\n x: 0.78125,\n y: 0.96875,\n },\n {\n x: 0.84375,\n y: 0.96875,\n },\n {\n x: 0.84375,\n y: 0.96875,\n },\n {\n x: 0.90625,\n y: 0.96875,\n },\n {\n x: 0.90625,\n y: 0.96875,\n },\n {\n x: 0.96875,\n y: 0.96875,\n },\n {\n x: 0.96875,\n y: 0.96875,\n },\n {\n x: 0.0625,\n y: 0.0625,\n },\n {\n x: 0.0625,\n y: 0.0625,\n },\n {\n x: 0.0625,\n y: 0.0625,\n },\n {\n x: 0.0625,\n y: 0.0625,\n },\n {\n x: 0.0625,\n y: 0.0625,\n },\n {\n x: 0.0625,\n y: 0.0625,\n },\n {\n x: 0.1875,\n y: 0.0625,\n },\n {\n x: 0.1875,\n y: 0.0625,\n },\n {\n x: 0.1875,\n y: 0.0625,\n },\n {\n x: 0.1875,\n y: 0.0625,\n },\n {\n x: 0.1875,\n y: 0.0625,\n },\n {\n x: 0.1875,\n y: 0.0625,\n },\n {\n x: 0.3125,\n y: 0.0625,\n },\n {\n x: 0.3125,\n y: 0.0625,\n },\n {\n x: 0.3125,\n y: 0.0625,\n },\n {\n x: 0.3125,\n y: 0.0625,\n },\n {\n x: 0.3125,\n y: 0.0625,\n },\n {\n x: 0.3125,\n y: 0.0625,\n },\n {\n x: 0.4375,\n y: 0.0625,\n },\n {\n x: 0.4375,\n y: 0.0625,\n },\n {\n x: 0.4375,\n y: 0.0625,\n },\n {\n x: 0.4375,\n y: 0.0625,\n },\n {\n x: 0.4375,\n y: 0.0625,\n },\n {\n x: 0.4375,\n y: 0.0625,\n },\n {\n x: 0.5625,\n y: 0.0625,\n },\n {\n x: 0.5625,\n y: 0.0625,\n },\n {\n x: 0.5625,\n y: 0.0625,\n },\n {\n x: 0.5625,\n y: 0.0625,\n },\n {\n x: 0.5625,\n y: 0.0625,\n },\n {\n x: 0.5625,\n y: 0.0625,\n },\n {\n x: 0.6875,\n y: 0.0625,\n },\n {\n x: 0.6875,\n y: 0.0625,\n },\n {\n x: 0.6875,\n y: 0.0625,\n },\n {\n x: 0.6875,\n y: 0.0625,\n },\n {\n x: 0.6875,\n y: 0.0625,\n },\n {\n x: 0.6875,\n y: 0.0625,\n },\n {\n x: 0.8125,\n y: 0.0625,\n },\n {\n x: 0.8125,\n y: 0.0625,\n },\n {\n x: 0.8125,\n y: 0.0625,\n },\n {\n x: 0.8125,\n y: 0.0625,\n },\n {\n x: 0.8125,\n y: 0.0625,\n },\n {\n x: 0.8125,\n y: 0.0625,\n },\n {\n x: 0.9375,\n y: 0.0625,\n },\n {\n x: 0.9375,\n y: 0.0625,\n },\n {\n x: 0.9375,\n y: 0.0625,\n },\n {\n x: 0.9375,\n y: 0.0625,\n },\n {\n x: 0.9375,\n y: 0.0625,\n },\n {\n x: 0.9375,\n y: 0.0625,\n },\n {\n x: 0.0625,\n y: 0.1875,\n },\n {\n x: 0.0625,\n y: 0.1875,\n },\n {\n x: 0.0625,\n y: 0.1875,\n },\n {\n x: 0.0625,\n y: 0.1875,\n },\n {\n x: 0.0625,\n y: 0.1875,\n },\n {\n x: 0.0625,\n y: 0.1875,\n },\n {\n x: 0.1875,\n y: 0.1875,\n },\n {\n x: 0.1875,\n y: 0.1875,\n },\n {\n x: 0.1875,\n y: 0.1875,\n },\n {\n x: 0.1875,\n y: 0.1875,\n },\n {\n x: 0.1875,\n y: 0.1875,\n },\n {\n x: 0.1875,\n y: 0.1875,\n },\n {\n x: 0.3125,\n y: 0.1875,\n },\n {\n x: 0.3125,\n y: 0.1875,\n },\n {\n x: 0.3125,\n y: 0.1875,\n },\n {\n x: 0.3125,\n y: 0.1875,\n },\n {\n x: 0.3125,\n y: 0.1875,\n },\n {\n x: 0.3125,\n y: 0.1875,\n },\n {\n x: 0.4375,\n y: 0.1875,\n },\n {\n x: 0.4375,\n y: 0.1875,\n },\n {\n x: 0.4375,\n y: 0.1875,\n },\n {\n x: 0.4375,\n y: 0.1875,\n },\n {\n x: 0.4375,\n y: 0.1875,\n },\n {\n x: 0.4375,\n y: 0.1875,\n },\n {\n x: 0.5625,\n y: 0.1875,\n },\n {\n x: 0.5625,\n y: 0.1875,\n },\n {\n x: 0.5625,\n y: 0.1875,\n },\n {\n x: 0.5625,\n y: 0.1875,\n },\n {\n x: 0.5625,\n y: 0.1875,\n },\n {\n x: 0.5625,\n y: 0.1875,\n },\n {\n x: 0.6875,\n y: 0.1875,\n },\n {\n x: 0.6875,\n y: 0.1875,\n },\n {\n x: 0.6875,\n y: 0.1875,\n },\n {\n x: 0.6875,\n y: 0.1875,\n },\n {\n x: 0.6875,\n y: 0.1875,\n },\n {\n x: 0.6875,\n y: 0.1875,\n },\n {\n x: 0.8125,\n y: 0.1875,\n },\n {\n x: 0.8125,\n y: 0.1875,\n },\n {\n x: 0.8125,\n y: 0.1875,\n },\n {\n x: 0.8125,\n y: 0.1875,\n },\n {\n x: 0.8125,\n y: 0.1875,\n },\n {\n x: 0.8125,\n y: 0.1875,\n },\n {\n x: 0.9375,\n y: 0.1875,\n },\n {\n x: 0.9375,\n y: 0.1875,\n },\n {\n x: 0.9375,\n y: 0.1875,\n },\n {\n x: 0.9375,\n y: 0.1875,\n },\n {\n x: 0.9375,\n y: 0.1875,\n },\n {\n x: 0.9375,\n y: 0.1875,\n },\n {\n x: 0.0625,\n y: 0.3125,\n },\n {\n x: 0.0625,\n y: 0.3125,\n },\n {\n x: 0.0625,\n y: 0.3125,\n },\n {\n x: 0.0625,\n y: 0.3125,\n },\n {\n x: 0.0625,\n y: 0.3125,\n },\n {\n x: 0.0625,\n y: 0.3125,\n },\n {\n x: 0.1875,\n y: 0.3125,\n },\n {\n x: 0.1875,\n y: 0.3125,\n },\n {\n x: 0.1875,\n y: 0.3125,\n },\n {\n x: 0.1875,\n y: 0.3125,\n },\n {\n x: 0.1875,\n y: 0.3125,\n },\n {\n x: 0.1875,\n y: 0.3125,\n },\n {\n x: 0.3125,\n y: 0.3125,\n },\n {\n x: 0.3125,\n y: 0.3125,\n },\n {\n x: 0.3125,\n y: 0.3125,\n },\n {\n x: 0.3125,\n y: 0.3125,\n },\n {\n x: 0.3125,\n y: 0.3125,\n },\n {\n x: 0.3125,\n y: 0.3125,\n },\n {\n x: 0.4375,\n y: 0.3125,\n },\n {\n x: 0.4375,\n y: 0.3125,\n },\n {\n x: 0.4375,\n y: 0.3125,\n },\n {\n x: 0.4375,\n y: 0.3125,\n },\n {\n x: 0.4375,\n y: 0.3125,\n },\n {\n x: 0.4375,\n y: 0.3125,\n },\n {\n x: 0.5625,\n y: 0.3125,\n },\n {\n x: 0.5625,\n y: 0.3125,\n },\n {\n x: 0.5625,\n y: 0.3125,\n },\n {\n x: 0.5625,\n y: 0.3125,\n },\n {\n x: 0.5625,\n y: 0.3125,\n },\n {\n x: 0.5625,\n y: 0.3125,\n },\n {\n x: 0.6875,\n y: 0.3125,\n },\n {\n x: 0.6875,\n y: 0.3125,\n },\n {\n x: 0.6875,\n y: 0.3125,\n },\n {\n x: 0.6875,\n y: 0.3125,\n },\n {\n x: 0.6875,\n y: 0.3125,\n },\n {\n x: 0.6875,\n y: 0.3125,\n },\n {\n x: 0.8125,\n y: 0.3125,\n },\n {\n x: 0.8125,\n y: 0.3125,\n },\n {\n x: 0.8125,\n y: 0.3125,\n },\n {\n x: 0.8125,\n y: 0.3125,\n },\n {\n x: 0.8125,\n y: 0.3125,\n },\n {\n x: 0.8125,\n y: 0.3125,\n },\n {\n x: 0.9375,\n y: 0.3125,\n },\n {\n x: 0.9375,\n y: 0.3125,\n },\n {\n x: 0.9375,\n y: 0.3125,\n },\n {\n x: 0.9375,\n y: 0.3125,\n },\n {\n x: 0.9375,\n y: 0.3125,\n },\n {\n x: 0.9375,\n y: 0.3125,\n },\n {\n x: 0.0625,\n y: 0.4375,\n },\n {\n x: 0.0625,\n y: 0.4375,\n },\n {\n x: 0.0625,\n y: 0.4375,\n },\n {\n x: 0.0625,\n y: 0.4375,\n },\n {\n x: 0.0625,\n y: 0.4375,\n },\n {\n x: 0.0625,\n y: 0.4375,\n },\n {\n x: 0.1875,\n y: 0.4375,\n },\n {\n x: 0.1875,\n y: 0.4375,\n },\n {\n x: 0.1875,\n y: 0.4375,\n },\n {\n x: 0.1875,\n y: 0.4375,\n },\n {\n x: 0.1875,\n y: 0.4375,\n },\n {\n x: 0.1875,\n y: 0.4375,\n },\n {\n x: 0.3125,\n y: 0.4375,\n },\n {\n x: 0.3125,\n y: 0.4375,\n },\n {\n x: 0.3125,\n y: 0.4375,\n },\n {\n x: 0.3125,\n y: 0.4375,\n },\n {\n x: 0.3125,\n y: 0.4375,\n },\n {\n x: 0.3125,\n y: 0.4375,\n },\n {\n x: 0.4375,\n y: 0.4375,\n },\n {\n x: 0.4375,\n y: 0.4375,\n },\n {\n x: 0.4375,\n y: 0.4375,\n },\n {\n x: 0.4375,\n y: 0.4375,\n },\n {\n x: 0.4375,\n y: 0.4375,\n },\n {\n x: 0.4375,\n y: 0.4375,\n },\n {\n x: 0.5625,\n y: 0.4375,\n },\n {\n x: 0.5625,\n y: 0.4375,\n },\n {\n x: 0.5625,\n y: 0.4375,\n },\n {\n x: 0.5625,\n y: 0.4375,\n },\n {\n x: 0.5625,\n y: 0.4375,\n },\n {\n x: 0.5625,\n y: 0.4375,\n },\n {\n x: 0.6875,\n y: 0.4375,\n },\n {\n x: 0.6875,\n y: 0.4375,\n },\n {\n x: 0.6875,\n y: 0.4375,\n },\n {\n x: 0.6875,\n y: 0.4375,\n },\n {\n x: 0.6875,\n y: 0.4375,\n },\n {\n x: 0.6875,\n y: 0.4375,\n },\n {\n x: 0.8125,\n y: 0.4375,\n },\n {\n x: 0.8125,\n y: 0.4375,\n },\n {\n x: 0.8125,\n y: 0.4375,\n },\n {\n x: 0.8125,\n y: 0.4375,\n },\n {\n x: 0.8125,\n y: 0.4375,\n },\n {\n x: 0.8125,\n y: 0.4375,\n },\n {\n x: 0.9375,\n y: 0.4375,\n },\n {\n x: 0.9375,\n y: 0.4375,\n },\n {\n x: 0.9375,\n y: 0.4375,\n },\n {\n x: 0.9375,\n y: 0.4375,\n },\n {\n x: 0.9375,\n y: 0.4375,\n },\n {\n x: 0.9375,\n y: 0.4375,\n },\n {\n x: 0.0625,\n y: 0.5625,\n },\n {\n x: 0.0625,\n y: 0.5625,\n },\n {\n x: 0.0625,\n y: 0.5625,\n },\n {\n x: 0.0625,\n y: 0.5625,\n },\n {\n x: 0.0625,\n y: 0.5625,\n },\n {\n x: 0.0625,\n y: 0.5625,\n },\n {\n x: 0.1875,\n y: 0.5625,\n },\n {\n x: 0.1875,\n y: 0.5625,\n },\n {\n x: 0.1875,\n y: 0.5625,\n },\n {\n x: 0.1875,\n y: 0.5625,\n },\n {\n x: 0.1875,\n y: 0.5625,\n },\n {\n x: 0.1875,\n y: 0.5625,\n },\n {\n x: 0.3125,\n y: 0.5625,\n },\n {\n x: 0.3125,\n y: 0.5625,\n },\n {\n x: 0.3125,\n y: 0.5625,\n },\n {\n x: 0.3125,\n y: 0.5625,\n },\n {\n x: 0.3125,\n y: 0.5625,\n },\n {\n x: 0.3125,\n y: 0.5625,\n },\n {\n x: 0.4375,\n y: 0.5625,\n },\n {\n x: 0.4375,\n y: 0.5625,\n },\n {\n x: 0.4375,\n y: 0.5625,\n },\n {\n x: 0.4375,\n y: 0.5625,\n },\n {\n x: 0.4375,\n y: 0.5625,\n },\n {\n x: 0.4375,\n y: 0.5625,\n },\n {\n x: 0.5625,\n y: 0.5625,\n },\n {\n x: 0.5625,\n y: 0.5625,\n },\n {\n x: 0.5625,\n y: 0.5625,\n },\n {\n x: 0.5625,\n y: 0.5625,\n },\n {\n x: 0.5625,\n y: 0.5625,\n },\n {\n x: 0.5625,\n y: 0.5625,\n },\n {\n x: 0.6875,\n y: 0.5625,\n },\n {\n x: 0.6875,\n y: 0.5625,\n },\n {\n x: 0.6875,\n y: 0.5625,\n },\n {\n x: 0.6875,\n y: 0.5625,\n },\n {\n x: 0.6875,\n y: 0.5625,\n },\n {\n x: 0.6875,\n y: 0.5625,\n },\n {\n x: 0.8125,\n y: 0.5625,\n },\n {\n x: 0.8125,\n y: 0.5625,\n },\n {\n x: 0.8125,\n y: 0.5625,\n },\n {\n x: 0.8125,\n y: 0.5625,\n },\n {\n x: 0.8125,\n y: 0.5625,\n },\n {\n x: 0.8125,\n y: 0.5625,\n },\n {\n x: 0.9375,\n y: 0.5625,\n },\n {\n x: 0.9375,\n y: 0.5625,\n },\n {\n x: 0.9375,\n y: 0.5625,\n },\n {\n x: 0.9375,\n y: 0.5625,\n },\n {\n x: 0.9375,\n y: 0.5625,\n },\n {\n x: 0.9375,\n y: 0.5625,\n },\n {\n x: 0.0625,\n y: 0.6875,\n },\n {\n x: 0.0625,\n y: 0.6875,\n },\n {\n x: 0.0625,\n y: 0.6875,\n },\n {\n x: 0.0625,\n y: 0.6875,\n },\n {\n x: 0.0625,\n y: 0.6875,\n },\n {\n x: 0.0625,\n y: 0.6875,\n },\n {\n x: 0.1875,\n y: 0.6875,\n },\n {\n x: 0.1875,\n y: 0.6875,\n },\n {\n x: 0.1875,\n y: 0.6875,\n },\n {\n x: 0.1875,\n y: 0.6875,\n },\n {\n x: 0.1875,\n y: 0.6875,\n },\n {\n x: 0.1875,\n y: 0.6875,\n },\n {\n x: 0.3125,\n y: 0.6875,\n },\n {\n x: 0.3125,\n y: 0.6875,\n },\n {\n x: 0.3125,\n y: 0.6875,\n },\n {\n x: 0.3125,\n y: 0.6875,\n },\n {\n x: 0.3125,\n y: 0.6875,\n },\n {\n x: 0.3125,\n y: 0.6875,\n },\n {\n x: 0.4375,\n y: 0.6875,\n },\n {\n x: 0.4375,\n y: 0.6875,\n },\n {\n x: 0.4375,\n y: 0.6875,\n },\n {\n x: 0.4375,\n y: 0.6875,\n },\n {\n x: 0.4375,\n y: 0.6875,\n },\n {\n x: 0.4375,\n y: 0.6875,\n },\n {\n x: 0.5625,\n y: 0.6875,\n },\n {\n x: 0.5625,\n y: 0.6875,\n },\n {\n x: 0.5625,\n y: 0.6875,\n },\n {\n x: 0.5625,\n y: 0.6875,\n },\n {\n x: 0.5625,\n y: 0.6875,\n },\n {\n x: 0.5625,\n y: 0.6875,\n },\n {\n x: 0.6875,\n y: 0.6875,\n },\n {\n x: 0.6875,\n y: 0.6875,\n },\n {\n x: 0.6875,\n y: 0.6875,\n },\n {\n x: 0.6875,\n y: 0.6875,\n },\n {\n x: 0.6875,\n y: 0.6875,\n },\n {\n x: 0.6875,\n y: 0.6875,\n },\n {\n x: 0.8125,\n y: 0.6875,\n },\n {\n x: 0.8125,\n y: 0.6875,\n },\n {\n x: 0.8125,\n y: 0.6875,\n },\n {\n x: 0.8125,\n y: 0.6875,\n },\n {\n x: 0.8125,\n y: 0.6875,\n },\n {\n x: 0.8125,\n y: 0.6875,\n },\n {\n x: 0.9375,\n y: 0.6875,\n },\n {\n x: 0.9375,\n y: 0.6875,\n },\n {\n x: 0.9375,\n y: 0.6875,\n },\n {\n x: 0.9375,\n y: 0.6875,\n },\n {\n x: 0.9375,\n y: 0.6875,\n },\n {\n x: 0.9375,\n y: 0.6875,\n },\n {\n x: 0.0625,\n y: 0.8125,\n },\n {\n x: 0.0625,\n y: 0.8125,\n },\n {\n x: 0.0625,\n y: 0.8125,\n },\n {\n x: 0.0625,\n y: 0.8125,\n },\n {\n x: 0.0625,\n y: 0.8125,\n },\n {\n x: 0.0625,\n y: 0.8125,\n },\n {\n x: 0.1875,\n y: 0.8125,\n },\n {\n x: 0.1875,\n y: 0.8125,\n },\n {\n x: 0.1875,\n y: 0.8125,\n },\n {\n x: 0.1875,\n y: 0.8125,\n },\n {\n x: 0.1875,\n y: 0.8125,\n },\n {\n x: 0.1875,\n y: 0.8125,\n },\n {\n x: 0.3125,\n y: 0.8125,\n },\n {\n x: 0.3125,\n y: 0.8125,\n },\n {\n x: 0.3125,\n y: 0.8125,\n },\n {\n x: 0.3125,\n y: 0.8125,\n },\n {\n x: 0.3125,\n y: 0.8125,\n },\n {\n x: 0.3125,\n y: 0.8125,\n },\n {\n x: 0.4375,\n y: 0.8125,\n },\n {\n x: 0.4375,\n y: 0.8125,\n },\n {\n x: 0.4375,\n y: 0.8125,\n },\n {\n x: 0.4375,\n y: 0.8125,\n },\n {\n x: 0.4375,\n y: 0.8125,\n },\n {\n x: 0.4375,\n y: 0.8125,\n },\n {\n x: 0.5625,\n y: 0.8125,\n },\n {\n x: 0.5625,\n y: 0.8125,\n },\n {\n x: 0.5625,\n y: 0.8125,\n },\n {\n x: 0.5625,\n y: 0.8125,\n },\n {\n x: 0.5625,\n y: 0.8125,\n },\n {\n x: 0.5625,\n y: 0.8125,\n },\n {\n x: 0.6875,\n y: 0.8125,\n },\n {\n x: 0.6875,\n y: 0.8125,\n },\n {\n x: 0.6875,\n y: 0.8125,\n },\n {\n x: 0.6875,\n y: 0.8125,\n },\n {\n x: 0.6875,\n y: 0.8125,\n },\n {\n x: 0.6875,\n y: 0.8125,\n },\n {\n x: 0.8125,\n y: 0.8125,\n },\n {\n x: 0.8125,\n y: 0.8125,\n },\n {\n x: 0.8125,\n y: 0.8125,\n },\n {\n x: 0.8125,\n y: 0.8125,\n },\n {\n x: 0.8125,\n y: 0.8125,\n },\n {\n x: 0.8125,\n y: 0.8125,\n },\n {\n x: 0.9375,\n y: 0.8125,\n },\n {\n x: 0.9375,\n y: 0.8125,\n },\n {\n x: 0.9375,\n y: 0.8125,\n },\n {\n x: 0.9375,\n y: 0.8125,\n },\n {\n x: 0.9375,\n y: 0.8125,\n },\n {\n x: 0.9375,\n y: 0.8125,\n },\n {\n x: 0.0625,\n y: 0.9375,\n },\n {\n x: 0.0625,\n y: 0.9375,\n },\n {\n x: 0.0625,\n y: 0.9375,\n },\n {\n x: 0.0625,\n y: 0.9375,\n },\n {\n x: 0.0625,\n y: 0.9375,\n },\n {\n x: 0.0625,\n y: 0.9375,\n },\n {\n x: 0.1875,\n y: 0.9375,\n },\n {\n x: 0.1875,\n y: 0.9375,\n },\n {\n x: 0.1875,\n y: 0.9375,\n },\n {\n x: 0.1875,\n y: 0.9375,\n },\n {\n x: 0.1875,\n y: 0.9375,\n },\n {\n x: 0.1875,\n y: 0.9375,\n },\n {\n x: 0.3125,\n y: 0.9375,\n },\n {\n x: 0.3125,\n y: 0.9375,\n },\n {\n x: 0.3125,\n y: 0.9375,\n },\n {\n x: 0.3125,\n y: 0.9375,\n },\n {\n x: 0.3125,\n y: 0.9375,\n },\n {\n x: 0.3125,\n y: 0.9375,\n },\n {\n x: 0.4375,\n y: 0.9375,\n },\n {\n x: 0.4375,\n y: 0.9375,\n },\n {\n x: 0.4375,\n y: 0.9375,\n },\n {\n x: 0.4375,\n y: 0.9375,\n },\n {\n x: 0.4375,\n y: 0.9375,\n },\n {\n x: 0.4375,\n y: 0.9375,\n },\n {\n x: 0.5625,\n y: 0.9375,\n },\n {\n x: 0.5625,\n y: 0.9375,\n },\n {\n x: 0.5625,\n y: 0.9375,\n },\n {\n x: 0.5625,\n y: 0.9375,\n },\n {\n x: 0.5625,\n y: 0.9375,\n },\n {\n x: 0.5625,\n y: 0.9375,\n },\n {\n x: 0.6875,\n y: 0.9375,\n },\n {\n x: 0.6875,\n y: 0.9375,\n },\n {\n x: 0.6875,\n y: 0.9375,\n },\n {\n x: 0.6875,\n y: 0.9375,\n },\n {\n x: 0.6875,\n y: 0.9375,\n },\n {\n x: 0.6875,\n y: 0.9375,\n },\n {\n x: 0.8125,\n y: 0.9375,\n },\n {\n x: 0.8125,\n y: 0.9375,\n },\n {\n x: 0.8125,\n y: 0.9375,\n },\n {\n x: 0.8125,\n y: 0.9375,\n },\n {\n x: 0.8125,\n y: 0.9375,\n },\n {\n x: 0.8125,\n y: 0.9375,\n },\n {\n x: 0.9375,\n y: 0.9375,\n },\n {\n x: 0.9375,\n y: 0.9375,\n },\n {\n x: 0.9375,\n y: 0.9375,\n },\n {\n x: 0.9375,\n y: 0.9375,\n },\n {\n x: 0.9375,\n y: 0.9375,\n },\n {\n x: 0.9375,\n y: 0.9375,\n },\n];\n", "import * as tf from '../../dist/tfjs.esm.js';\nimport * as box from './box';\nimport * as anchors from './anchors';\n\nexport class HandDetector {\n model: any;\n anchors: any;\n anchorsTensor: any;\n inputSize: number;\n inputSizeTensor: any;\n doubleInputSizeTensor: any;\n\n constructor(model) {\n this.model = model;\n this.anchors = anchors.anchors.map((anchor) => [anchor.x, anchor.y]);\n this.anchorsTensor = tf.tensor2d(this.anchors);\n this.inputSize = this.model?.inputs[0].shape[2];\n this.inputSizeTensor = tf.tensor1d([this.inputSize, this.inputSize]);\n this.doubleInputSizeTensor = tf.tensor1d([this.inputSize * 2, this.inputSize * 2]);\n }\n\n normalizeBoxes(boxes) {\n return tf.tidy(() => {\n const boxOffsets = tf.slice(boxes, [0, 0], [-1, 2]);\n const boxSizes = tf.slice(boxes, [0, 2], [-1, 2]);\n const boxCenterPoints = tf.add(tf.div(boxOffsets, this.inputSizeTensor), this.anchorsTensor);\n const halfBoxSizes = tf.div(boxSizes, this.doubleInputSizeTensor);\n const startPoints = tf.mul(tf.sub(boxCenterPoints, halfBoxSizes), this.inputSizeTensor);\n const endPoints = tf.mul(tf.add(boxCenterPoints, halfBoxSizes), this.inputSizeTensor);\n return tf.concat2d([startPoints, endPoints], 1);\n });\n }\n\n normalizeLandmarks(rawPalmLandmarks, index) {\n return tf.tidy(() => {\n const landmarks = tf.add(tf.div(rawPalmLandmarks.reshape([-1, 7, 2]), this.inputSizeTensor), this.anchors[index]);\n return tf.mul(landmarks, this.inputSizeTensor);\n });\n }\n\n async getBoxes(input, config) {\n const batched = this.model.predict(input);\n const predictions = batched.squeeze();\n batched.dispose();\n const scoresT = tf.tidy(() => tf.sigmoid(tf.slice(predictions, [0, 0], [-1, 1])).squeeze());\n const scores = scoresT.dataSync();\n const rawBoxes = tf.slice(predictions, [0, 1], [-1, 4]);\n const boxes = this.normalizeBoxes(rawBoxes);\n rawBoxes.dispose();\n const filteredT = await tf.image.nonMaxSuppressionAsync(boxes, scores, config.hand.maxDetected, config.hand.iouThreshold, config.hand.minConfidence);\n const filtered = filteredT.arraySync();\n\n scoresT.dispose();\n filteredT.dispose();\n const hands: Array<{ box: any, palmLandmarks: any, confidence: number }> = [];\n for (const index of filtered) {\n if (scores[index] >= config.hand.minConfidence) {\n const matchingBox = tf.slice(boxes, [index, 0], [1, -1]);\n const rawPalmLandmarks = tf.slice(predictions, [index, 5], [1, 14]);\n const palmLandmarks = tf.tidy(() => this.normalizeLandmarks(rawPalmLandmarks, index).reshape([-1, 2]));\n rawPalmLandmarks.dispose();\n hands.push({ box: matchingBox, palmLandmarks, confidence: scores[index] });\n }\n }\n predictions.dispose();\n boxes.dispose();\n return hands;\n }\n\n async estimateHandBounds(input, config) {\n const inputHeight = input.shape[1];\n const inputWidth = input.shape[2];\n const image = tf.tidy(() => input.resizeBilinear([this.inputSize, this.inputSize]).div(127.5).sub(1));\n const predictions = await this.getBoxes(image, config);\n image.dispose();\n const hands: Array<{}> = [];\n if (!predictions || predictions.length === 0) return hands;\n for (const prediction of predictions) {\n const boxes = prediction.box.dataSync();\n const startPoint = boxes.slice(0, 2);\n const endPoint = boxes.slice(2, 4);\n const palmLandmarks = prediction.palmLandmarks.arraySync();\n prediction.box.dispose();\n prediction.palmLandmarks.dispose();\n hands.push(box.scaleBoxCoordinates({ startPoint, endPoint, palmLandmarks, confidence: prediction.confidence }, [inputWidth / this.inputSize, inputHeight / this.inputSize]));\n }\n return hands;\n }\n}\n", "export function normalizeRadians(angle) {\n return angle - 2 * Math.PI * Math.floor((angle + Math.PI) / (2 * Math.PI));\n}\n\nexport function computeRotation(point1, point2) {\n const radians = Math.PI / 2 - Math.atan2(-(point2[1] - point1[1]), point2[0] - point1[0]);\n return normalizeRadians(radians);\n}\n\nexport const buildTranslationMatrix = (x, y) => [[1, 0, x], [0, 1, y], [0, 0, 1]];\n\nexport function dot(v1, v2) {\n let product = 0;\n for (let i = 0; i < v1.length; i++) {\n product += v1[i] * v2[i];\n }\n return product;\n}\n\nexport function getColumnFrom2DArr(arr, columnIndex) {\n const column: Array = [];\n for (let i = 0; i < arr.length; i++) {\n column.push(arr[i][columnIndex]);\n }\n return column;\n}\n\nexport function multiplyTransformMatrices(mat1, mat2) {\n const product: Array = [];\n const size = mat1.length;\n for (let row = 0; row < size; row++) {\n product.push([]);\n for (let col = 0; col < size; col++) {\n product[row].push(dot(mat1[row], getColumnFrom2DArr(mat2, col)));\n }\n }\n return product;\n}\n\nexport function buildRotationMatrix(rotation, center) {\n const cosA = Math.cos(rotation);\n const sinA = Math.sin(rotation);\n const rotationMatrix = [[cosA, -sinA, 0], [sinA, cosA, 0], [0, 0, 1]];\n const translationMatrix = buildTranslationMatrix(center[0], center[1]);\n const translationTimesRotation = multiplyTransformMatrices(translationMatrix, rotationMatrix);\n const negativeTranslationMatrix = buildTranslationMatrix(-center[0], -center[1]);\n return multiplyTransformMatrices(translationTimesRotation, negativeTranslationMatrix);\n}\n\nexport function invertTransformMatrix(matrix) {\n const rotationComponent = [[matrix[0][0], matrix[1][0]], [matrix[0][1], matrix[1][1]]];\n const translationComponent = [matrix[0][2], matrix[1][2]];\n const invertedTranslation = [\n -dot(rotationComponent[0], translationComponent),\n -dot(rotationComponent[1], translationComponent),\n ];\n return [\n rotationComponent[0].concat(invertedTranslation[0]),\n rotationComponent[1].concat(invertedTranslation[1]),\n [0, 0, 1],\n ];\n}\n\nexport function rotatePoint(homogeneousCoordinate, rotationMatrix) {\n return [\n dot(homogeneousCoordinate, rotationMatrix[0]),\n dot(homogeneousCoordinate, rotationMatrix[1]),\n ];\n}\n", "import * as tf from '../../dist/tfjs.esm.js';\nimport * as box from './box';\nimport * as util from './util';\n\nconst palmBoxEnlargeFactor = 5; // default 3\nconst handBoxEnlargeFactor = 1.65; // default 1.65\nconst palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2];\nconst palmLandmarksPalmBase = 0;\nconst palmLandmarksMiddleFingerBase = 2;\n\nexport class HandPipeline {\n handDetector: any;\n landmarkDetector: any;\n inputSize: number;\n storedBoxes: any;\n skipped: number;\n detectedHands: number;\n\n constructor(handDetector, landmarkDetector) {\n this.handDetector = handDetector;\n this.landmarkDetector = landmarkDetector;\n this.inputSize = this.landmarkDetector?.inputs[0].shape[2];\n this.storedBoxes = [];\n this.skipped = 0;\n this.detectedHands = 0;\n }\n\n // eslint-disable-next-line class-methods-use-this\n calculateLandmarksBoundingBox(landmarks) {\n const xs = landmarks.map((d) => d[0]);\n const ys = landmarks.map((d) => d[1]);\n const startPoint = [Math.min(...xs), Math.min(...ys)];\n const endPoint = [Math.max(...xs), Math.max(...ys)];\n return { startPoint, endPoint };\n }\n\n getBoxForPalmLandmarks(palmLandmarks, rotationMatrix) {\n const rotatedPalmLandmarks = palmLandmarks.map((coord) => util.rotatePoint([...coord, 1], rotationMatrix));\n const boxAroundPalm = this.calculateLandmarksBoundingBox(rotatedPalmLandmarks);\n return box.enlargeBox(box.squarifyBox(boxAroundPalm), palmBoxEnlargeFactor);\n }\n\n getBoxForHandLandmarks(landmarks) {\n const boundingBox = this.calculateLandmarksBoundingBox(landmarks);\n const boxAroundHand = box.enlargeBox(box.squarifyBox(boundingBox), handBoxEnlargeFactor);\n boxAroundHand.palmLandmarks = [];\n for (let i = 0; i < palmLandmarkIds.length; i++) {\n boxAroundHand.palmLandmarks.push(landmarks[palmLandmarkIds[i]].slice(0, 2));\n }\n return boxAroundHand;\n }\n\n transformRawCoords(rawCoords, box2, angle, rotationMatrix) {\n const boxSize = box.getBoxSize(box2);\n const scaleFactor = [boxSize[0] / this.inputSize, boxSize[1] / this.inputSize, (boxSize[0] + boxSize[1]) / this.inputSize / 2];\n const coordsScaled = rawCoords.map((coord) => [\n scaleFactor[0] * (coord[0] - this.inputSize / 2),\n scaleFactor[1] * (coord[1] - this.inputSize / 2),\n scaleFactor[2] * coord[2],\n ]);\n const coordsRotationMatrix = util.buildRotationMatrix(angle, [0, 0]);\n const coordsRotated = coordsScaled.map((coord) => {\n const rotated = util.rotatePoint(coord, coordsRotationMatrix);\n return [...rotated, coord[2]];\n });\n const inverseRotationMatrix = util.invertTransformMatrix(rotationMatrix);\n const boxCenter = [...box.getBoxCenter(box2), 1];\n const originalBoxCenter = [\n util.dot(boxCenter, inverseRotationMatrix[0]),\n util.dot(boxCenter, inverseRotationMatrix[1]),\n ];\n return coordsRotated.map((coord) => [\n coord[0] + originalBoxCenter[0],\n coord[1] + originalBoxCenter[1],\n coord[2],\n ]);\n }\n\n async estimateHands(image, config) {\n let useFreshBox = false;\n\n // run new detector every skipFrames unless we only want box to start with\n let boxes;\n if ((this.skipped === 0) || (this.skipped > config.hand.skipFrames) || !config.hand.landmarks || !config.videoOptimized) {\n boxes = await this.handDetector.estimateHandBounds(image, config);\n this.skipped = 0;\n }\n if (config.videoOptimized) this.skipped++;\n\n // if detector result count doesn't match current working set, use it to reset current working set\n if (boxes && (boxes.length > 0) && ((boxes.length !== this.detectedHands) && (this.detectedHands !== config.hand.maxDetected) || !config.hand.landmarks)) {\n this.detectedHands = 0;\n this.storedBoxes = [...boxes];\n // for (const possible of boxes) this.storedBoxes.push(possible);\n if (this.storedBoxes.length > 0) useFreshBox = true;\n }\n const hands: Array<{}> = [];\n\n if (config.hand.skipInitial && this.detectedHands === 0) this.skipped = 0;\n\n // go through working set of boxes\n for (let i = 0; i < this.storedBoxes.length; i++) {\n const currentBox = this.storedBoxes[i];\n if (!currentBox) continue;\n if (config.hand.landmarks) {\n const angle = config.hand.rotation ? util.computeRotation(currentBox.palmLandmarks[palmLandmarksPalmBase], currentBox.palmLandmarks[palmLandmarksMiddleFingerBase]) : 0;\n const palmCenter = box.getBoxCenter(currentBox);\n const palmCenterNormalized = [palmCenter[0] / image.shape[2], palmCenter[1] / image.shape[1]];\n const rotatedImage = config.hand.rotation ? tf.image.rotateWithOffset(image, angle, 0, palmCenterNormalized) : image.clone();\n const rotationMatrix = util.buildRotationMatrix(-angle, palmCenter);\n const newBox = useFreshBox ? this.getBoxForPalmLandmarks(currentBox.palmLandmarks, rotationMatrix) : currentBox;\n const croppedInput = box.cutBoxFromImageAndResize(newBox, rotatedImage, [this.inputSize, this.inputSize]);\n const handImage = croppedInput.div(255);\n croppedInput.dispose();\n rotatedImage.dispose();\n const [confidenceT, keypoints] = await this.landmarkDetector.predict(handImage);\n handImage.dispose();\n const confidence = confidenceT.dataSync()[0];\n confidenceT.dispose();\n if (confidence >= config.hand.minConfidence) {\n const keypointsReshaped = tf.reshape(keypoints, [-1, 3]);\n const rawCoords = keypointsReshaped.arraySync();\n keypoints.dispose();\n keypointsReshaped.dispose();\n const coords = this.transformRawCoords(rawCoords, newBox, angle, rotationMatrix);\n const nextBoundingBox = this.getBoxForHandLandmarks(coords);\n this.storedBoxes[i] = nextBoundingBox;\n const result = {\n landmarks: coords,\n confidence,\n box: { topLeft: nextBoundingBox.startPoint, bottomRight: nextBoundingBox.endPoint },\n };\n hands.push(result);\n } else {\n this.storedBoxes[i] = null;\n }\n keypoints.dispose();\n } else {\n // const enlarged = box.enlargeBox(box.squarifyBox(box.shiftBox(currentBox, HAND_BOX_SHIFT_VECTOR)), handBoxEnlargeFactor);\n const enlarged = box.enlargeBox(box.squarifyBox(currentBox), handBoxEnlargeFactor);\n const result = {\n confidence: currentBox.confidence,\n box: { topLeft: enlarged.startPoint, bottomRight: enlarged.endPoint },\n };\n hands.push(result);\n }\n }\n this.storedBoxes = this.storedBoxes.filter((a) => a !== null);\n this.detectedHands = hands.length;\n return hands;\n }\n}\n", "// paper: https://ai.googleblog.com/2020/08/on-device-real-time-body-pose-tracking.html\n\nimport { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport * as annotations from './annotations';\n\nlet model;\n\nexport async function load(config) {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.body.modelPath));\n model.width = parseInt(model.signature.inputs['input_1:0'].tensorShape.dim[2].size);\n model.height = parseInt(model.signature.inputs['input_1:0'].tensorShape.dim[1].size);\n if (!model || !model.modelUrl) log('load model failed:', config.body.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n\nexport async function predict(image, config) {\n if (!model) return null;\n if (!config.body.enabled) return null;\n const imgSize = { width: image.shape[2], height: image.shape[1] };\n const resize = tf.image.resizeBilinear(image, [model.width, model.height], false);\n const normalize = tf.div(resize, [255.0]);\n resize.dispose();\n const resT = await model.predict(normalize);\n const points = resT.find((t) => (t.size === 195 || t.size === 155)).dataSync(); // order of output tensors may change between models, full has 195 and upper has 155 items\n resT.forEach((t) => t.dispose());\n normalize.dispose();\n const keypoints: Array<{ id, part, position: { x, y, z }, score, presence }> = [];\n const labels = points.length === 195 ? annotations.full : annotations.upper; // full model has 39 keypoints, upper has 31 keypoints\n const depth = 5; // each points has x,y,z,visibility,presence\n for (let i = 0; i < points.length / depth; i++) {\n keypoints.push({\n id: i,\n part: labels[i],\n position: {\n x: Math.trunc(imgSize.width * points[depth * i + 0] / 255), // return normalized x value istead of 0..255\n y: Math.trunc(imgSize.height * points[depth * i + 1] / 255), // return normalized y value istead of 0..255\n z: Math.trunc(points[depth * i + 2]) + 0, // fix negative zero\n },\n score: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 3])))) / 100, // reverse sigmoid value\n presence: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 4])))) / 100, // reverse sigmoid value\n });\n }\n const score = keypoints.reduce((prev, curr) => (curr.score > prev ? curr.score : prev), 0);\n return [{ score, keypoints }];\n}\n", "export const full = [\n 'nose',\n 'leftEyeInside',\n 'leftEye',\n 'leftEyeOutside',\n 'rightEyeInside',\n 'rightEye',\n 'rightEyeOutside',\n 'leftEar',\n 'rightEar',\n 'leftMouth',\n 'rightMouth',\n 'leftShoulder',\n 'rightShoulder',\n 'leftElbow',\n 'rightElbow',\n 'leftWrist',\n 'rightWrist',\n 'leftPalm',\n 'rightPalm',\n 'leftIndex',\n 'rightIndex',\n 'leftPinky',\n 'rightPinky',\n 'leftHip',\n 'rightHip',\n 'leftKnee',\n 'rightKnee',\n 'leftAnkle',\n 'rightAnkle',\n 'leftHeel',\n 'rightHeel',\n 'leftFoot',\n 'rightFoot',\n 'midHip',\n 'forehead',\n 'leftThumb',\n 'leftHand',\n 'rightThumb',\n 'rightHand',\n];\n\nexport const upper = [\n 'nose',\n 'leftEyeInside',\n 'leftEye',\n 'leftEyeOutside',\n 'rightEyeInside',\n 'rightEye',\n 'rightEyeOutside',\n 'leftEar',\n 'rightEar',\n 'leftMouth',\n 'rightMouth',\n 'leftShoulder',\n 'rightShoulder',\n 'leftElbow',\n 'rightElbow',\n 'left:15',\n 'right:16',\n 'left:17',\n 'right:18',\n 'left:19',\n 'right:20',\n 'left:21',\n 'right:22',\n 'leftChest',\n 'rightChest',\n 'neck',\n 'forehead',\n 'left:27',\n 'right:28',\n 'left:29',\n 'right:30',\n];\n", "import { log, join } from '../helpers';\nimport * as tf from '../../dist/tfjs.esm.js';\nimport { labels } from './labels';\n\nlet model;\nlet last: Array<{}> = [];\nlet skipped = Number.MAX_SAFE_INTEGER;\n\nconst scaleBox = 2.5; // increase box size\n\nexport async function load(config) {\n if (!model) {\n model = await tf.loadGraphModel(join(config.modelBasePath, config.object.modelPath));\n const inputs = Object.values(model.modelSignature['inputs']);\n model.inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : null;\n if (!model.inputSize) throw new Error(`Human: Cannot determine model inputSize: ${config.object.modelPath}`);\n if (!model || !model.modelUrl) log('load model failed:', config.object.modelPath);\n else if (config.debug) log('load model:', model.modelUrl);\n } else if (config.debug) log('cached model:', model.modelUrl);\n return model;\n}\n\nasync function process(res, inputSize, outputShape, config) {\n let id = 0;\n let results: Array<{ score: number, strideSize: number, class: number, label: string, center: number[], centerRaw: number[], box: number[], boxRaw: number[] }> = [];\n for (const strideSize of [1, 2, 4]) { // try each stride size as it detects large/medium/small objects\n // find scores, boxes, classes\n tf.tidy(() => { // wrap in tidy to automatically deallocate temp tensors\n const baseSize = strideSize * 13; // 13x13=169, 26x26=676, 52x52=2704\n // find boxes and scores output depending on stride\n const scoresT = res.find((a) => (a.shape[1] === (baseSize ** 2) && a.shape[2] === labels.length))?.squeeze();\n const featuresT = res.find((a) => (a.shape[1] === (baseSize ** 2) && a.shape[2] < labels.length))?.squeeze();\n const boxesMax = featuresT.reshape([-1, 4, featuresT.shape[1] / 4]); // reshape [output] to [4, output / 4] where number is number of different features inside each stride\n const boxIdx = boxesMax.argMax(2).arraySync(); // what we need is indexes of features with highest scores, not values itself\n const scores = scoresT.arraySync(); // optionally use exponential scores or just as-is\n for (let i = 0; i < scoresT.shape[0]; i++) { // total strides (x * y matrix)\n for (let j = 0; j < scoresT.shape[1]; j++) { // one score for each class\n const score = scores[i][j]; // get score for current position\n if (score > config.object.minConfidence && j !== 61) {\n const cx = (0.5 + Math.trunc(i % baseSize)) / baseSize; // center.x normalized to range 0..1\n const cy = (0.5 + Math.trunc(i / baseSize)) / baseSize; // center.y normalized to range 0..1\n const boxOffset = boxIdx[i].map((a) => a * (baseSize / strideSize / inputSize)); // just grab indexes of features with highest scores\n const [x, y] = [\n cx - (scaleBox / strideSize * boxOffset[0]),\n cy - (scaleBox / strideSize * boxOffset[1]),\n ];\n const [w, h] = [\n cx + (scaleBox / strideSize * boxOffset[2]) - x,\n cy + (scaleBox / strideSize * boxOffset[3]) - y,\n ];\n let boxRaw = [x, y, w, h]; // results normalized to range 0..1\n boxRaw = boxRaw.map((a) => Math.max(0, Math.min(a, 1))); // fix out-of-bounds coords\n const box = [ // results normalized to input image pixels\n boxRaw[0] * outputShape[0],\n boxRaw[1] * outputShape[1],\n boxRaw[2] * outputShape[0],\n boxRaw[3] * outputShape[1],\n ];\n const result = {\n id: id++,\n strideSize,\n score: Math.round(100 * score) / 100,\n class: j + 1,\n label: labels[j].label,\n center: [Math.trunc(outputShape[0] * cx), Math.trunc(outputShape[1] * cy)],\n centerRaw: [cx, cy],\n box: box.map((a) => Math.trunc(a)),\n boxRaw,\n };\n results.push(result);\n }\n }\n }\n });\n }\n // deallocate tensors\n res.forEach((t) => tf.dispose(t));\n\n // normally nms is run on raw results, but since boxes need to be calculated this way we skip calulcation of\n // unnecessary boxes and run nms only on good candidates (basically it just does IOU analysis as scores are already filtered)\n const nmsBoxes = results.map((a) => a.boxRaw);\n const nmsScores = results.map((a) => a.score);\n let nmsIdx: any[] = [];\n if (nmsBoxes && nmsBoxes.length > 0) {\n const nms = await tf.image.nonMaxSuppressionAsync(nmsBoxes, nmsScores, config.object.maxDetected, config.object.iouThreshold, config.object.minConfidence);\n nmsIdx = nms.dataSync();\n tf.dispose(nms);\n }\n\n // filter & sort results\n results = results\n .filter((a, idx) => nmsIdx.includes(idx))\n .sort((a, b) => (b.score - a.score));\n\n return results;\n}\n\nexport async function predict(image, config) {\n if (!model) return null;\n // console.log(skipped, config.object.skipFrames, config.videoOptimized, ((skipped < config.object.skipFrames) && config.videoOptimized && (last.length > 0)));\n if ((skipped < config.object.skipFrames) && config.videoOptimized && (last.length > 0)) {\n skipped++;\n return last;\n }\n if (config.videoOptimized) skipped = 0;\n else skipped = Number.MAX_SAFE_INTEGER;\n return new Promise(async (resolve) => {\n const outputSize = [image.shape[2], image.shape[1]];\n const resize = tf.image.resizeBilinear(image, [model.inputSize, model.inputSize], false);\n const norm = resize.div(255);\n const transpose = norm.transpose([0, 3, 1, 2]);\n norm.dispose();\n resize.dispose();\n\n let objectT;\n if (config.object.enabled) objectT = await model.predict(transpose);\n transpose.dispose();\n\n const obj = await process(objectT, model.inputSize, outputSize, config);\n last = obj;\n resolve(obj);\n });\n}\n", "export const labels = [\n { class: 1, label: 'person' },\n { class: 2, label: 'bicycle' },\n { class: 3, label: 'car' },\n { class: 4, label: 'motorcycle' },\n { class: 5, label: 'airplane' },\n { class: 6, label: 'bus' },\n { class: 7, label: 'train' },\n { class: 8, label: 'truck' },\n { class: 9, label: 'boat' },\n { class: 10, label: 'traffic light' },\n { class: 11, label: 'fire hydrant' },\n { class: 12, label: 'stop sign' },\n { class: 13, label: 'parking meter' },\n { class: 14, label: 'bench' },\n { class: 15, label: 'bird' },\n { class: 16, label: 'cat' },\n { class: 17, label: 'dog' },\n { class: 18, label: 'horse' },\n { class: 19, label: 'sheep' },\n { class: 20, label: 'cow' },\n { class: 21, label: 'elephant' },\n { class: 22, label: 'bear' },\n { class: 23, label: 'zebra' },\n { class: 24, label: 'giraffe' },\n { class: 25, label: 'backpack' },\n { class: 26, label: 'umbrella' },\n { class: 27, label: 'handbag' },\n { class: 28, label: 'tie' },\n { class: 29, label: 'suitcase' },\n { class: 30, label: 'frisbee' },\n { class: 31, label: 'skis' },\n { class: 32, label: 'snowboard' },\n { class: 33, label: 'sports ball' },\n { class: 34, label: 'kite' },\n { class: 35, label: 'baseball bat' },\n { class: 36, label: 'baseball glove' },\n { class: 37, label: 'skateboard' },\n { class: 38, label: 'surfboard' },\n { class: 39, label: 'tennis racket' },\n { class: 40, label: 'bottle' },\n { class: 41, label: 'wine glass' },\n { class: 42, label: 'cup' },\n { class: 43, label: 'fork' },\n { class: 44, label: 'knife' },\n { class: 45, label: 'spoon' },\n { class: 46, label: 'bowl' },\n { class: 47, label: 'banana' },\n { class: 48, label: 'apple' },\n { class: 49, label: 'sandwich' },\n { class: 50, label: 'orange' },\n { class: 51, label: 'broccoli' },\n { class: 52, label: 'carrot' },\n { class: 53, label: 'hot dog' },\n { class: 54, label: 'pizza' },\n { class: 55, label: 'donut' },\n { class: 56, label: 'cake' },\n { class: 57, label: 'chair' },\n { class: 58, label: 'couch' },\n { class: 59, label: 'potted plant' },\n { class: 60, label: 'bed' },\n { class: 61, label: 'dining table' },\n { class: 62, label: 'toilet' },\n { class: 63, label: 'tv' },\n { class: 64, label: 'laptop' },\n { class: 65, label: 'mouse' },\n { class: 66, label: 'remote' },\n { class: 67, label: 'keyboard' },\n { class: 68, label: 'cell phone' },\n { class: 69, label: 'microwave' },\n { class: 70, label: 'oven' },\n { class: 71, label: 'toaster' },\n { class: 72, label: 'sink' },\n { class: 73, label: 'refrigerator' },\n { class: 74, label: 'book' },\n { class: 75, label: 'clock' },\n { class: 76, label: 'vase' },\n { class: 77, label: 'scissors' },\n { class: 78, label: 'teddy bear' },\n { class: 79, label: 'hair drier' },\n { class: 80, label: 'toothbrush' },\n];\n", "export const body = (res) => {\n if (!res) return [];\n const gestures: Array<{ body: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n // raising hands\n const leftWrist = res[i].keypoints.find((a) => (a.part === 'leftWrist'));\n const rightWrist = res[i].keypoints.find((a) => (a.part === 'rightWrist'));\n const nose = res[i].keypoints.find((a) => (a.part === 'nose'));\n if (nose && leftWrist && rightWrist && (leftWrist.position.y < nose.position.y) && (rightWrist.position.y < nose.position.y)) gestures.push({ body: i, gesture: 'i give up' });\n else if (nose && leftWrist && (leftWrist.position.y < nose.position.y)) gestures.push({ body: i, gesture: 'raise left hand' });\n else if (nose && rightWrist && (rightWrist.position.y < nose.position.y)) gestures.push({ body: i, gesture: 'raise right hand' });\n\n // leaning\n const leftShoulder = res[i].keypoints.find((a) => (a.part === 'leftShoulder'));\n const rightShoulder = res[i].keypoints.find((a) => (a.part === 'rightShoulder'));\n if (leftShoulder && rightShoulder) gestures.push({ body: i, gesture: `leaning ${(leftShoulder.position.y > rightShoulder.position.y) ? 'left' : 'right'}` });\n }\n return gestures;\n};\n\nexport const face = (res) => {\n if (!res) return [];\n const gestures: Array<{ face: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n if (res[i].mesh && res[i].mesh.length > 0) {\n const eyeFacing = res[i].mesh[33][2] - res[i].mesh[263][2];\n if (Math.abs(eyeFacing) < 10) gestures.push({ face: i, gesture: 'facing center' });\n else gestures.push({ face: i, gesture: `facing ${eyeFacing < 0 ? 'left' : 'right'}` });\n const openLeft = Math.abs(res[i].mesh[374][1] - res[i].mesh[386][1]) / Math.abs(res[i].mesh[443][1] - res[i].mesh[450][1]); // center of eye inner lid y coord div center of wider eye border y coord\n if (openLeft < 0.2) gestures.push({ face: i, gesture: 'blink left eye' });\n const openRight = Math.abs(res[i].mesh[145][1] - res[i].mesh[159][1]) / Math.abs(res[i].mesh[223][1] - res[i].mesh[230][1]); // center of eye inner lid y coord div center of wider eye border y coord\n if (openRight < 0.2) gestures.push({ face: i, gesture: 'blink right eye' });\n const mouthOpen = Math.min(100, 500 * Math.abs(res[i].mesh[13][1] - res[i].mesh[14][1]) / Math.abs(res[i].mesh[10][1] - res[i].mesh[152][1]));\n if (mouthOpen > 10) gestures.push({ face: i, gesture: `mouth ${Math.trunc(mouthOpen)}% open` });\n const chinDepth = res[i].mesh[152][2];\n if (Math.abs(chinDepth) > 10) gestures.push({ face: i, gesture: `head ${chinDepth < 0 ? 'up' : 'down'}` });\n }\n }\n return gestures;\n};\n\nexport const iris = (res) => {\n if (!res) return [];\n const gestures: Array<{ iris: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n if (!res[i].annotations || !res[i].annotations.leftEyeIris || !res[i].annotations.rightEyeIris) continue;\n const sizeXLeft = res[i].annotations.leftEyeIris[3][0] - res[i].annotations.leftEyeIris[1][0];\n const sizeYLeft = res[i].annotations.leftEyeIris[4][1] - res[i].annotations.leftEyeIris[2][1];\n const areaLeft = Math.abs(sizeXLeft * sizeYLeft);\n\n const sizeXRight = res[i].annotations.rightEyeIris[3][0] - res[i].annotations.rightEyeIris[1][0];\n const sizeYRight = res[i].annotations.rightEyeIris[4][1] - res[i].annotations.rightEyeIris[2][1];\n const areaRight = Math.abs(sizeXRight * sizeYRight);\n\n let center = false;\n const difference = Math.abs(areaLeft - areaRight) / Math.max(areaLeft, areaRight);\n if (difference < 0.25) {\n center = true;\n gestures.push({ iris: i, gesture: 'facing center' });\n }\n\n const rightIrisCenterX = Math.abs(res[i].mesh[33][0] - res[i].annotations.rightEyeIris[0][0]) / res[i].annotations.rightEyeIris[0][0];\n const leftIrisCenterX = Math.abs(res[i].mesh[263][0] - res[i].annotations.leftEyeIris[0][0]) / res[i].annotations.leftEyeIris[0][0];\n if (leftIrisCenterX > 0.033 || rightIrisCenterX > 0.033) center = false;\n if (leftIrisCenterX > 0.033) gestures.push({ iris: i, gesture: 'looking right' });\n if (rightIrisCenterX > 0.033) gestures.push({ iris: i, gesture: 'looking left' });\n\n const rightIrisCenterY = Math.abs(res[i].mesh[145][1] - res[i].annotations.rightEyeIris[0][1]) / res[i].annotations.rightEyeIris[0][1];\n const leftIrisCenterY = Math.abs(res[i].mesh[374][1] - res[i].annotations.leftEyeIris[0][1]) / res[i].annotations.leftEyeIris[0][1];\n if (leftIrisCenterY < 0.015 || rightIrisCenterY < 0.015 || leftIrisCenterY > 0.030 || rightIrisCenterY > 0.030) center = false;\n if (leftIrisCenterY < 0.015 || rightIrisCenterY < 0.015) gestures.push({ iris: i, gesture: 'looking down' });\n if (leftIrisCenterY > 0.030 || rightIrisCenterY > 0.030) gestures.push({ iris: i, gesture: 'looking up' });\n\n // still center;\n if (center) gestures.push({ iris: i, gesture: 'looking center' });\n }\n return gestures;\n};\n\nexport const hand = (res) => {\n if (!res) return [];\n const gestures: Array<{ hand: number, gesture: string }> = [];\n for (let i = 0; i < res.length; i++) {\n const fingers: Array<{ name: string, position: number }> = [];\n for (const [finger, pos] of Object.entries(res[i]['annotations'])) {\n if (finger !== 'palmBase' && Array.isArray(pos)) fingers.push({ name: finger.toLowerCase(), position: pos[0] }); // get tip of each finger\n }\n if (fingers && fingers.length > 0) {\n const closest = fingers.reduce((best, a) => (best.position[2] < a.position[2] ? best : a));\n const highest = fingers.reduce((best, a) => (best.position[1] < a.position[1] ? best : a));\n gestures.push({ hand: i, gesture: `${closest.name} forward ${highest.name} up` });\n }\n }\n return gestures;\n};\n", "import * as tf from '../../dist/tfjs.esm.js';\nimport * as fxImage from './imagefx';\n\nconst maxSize = 2048;\n// internal temp canvases\nlet inCanvas;\nlet outCanvas;\n// instance of fximage\nlet fx;\n\n// process input image and return tensor\n// input can be tensor, imagedata, htmlimageelement, htmlvideoelement\n// input is resized and run through imagefx filter\nexport function process(input, config): { tensor: typeof tf.Tensor | null, canvas: OffscreenCanvas | HTMLCanvasElement } {\n let tensor;\n if (!input) throw new Error('Human: Input is missing');\n // sanity checks since different browsers do not implement all dom elements\n if (\n !(input instanceof tf.Tensor)\n && !(typeof Image !== 'undefined' && input instanceof Image)\n && !(typeof ImageData !== 'undefined' && input instanceof ImageData)\n && !(typeof ImageBitmap !== 'undefined' && input instanceof ImageBitmap)\n && !(typeof HTMLImageElement !== 'undefined' && input instanceof HTMLImageElement)\n && !(typeof HTMLMediaElement !== 'undefined' && input instanceof HTMLMediaElement)\n && !(typeof HTMLVideoElement !== 'undefined' && input instanceof HTMLVideoElement)\n && !(typeof HTMLCanvasElement !== 'undefined' && input instanceof HTMLCanvasElement)\n && !(typeof OffscreenCanvas !== 'undefined' && input instanceof OffscreenCanvas)\n ) {\n throw new Error('Human: Input type is not recognized');\n }\n if (input instanceof tf.Tensor) {\n // if input is tensor, use as-is\n if (input.shape && input.shape.length === 4 && input.shape[0] === 1 && input.shape[3] === 3) tensor = tf.clone(input);\n else throw new Error(`Human: Input tensor shape must be [1, height, width, 3] and instead was ${input.shape}`);\n } else {\n // check if resizing will be needed\n const originalWidth = input['naturalWidth'] || input['videoWidth'] || input['width'] || (input['shape'] && (input['shape'][1] > 0));\n const originalHeight = input['naturalHeight'] || input['videoHeight'] || input['height'] || (input['shape'] && (input['shape'][2] > 0));\n let targetWidth = originalWidth;\n let targetHeight = originalHeight;\n if (targetWidth > maxSize) {\n targetWidth = maxSize;\n targetHeight = targetWidth * originalHeight / originalWidth;\n }\n if (targetHeight > maxSize) {\n targetHeight = maxSize;\n targetWidth = targetHeight * originalWidth / originalHeight;\n }\n\n // create our canvas and resize it if needed\n if (config.filter.width > 0) targetWidth = config.filter.width;\n else if (config.filter.height > 0) targetWidth = originalWidth * (config.filter.height / originalHeight);\n if (config.filter.height > 0) targetHeight = config.filter.height;\n else if (config.filter.width > 0) targetHeight = originalHeight * (config.filter.width / originalWidth);\n if (!targetWidth || !targetHeight) throw new Error('Human: Input cannot determine dimension');\n if (!inCanvas || (inCanvas?.width !== targetWidth) || (inCanvas?.height !== targetHeight)) {\n inCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(targetWidth, targetHeight) : document.createElement('canvas');\n if (inCanvas?.width !== targetWidth) inCanvas.width = targetWidth;\n if (inCanvas?.height !== targetHeight) inCanvas.height = targetHeight;\n }\n\n // draw input to our canvas\n const ctx = inCanvas.getContext('2d');\n if (input instanceof ImageData) {\n ctx.putImageData(input, 0, 0);\n } else {\n if (config.filter.flip && typeof ctx.translate !== 'undefined') {\n ctx.translate(originalWidth, 0);\n ctx.scale(-1, 1);\n ctx.drawImage(input, 0, 0, originalWidth, originalHeight, 0, 0, inCanvas?.width, inCanvas?.height);\n ctx.setTransform(1, 0, 0, 1, 0, 0); // resets transforms to defaults\n } else {\n ctx.drawImage(input, 0, 0, originalWidth, originalHeight, 0, 0, inCanvas?.width, inCanvas?.height);\n }\n }\n\n // imagefx transforms using gl\n if (config.filter.enabled) {\n if (!fx || !outCanvas || (inCanvas.width !== outCanvas.width) || (inCanvas?.height !== outCanvas?.height)) {\n outCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(inCanvas?.width, inCanvas?.height) : document.createElement('canvas');\n if (outCanvas?.width !== inCanvas?.width) outCanvas.width = inCanvas?.width;\n if (outCanvas?.height !== inCanvas?.height) outCanvas.height = inCanvas?.height;\n // log('created FX filter');\n fx = tf.ENV.flags.IS_BROWSER ? new fxImage.GLImageFilter({ canvas: outCanvas }) : null; // && (typeof document !== 'undefined')\n }\n if (!fx) return { tensor: null, canvas: inCanvas };\n fx.reset();\n fx.addFilter('brightness', config.filter.brightness); // must have at least one filter enabled\n if (config.filter.contrast !== 0) fx.addFilter('contrast', config.filter.contrast);\n if (config.filter.sharpness !== 0) fx.addFilter('sharpen', config.filter.sharpness);\n if (config.filter.blur !== 0) fx.addFilter('blur', config.filter.blur);\n if (config.filter.saturation !== 0) fx.addFilter('saturation', config.filter.saturation);\n if (config.filter.hue !== 0) fx.addFilter('hue', config.filter.hue);\n if (config.filter.negative) fx.addFilter('negative');\n if (config.filter.sepia) fx.addFilter('sepia');\n if (config.filter.vintage) fx.addFilter('brownie');\n if (config.filter.sepia) fx.addFilter('sepia');\n if (config.filter.kodachrome) fx.addFilter('kodachrome');\n if (config.filter.technicolor) fx.addFilter('technicolor');\n if (config.filter.polaroid) fx.addFilter('polaroid');\n if (config.filter.pixelate !== 0) fx.addFilter('pixelate', config.filter.pixelate);\n fx.apply(inCanvas);\n // read pixel data\n /*\n const gl = outCanvas.getContext('webgl');\n if (gl) {\n const glBuffer = new Uint8Array(outCanvas.width * outCanvas.height * 4);\n const pixBuffer = new Uint8Array(outCanvas.width * outCanvas.height * 3);\n gl.readPixels(0, 0, outCanvas.width, outCanvas.height, gl.RGBA, gl.UNSIGNED_BYTE, glBuffer);\n // gl returns rbga while we only need rgb, so discarding alpha channel\n // gl returns starting point as lower left, so need to invert vertical\n let i = 0;\n for (let y = outCanvas.height - 1; y >= 0; y--) {\n for (let x = 0; x < outCanvas.width; x++) {\n const index = (x + y * outCanvas.width) * 4;\n pixBuffer[i++] = glBuffer[index + 0];\n pixBuffer[i++] = glBuffer[index + 1];\n pixBuffer[i++] = glBuffer[index + 2];\n }\n }\n outCanvas.data = pixBuffer;\n }\n */\n } else {\n outCanvas = inCanvas;\n if (fx) fx = null;\n }\n\n // create tensor from image\n let pixels;\n if (outCanvas.data) { // if we have data, just convert to tensor\n const shape = [outCanvas.height, outCanvas.width, 3];\n pixels = tf.tensor3d(outCanvas.data, shape, 'int32');\n } else if (outCanvas instanceof ImageData) { // if input is imagedata, just use it\n pixels = tf.browser.fromPixels(outCanvas);\n } else if (config.backend === 'webgl' || config.backend === 'humangl') { // tf kernel-optimized method to get imagedata\n // we can use canvas as-is as it already has a context, so we do a silly one more canvas\n const tempCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(targetWidth, targetHeight) : document.createElement('canvas');\n tempCanvas.width = targetWidth;\n tempCanvas.height = targetHeight;\n const tempCtx = tempCanvas.getContext('2d');\n tempCtx?.drawImage(outCanvas, 0, 0);\n pixels = tf.browser.fromPixels(tempCanvas);\n } else { // cpu and wasm kernel does not implement efficient fromPixels method\n // we can use canvas as-is as it already has a context, so we do a silly one more canvas\n const tempCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(targetWidth, targetHeight) : document.createElement('canvas');\n tempCanvas.width = targetWidth;\n tempCanvas.height = targetHeight;\n const tempCtx = tempCanvas.getContext('2d');\n tempCtx?.drawImage(outCanvas, 0, 0);\n const data = tempCtx?.getImageData(0, 0, targetWidth, targetHeight);\n pixels = tf.browser.fromPixels(data);\n }\n const casted = pixels.toFloat();\n tensor = casted.expandDims(0);\n pixels.dispose();\n casted.dispose();\n }\n const canvas = config.filter.return ? outCanvas : null;\n return { tensor, canvas };\n}\n", "/*\nWebGLImageFilter - MIT Licensed\n2013, Dominic Szablewski - phoboslab.org\n\n*/\n\nfunction GLProgram(gl, vertexSource, fragmentSource) {\n const _collect = function (source, prefix, collection) {\n const r = new RegExp('\\\\b' + prefix + ' \\\\w+ (\\\\w+)', 'ig');\n source.replace(r, (match, name) => {\n collection[name] = 0;\n return match;\n });\n };\n\n const _compile = function (source, type) {\n const shader = gl.createShader(type);\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) throw new Error('Filter: GL compile failed', gl.getShaderInfoLog(shader));\n return shader;\n };\n\n this.uniform = {};\n this.attribute = {};\n const _vsh = _compile(vertexSource, gl.VERTEX_SHADER);\n const _fsh = _compile(fragmentSource, gl.FRAGMENT_SHADER);\n this.id = gl.createProgram();\n gl.attachShader(this.id, _vsh);\n gl.attachShader(this.id, _fsh);\n gl.linkProgram(this.id);\n\n if (!gl.getProgramParameter(this.id, gl.LINK_STATUS)) throw new Error('Filter: GL link failed', gl.getProgramInfoLog(this.id));\n\n gl.useProgram(this.id);\n // Collect attributes\n _collect(vertexSource, 'attribute', this.attribute);\n for (const a in this.attribute) this.attribute[a] = gl.getAttribLocation(this.id, a);\n // Collect uniforms\n _collect(vertexSource, 'uniform', this.uniform);\n _collect(fragmentSource, 'uniform', this.uniform);\n for (const u in this.uniform) this.uniform[u] = gl.getUniformLocation(this.id, u);\n}\n\n// export const GLImageFilter = function (params) {\nexport function GLImageFilter(params) {\n if (!params) params = { };\n let _drawCount = 0;\n let _sourceTexture = null;\n let _lastInChain = false;\n let _currentFramebufferIndex = -1;\n let _tempFramebuffers = [null, null];\n let _filterChain = [];\n let _width = -1;\n let _height = -1;\n let _vertexBuffer = null;\n let _currentProgram = null;\n const _filter = {};\n const _canvas = params.canvas || document.createElement('canvas');\n // key is the shader program source, value is the compiled program\n const _shaderProgramCache = { };\n const DRAW = { INTERMEDIATE: 1 };\n const gl = _canvas.getContext('webgl');\n if (!gl) throw new Error('Filter: getContext() failed');\n\n this.addFilter = function (name) {\n // eslint-disable-next-line prefer-rest-params\n const args = Array.prototype.slice.call(arguments, 1);\n const filter = _filter[name];\n _filterChain.push({ func: filter, args });\n };\n\n this.reset = function () {\n _filterChain = [];\n };\n\n const _resize = function (width, height) {\n // Same width/height? Nothing to do here\n if (width === _width && height === _height) { return; }\n _canvas.width = width;\n _width = width;\n _canvas.height = height;\n _height = height;\n // Create the context if we don't have it yet\n if (!_vertexBuffer) {\n // Create the vertex buffer for the two triangles [x, y, u, v] * 6\n const vertices = new Float32Array([\n -1, -1, 0, 1, 1, -1, 1, 1, -1, 1, 0, 0,\n -1, 1, 0, 0, 1, -1, 1, 1, 1, 1, 1, 0,\n ]);\n // eslint-disable-next-line no-unused-expressions\n (_vertexBuffer = gl.createBuffer(), gl.bindBuffer(gl.ARRAY_BUFFER, _vertexBuffer));\n gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n }\n gl.viewport(0, 0, _width, _height);\n // Delete old temp framebuffers\n _tempFramebuffers = [null, null];\n };\n\n const _createFramebufferTexture = function (width, height) {\n const fbo = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);\n const renderbuffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer);\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n return { fbo, texture };\n };\n\n const _getTempFramebuffer = function (index) {\n _tempFramebuffers[index] = _tempFramebuffers[index] || _createFramebufferTexture(_width, _height);\n return _tempFramebuffers[index];\n };\n\n const _draw = function (flags = null) {\n let source = null;\n let target = null;\n let flipY = false;\n // Set up the source\n if (_drawCount === 0) {\n // First draw call - use the source texture\n source = _sourceTexture;\n } else {\n // All following draw calls use the temp buffer last drawn to\n source = _getTempFramebuffer(_currentFramebufferIndex)?.texture;\n }\n _drawCount++;\n // Set up the target\n if (_lastInChain && !(flags & DRAW.INTERMEDIATE)) {\n // Last filter in our chain - draw directly to the WebGL Canvas. We may\n // also have to flip the image vertically now\n target = null;\n flipY = _drawCount % 2 === 0;\n } else {\n // Intermediate draw call - get a temp buffer to draw to\n _currentFramebufferIndex = (_currentFramebufferIndex + 1) % 2;\n target = _getTempFramebuffer(_currentFramebufferIndex)?.fbo;\n }\n // Bind the source and target and draw the two triangles\n gl.bindTexture(gl.TEXTURE_2D, source);\n gl.bindFramebuffer(gl.FRAMEBUFFER, target);\n gl.uniform1f(_currentProgram.uniform.flipY, (flipY ? -1 : 1));\n gl.drawArrays(gl.TRIANGLES, 0, 6);\n };\n\n this.apply = function (image) {\n _resize(image.width, image.height);\n _drawCount = 0;\n // Create the texture for the input image if we haven't yet\n if (!_sourceTexture) _sourceTexture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, _sourceTexture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);\n // No filters? Just draw\n if (_filterChain.length === 0) {\n // const program = _compileShader(SHADER.FRAGMENT_IDENTITY);\n _draw();\n return _canvas;\n }\n for (let i = 0; i < _filterChain.length; i++) {\n _lastInChain = (i === _filterChain.length - 1);\n const f = _filterChain[i];\n f.func.apply(this, f.args || []);\n }\n return _canvas;\n };\n\n const _compileShader = function (fragmentSource) {\n if (_shaderProgramCache[fragmentSource]) {\n _currentProgram = _shaderProgramCache[fragmentSource];\n gl.useProgram(_currentProgram.id);\n return _currentProgram;\n }\n // Compile shaders\n const SHADER = {};\n SHADER.VERTEX_IDENTITY = [\n 'precision highp float;',\n 'attribute vec2 pos;',\n 'attribute vec2 uv;',\n 'varying vec2 vUv;',\n 'uniform float flipY;',\n 'void main(void) {',\n 'vUv = uv;',\n 'gl_Position = vec4(pos.x, pos.y*flipY, 0.0, 1.);',\n '}',\n ].join('\\n');\n SHADER.FRAGMENT_IDENTITY = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'void main(void) {',\n 'gl_FragColor = texture2D(texture, vUv);',\n '}',\n ].join('\\n');\n _currentProgram = new GLProgram(gl, SHADER.VERTEX_IDENTITY, fragmentSource);\n const floatSize = Float32Array.BYTES_PER_ELEMENT;\n const vertSize = 4 * floatSize;\n gl.enableVertexAttribArray(_currentProgram.attribute.pos);\n gl.vertexAttribPointer(_currentProgram.attribute.pos, 2, gl.FLOAT, false, vertSize, 0 * floatSize);\n gl.enableVertexAttribArray(_currentProgram.attribute.uv);\n gl.vertexAttribPointer(_currentProgram.attribute.uv, 2, gl.FLOAT, false, vertSize, 2 * floatSize);\n _shaderProgramCache[fragmentSource] = _currentProgram;\n return _currentProgram;\n };\n\n // -------------------------------------------------------------------------\n // Color Matrix Filter\n _filter.colorMatrix = function (matrix) {\n // Create a Float32 Array and normalize the offset component to 0-1\n const m = new Float32Array(matrix);\n m[4] /= 255;\n m[9] /= 255;\n m[14] /= 255;\n m[19] /= 255;\n // Can we ignore the alpha value? Makes things a bit faster.\n const shader = (m[18] === 1 && m[3] === 0 && m[8] === 0 && m[13] === 0 && m[15] === 0 && m[16] === 0 && m[17] === 0 && m[19] === 0)\n ? _filter.colorMatrix.SHADER.WITHOUT_ALPHA\n : _filter.colorMatrix.SHADER.WITH_ALPHA;\n const program = _compileShader(shader);\n gl.uniform1fv(program.uniform.m, m);\n _draw();\n };\n _filter.colorMatrix.SHADER = {};\n _filter.colorMatrix.SHADER.WITH_ALPHA = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform float m[20];',\n 'void main(void) {',\n 'vec4 c = texture2D(texture, vUv);',\n 'gl_FragColor.r = m[0] * c.r + m[1] * c.g + m[2] * c.b + m[3] * c.a + m[4];',\n 'gl_FragColor.g = m[5] * c.r + m[6] * c.g + m[7] * c.b + m[8] * c.a + m[9];',\n 'gl_FragColor.b = m[10] * c.r + m[11] * c.g + m[12] * c.b + m[13] * c.a + m[14];',\n 'gl_FragColor.a = m[15] * c.r + m[16] * c.g + m[17] * c.b + m[18] * c.a + m[19];',\n '}',\n ].join('\\n');\n _filter.colorMatrix.SHADER.WITHOUT_ALPHA = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform float m[20];',\n 'void main(void) {',\n 'vec4 c = texture2D(texture, vUv);',\n 'gl_FragColor.r = m[0] * c.r + m[1] * c.g + m[2] * c.b + m[4];',\n 'gl_FragColor.g = m[5] * c.r + m[6] * c.g + m[7] * c.b + m[9];',\n 'gl_FragColor.b = m[10] * c.r + m[11] * c.g + m[12] * c.b + m[14];',\n 'gl_FragColor.a = c.a;',\n '}',\n ].join('\\n');\n\n _filter.brightness = function (brightness) {\n const b = (brightness || 0) + 1;\n _filter.colorMatrix([\n b, 0, 0, 0, 0,\n 0, b, 0, 0, 0,\n 0, 0, b, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.saturation = function (amount) {\n const x = (amount || 0) * 2 / 3 + 1;\n const y = ((x - 1) * -0.5);\n _filter.colorMatrix([\n x, y, y, 0, 0,\n y, x, y, 0, 0,\n y, y, x, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.desaturate = function () {\n _filter.saturation(-1);\n };\n\n _filter.contrast = function (amount) {\n const v = (amount || 0) + 1;\n const o = -128 * (v - 1);\n\n _filter.colorMatrix([\n v, 0, 0, 0, o,\n 0, v, 0, 0, o,\n 0, 0, v, 0, o,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.negative = function () {\n _filter.contrast(-2);\n };\n\n _filter.hue = function (rotation) {\n rotation = (rotation || 0) / 180 * Math.PI;\n const cos = Math.cos(rotation);\n const sin = Math.sin(rotation);\n const lumR = 0.213;\n const lumG = 0.715;\n const lumB = 0.072;\n\n _filter.colorMatrix([\n lumR + cos * (1 - lumR) + sin * (-lumR), lumG + cos * (-lumG) + sin * (-lumG), lumB + cos * (-lumB) + sin * (1 - lumB), 0, 0,\n lumR + cos * (-lumR) + sin * (0.143), lumG + cos * (1 - lumG) + sin * (0.140), lumB + cos * (-lumB) + sin * (-0.283), 0, 0,\n lumR + cos * (-lumR) + sin * (-(1 - lumR)), lumG + cos * (-lumG) + sin * (lumG), lumB + cos * (1 - lumB) + sin * (lumB), 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.desaturateLuminance = function () {\n _filter.colorMatrix([\n 0.2764723, 0.9297080, 0.0938197, 0, -37.1,\n 0.2764723, 0.9297080, 0.0938197, 0, -37.1,\n 0.2764723, 0.9297080, 0.0938197, 0, -37.1,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.sepia = function () {\n _filter.colorMatrix([\n 0.393, 0.7689999, 0.18899999, 0, 0,\n 0.349, 0.6859999, 0.16799999, 0, 0,\n 0.272, 0.5339999, 0.13099999, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.brownie = function () {\n _filter.colorMatrix([\n 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873,\n -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127,\n 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.vintagePinhole = function () {\n _filter.colorMatrix([\n 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123,\n 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591,\n 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.kodachrome = function () {\n _filter.colorMatrix([\n 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502,\n -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203,\n -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.technicolor = function () {\n _filter.colorMatrix([\n 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337,\n -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398,\n -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.polaroid = function () {\n _filter.colorMatrix([\n 1.438, -0.062, -0.062, 0, 0,\n -0.122, 1.378, -0.122, 0, 0,\n -0.016, -0.016, 1.483, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n _filter.shiftToBGR = function () {\n _filter.colorMatrix([\n 0, 0, 1, 0, 0,\n 0, 1, 0, 0, 0,\n 1, 0, 0, 0, 0,\n 0, 0, 0, 1, 0,\n ]);\n };\n\n // -------------------------------------------------------------------------\n // Convolution Filter\n _filter.convolution = function (matrix) {\n const m = new Float32Array(matrix);\n const pixelSizeX = 1 / _width;\n const pixelSizeY = 1 / _height;\n const program = _compileShader(_filter.convolution.SHADER);\n gl.uniform1fv(program.uniform.m, m);\n gl.uniform2f(program.uniform.px, pixelSizeX, pixelSizeY);\n _draw();\n };\n\n _filter.convolution.SHADER = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform vec2 px;',\n 'uniform float m[9];',\n 'void main(void) {',\n 'vec4 c11 = texture2D(texture, vUv - px);', // top left\n 'vec4 c12 = texture2D(texture, vec2(vUv.x, vUv.y - px.y));', // top center\n 'vec4 c13 = texture2D(texture, vec2(vUv.x + px.x, vUv.y - px.y));', // top right\n 'vec4 c21 = texture2D(texture, vec2(vUv.x - px.x, vUv.y) );', // mid left\n 'vec4 c22 = texture2D(texture, vUv);', // mid center\n 'vec4 c23 = texture2D(texture, vec2(vUv.x + px.x, vUv.y) );', // mid right\n 'vec4 c31 = texture2D(texture, vec2(vUv.x - px.x, vUv.y + px.y) );', // bottom left\n 'vec4 c32 = texture2D(texture, vec2(vUv.x, vUv.y + px.y) );', // bottom center\n 'vec4 c33 = texture2D(texture, vUv + px );', // bottom right\n 'gl_FragColor = ',\n 'c11 * m[0] + c12 * m[1] + c22 * m[2] +',\n 'c21 * m[3] + c22 * m[4] + c23 * m[5] +',\n 'c31 * m[6] + c32 * m[7] + c33 * m[8];',\n 'gl_FragColor.a = c22.a;',\n '}',\n ].join('\\n');\n\n _filter.detectEdges = function () {\n _filter.convolution.call(this, [\n 0, 1, 0,\n 1, -4, 1,\n 0, 1, 0,\n ]);\n };\n\n _filter.sobelX = function () {\n _filter.convolution.call(this, [\n -1, 0, 1,\n -2, 0, 2,\n -1, 0, 1,\n ]);\n };\n\n _filter.sobelY = function () {\n _filter.convolution.call(this, [\n -1, -2, -1,\n 0, 0, 0,\n 1, 2, 1,\n ]);\n };\n\n _filter.sharpen = function (amount) {\n const a = amount || 1;\n _filter.convolution.call(this, [\n 0, -1 * a, 0,\n -1 * a, 1 + 4 * a, -1 * a,\n 0, -1 * a, 0,\n ]);\n };\n\n _filter.emboss = function (size) {\n const s = size || 1;\n _filter.convolution.call(this, [\n -2 * s, -1 * s, 0,\n -1 * s, 1, 1 * s,\n 0, 1 * s, 2 * s,\n ]);\n };\n\n // -------------------------------------------------------------------------\n // Blur Filter\n _filter.blur = function (size) {\n const blurSizeX = (size / 7) / _width;\n const blurSizeY = (size / 7) / _height;\n const program = _compileShader(_filter.blur.SHADER);\n // Vertical\n gl.uniform2f(program.uniform.px, 0, blurSizeY);\n _draw(DRAW.INTERMEDIATE);\n // Horizontal\n gl.uniform2f(program.uniform.px, blurSizeX, 0);\n _draw();\n };\n\n _filter.blur.SHADER = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform sampler2D texture;',\n 'uniform vec2 px;',\n 'void main(void) {',\n 'gl_FragColor = vec4(0.0);',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-7.0*px.x, -7.0*px.y))*0.0044299121055113265;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-6.0*px.x, -6.0*px.y))*0.00895781211794;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-5.0*px.x, -5.0*px.y))*0.0215963866053;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-4.0*px.x, -4.0*px.y))*0.0443683338718;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-3.0*px.x, -3.0*px.y))*0.0776744219933;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-2.0*px.x, -2.0*px.y))*0.115876621105;',\n 'gl_FragColor += texture2D(texture, vUv + vec2(-1.0*px.x, -1.0*px.y))*0.147308056121;',\n 'gl_FragColor += texture2D(texture, vUv )*0.159576912161;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 1.0*px.x, 1.0*px.y))*0.147308056121;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 2.0*px.x, 2.0*px.y))*0.115876621105;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 3.0*px.x, 3.0*px.y))*0.0776744219933;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 4.0*px.x, 4.0*px.y))*0.0443683338718;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 5.0*px.x, 5.0*px.y))*0.0215963866053;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 6.0*px.x, 6.0*px.y))*0.00895781211794;',\n 'gl_FragColor += texture2D(texture, vUv + vec2( 7.0*px.x, 7.0*px.y))*0.0044299121055113265;',\n '}',\n ].join('\\n');\n\n // -------------------------------------------------------------------------\n // Pixelate Filter\n _filter.pixelate = function (size) {\n const blurSizeX = (size) / _width;\n const blurSizeY = (size) / _height;\n const program = _compileShader(_filter.pixelate.SHADER);\n // Horizontal\n gl.uniform2f(program.uniform.size, blurSizeX, blurSizeY);\n _draw();\n };\n\n _filter.pixelate.SHADER = [\n 'precision highp float;',\n 'varying vec2 vUv;',\n 'uniform vec2 size;',\n 'uniform sampler2D texture;',\n 'vec2 pixelate(vec2 coord, vec2 size) {',\n 'return floor( coord / size ) * size;',\n '}',\n 'void main(void) {',\n 'gl_FragColor = vec4(0.0);',\n 'vec2 coord = pixelate(vUv, size);',\n 'gl_FragColor += texture2D(texture, coord);',\n '}',\n ].join('\\n');\n}\n", "import { TRI468 as triangulation } from '../blazeface/coords';\nimport { mergeDeep } from '../helpers';\n\n/**\n * Draw Options\n * Accessed via `human.draw.options` or provided per each draw method as the drawOptions optional parameter\n * -color: draw color\n * -labelColor: color for labels\n * -shadowColor: optional shadow color for labels\n * -font: font for labels\n * -lineHeight: line height for labels, used for multi-line labels,\n * -lineWidth: width of any lines,\n * -pointSize: size of any point,\n * -roundRect: for boxes, round corners by this many pixels,\n * -drawPoints: should points be drawn,\n * -drawLabels: should labels be drawn,\n * -drawBoxes: should boxes be drawn,\n * -drawPolygons: should polygons be drawn,\n * -fillPolygons: should drawn polygons be filled,\n * -useDepth: use z-axis coordinate as color shade,\n * -useCurves: draw polygons as cures or as lines,\n * -bufferedOutput: experimental: allows to call draw methods multiple times for each detection and interpolate results between results thus achieving smoother animations\n * -useRawBoxes: Boolean: internal: use non-normalized coordinates when performing draw methods,\n */\nexport interface DrawOptions {\n color: string,\n labelColor: string,\n shadowColor: string,\n font: string,\n lineHeight: number,\n lineWidth: number,\n pointSize: number,\n roundRect: number,\n drawPoints: Boolean,\n drawLabels: Boolean,\n drawBoxes: Boolean,\n drawPolygons: Boolean,\n fillPolygons: Boolean,\n useDepth: Boolean,\n useCurves: Boolean,\n bufferedOutput: Boolean,\n useRawBoxes: Boolean,\n calculateHandBox: Boolean,\n}\n\nexport const options: DrawOptions = {\n color: 'rgba(173, 216, 230, 0.3)', // 'lightblue' with light alpha channel\n labelColor: 'rgba(173, 216, 230, 1)', // 'lightblue' with dark alpha channel\n shadowColor: 'black',\n font: 'small-caps 16px \"Segoe UI\"',\n lineHeight: 24,\n lineWidth: 6,\n pointSize: 2,\n roundRect: 28,\n drawPoints: false,\n drawLabels: true,\n drawBoxes: false,\n drawPolygons: true,\n fillPolygons: false,\n useDepth: true,\n useCurves: false,\n bufferedOutput: false,\n useRawBoxes: false,\n calculateHandBox: true,\n};\n\nfunction point(ctx, x, y, z = 0, localOptions) {\n ctx.fillStyle = localOptions.useDepth && z ? `rgba(${127.5 + (2 * z)}, ${127.5 - (2 * z)}, 255, 0.3)` : localOptions.color;\n ctx.beginPath();\n ctx.arc(x, y, localOptions.pointSize, 0, 2 * Math.PI);\n ctx.fill();\n}\n\nfunction rect(ctx, x, y, width, height, localOptions) {\n ctx.beginPath();\n if (localOptions.useCurves) {\n const cx = (x + x + width) / 2;\n const cy = (y + y + height) / 2;\n ctx.ellipse(cx, cy, width / 2, height / 2, 0, 0, 2 * Math.PI);\n } else {\n ctx.lineWidth = localOptions.lineWidth;\n ctx.moveTo(x + localOptions.roundRect, y);\n ctx.lineTo(x + width - localOptions.roundRect, y);\n ctx.quadraticCurveTo(x + width, y, x + width, y + localOptions.roundRect);\n ctx.lineTo(x + width, y + height - localOptions.roundRect);\n ctx.quadraticCurveTo(x + width, y + height, x + width - localOptions.roundRect, y + height);\n ctx.lineTo(x + localOptions.roundRect, y + height);\n ctx.quadraticCurveTo(x, y + height, x, y + height - localOptions.roundRect);\n ctx.lineTo(x, y + localOptions.roundRect);\n ctx.quadraticCurveTo(x, y, x + localOptions.roundRect, y);\n ctx.closePath();\n }\n ctx.stroke();\n}\n\nfunction lines(ctx, points: number[] = [], localOptions) {\n if (points === undefined || points.length === 0) return;\n ctx.beginPath();\n ctx.moveTo(points[0][0], points[0][1]);\n for (const pt of points) {\n ctx.strokeStyle = localOptions.useDepth && pt[2] ? `rgba(${127.5 + (2 * pt[2])}, ${127.5 - (2 * pt[2])}, 255, 0.3)` : localOptions.color;\n ctx.fillStyle = localOptions.useDepth && pt[2] ? `rgba(${127.5 + (2 * pt[2])}, ${127.5 - (2 * pt[2])}, 255, 0.3)` : localOptions.color;\n ctx.lineTo(pt[0], parseInt(pt[1]));\n }\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.closePath();\n ctx.fill();\n }\n}\n\nfunction curves(ctx, points: number[] = [], localOptions) {\n if (points === undefined || points.length === 0) return;\n if (!localOptions.useCurves || points.length <= 2) {\n lines(ctx, points, localOptions);\n return;\n }\n ctx.moveTo(points[0][0], points[0][1]);\n for (let i = 0; i < points.length - 2; i++) {\n const xc = (points[i][0] + points[i + 1][0]) / 2;\n const yc = (points[i][1] + points[i + 1][1]) / 2;\n ctx.quadraticCurveTo(points[i][0], points[i][1], xc, yc);\n }\n ctx.quadraticCurveTo(points[points.length - 2][0], points[points.length - 2][1], points[points.length - 1][0], points[points.length - 1][1]);\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.closePath();\n ctx.fill();\n }\n}\n\nexport async function gesture(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.font = localOptions.font;\n ctx.fillStyle = localOptions.color;\n let i = 1;\n for (let j = 0; j < result.length; j++) {\n let where:any[] = [];\n let what:any[] = [];\n [where, what] = Object.entries(result[j]);\n if ((what.length > 1) && (what[1].length > 0)) {\n const person = where[1] > 0 ? `#${where[1]}` : '';\n const label = `${where[0]} ${person}: ${what[1]}`;\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(label, 8, 2 + (i * localOptions.lineHeight));\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(label, 6, 0 + (i * localOptions.lineHeight));\n i += 1;\n }\n }\n}\n\nexport async function face(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n for (const f of result) {\n ctx.font = localOptions.font;\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n if (localOptions.drawBoxes) {\n if (localOptions.useRawBoxes) rect(ctx, inCanvas.width * f.boxRaw[0], inCanvas.height * f.boxRaw[1], inCanvas.width * f.boxRaw[2], inCanvas.height * f.boxRaw[3], localOptions);\n else rect(ctx, f.box[0], f.box[1], f.box[2], f.box[3], localOptions);\n }\n // silly hack since fillText does not suport new line\n const labels:string[] = [];\n labels.push(`face confidence: ${Math.trunc(100 * f.confidence)}%`);\n if (f.genderConfidence) labels.push(`${f.gender || ''} ${Math.trunc(100 * f.genderConfidence)}% confident`);\n // if (f.genderConfidence) labels.push(f.gender);\n if (f.age) labels.push(`age: ${f.age || ''}`);\n if (f.iris) labels.push(`iris distance: ${f.iris}`);\n if (f.emotion && f.emotion.length > 0) {\n const emotion = f.emotion.map((a) => `${Math.trunc(100 * a.score)}% ${a.emotion}`);\n labels.push(emotion.join(' '));\n }\n if (f.rotation && f.rotation.angle && f.rotation.angle.roll) labels.push(`roll: ${Math.trunc(100 * f.rotation.angle.roll) / 100} yaw:${Math.trunc(100 * f.rotation.angle.yaw) / 100} pitch:${Math.trunc(100 * f.rotation.angle.pitch) / 100}`);\n if (labels.length === 0) labels.push('face');\n ctx.fillStyle = localOptions.color;\n for (let i = labels.length - 1; i >= 0; i--) {\n const x = Math.max(f.box[0], 0);\n const y = i * localOptions.lineHeight + f.box[1];\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(labels[i], x + 5, y + 16);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(labels[i], x + 4, y + 15);\n }\n ctx.lineWidth = 1;\n if (f.mesh && f.mesh.length > 0) {\n if (localOptions.drawPoints) {\n for (const pt of f.mesh) point(ctx, pt[0], pt[1], pt[2], localOptions);\n // for (const pt of f.meshRaw) point(ctx, pt[0] * inCanvas.offsetWidth, pt[1] * inCanvas.offsetHeight, pt[2]);\n }\n if (localOptions.drawPolygons) {\n ctx.lineWidth = 1;\n for (let i = 0; i < triangulation.length / 3; i++) {\n const points = [\n triangulation[i * 3 + 0],\n triangulation[i * 3 + 1],\n triangulation[i * 3 + 2],\n ].map((index) => f.mesh[index]);\n lines(ctx, points, localOptions);\n }\n // iris: array[center, left, top, right, bottom]\n if (f.annotations && f.annotations.leftEyeIris) {\n ctx.strokeStyle = localOptions.useDepth ? 'rgba(255, 200, 255, 0.3)' : localOptions.color;\n ctx.beginPath();\n const sizeX = Math.abs(f.annotations.leftEyeIris[3][0] - f.annotations.leftEyeIris[1][0]) / 2;\n const sizeY = Math.abs(f.annotations.leftEyeIris[4][1] - f.annotations.leftEyeIris[2][1]) / 2;\n ctx.ellipse(f.annotations.leftEyeIris[0][0], f.annotations.leftEyeIris[0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.fillStyle = localOptions.useDepth ? 'rgba(255, 255, 200, 0.3)' : localOptions.color;\n ctx.fill();\n }\n }\n if (f.annotations && f.annotations.rightEyeIris) {\n ctx.strokeStyle = localOptions.useDepth ? 'rgba(255, 200, 255, 0.3)' : localOptions.color;\n ctx.beginPath();\n const sizeX = Math.abs(f.annotations.rightEyeIris[3][0] - f.annotations.rightEyeIris[1][0]) / 2;\n const sizeY = Math.abs(f.annotations.rightEyeIris[4][1] - f.annotations.rightEyeIris[2][1]) / 2;\n ctx.ellipse(f.annotations.rightEyeIris[0][0], f.annotations.rightEyeIris[0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);\n ctx.stroke();\n if (localOptions.fillPolygons) {\n ctx.fillStyle = localOptions.useDepth ? 'rgba(255, 255, 200, 0.3)' : localOptions.color;\n ctx.fill();\n }\n }\n }\n }\n }\n}\n\nconst lastDrawnPose:any[] = [];\nexport async function body(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.lineJoin = 'round';\n for (let i = 0; i < result.length; i++) {\n // result[i].keypoints = result[i].keypoints.filter((a) => a.score > 0.5);\n if (!lastDrawnPose[i] && localOptions.bufferedOutput) lastDrawnPose[i] = { ...result[i] };\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n ctx.lineWidth = localOptions.lineWidth;\n ctx.font = localOptions.font;\n if (localOptions.drawBoxes) {\n rect(ctx, result[i].box[0], result[i].box[1], result[i].box[2], result[i].box[3], localOptions);\n if (localOptions.drawLabels) {\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(`body ${100 * result[i].score}%`, result[i].box[0] + 3, 1 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(`body ${100 * result[i].score}%`, result[i].box[0] + 2, 0 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);\n }\n }\n if (localOptions.drawPoints) {\n for (let pt = 0; pt < result[i].keypoints.length; pt++) {\n ctx.fillStyle = localOptions.useDepth && result[i].keypoints[pt].position.z ? `rgba(${127.5 + (2 * result[i].keypoints[pt].position.z)}, ${127.5 - (2 * result[i].keypoints[pt].position.z)}, 255, 0.5)` : localOptions.color;\n if (localOptions.bufferedOutput) {\n lastDrawnPose[i].keypoints[pt][0] = (lastDrawnPose[i].keypoints[pt][0] + result[i].keypoints[pt].position.x) / 2;\n lastDrawnPose[i].keypoints[pt][1] = (lastDrawnPose[i].keypoints[pt][1] + result[i].keypoints[pt].position.y) / 2;\n point(ctx, lastDrawnPose[i].keypoints[pt][0], lastDrawnPose[i].keypoints[pt][1], 0, localOptions);\n } else {\n point(ctx, result[i].keypoints[pt].position.x, result[i].keypoints[pt].position.y, 0, localOptions);\n }\n }\n }\n if (localOptions.drawLabels) {\n ctx.font = localOptions.font;\n if (result[i].keypoints) {\n for (const pt of result[i].keypoints) {\n ctx.fillStyle = localOptions.useDepth && pt.position.z ? `rgba(${127.5 + (2 * pt.position.z)}, ${127.5 - (2 * pt.position.z)}, 255, 0.5)` : localOptions.color;\n ctx.fillText(`${pt.part} ${Math.trunc(100 * pt.score)}%`, pt.position.x + 4, pt.position.y + 4);\n }\n }\n }\n if (localOptions.drawPolygons && result[i].keypoints) {\n let part;\n const points: any[] = [];\n // shoulder line\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'leftShoulder');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightShoulder');\n if (part) points.push([part.position.x, part.position.y]);\n curves(ctx, points, localOptions);\n // torso main\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'rightShoulder');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightHip');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftHip');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftShoulder');\n if (part) points.push([part.position.x, part.position.y]);\n if (points.length === 4) lines(ctx, points, localOptions); // only draw if we have complete torso\n // leg left\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'leftHip');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftKnee');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftAnkle');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftHeel');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftFoot');\n if (part) points.push([part.position.x, part.position.y]);\n curves(ctx, points, localOptions);\n // leg right\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'rightHip');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightKnee');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightAnkle');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightHeel');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightFoot');\n if (part) points.push([part.position.x, part.position.y]);\n curves(ctx, points, localOptions);\n // arm left\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'leftShoulder');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftElbow');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftWrist');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'leftPalm');\n if (part) points.push([part.position.x, part.position.y]);\n curves(ctx, points, localOptions);\n // arm right\n points.length = 0;\n part = result[i].keypoints.find((a) => a.part === 'rightShoulder');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightElbow');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightWrist');\n if (part) points.push([part.position.x, part.position.y]);\n part = result[i].keypoints.find((a) => a.part === 'rightPalm');\n if (part) points.push([part.position.x, part.position.y]);\n curves(ctx, points, localOptions);\n // draw all\n }\n }\n}\n\nexport async function hand(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.lineJoin = 'round';\n ctx.font = localOptions.font;\n for (const h of result) {\n if (localOptions.drawBoxes) {\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n let box;\n if (!localOptions.calculateHandBox) {\n box = localOptions.useRawBoxes ? h.boxRaw : h.box;\n } else {\n box = [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, 0, 0];\n if (h.landmarks && h.landmarks.length > 0) {\n for (const pt of h.landmarks) {\n if (pt[0] < box[0]) box[0] = pt[0];\n if (pt[1] < box[1]) box[1] = pt[1];\n if (pt[0] > box[2]) box[2] = pt[0];\n if (pt[1] > box[3]) box[3] = pt[1];\n }\n box[2] -= box[0];\n box[3] -= box[1];\n }\n }\n if (localOptions.useRawBoxes) rect(ctx, inCanvas.width * box[0], inCanvas.height * box[1], inCanvas.width * box[2], inCanvas.height * box[3], localOptions);\n else rect(ctx, box[0], box[1], box[2], box[3], localOptions);\n if (localOptions.drawLabels) {\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText('hand', box[0] + 3, 1 + box[1] + localOptions.lineHeight, box[2]);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText('hand', box[0] + 2, 0 + box[1] + localOptions.lineHeight, box[2]);\n }\n ctx.stroke();\n }\n if (localOptions.drawPoints) {\n if (h.landmarks && h.landmarks.length > 0) {\n for (const pt of h.landmarks) {\n ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + (2 * pt[2])}, ${127.5 - (2 * pt[2])}, 255, 0.5)` : localOptions.color;\n point(ctx, pt[0], pt[1], 0, localOptions);\n }\n }\n }\n if (localOptions.drawLabels) {\n const addHandLabel = (part, title) => {\n ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + (2 * part[part.length - 1][2])}, ${127.5 - (2 * part[part.length - 1][2])}, 255, 0.5)` : localOptions.color;\n ctx.fillText(title, part[part.length - 1][0] + 4, part[part.length - 1][1] + 4);\n };\n ctx.font = localOptions.font;\n addHandLabel(h.annotations.indexFinger, 'index');\n addHandLabel(h.annotations.middleFinger, 'middle');\n addHandLabel(h.annotations.ringFinger, 'ring');\n addHandLabel(h.annotations.pinky, 'pinky');\n addHandLabel(h.annotations.thumb, 'thumb');\n addHandLabel(h.annotations.palmBase, 'palm');\n }\n if (localOptions.drawPolygons) {\n const addHandLine = (part) => {\n if (!part) return;\n for (let i = 0; i < part.length; i++) {\n ctx.beginPath();\n ctx.strokeStyle = localOptions.useDepth ? `rgba(${127.5 + (2 * part[i][2])}, ${127.5 - (2 * part[i][2])}, 255, 0.5)` : localOptions.color;\n ctx.moveTo(part[i > 0 ? i - 1 : 0][0], part[i > 0 ? i - 1 : 0][1]);\n ctx.lineTo(part[i][0], part[i][1]);\n ctx.stroke();\n }\n };\n ctx.lineWidth = localOptions.lineWidth;\n addHandLine(h.annotations.indexFinger);\n addHandLine(h.annotations.middleFinger);\n addHandLine(h.annotations.ringFinger);\n addHandLine(h.annotations.pinky);\n addHandLine(h.annotations.thumb);\n // addPart(h.annotations.palmBase);\n }\n }\n}\n\nexport async function object(inCanvas: HTMLCanvasElement, result: Array, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n const ctx = inCanvas.getContext('2d');\n if (!ctx) return;\n ctx.lineJoin = 'round';\n ctx.font = localOptions.font;\n for (const h of result) {\n if (localOptions.drawBoxes) {\n ctx.strokeStyle = localOptions.color;\n ctx.fillStyle = localOptions.color;\n if (localOptions.useRawBoxes) rect(ctx, inCanvas.width * h.boxRaw[0], inCanvas.height * h.boxRaw[1], inCanvas.width * h.boxRaw[2], inCanvas.height * h.boxRaw[3], localOptions);\n else rect(ctx, h.box[0], h.box[1], h.box[2], h.box[3], localOptions);\n if (localOptions.drawLabels) {\n const label = `${Math.round(100 * h.score)}% ${h.label}`;\n if (localOptions.shadowColor && localOptions.shadowColor !== '') {\n ctx.fillStyle = localOptions.shadowColor;\n ctx.fillText(label, h.box[0] + 3, 1 + h.box[1] + localOptions.lineHeight, h.box[2]);\n }\n ctx.fillStyle = localOptions.labelColor;\n ctx.fillText(label, h.box[0] + 2, 0 + h.box[1] + localOptions.lineHeight, h.box[2]);\n }\n ctx.stroke();\n }\n }\n}\n\nexport async function canvas(inCanvas: HTMLCanvasElement, outCanvas: HTMLCanvasElement) {\n if (!inCanvas || !outCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement) || !(outCanvas instanceof HTMLCanvasElement)) return;\n const outCtx = inCanvas.getContext('2d');\n outCtx?.drawImage(inCanvas, 0, 0);\n}\n\nexport async function all(inCanvas: HTMLCanvasElement, result:any, drawOptions?: DrawOptions) {\n const localOptions = mergeDeep(options, drawOptions);\n if (!result || !inCanvas) return;\n if (!(inCanvas instanceof HTMLCanvasElement)) return;\n face(inCanvas, result.face, localOptions);\n body(inCanvas, result.body, localOptions);\n hand(inCanvas, result.hand, localOptions);\n gesture(inCanvas, result.gesture, localOptions);\n object(inCanvas, result.object, localOptions);\n}\n", "// data:image/jpeg;base64,\nexport const face = `\n/9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUA\nAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAARAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQu\nbmV0IDQuMi4xMwAA/9sAQwAGBAUGBQQGBgUGBwcGCAoQCgoJCQoUDg8MEBcUGBgXFB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mNng+K4+I8Hy2yaTfl37TXetoCPfRxfp1qi3F48ofKMvtvxak8s6LDv61\nrZji9rPaLUf5PC+bfttS0q8q3p9W/wBrRMdpUZuKdN99nzvFqPbTVz7nD8OKs+do2/mW3h4D7Xaq\nZnPrtNpqz35aRaYOHY9Zk4pNt9rR+rl6zi+OnS+WN57Rv1lXp/YrNaYtruL6zNPnGO3hxP6O5w/2\nf0HDuun09Yv55Le9afznqcOvO4tBreMTHu30unnva0bWt8on+70nDuE4OHYYx4Kbesz3tPrMuhGO\nIjpDOKrK9YVpsyiGUQnYGOyUgI2SlAIEmwMWMs9kTAMJYzDOYRMArmGErZhhMArlHmzmGMwDE3Ts\nbAbs4swj5pgFkSziVcM4BZEsolXDKAZwyhjCYBkACQhIAAAAAAAJAAAAAAAAAAAAAAAAAAAShIAA\nAAAAAAJAAAAAAAAAAAAAABAJEAAAAAAAAAAAAAAAIEoBKAAAAAAAAAAAAAAABAlAAAAAAAIAAAAA\nBAkBAkBAkBAlACEgMZjdjbFW8bWrEx8YWANb6Fp+bfwab+vLDKMFK9qxH5L0bAr8OPRPKz2AY7J2\nSbAjYZAI2E7AIEgIEgIEgMdkSy2NgY7MdlmyNoBXsxmFuyNgVTVjNV3KjlBRNTlXTVHKCrlIqt5T\nlBhEMohlFerLlBjEMohMVTEARDKCITsAk2AEgAAAkAAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAD/\n2Q==`;\n", "import { log, now, mergeDeep } from './helpers';\nimport { Config, defaults } from './config';\nimport { Result } from './result';\nimport * as sysinfo from './sysinfo';\nimport * as tf from '../dist/tfjs.esm.js';\nimport * as backend from './tfjs/backend';\nimport * as faceall from './faceall';\nimport * as facemesh from './blazeface/facemesh';\nimport * as faceres from './faceres/faceres';\nimport * as emotion from './emotion/emotion';\nimport * as posenet from './posenet/posenet';\nimport * as handpose from './handpose/handpose';\nimport * as blazepose from './blazepose/blazepose';\nimport * as nanodet from './nanodet/nanodet';\nimport * as gesture from './gesture/gesture';\nimport * as image from './image/image';\nimport * as draw from './draw/draw';\nimport * as sample from './sample';\nimport * as app from '../package.json';\n\n/** Generic Tensor object type */\nexport type Tensor = typeof tf.Tensor;\n\nexport type { Config } from './config';\nexport type { Result } from './result';\nexport type { DrawOptions } from './draw/draw';\n\n/** Defines all possible input types for **Human** detection */\nexport type Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;\n\n/** Error message */\nexport type Error = { error: string };\n\n/** Instance of TensorFlow/JS */\nexport type TensorFlow = typeof tf;\n\n/** Generic Model object type, holds instance of individual models */\ntype Model = Object;\n\n/**\n * **Human** library main class\n *\n * All methods and properties are available only as members of Human class\n *\n * - Configuration object definition: {@link Config}\n * - Results object definition: {@link Result}\n * - Possible inputs: {@link Input}\n */\nexport class Human {\n /** Current version of Human library in semver format */\n version: string;\n /** Current configuration\n * - Details: {@link Config}\n */\n config: Config;\n /** Current state of Human library\n * - Can be polled to determine operations that are currently executed\n */\n state: string;\n /** Internal: Instance of current image being processed */\n image: { tensor: Tensor | null, canvas: OffscreenCanvas | HTMLCanvasElement | null };\n /** Internal: Instance of TensorFlow/JS used by Human\n * - Can be embedded or externally provided\n */\n tf: TensorFlow;\n /** Draw helper classes that can draw detected objects on canvas using specified draw styles\n * - options: global settings for all draw operations, can be overriden for each draw method, for details see {@link DrawOptions}\n * - face: draw detected faces\n * - body: draw detected people and body parts\n * - hand: draw detected hands and hand parts\n * - canvas: draw processed canvas which is a processed copy of the input\n * - all: meta-function that performs: canvas, face, body, hand\n */\n draw: {\n options: draw.DrawOptions,\n gesture: typeof draw.gesture,\n face: typeof draw.face,\n body: typeof draw.body,\n hand: typeof draw.hand,\n canvas: typeof draw.canvas,\n all: typeof draw.all,\n };\n /** Internal: Currently loaded models */\n models: {\n face: [Model, Model, Model] | null,\n posenet: Model | null,\n blazepose: Model | null,\n efficientpose: Model | null,\n handpose: [Model, Model] | null,\n iris: Model | null,\n age: Model | null,\n gender: Model | null,\n emotion: Model | null,\n embedding: Model | null,\n nanodet: Model | null,\n faceres: Model | null,\n };\n /** Internal: Currently loaded classes */\n classes: {\n facemesh: typeof facemesh;\n emotion: typeof emotion;\n body: typeof posenet | typeof blazepose;\n hand: typeof handpose;\n nanodet: typeof nanodet;\n faceres: typeof faceres;\n };\n /** Face triangualtion array of 468 points, used for triangle references between points */\n faceTriangulation: typeof facemesh.triangulation;\n /** UV map of 468 values, used for 3D mapping of the face mesh */\n faceUVMap: typeof facemesh.uvmap;\n /** Platform and agent information detected by Human */\n sysinfo: { platform: string, agent: string };\n /** Performance object that contains values for all recently performed operations */\n perf: any;\n #numTensors: number;\n #analyzeMemoryLeaks: boolean;\n #checkSanity: boolean;\n #firstRun: boolean;\n\n // definition end\n\n /**\n * Creates instance of Human library that is futher used for all operations\n * - @param userConfig: {@link Config}\n */\n constructor(userConfig: Config | Object = {}) {\n this.tf = tf;\n this.draw = draw;\n this.version = app.version;\n this.config = mergeDeep(defaults, userConfig);\n this.state = 'idle';\n this.#numTensors = 0;\n this.#analyzeMemoryLeaks = false;\n this.#checkSanity = false;\n this.#firstRun = true;\n this.perf = {};\n // object that contains all initialized models\n this.models = {\n face: null,\n posenet: null,\n blazepose: null,\n efficientpose: null,\n handpose: null,\n iris: null,\n age: null,\n gender: null,\n emotion: null,\n embedding: null,\n nanodet: null,\n faceres: null,\n };\n // export access to image processing\n // @ts-ignore eslint-typescript cannot correctly infer type in anonymous function\n this.image = (input: Input) => image.process(input, this.config);\n // export raw access to underlying models\n this.classes = {\n facemesh,\n emotion,\n faceres,\n body: this.config.body.modelPath.includes('posenet') ? posenet : blazepose,\n hand: handpose,\n nanodet,\n };\n this.faceTriangulation = facemesh.triangulation;\n this.faceUVMap = facemesh.uvmap;\n // include platform info\n this.sysinfo = sysinfo.info();\n }\n\n // helper function: measure tensor leak\n /** @hidden */\n analyze = (...msg) => {\n if (!this.#analyzeMemoryLeaks) return;\n const current = this.tf.engine().state.numTensors;\n const previous = this.#numTensors;\n this.#numTensors = current;\n const leaked = current - previous;\n if (leaked !== 0) log(...msg, leaked);\n }\n\n // quick sanity check on inputs\n /** @hidden */\n #sanity = (input): null | string => {\n if (!this.#checkSanity) return null;\n if (!input) return 'input is not defined';\n if (this.tf.ENV.flags.IS_NODE && !(input instanceof tf.Tensor)) return 'input must be a tensor';\n try {\n this.tf.getBackend();\n } catch {\n return 'backend not loaded';\n }\n return null;\n }\n\n /** Simmilarity method calculates simmilarity between two provided face descriptors (face embeddings)\n * - Calculation is based on normalized Minkowski distance between\n */\n // eslint-disable-next-line class-methods-use-this\n similarity(embedding1: Array, embedding2: Array): number {\n return faceres.similarity(embedding1, embedding2);\n }\n\n /** Enhance method performs additional enhacements to face image previously detected for futher processing\n * @param input Tensor as provided in human.result.face[n].tensor\n * @returns Tensor\n */\n // eslint-disable-next-line class-methods-use-this\n enhance(input: Tensor): Tensor | null {\n return faceres.enhance(input);\n }\n\n /**\n * Math method find best match between provided face descriptor and predefined database of known descriptors\n * @param faceEmbedding: face descriptor previsouly calculated on any face\n * @param db: array of mapping of face descriptors to known values\n * @param threshold: minimum score for matching to be considered in the result\n * @returns best match\n */\n // eslint-disable-next-line class-methods-use-this\n match(faceEmbedding: Array, db: Array<{ name: string, source: string, embedding: number[] }>, threshold = 0): { name: string, source: string, similarity: number, embedding: number[] } {\n return faceres.match(faceEmbedding, db, threshold);\n }\n\n /** Load method preloads all configured models on-demand\n * - Not explicitly required as any required model is load implicitly on it's first run\n */\n async load(userConfig: Config | Object = {}) {\n this.state = 'load';\n const timeStamp = now();\n if (userConfig) this.config = mergeDeep(this.config, userConfig);\n\n if (this.#firstRun) {\n if (this.config.debug) log(`version: ${this.version}`);\n if (this.config.debug) log(`tfjs version: ${this.tf.version_core}`);\n if (this.config.debug) log('platform:', this.sysinfo.platform);\n if (this.config.debug) log('agent:', this.sysinfo.agent);\n\n await this.#checkBackend(true);\n if (this.tf.ENV.flags.IS_BROWSER) {\n if (this.config.debug) log('configuration:', this.config);\n if (this.config.debug) log('tf flags:', this.tf.ENV.flags);\n }\n }\n if (this.config.async) {\n [\n this.models.face,\n this.models.emotion,\n this.models.handpose,\n this.models.posenet,\n this.models.blazepose,\n this.models.nanodet,\n this.models.faceres,\n ] = await Promise.all([\n this.models.face || (this.config.face.enabled ? facemesh.load(this.config) : null),\n this.models.emotion || ((this.config.face.enabled && this.config.face.emotion.enabled) ? emotion.load(this.config) : null),\n this.models.handpose || (this.config.hand.enabled ? handpose.load(this.config) : null),\n this.models.posenet || (this.config.body.enabled && this.config.body.modelPath.includes('posenet') ? posenet.load(this.config) : null),\n this.models.blazepose || (this.config.body.enabled && this.config.body.modelPath.includes('blazepose') ? blazepose.load(this.config) : null),\n this.models.nanodet || (this.config.object.enabled ? nanodet.load(this.config) : null),\n this.models.faceres || ((this.config.face.enabled && this.config.face.description.enabled) ? faceres.load(this.config) : null),\n ]);\n } else {\n if (this.config.face.enabled && !this.models.face) this.models.face = await facemesh.load(this.config);\n if (this.config.face.enabled && this.config.face.emotion.enabled && !this.models.emotion) this.models.emotion = await emotion.load(this.config);\n if (this.config.hand.enabled && !this.models.handpose) this.models.handpose = await handpose.load(this.config);\n if (this.config.body.enabled && !this.models.posenet && this.config.body.modelPath.includes('posenet')) this.models.posenet = await posenet.load(this.config);\n if (this.config.body.enabled && !this.models.blazepose && this.config.body.modelPath.includes('blazepose')) this.models.blazepose = await blazepose.load(this.config);\n if (this.config.object.enabled && !this.models.nanodet) this.models.nanodet = await nanodet.load(this.config);\n if (this.config.face.enabled && this.config.face.description.enabled && !this.models.faceres) this.models.faceres = await faceres.load(this.config);\n }\n\n if (this.#firstRun) {\n if (this.config.debug) log('tf engine state:', this.tf.engine().state.numBytes, 'bytes', this.tf.engine().state.numTensors, 'tensors');\n this.#firstRun = false;\n }\n\n const current = Math.trunc(now() - timeStamp);\n if (current > (this.perf.load || 0)) this.perf.load = current;\n }\n\n // check if backend needs initialization if it changed\n /** @hidden */\n #checkBackend = async (force = false) => {\n if (this.config.backend && (this.config.backend.length > 0) && force || (this.tf.getBackend() !== this.config.backend)) {\n const timeStamp = now();\n this.state = 'backend';\n /* force backend reload\n if (this.config.backend in tf.engine().registry) {\n const backendFactory = tf.findBackendFactory(this.config.backend);\n tf.removeBackend(this.config.backend);\n tf.registerBackend(this.config.backend, backendFactory);\n } else {\n log('Backend not registred:', this.config.backend);\n }\n */\n\n if (this.config.backend && this.config.backend.length > 0) {\n // @ts-ignore ignore missing type for WorkerGlobalScope as that is the point\n if (typeof window === 'undefined' && typeof WorkerGlobalScope !== 'undefined' && this.config.debug) log('running inside web worker');\n\n // force browser vs node backend\n if (this.tf.ENV.flags.IS_BROWSER && this.config.backend === 'tensorflow') this.config.backend = 'webgl';\n if (this.tf.ENV.flags.IS_NODE && (this.config.backend === 'webgl' || this.config.backend === 'humangl')) this.config.backend = 'tensorflow';\n\n if (this.config.debug) log('setting backend:', this.config.backend);\n\n if (this.config.backend === 'wasm') {\n if (this.config.debug) log('wasm path:', this.config.wasmPath);\n if (typeof this.tf?.setWasmPaths !== 'undefined') this.tf.setWasmPaths(this.config.wasmPath);\n else throw new Error('Human: WASM backend is not loaded');\n const simd = await this.tf.env().getAsync('WASM_HAS_SIMD_SUPPORT');\n const mt = await this.tf.env().getAsync('WASM_HAS_MULTITHREAD_SUPPORT');\n if (this.config.debug) log(`wasm execution: ${simd ? 'SIMD' : 'no SIMD'} ${mt ? 'multithreaded' : 'singlethreaded'}`);\n if (this.config.debug && !simd) log('warning: wasm simd support is not enabled');\n }\n\n if (this.config.backend === 'humangl') backend.register();\n try {\n await this.tf.setBackend(this.config.backend);\n } catch (err) {\n log('error: cannot set backend:', this.config.backend, err);\n }\n }\n this.tf.enableProdMode();\n // this.tf.enableDebugMode();\n if (this.tf.getBackend() === 'webgl' || this.tf.getBackend() === 'humangl') {\n this.tf.ENV.set('CHECK_COMPUTATION_FOR_ERRORS', false);\n this.tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);\n if (typeof this.config['deallocate'] !== 'undefined') {\n log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', true);\n this.tf.ENV.set('WEBGL_DELETE_TEXTURE_THRESHOLD', 0);\n }\n const gl = await this.tf.backend().getGPGPUContext().gl;\n if (this.config.debug) log(`gl version:${gl.getParameter(gl.VERSION)} renderer:${gl.getParameter(gl.RENDERER)}`);\n }\n await this.tf.ready();\n this.perf.backend = Math.trunc(now() - timeStamp);\n }\n }\n\n /** Main detection method\n * - Analyze configuration: {@link Config}\n * - Pre-process input: {@link Input}\n * - Run inference for all configured models\n * - Process and return result: {@link Result}\n */\n async detect(input: Input, userConfig: Config | Object = {}): Promise {\n // detection happens inside a promise\n return new Promise(async (resolve) => {\n this.state = 'config';\n let timeStamp;\n\n // update configuration\n this.config = mergeDeep(this.config, userConfig);\n\n // sanity checks\n this.state = 'check';\n const error = this.#sanity(input);\n if (error) {\n log(error, input);\n resolve({ error });\n }\n\n const timeStart = now();\n\n // configure backend\n await this.#checkBackend();\n\n // load models if enabled\n await this.load();\n\n // disable video optimization for inputs of type image, but skip if inside worker thread\n let previousVideoOptimized;\n // @ts-ignore ignore missing type for WorkerGlobalScope as that is the point\n if (input && this.config.videoOptimized && (typeof window !== 'undefined') && (typeof WorkerGlobalScope !== 'undefined') && (\n (typeof HTMLImageElement !== 'undefined' && input instanceof HTMLImageElement)\n || (typeof Image !== 'undefined' && input instanceof Image)\n || (typeof ImageData !== 'undefined' && input instanceof ImageData)\n || (typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap))\n ) {\n log('disabling video optimization');\n previousVideoOptimized = this.config.videoOptimized;\n this.config.videoOptimized = false;\n }\n\n timeStamp = now();\n const process = image.process(input, this.config);\n if (!process || !process.tensor) {\n log('could not convert input to tensor');\n resolve({ error: 'could not convert input to tensor' });\n return;\n }\n this.perf.image = Math.trunc(now() - timeStamp);\n this.analyze('Get Image:');\n\n // prepare where to store model results\n let bodyRes;\n let handRes;\n let faceRes;\n let objectRes;\n let current;\n\n // run face detection followed by all models that rely on face bounding box: face mesh, age, gender, emotion\n if (this.config.async) {\n faceRes = this.config.face.enabled ? faceall.detectFace(this, process.tensor) : [];\n if (this.perf.face) delete this.perf.face;\n } else {\n this.state = 'run:face';\n timeStamp = now();\n faceRes = this.config.face.enabled ? await faceall.detectFace(this, process.tensor) : [];\n current = Math.trunc(now() - timeStamp);\n if (current > 0) this.perf.face = current;\n }\n\n // run body: can be posenet or blazepose\n this.analyze('Start Body:');\n if (this.config.async) {\n if (this.config.body.modelPath.includes('posenet')) bodyRes = this.config.body.enabled ? posenet.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('blazepose')) bodyRes = this.config.body.enabled ? blazepose.predict(process.tensor, this.config) : [];\n if (this.perf.body) delete this.perf.body;\n } else {\n this.state = 'run:body';\n timeStamp = now();\n if (this.config.body.modelPath.includes('posenet')) bodyRes = this.config.body.enabled ? await posenet.predict(process.tensor, this.config) : [];\n else if (this.config.body.modelPath.includes('blazepose')) bodyRes = this.config.body.enabled ? await blazepose.predict(process.tensor, this.config) : [];\n current = Math.trunc(now() - timeStamp);\n if (current > 0) this.perf.body = current;\n }\n this.analyze('End Body:');\n\n // run handpose\n this.analyze('Start Hand:');\n if (this.config.async) {\n handRes = this.config.hand.enabled ? handpose.predict(process.tensor, this.config) : [];\n if (this.perf.hand) delete this.perf.hand;\n } else {\n this.state = 'run:hand';\n timeStamp = now();\n handRes = this.config.hand.enabled ? await handpose.predict(process.tensor, this.config) : [];\n current = Math.trunc(now() - timeStamp);\n if (current > 0) this.perf.hand = current;\n }\n this.analyze('End Hand:');\n\n // run nanodet\n this.analyze('Start Object:');\n if (this.config.async) {\n objectRes = this.config.object.enabled ? nanodet.predict(process.tensor, this.config) : [];\n if (this.perf.object) delete this.perf.object;\n } else {\n this.state = 'run:object';\n timeStamp = now();\n objectRes = this.config.object.enabled ? await nanodet.predict(process.tensor, this.config) : [];\n current = Math.trunc(now() - timeStamp);\n if (current > 0) this.perf.object = current;\n }\n this.analyze('End Object:');\n\n // if async wait for results\n if (this.config.async) {\n [faceRes, bodyRes, handRes, objectRes] = await Promise.all([faceRes, bodyRes, handRes, objectRes]);\n }\n tf.dispose(process.tensor);\n\n // run gesture analysis last\n let gestureRes: any[] = [];\n if (this.config.gesture.enabled) {\n timeStamp = now();\n gestureRes = [...gesture.face(faceRes), ...gesture.body(bodyRes), ...gesture.hand(handRes), ...gesture.iris(faceRes)];\n if (!this.config.async) this.perf.gesture = Math.trunc(now() - timeStamp);\n else if (this.perf.gesture) delete this.perf.gesture;\n }\n\n // restore video optimizations if previously disabled\n if (previousVideoOptimized) this.config.videoOptimized = previousVideoOptimized;\n\n this.perf.total = Math.trunc(now() - timeStart);\n this.state = 'idle';\n const result = {\n face: faceRes,\n body: bodyRes,\n hand: handRes,\n gesture: gestureRes,\n object: objectRes,\n performance: this.perf,\n canvas: process.canvas,\n };\n // log('Result:', result);\n resolve(result);\n });\n }\n\n /** @hidden */\n #warmupBitmap = async () => {\n const b64toBlob = (base64, type = 'application/octet-stream') => fetch(`data:${type};base64,${base64}`).then((res) => res.blob());\n let blob;\n let res;\n switch (this.config.warmup) {\n case 'face': blob = await b64toBlob(sample.face); break;\n case 'full': blob = await b64toBlob(sample.body); break;\n default: blob = null;\n }\n if (blob) {\n const bitmap = await createImageBitmap(blob);\n res = await this.detect(bitmap, this.config);\n bitmap.close();\n }\n return res;\n }\n\n /** @hidden */\n #warmupCanvas = async () => new Promise((resolve) => {\n let src;\n let size = 0;\n switch (this.config.warmup) {\n case 'face':\n size = 256;\n src = 'data:image/jpeg;base64,' + sample.face;\n break;\n case 'full':\n case 'body':\n size = 1200;\n src = 'data:image/jpeg;base64,' + sample.body;\n break;\n default:\n src = null;\n }\n // src = encodeURI('../assets/human-sample-upper.jpg');\n const img = new Image();\n img.onload = async () => {\n const canvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(size, size) : document.createElement('canvas');\n canvas.width = img.naturalWidth;\n canvas.height = img.naturalHeight;\n const ctx = canvas.getContext('2d');\n ctx?.drawImage(img, 0, 0);\n // const data = ctx?.getImageData(0, 0, canvas.height, canvas.width);\n const res = await this.detect(canvas, this.config);\n resolve(res);\n };\n if (src) img.src = src;\n else resolve(null);\n });\n\n /** @hidden */\n #warmupNode = async () => {\n const atob = (str) => Buffer.from(str, 'base64');\n let img;\n if (this.config.warmup === 'face') img = atob(sample.face);\n if (this.config.warmup === 'body' || this.config.warmup === 'full') img = atob(sample.body);\n if (!img) return null;\n let res;\n if (typeof tf['node'] !== 'undefined') {\n const data = tf['node'].decodeJpeg(img);\n const expanded = data.expandDims(0);\n this.tf.dispose(data);\n // log('Input:', expanded);\n res = await this.detect(expanded, this.config);\n this.tf.dispose(expanded);\n } else {\n if (this.config.debug) log('Warmup tfjs-node not loaded');\n /*\n const input = await canvasJS.loadImage(img);\n const canvas = canvasJS.createCanvas(input.width, input.height);\n const ctx = canvas.getContext('2d');\n ctx.drawImage(img, 0, 0, input.width, input.height);\n res = await this.detect(input, this.config);\n */\n }\n return res;\n }\n\n /** Warmup metho pre-initializes all models for faster inference\n * - can take significant time on startup\n * - only used for `webgl` and `humangl` backends\n */\n async warmup(userConfig: Config | Object = {}): Promise {\n const t0 = now();\n if (userConfig) this.config = mergeDeep(this.config, userConfig);\n if (!this.config.warmup || this.config.warmup === 'none') return { error: 'null' };\n const save = this.config.videoOptimized;\n this.config.videoOptimized = false;\n let res;\n if (typeof createImageBitmap === 'function') res = await this.#warmupBitmap();\n else if (typeof Image !== 'undefined') res = await this.#warmupCanvas();\n else res = await this.#warmupNode();\n this.config.videoOptimized = save;\n const t1 = now();\n if (this.config.debug) log('Warmup', this.config.warmup, Math.round(t1 - t0), 'ms', res);\n return res;\n }\n}\n\n/**\n * Class Human is also available as default export\n */\nexport { Human as default };\n"], + "mappings": ";;;;;;;stBACO,WAAc,EAAgB,EAAsB,CACzD,GAAM,GAAY,EAAO,SAAS,KAAO,GAAK,IAExC,EAAO,AADI,EAAK,WAAW,MAAQ,EA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OAAO,eAAiB,GAEzD,KAAK,KAAK,MAAQ,KAAK,MAAM,IAAQ,GACrC,KAAK,MAAQ,OACb,GAAM,GAAS,CACb,KAAM,EACN,KAAM,EACN,KAAM,EACN,QAAS,EACT,OAAQ,EACR,YAAa,KAAK,KAClB,OAAQ,EAAQ,QAGlB,EAAQ,UAuFN,QAAO,EAA8B,GAAiC,CAC1E,GAAM,GAAK,IAEX,GADI,GAAY,MAAK,OAAS,EAAU,KAAK,OAAQ,IACjD,CAAC,KAAK,OAAO,QAAU,KAAK,OAAO,SAAW,OAAQ,MAAO,CAAE,MAAO,QAC1E,GAAM,GAAO,KAAK,OAAO,eACzB,KAAK,OAAO,eAAiB,GAC7B,GAAI,GACJ,AAAI,MAAO,oBAAsB,WAAY,EAAM,KAAM,QAAK,IAAL,WACpD,AAAI,MAAO,QAAU,YAAa,EAAM,KAAM,QAAK,IAAL,WAC9C,EAAM,KAAM,QAAK,IAAL,WACjB,KAAK,OAAO,eAAiB,EAC7B,GAAM,GAAK,IACX,MAAI,MAAK,OAAO,OAAO,EAAI,SAAU,KAAK,OAAO,OAAQ,KAAK,MAAM,EAAK,GAAK,KAAM,GAC7E,IA1dT,eACA,eACA,eACA,eAiEA,eAoGA,eAmNA,eAkBA,eAiCA", "names": [] } diff --git a/dist/human.esm.js b/dist/human.esm.js index 6137bd18..63ce28c7 100644 --- a/dist/human.esm.js +++ b/dist/human.esm.js @@ -5,41 +5,41 @@ author: ' */ -var P9=Object.defineProperty;var Ma=(e,t)=>{for(var n in t)P9(e,n,{get:t[n],enumerable:!0})};var _g=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var na=(e,t,n)=>(_g(e,t,"read from private field"),n?n.call(e):t.get(e)),as=(e,t,n,a)=>(_g(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n);function Yt(e,t){let n=e.endsWith("/")?"":"/",r=t.startsWith(".")||t.startsWith("/")||t.startsWith("http:")||t.startsWith("https:")||t.startsWith("file:")?`${t}`:`${e}${n}${t}`;if(!r.toLocaleLowerCase().includes(".json"))throw new Error(`Human: ModelPath Error: ${r} Expecting JSON file`);return r}function he(...e){let t=new Date,n=`${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}:${t.getSeconds().toString().padStart(2,"0")}.${t.getMilliseconds().toString().padStart(3,"0")}`;e&&console.log(n,"Human:",...e)}var it=()=>typeof performance!="undefined"?performance.now():parseInt((Number(process.hrtime.bigint())/1e3/1e3).toString());function Hn(...e){let t=n=>n&&typeof n=="object";return e.reduce((n,a)=>(Object.keys(a||{}).forEach(r=>{let s=n[r],i=a[r];Array.isArray(s)&&Array.isArray(i)?n[r]=s.concat(...i):t(s)&&t(i)?n[r]=Hn(s,i):n[r]=i}),n),{})}var Pg={backend:"webgl",modelBasePath:"../models/",wasmPath:"../assets/",debug:!0,async:!0,videoOptimized:!0,warmup:"full",filter:{enabled:!0,width:0,height:0,flip:!1,return:!0,brightness:0,contrast:0,sharpness:0,blur:0,saturation:0,hue:0,negative:!1,sepia:!1,vintage:!1,kodachrome:!1,technicolor:!1,polaroid:!1,pixelate:0},gesture:{enabled:!0},face:{enabled:!0,detector:{modelPath:"blazeface.json",rotation:!1,maxDetected:10,skipFrames:21,skipInitial:!1,minConfidence:.2,iouThreshold:.1,return:!1},mesh:{enabled:!0,modelPath:"facemesh.json"},iris:{enabled:!0,modelPath:"iris.json"},description:{enabled:!0,modelPath:"faceres.json",skipFrames:31,minConfidence:.1},emotion:{enabled:!0,minConfidence:.1,skipFrames:32,modelPath:"emotion.json"}},body:{enabled:!0,modelPath:"posenet.json",maxDetected:1,minConfidence:.1},hand:{enabled:!0,rotation:!1,skipFrames:12,skipInitial:!1,minConfidence:.1,iouThreshold:.1,maxDetected:2,landmarks:!0,detector:{modelPath:"handdetect.json"},skeleton:{modelPath:"handskeleton.json"}},object:{enabled:!1,modelPath:"nanodet.json",minConfidence:.2,iouThreshold:.4,maxDetected:10,skipFrames:41}};function Lg(){let e,t;if(typeof navigator!="undefined"){let n=navigator.userAgent.match(/\(([^()]+)\)/g);if(n&&n[0]){let a=n[0].match(/\(([^()]+)\)/g);e=a?a[0].replace(/\(|\)/g,""):"",t=navigator.userAgent.replace(n[0],""),e[1]&&(t=t.replace(n[1],"")),t=t.replace(/ /g," ")}}else typeof process!="undefined"&&(e=`${process.platform} ${process.arch}`,t=`NodeJS ${process.version}`);return{platform:e,agent:t}}var pu={};Ma(pu,{Abs:()=>Qi,Acos:()=>eo,Acosh:()=>to,AdadeltaOptimizer:()=>Kc,AdagradOptimizer:()=>Zc,AdamOptimizer:()=>Yc,AdamaxOptimizer:()=>Jc,Add:()=>wr,AddN:()=>is,All:()=>no,Any:()=>ao,ArgMax:()=>os,ArgMin:()=>Au,Asin:()=>ro,Asinh:()=>so,Atan:()=>io,Atan2:()=>lo,Atanh:()=>oo,AvgPool:()=>ls,AvgPool3D:()=>yu,AvgPool3DGrad:()=>Cp,AvgPoolGrad:()=>Ep,BackendWasm:()=>p6,BatchMatMul:()=>us,BatchToSpaceND:()=>gu,Bincount:()=>Rp,BroadcastTo:()=>Mx,Callback:()=>a8,CallbackList:()=>e4,Cast:()=>ds,Ceil:()=>ps,ClipByValue:()=>kr,Complex:()=>Mp,ComplexAbs:()=>xu,Concat:()=>uo,Conv2D:()=>cs,Conv2DBackpropFilter:()=>Fp,Conv2DBackpropInput:()=>hs,Conv3D:()=>bu,Conv3DBackpropFilterV2:()=>$p,Conv3DBackpropInputV2:()=>Dp,Cos:()=>fs,Cosh:()=>po,CropAndResize:()=>co,Cumsum:()=>ms,CustomCallback:()=>n4,DataStorage:()=>Ip,DenseBincount:()=>Op,DepthToSpace:()=>ho,DepthwiseConv2dNative:()=>As,DepthwiseConv2dNativeBackpropFilter:()=>zp,DepthwiseConv2dNativeBackpropInput:()=>_p,Diag:()=>Pp,Dilation2D:()=>vu,Dilation2DBackpropFilter:()=>Wp,Dilation2DBackpropInput:()=>Lp,ENV:()=>fa,EarlyStopping:()=>s8,Einsum:()=>Bp,Elu:()=>fo,EluGrad:()=>Vp,Environment:()=>Cx,Equal:()=>Ao,Erf:()=>mo,Exp:()=>gs,ExpandDims:()=>yo,Expm1:()=>go,FFT:()=>jp,Fill:()=>wu,FlipLeftRight:()=>xo,Floor:()=>xs,FloorDiv:()=>bs,FromPixels:()=>sc,FusedBatchNorm:()=>vs,FusedConv2D:()=>ti,FusedDepthwiseConv2D:()=>ni,GPGPUContext:()=>mh,GatherNd:()=>vo,GatherV2:()=>bo,GraphModel:()=>O8,Greater:()=>wo,GreaterEqual:()=>ws,History:()=>t4,IFFT:()=>Up,Identity:()=>ks,Imag:()=>Hp,InputSpec:()=>Mt,IsFinite:()=>ko,IsInf:()=>Io,IsNan:()=>So,KernelBackend:()=>hu,LRN:()=>Su,LRNGrad:()=>qp,LayerVariable:()=>K6,LayersModel:()=>dr,LeakyRelu:()=>Is,Less:()=>No,LessEqual:()=>To,LinSpace:()=>Gp,Log:()=>Ss,Log1p:()=>Eo,LogSoftmax:()=>Fx,LogicalAnd:()=>Co,LogicalNot:()=>ku,LogicalOr:()=>Iu,MathBackendCPU:()=>nh,MathBackendWebGL:()=>Ol,Max:()=>Ns,MaxPool:()=>Es,MaxPool3D:()=>Nu,MaxPool3DGrad:()=>Kp,MaxPoolGrad:()=>Xp,MaxPoolWithArgmax:()=>Zp,Maximum:()=>Ts,Mean:()=>Cs,Min:()=>Rs,Minimum:()=>Ms,MirrorPad:()=>Fs,Mod:()=>Ro,MomentumOptimizer:()=>Qc,Multinomial:()=>Yp,Multiply:()=>$s,Neg:()=>Mo,NonMaxSuppressionV3:()=>$o,NonMaxSuppressionV4:()=>Do,NonMaxSuppressionV5:()=>Oo,NotEqual:()=>Fo,OP_SCOPE_SUFFIX:()=>jx,OneHot:()=>Ds,OnesLike:()=>zo,Optimizer:()=>ir,Pack:()=>_o,PadV2:()=>Os,Pool:()=>LI,Pow:()=>zs,Prelu:()=>_s,Prod:()=>Po,RMSPropOptimizer:()=>eh,RNN:()=>Ua,Range:()=>Tu,Rank:()=>Sm,Real:()=>Jp,RealDiv:()=>ys,Reciprocal:()=>Lo,Reduction:()=>un,Relu:()=>Ps,Relu6:()=>Ws,Reshape:()=>Wo,ResizeBilinear:()=>Ls,ResizeBilinearGrad:()=>ec,ResizeNearestNeighbor:()=>Eu,ResizeNearestNeighborGrad:()=>Qp,Reverse:()=>Bs,RotateWithOffset:()=>el,Round:()=>Vs,Rsqrt:()=>js,SGDOptimizer:()=>sd,ScatterNd:()=>Bo,Select:()=>Vo,Selu:()=>jo,Sequential:()=>Ul,Sigmoid:()=>Hs,Sign:()=>Go,Sin:()=>Us,Sinh:()=>Ho,Slice:()=>Uo,Softmax:()=>Xs,Softplus:()=>qo,SpaceToBatchND:()=>Cu,SparseFillEmptyRows:()=>tc,SparseReshape:()=>nc,SparseToDense:()=>ac,SplitV:()=>Xo,Sqrt:()=>Gs,Square:()=>Ru,SquaredDifference:()=>Ks,Step:()=>Sr,StridedSlice:()=>Ko,Sub:()=>Zs,Sum:()=>qs,SymbolicTensor:()=>Ia,Tan:()=>Ys,Tanh:()=>Js,Tensor:()=>Le,TensorBuffer:()=>Dt,Tile:()=>Ir,TopK:()=>Zo,Transform:()=>Yo,Transpose:()=>Qs,Unique:()=>rc,Unpack:()=>Jo,UnsortedSegmentSum:()=>Mu,Variable:()=>Pu,ZerosLike:()=>Qo,_FusedMatMul:()=>ei,abs:()=>Ot,acos:()=>Ym,acosh:()=>Jm,add:()=>se,addN:()=>yc,all:()=>gc,any:()=>ju,argMax:()=>Uu,argMin:()=>Qm,asin:()=>eA,asinh:()=>tA,atan:()=>nA,atan2:()=>aA,atanh:()=>rA,avgPool:()=>Gu,avgPool3d:()=>oA,backend:()=>Ib,backend_util:()=>C,basicLSTMCell:()=>gT,batchNorm:()=>pi,batchNorm2d:()=>Eb,batchNorm3d:()=>Cb,batchNorm4d:()=>Rb,batchToSpaceND:()=>qu,bincount:()=>lA,booleanMaskAsync:()=>IR,broadcastTo:()=>pl,browser:()=>oi,buffer:()=>We,callbacks:()=>Ore,cast:()=>fe,ceil:()=>uA,clipByValue:()=>kn,clone:()=>Da,complex:()=>Nr,concat:()=>ot,concat1d:()=>Mb,concat2d:()=>cl,concat3d:()=>Fb,concat4d:()=>$b,constraints:()=>w6,conv1d:()=>bc,conv2d:()=>nr,conv2dTranspose:()=>vc,conv3d:()=>pA,conv3dTranspose:()=>Ob,copyRegisteredKernels:()=>VI,cos:()=>Xu,cosh:()=>wc,cosineWindow:()=>PA,cumsum:()=>kc,customGrad:()=>za,data:()=>z8,denseBincount:()=>zb,deprecationWarn:()=>Km,depthToSpace:()=>cA,depthwiseConv2d:()=>hl,deregisterOp:()=>_re,device_util:()=>Wu,diag:()=>qT,dilation2d:()=>hA,disableDeprecationWarnings:()=>MN,dispose:()=>Ee,disposeVariables:()=>FN,div:()=>me,divNoNan:()=>fA,dot:()=>_b,dropout:()=>r3,einsum:()=>Pb,elu:()=>fl,enableDebugMode:()=>RN,enableProdMode:()=>CN,enclosingPowerOfTwo:()=>s3,engine:()=>tr,env:()=>J,equal:()=>Mr,erf:()=>mA,exp:()=>qn,expandDims:()=>ln,expm1:()=>AA,eye:()=>yA,fft:()=>ad,fill:()=>ml,findBackend:()=>Zm,findBackendFactory:()=>LN,floor:()=>Al,floorDiv:()=>Ac,forceHalfFloat:()=>wv,fused:()=>zr,gather:()=>ci,gatherND:()=>a3,gather_util:()=>Vm,getBackend:()=>_N,getGradient:()=>wm,getKernel:()=>ic,getKernelsForBackend:()=>nl,gpgpu_util:()=>G7,grad:()=>kE,grads:()=>IE,greater:()=>Mn,greaterEqual:()=>$r,ifft:()=>vl,imag:()=>Ic,image:()=>Ye,inTopKAsync:()=>OR,initializers:()=>C6,input:()=>V6,io:()=>vn,irfft:()=>Wc,isFinite:()=>Lb,isInf:()=>Wb,isNaN:()=>gA,keep:()=>jt,kernel_impls:()=>La,layers:()=>B6,leakyRelu:()=>Ku,less:()=>Sc,lessEqual:()=>Dr,linalg:()=>y3,linspace:()=>Bb,loadGraphModel:()=>Gt,loadLayersModel:()=>tre,localResponseNormalization:()=>xA,log:()=>Fn,log1p:()=>Nc,logSigmoid:()=>jb,logSoftmax:()=>Ec,logSumExp:()=>wA,logicalAnd:()=>oa,logicalNot:()=>Zu,logicalOr:()=>Cc,logicalXor:()=>qb,losses:()=>sF,matMul:()=>Be,math:()=>sb,max:()=>Xn,maxPool:()=>Yu,maxPool3d:()=>kA,maxPoolWithArgmax:()=>Xb,maximum:()=>_a,mean:()=>wt,memory:()=>mc,meshgrid:()=>GE,metrics:()=>e8,min:()=>yl,minimum:()=>gl,mirrorPad:()=>IA,mod:()=>SA,model:()=>Qae,models:()=>t8,moments:()=>Rc,movingAverage:()=>TR,mul:()=>_,multiRNNCell:()=>eC,multinomial:()=>Kb,neg:()=>vt,nextFrame:()=>th,norm:()=>Uc,notEqual:()=>mi,oneHot:()=>ol,ones:()=>$n,onesLike:()=>Dn,op:()=>O,outerProduct:()=>sC,pad:()=>ar,pad1d:()=>lC,pad2d:()=>dC,pad3d:()=>cC,pad4d:()=>fC,pool:()=>Zb,pow:()=>rr,prelu:()=>Qu,print:()=>Qx,prod:()=>Mc,profile:()=>$N,rand:()=>kC,randomGamma:()=>TC,randomNormal:()=>Yb,randomUniform:()=>xl,range:()=>bl,ready:()=>zN,real:()=>ed,reciprocal:()=>EA,registerBackend:()=>ul,registerCallbackConstructor:()=>nre,registerGradient:()=>$x,registerKernel:()=>ai,registerOp:()=>zre,regularizers:()=>n8,relu:()=>Pa,relu6:()=>Fc,removeBackend:()=>PN,reshape:()=>H,reverse:()=>On,reverse1d:()=>zC,reverse2d:()=>PC,reverse3d:()=>WC,reverse4d:()=>VC,rfft:()=>rd,round:()=>$c,rsqrt:()=>Dc,scalar:()=>Se,scatterND:()=>n3,scatter_util:()=>jm,selu:()=>Oc,separableConv2d:()=>CA,sequential:()=>ere,serialization:()=>ae,setBackend:()=>ON,setPlatform:()=>WN,setWasmPath:()=>KJ,setWasmPaths:()=>ZJ,setWebGLContext:()=>ph,setdiff1dAsync:()=>Jb,shared:()=>jA,sigmoid:()=>wn,sign:()=>RA,signal:()=>rF,sin:()=>zc,sinh:()=>_c,slice:()=>Re,slice1d:()=>Pc,slice2d:()=>MA,slice3d:()=>Lc,slice4d:()=>td,slice_util:()=>on,softmax:()=>nd,softplus:()=>hi,spaceToBatchND:()=>Ju,sparse:()=>g3,sparseToDense:()=>_A,spectral:()=>aF,split:()=>an,sqrt:()=>Jt,square:()=>st,squaredDifference:()=>Bc,squeeze:()=>Or,stack:()=>zn,step:()=>wl,stridedSlice:()=>FA,sub:()=>ge,sum:()=>ke,sumOutType:()=>dc,tan:()=>$A,tanh:()=>di,tensor:()=>ia,tensor1d:()=>Tt,tensor2d:()=>ya,tensor3d:()=>hc,tensor4d:()=>fR,tensor5d:()=>mR,tensor6d:()=>AR,tensor_util:()=>ma,test_util:()=>vb,tidy:()=>W,tile:()=>Fr,time:()=>DN,topk:()=>DA,train:()=>yi,transpose:()=>Ze,truncatedNormal:()=>Vc,unique:()=>jc,unregisterGradient:()=>BI,unregisterKernel:()=>WI,unsortedSegmentSum:()=>OA,unstack:()=>la,upcastType:()=>sa,util:()=>k,valueAndGrad:()=>SE,valueAndGrads:()=>NE,variable:()=>Qb,variableGrads:()=>Vb,version:()=>kie,version_converter:()=>_se,version_core:()=>EN,version_cpu:()=>J3,version_layers:()=>ly,version_wasm:()=>h6,version_webgl:()=>vv,webgl:()=>GW,webgl_util:()=>b7,where:()=>nn,whereAsync:()=>zA,zeros:()=>Ct,zerosLike:()=>Ue});var L9=Object.create,kp=Object.defineProperty,W9=Object.getPrototypeOf,B9=Object.prototype.hasOwnProperty,V9=Object.getOwnPropertyNames,j9=Object.getOwnPropertyDescriptor,U9=e=>kp(e,"__esModule",{value:!0}),xt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Fe=(e,t)=>{for(var n in t)kp(e,n,{get:t[n],enumerable:!0})},H9=(e,t,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of V9(t))!B9.call(e,a)&&a!=="default"&&kp(e,a,{get:()=>t[a],enumerable:!(n=j9(t,a))||n.enumerable});return e},Zi=e=>H9(U9(kp(e!=null?L9(W9(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),G9=xt(()=>{}),q9=xt((e,t)=>{(function(n,a,r){function s(d){var u=this,p=l();u.next=function(){var c=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=c-(u.c=c|0)},u.c=1,u.s0=p(" "),u.s1=p(" "),u.s2=p(" "),u.s0-=p(d),u.s0<0&&(u.s0+=1),u.s1-=p(d),u.s1<0&&(u.s1+=1),u.s2-=p(d),u.s2<0&&(u.s2+=1),p=null}function i(d,u){return u.c=d.c,u.s0=d.s0,u.s1=d.s1,u.s2=d.s2,u}function o(d,u){var p=new s(d),c=u&&u.state,h=p.next;return h.int32=function(){return p.next()*4294967296|0},h.double=function(){return h()+(h()*2097152|0)*11102230246251565e-32},h.quick=h,c&&(typeof c=="object"&&i(c,p),h.state=function(){return i(p,{})}),h}function l(){var d=4022871197,u=function(p){p=p.toString();for(var c=0;c>>0,h-=d,h*=d,d=h>>>0,h-=d,d+=h*4294967296}return(d>>>0)*23283064365386963e-26};return u}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.alea=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),X9=xt((e,t)=>{(function(n,a,r){function s(l){var d=this,u="";d.x=0,d.y=0,d.z=0,d.w=0,d.next=function(){var c=d.x^d.x<<11;return d.x=d.y,d.y=d.z,d.z=d.w,d.w^=d.w>>>19^c^c>>>8},l===(l|0)?d.x=l:u+=l;for(var p=0;p>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(typeof p=="object"&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xor128=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),K9=xt((e,t)=>{(function(n,a,r){function s(l){var d=this,u="";d.next=function(){var c=d.x^d.x>>>2;return d.x=d.y,d.y=d.z,d.z=d.w,d.w=d.v,(d.d=d.d+362437|0)+(d.v=d.v^d.v<<4^(c^c<<1))|0},d.x=0,d.y=0,d.z=0,d.w=0,d.v=0,l===(l|0)?d.x=l:u+=l;for(var p=0;p>>4),d.next()}function i(l,d){return d.x=l.x,d.y=l.y,d.z=l.z,d.w=l.w,d.v=l.v,d.d=l.d,d}function o(l,d){var u=new s(l),p=d&&d.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(typeof p=="object"&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xorwow=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),Z9=xt((e,t)=>{(function(n,a,r){function s(l){var d=this;d.next=function(){var p=d.x,c=d.i,h,m,f;return h=p[c],h^=h>>>7,m=h^h<<24,h=p[c+1&7],m^=h^h>>>10,h=p[c+3&7],m^=h^h>>>3,h=p[c+4&7],m^=h^h<<7,h=p[c+7&7],h=h^h<<13,m^=h^h<<9,p[c]=m,d.i=c+1&7,m};function u(p,c){var h,m,f=[];if(c===(c|0))m=f[0]=c;else for(c=""+c,h=0;h0;--h)p.next()}u(d,l)}function i(l,d){return d.x=l.x.slice(),d.i=l.i,d}function o(l,d){l==null&&(l=+new Date);var u=new s(l),p=d&&d.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(p.x&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xorshift7=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),Y9=xt((e,t)=>{(function(n,a,r){function s(l){var d=this;d.next=function(){var p=d.w,c=d.X,h=d.i,m,f;return d.w=p=p+1640531527|0,f=c[h+34&127],m=c[h=h+1&127],f^=f<<13,m^=m<<17,f^=f>>>15,m^=m>>>12,f=c[h]=f^m,d.i=h,f+(p^p>>>16)|0};function u(p,c){var h,m,f,A,y,g=[],x=128;for(c===(c|0)?(m=c,c=null):(c=c+"\0",m=0,x=Math.max(x,c.length)),f=0,A=-32;A>>15,m^=m<<4,m^=m>>>13,A>=0&&(y=y+1640531527|0,h=g[A&127]^=m+y,f=h==0?f+1:0);for(f>=128&&(g[(c&&c.length||0)&127]=-1),f=127,A=4*128;A>0;--A)m=g[f+34&127],h=g[f=f+1&127],m^=m<<13,h^=h<<17,m^=m>>>15,h^=h>>>12,g[f]=m^h;p.w=y,p.X=g,p.i=f}u(d,l)}function i(l,d){return d.i=l.i,d.w=l.w,d.X=l.X.slice(),d}function o(l,d){l==null&&(l=+new Date);var u=new s(l),p=d&&d.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(p.X&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xor4096=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),J9=xt((e,t)=>{(function(n,a,r){function s(l){var d=this,u="";d.next=function(){var c=d.b,h=d.c,m=d.d,f=d.a;return c=c<<25^c>>>7^h,h=h-m|0,m=m<<24^m>>>8^f,f=f-c|0,d.b=c=c<<20^c>>>12^h,d.c=h=h-m|0,d.d=m<<16^h>>>16^f,d.a=f-c|0},d.a=0,d.b=0,d.c=2654435769|0,d.d=1367130551,l===Math.floor(l)?(d.a=l/4294967296|0,d.b=l|0):u+=l;for(var p=0;p>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(typeof p=="object"&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.tychei=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),Wg=xt(()=>{}),Q9=xt((e,t)=>{(function(n,a){var r=this,s=256,i=6,o=52,l="random",d=a.pow(s,i),u=a.pow(2,o),p=u*2,c=s-1,h;function m(b,v,N){var T=[];v=v==!0?{entropy:!0}:v||{};var R=g(y(v.entropy?[b,w(n)]:b==null?x():b,3),T),$=new f(T),z=function(){for(var P=$.g(i),V=d,j=0;P=p;)P/=2,V/=2,j>>>=1;return(P+j)/V};return z.int32=function(){return $.g(4)|0},z.quick=function(){return $.g(4)/4294967296},z.double=z,g(w($.S),n),(v.pass||N||function(P,V,j,U){return U&&(U.S&&A(U,$),P.state=function(){return A($,{})}),j?(a[l]=P,V):P})(z,R,"global"in v?v.global:this==a,v.state)}a["seed"+l]=m;function f(b){var v,N=b.length,T=this,R=0,$=T.i=T.j=0,z=T.S=[];for(N||(b=[N++]);R{var n=q9(),a=X9(),r=K9(),s=Z9(),i=Y9(),o=J9(),l=Q9();l.alea=n,l.xor128=a,l.xorwow=r,l.xorshift7=s,l.xor4096=i,l.tychei=o,t.exports=l}),cu=xt(()=>{}),eI=xt(()=>{}),tI=xt(()=>{}),nI=xt((e,t)=>{var n=function(){var a=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename!="undefined"&&(a=a||__filename),function(r){r=r||{};function s(){return Q.buffer!=Ve&&Kt(Q.buffer),An}function i(){return Q.buffer!=Ve&&Kt(Q.buffer),gt}function o(){return Q.buffer!=Ve&&Kt(Q.buffer),yn}function l(){return Q.buffer!=Ve&&Kt(Q.buffer),jn}function d(){return Q.buffer!=Ve&&Kt(Q.buffer),rn}var u=typeof r!="undefined"?r:{},p,c;u.ready=new Promise(function(S,E){p=S,c=E});var h={},m;for(m in u)u.hasOwnProperty(m)&&(h[m]=u[m]);var f=[],A="./this.program",y=function(S,E){throw E},g=!1,x=!1,w=!1,b=!1;g=typeof window=="object",x=typeof importScripts=="function",w=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",b=!g&&!w&&!x;var v=u.ENVIRONMENT_IS_PTHREAD||!1;v&&(Ve=u.buffer);var N="";function T(S){return u.locateFile?u.locateFile(S,N):N+S}var R,$,z,P,V,j;if(w){x?N=cu().dirname(N)+"/":N=__dirname+"/",R=function(S,E){return V||(V=require("fs")),j||(j=cu()),S=j.normalize(S),V.readFileSync(S,E?null:"utf8")},z=function(S){var E=R(S,!0);return E.buffer||(E=new Uint8Array(E)),ce(E.buffer),E},process.argv.length>1&&(A=process.argv[1].replace(/\\/g,"/")),f=process.argv.slice(2),process.on("uncaughtException",function(S){if(!(S instanceof du))throw S}),process.on("unhandledRejection",Za),y=function(S){process.exit(S)},u.inspect=function(){return"[Emscripten Module object]"};var U;try{U=eI()}catch(S){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),S}global.Worker=U.Worker}else b?(typeof read!="undefined"&&(R=function(S){return read(S)}),z=function(S){var E;return typeof readbuffer=="function"?new Uint8Array(readbuffer(S)):(E=read(S,"binary"),ce(typeof E=="object"),E)},typeof scriptArgs!="undefined"?f=scriptArgs:typeof arguments!="undefined"&&(f=arguments),typeof quit=="function"&&(y=function(S){quit(S)}),typeof print!="undefined"&&(typeof console=="undefined"&&(console={}),console.log=print,console.warn=console.error=typeof printErr!="undefined"?printErr:print)):(g||x)&&(x?N=self.location.href:typeof document!="undefined"&&document.currentScript&&(N=document.currentScript.src),typeof a!="undefined"&&a&&(N=a),N.indexOf("blob:")!==0?N=N.substr(0,N.lastIndexOf("/")+1):N="",w?(R=function(S,E){return V||(V=require("fs")),j||(j=cu()),S=j.normalize(S),V.readFileSync(S,E?null:"utf8")},z=function(S){var E=R(S,!0);return E.buffer||(E=new Uint8Array(E)),ce(E.buffer),E}):(R=function(S){var E=new XMLHttpRequest;return E.open("GET",S,!1),E.send(null),E.responseText},x&&(z=function(S){var E=new XMLHttpRequest;return E.open("GET",S,!1),E.responseType="arraybuffer",E.send(null),new Uint8Array(E.response)}),$=function(S,E,L){var q=new XMLHttpRequest;q.open("GET",S,!0),q.responseType="arraybuffer",q.onload=function(){if(q.status==200||q.status==0&&q.response){E(q.response);return}L()},q.onerror=L,q.send(null)}),P=function(S){document.title=S});w&&typeof performance=="undefined"&&(global.performance=tI().performance);var X=u.print||console.log.bind(console),G=u.printErr||console.warn.bind(console);for(m in h)h.hasOwnProperty(m)&&(u[m]=h[m]);h=null,u.arguments&&(f=u.arguments),u.thisProgram&&(A=u.thisProgram),u.quit&&(y=u.quit);var ee=Atomics.load,Y=Atomics.store,re=Atomics.compareExchange,ne;u.wasmBinary&&(ne=u.wasmBinary);var ie=u.noExitRuntime||!0;typeof WebAssembly!="object"&&Za("no native wasm support detected");var Q,de,oe=!1,ye;function ce(S,E){S||Za("Assertion failed: "+E)}function Ie(S){var E=u["_"+S];return ce(E,"Cannot call unknown function "+S+", make sure it is exported"),E}function Ne(S,E,L,q,pe){var le={string:function(bn){var Ki=0;if(bn!=null&&bn!==0){var zg=(bn.length<<2)+1;Ki=Gi(zg),et(bn,Ki,zg)}return Ki},array:function(bn){var Ki=Gi(bn.length);return Xe(bn,Ki),Ki}};function ue(bn){return E==="string"?De(bn):E==="boolean"?Boolean(bn):bn}var be=Ie(S),tt=[],Bt=0;if(q)for(var $t=0;$t=q);){var le=S[E++];if(!le)return pe;if(!(le&128)){pe+=String.fromCharCode(le);continue}var ue=S[E++]&63;if((le&224)==192){pe+=String.fromCharCode((le&31)<<6|ue);continue}var be=S[E++]&63;if((le&240)==224?le=(le&15)<<12|ue<<6|be:le=(le&7)<<18|ue<<12|be<<6|S[E++]&63,le<65536)pe+=String.fromCharCode(le);else{var tt=le-65536;pe+=String.fromCharCode(55296|tt>>10,56320|tt&1023)}}return pe}function De(S,E){return S?ze(i(),S,E):""}function Qe(S,E,L,q){if(!(q>0))return 0;for(var pe=L,le=L+q-1,ue=0;ue=55296&&be<=57343){var tt=S.charCodeAt(++ue);be=65536+((be&1023)<<10)|tt&1023}if(be<=127){if(L>=le)break;E[L++]=be}else if(be<=2047){if(L+1>=le)break;E[L++]=192|be>>6,E[L++]=128|be&63}else if(be<=65535){if(L+2>=le)break;E[L++]=224|be>>12,E[L++]=128|be>>6&63,E[L++]=128|be&63}else{if(L+3>=le)break;E[L++]=240|be>>18,E[L++]=128|be>>12&63,E[L++]=128|be>>6&63,E[L++]=128|be&63}}return E[L]=0,L-pe}function et(S,E,L){return Qe(S,i(),E,L)}function rt(S){for(var E=0,L=0;L=55296&&q<=57343&&(q=65536+((q&1023)<<10)|S.charCodeAt(++L)&1023),q<=127?++E:q<=2047?E+=2:q<=65535?E+=3:E+=4}return E}function Xe(S,E){s().set(S,E)}function dt(S,E){return S%E>0&&(S+=E-S%E),S}var Ve,An,gt,Vn,Xt,yn,jn,Rn,rn;function Kt(S){Ve=S,u.HEAP8=An=new Int8Array(S),u.HEAP16=Vn=new Int16Array(S),u.HEAP32=yn=new Int32Array(S),u.HEAPU8=gt=new Uint8Array(S),u.HEAPU16=Xt=new Uint16Array(S),u.HEAPU32=jn=new Uint32Array(S),u.HEAPF32=Rn=new Float32Array(S),u.HEAPF64=rn=new Float64Array(S)}var Ca=u.INITIAL_MEMORY||16777216;if(v)Q=u.wasmMemory,Ve=u.buffer;else if(u.wasmMemory)Q=u.wasmMemory;else if(Q=new WebAssembly.Memory({initial:Ca/65536,maximum:2147483648/65536,shared:!0}),!(Q.buffer instanceof SharedArrayBuffer))throw G("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),w&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");Q&&(Ve=Q.buffer),Ca=Ve.byteLength,Kt(Ve);var ea,ta=[],hr=[],Xa=[],fr=[],Li=[],Ra=!1,tp=!1;v||hr.push({func:function(){Ap()}});function L0(){if(!v){if(u.preRun)for(typeof u.preRun=="function"&&(u.preRun=[u.preRun]);u.preRun.length;)ap(u.preRun.shift());Bi(ta)}}function eu(){Ra=!0,!v&&Bi(hr)}function W0(){v||Bi(Xa)}function np(){v||(tp=!0)}function gn(){if(!v){if(u.postRun)for(typeof u.postRun=="function"&&(u.postRun=[u.postRun]);u.postRun.length;)B0(u.postRun.shift());Bi(Li)}}function ap(S){ta.unshift(S)}function B0(S){Li.unshift(S)}var Ka=0,mr=null,es=null;function V0(S){ce(!v,"addRunDependency cannot be used in a pthread worker"),Ka++,u.monitorRunDependencies&&u.monitorRunDependencies(Ka)}function j0(S){if(Ka--,u.monitorRunDependencies&&u.monitorRunDependencies(Ka),Ka==0&&(mr!==null&&(clearInterval(mr),mr=null),es)){var E=es;es=null,E()}}u.preloadedImages={},u.preloadedAudios={};function Za(S){u.onAbort&&u.onAbort(S),v&&console.error("Pthread aborting at "+new Error().stack),S+="",G(S),oe=!0,ye=1,S="abort("+S+"). Build with -s ASSERTIONS=1 for more info.";var E=new WebAssembly.RuntimeError(S);throw c(E),E}function rp(S,E){return String.prototype.startsWith?S.startsWith(E):S.indexOf(E)===0}var Wi="data:application/octet-stream;base64,";function sp(S){return rp(S,Wi)}var U0="file://";function ip(S){return rp(S,U0)}var xn="tfjs-backend-wasm-threaded-simd.wasm";sp(xn)||(xn=T(xn));function op(S){try{if(S==xn&&ne)return new Uint8Array(ne);if(z)return z(S);throw"both async and sync fetching of the wasm failed"}catch(E){Za(E)}}function H0(){if(!ne&&(g||x)){if(typeof fetch=="function"&&!ip(xn))return fetch(xn,{credentials:"same-origin"}).then(function(S){if(!S.ok)throw"failed to load wasm binary file at '"+xn+"'";return S.arrayBuffer()}).catch(function(){return op(xn)});if($)return new Promise(function(S,E){$(xn,function(L){S(new Uint8Array(L))},E)})}return Promise.resolve().then(function(){return op(xn)})}function G0(){var S={a:_f};function E(ue,be){var tt=ue.exports;if(u.asm=tt,ea=u.asm.F,de=be,!v){var Bt=we.unusedWorkers.length;we.unusedWorkers.forEach(function($t){we.loadWasmModuleToWorker($t,function(){--Bt||j0("wasm-instantiate")})})}}v||V0("wasm-instantiate");function L(ue){E(ue.instance,ue.module)}function q(ue){return H0().then(function(be){return WebAssembly.instantiate(be,S)}).then(ue,function(be){G("failed to asynchronously prepare wasm: "+be),Za(be)})}function pe(){return!ne&&typeof WebAssembly.instantiateStreaming=="function"&&!sp(xn)&&!ip(xn)&&typeof fetch=="function"?fetch(xn,{credentials:"same-origin"}).then(function(ue){var be=WebAssembly.instantiateStreaming(ue,S);return be.then(L,function(tt){return G("wasm streaming compile failed: "+tt),G("falling back to ArrayBuffer instantiation"),q(L)})}):q(L)}if(u.instantiateWasm)try{var le=u.instantiateWasm(S,E);return le}catch(ue){return G("Module.instantiateWasm callback failed with error: "+ue),!1}return pe().catch(c),{}}var q0={9816:function(){throw"Canceled!"},9834:function(S,E){setTimeout(function(){Rg(S,E)},0)}};function lp(){we.initRuntime()}function Bi(S){for(;S.length>0;){var E=S.shift();if(typeof E=="function"){E(u);continue}var L=E.func;typeof L=="number"?E.arg===void 0?ea.get(L)():ea.get(L)(E.arg):L(E.arg===void 0?null:E.arg)}}function tu(S,E){if(S<=0||S>s().length||S&!0||E<0)return-28;if(E==0)return 0;E>=2147483647&&(E=Infinity);var L=Atomics.load(o(),qi>>2),q=0;if(L==S){var pe=Atomics.compareExchange(o(),qi>>2,L,0);if(pe==L&&(--E,q=1,E<=0))return 1}var le=Atomics.notify(o(),S>>2,E);if(le>=0)return le+q;throw"Atomics.notify returned an unexpected value "+le}u._emscripten_futex_wake=tu;function X0(S){if(v)throw"Internal Error! killThread() can only ever be called from main application thread!";if(!S)throw"Internal Error! Null pthread_ptr in killThread!";o()[S+12>>2]=0;var E=we.pthreads[S];E.worker.terminate(),we.freeThreadData(E),we.runningWorkers.splice(we.runningWorkers.indexOf(E.worker),1),E.worker.pthread=void 0}function K0(S){if(v)throw"Internal Error! cancelThread() can only ever be called from main application thread!";if(!S)throw"Internal Error! Null pthread_ptr in cancelThread!";var E=we.pthreads[S];E.worker.postMessage({cmd:"cancel"})}function Z0(S){if(v)throw"Internal Error! cleanupThread() can only ever be called from main application thread!";if(!S)throw"Internal Error! Null pthread_ptr in cleanupThread!";var E=we.pthreads[S];if(E){o()[S+12>>2]=0;var L=E.worker;we.returnWorkerToPool(L)}}var we={unusedWorkers:[],runningWorkers:[],initMainThreadBlock:function(){for(var S=Math.min(4,Math.max(1,(navigator.hardwareConcurrency||1)/2)),E=0;E>2]=S;var L=S+152;o()[L>>2]=L;for(var q=ns(512),E=0;E<128;++E)l()[q/4+E]=0;Atomics.store(l(),S+100>>2,q),Atomics.store(l(),S+40>>2,S),lm(S,!x,1),Cg(S)},initWorker:function(){},pthreads:{},threadExitHandlers:[],setThreadStatus:function(){},runExitHandlers:function(){for(;we.threadExitHandlers.length>0;)we.threadExitHandlers.pop()();v&&Ui()&&Eg()},runExitHandlersAndDeinitThread:function(S,E){Atomics.store(l(),S+56>>2,1),Atomics.store(l(),S+60>>2,0),we.runExitHandlers(),Atomics.store(l(),S+4>>2,E),Atomics.store(l(),S+0>>2,1),tu(S+0,2147483647),lm(0,0,0)},threadExit:function(S){var E=Ui();E&&(we.runExitHandlersAndDeinitThread(E,S),v&&postMessage({cmd:"exit"}))},threadCancel:function(){we.runExitHandlersAndDeinitThread(Ui(),-1),postMessage({cmd:"cancelDone"})},terminateAllThreads:function(){for(var S in we.pthreads){var E=we.pthreads[S];E&&E.worker&&we.returnWorkerToPool(E.worker)}we.pthreads={};for(var L=0;L>2];o()[S.threadInfoStruct+100>>2]=0,lu(E),lu(S.threadInfoStruct)}S.threadInfoStruct=0,S.allocatedOwnStack&&S.stackBase&&lu(S.stackBase),S.stackBase=0,S.worker&&(S.worker.pthread=null)}},returnWorkerToPool:function(S){we.runWithoutMainThreadQueuedCalls(function(){delete we.pthreads[S.pthread.threadInfoStruct],we.unusedWorkers.push(S),we.runningWorkers.splice(we.runningWorkers.indexOf(S),1),we.freeThreadData(S.pthread),S.pthread=void 0})},runWithoutMainThreadQueuedCalls:function(S){o()[Og>>2]=0;try{S()}finally{o()[Og>>2]=1}},receiveObjectTransfer:function(S){},loadWasmModuleToWorker:function(S,E){S.onmessage=function(L){var q=L.data,pe=q.cmd;if(S.pthread&&(we.currentProxiedOperationCallerThread=S.pthread.threadInfoStruct),q.targetThread&&q.targetThread!=Ui()){var le=we.pthreads[q.targetThread];le?le.worker.postMessage(L.data,q.transferList):console.error('Internal error! Worker sent a message "'+pe+'" to target pthread '+q.targetThread+", but that thread no longer exists!"),we.currentProxiedOperationCallerThread=void 0;return}if(pe==="processQueuedMainThreadWork")im();else if(pe==="spawnThread")fp(L.data);else if(pe==="cleanupThread")Z0(q.thread);else if(pe==="killThread")X0(q.thread);else if(pe==="cancelThread")K0(q.thread);else if(pe==="loaded")S.loaded=!0,E&&E(S),S.runPthread&&(S.runPthread(),delete S.runPthread);else if(pe==="print")X("Thread "+q.threadId+": "+q.text);else if(pe==="printErr")G("Thread "+q.threadId+": "+q.text);else if(pe==="alert")alert("Thread "+q.threadId+": "+q.text);else if(pe==="exit"){var ue=S.pthread&&Atomics.load(l(),S.pthread.threadInfoStruct+64>>2);ue&&we.returnWorkerToPool(S)}else if(pe==="exitProcess")try{_9(q.returnCode)}catch(be){if(be instanceof du)return;throw be}else pe==="cancelDone"?we.returnWorkerToPool(S):pe==="objectTransfer"?we.receiveObjectTransfer(L.data):L.data.target==="setimmediate"?S.postMessage(L.data):G("worker sent an unknown command "+pe);we.currentProxiedOperationCallerThread=void 0},S.onerror=function(L){G("pthread sent an error! "+L.filename+":"+L.lineno+": "+L.message)},w&&(S.on("message",function(L){S.onmessage({data:L})}),S.on("error",function(L){S.onerror(L)}),S.on("exit",function(L){})),S.postMessage({cmd:"load",urlOrBlob:u.mainScriptUrlOrBlob||a,wasmMemory:Q,wasmModule:de})},allocateUnusedWorker:function(){var S=T("tfjs-backend-wasm-threaded-simd.worker.js");we.unusedWorkers.push(new Worker(S))},getNewWorker:function(){return we.unusedWorkers.length==0&&(we.allocateUnusedWorker(),we.loadWasmModuleToWorker(we.unusedWorkers[0])),we.unusedWorkers.length>0?we.unusedWorkers.pop():null},busySpinWait:function(S){for(var E=performance.now()+S;performance.now()>2]=S,S}function af(S,E){if(v)return Ar(1,1,S,E)}function rf(S,E){if(S==E)postMessage({cmd:"processQueuedMainThreadWork"});else if(v)postMessage({targetThread:S,cmd:"processThreadQueue"});else{var L=we.pthreads[S],q=L&&L.worker;if(!q)return;q.postMessage({cmd:"processThreadQueue"})}return 1}function sf(){Za()}function of(S,E,L){var q=cf(E,L);return q0[S].apply(null,q)}function lf(S,E){}function uf(S,E,L){if(S<=0||S>s().length||S&!0)return-28;if(g){if(Atomics.load(o(),S>>2)!=E)return-6;for(var q=performance.now(),pe=q+L,le=Atomics.exchange(o(),qi>>2,S);;){if(q=performance.now(),q>pe)return le=Atomics.exchange(o(),qi>>2,0),-73;if(le=Atomics.exchange(o(),qi>>2,0),le==0)break;if(im(),Atomics.load(o(),S>>2)!=E)return-6;le=Atomics.exchange(o(),qi>>2,S)}return 0}else{var ue=Atomics.wait(o(),S>>2,E,L);if(ue==="timed-out")return-73;if(ue==="not-equal")return-6;if(ue==="ok")return 0;throw"Atomics.wait returned an unexpected value "+ue}}function df(S,E,L){i().copyWithin(S,E,E+L)}function pf(){return w?require("os").cpus().length:navigator.hardwareConcurrency}function Ar(S,E){for(var L=arguments.length-2,q=uu(),pe=L,le=Gi(pe*8),ue=le>>3,be=0;be>=2;L=i()[S++];){var q=L<105;q&&E&1&&E++,au.push(q?d()[E++>>1]:o()[E]),++E}return au}function hf(S,E,L){nu.length=E;for(var q=L>>3,pe=0;pe>>16),Kt(Q.buffer),1}catch(E){}}function Af(S){var E=ff();if(S<=E)return!1;var L=2147483648;if(S>L)return!1;for(var q=1;q<=4;q*=2){var pe=E*(1+.2/q);pe=Math.min(pe,S+100663296);var le=Math.min(L,dt(Math.max(S,pe),65536)),ue=mf(le);if(ue)return!0}return!1}var Pe={inEventHandler:0,removeAllEventListeners:function(){for(var S=Pe.eventHandlers.length-1;S>=0;--S)Pe._removeHandler(S);Pe.eventHandlers=[],Pe.deferredCalls=[]},registerRemoveEventListeners:function(){Pe.removeEventListenersRegistered||(fr.push(Pe.removeAllEventListeners),Pe.removeEventListenersRegistered=!0)},deferredCalls:[],deferCall:function(S,E,L){function q(ue,be){if(ue.length!=be.length)return!1;for(var tt in ue)if(ue[tt]!=be[tt])return!1;return!0}for(var pe in Pe.deferredCalls){var le=Pe.deferredCalls[pe];if(le.targetFunction==S&&q(le.argsList,L))return}Pe.deferredCalls.push({targetFunction:S,precedence:E,argsList:L}),Pe.deferredCalls.sort(function(ue,be){return ue.precedence>2]=L,o()[ue+4>>2]=q,o()[ue+8>>2]=pe,om(0,S,637534208,E,q,ue),Hi(le)},getTargetThreadForEventCallback:function(S){switch(S){case 1:return 0;case 2:return we.currentProxiedOperationCallerThread;default:return S}},getNodeNameForTarget:function(S){return S?S==window?"#window":S==screen?"#screen":S&&S.nodeName?S.nodeName:"":""},fullscreenEnabled:function(){return document.fullscreenEnabled||document.webkitFullscreenEnabled}};function yf(S){var E=rt(S)+1,L=ns(E);return et(S,L,E),L}function gf(S,E,L,q){var pe=uu(),le=Gi(12),ue=0;E&&(ue=yf(E)),o()[le>>2]=ue,o()[le+4>>2]=L,o()[le+8>>2]=q,om(0,S,657457152,0,ue,le),Hi(pe)}function xf(S,E,L,q){E=E?De(E):"",gf(S,E,L,q)}function bf(S){return S>2?De(S):S}var vf=[0,typeof document!="undefined"?document:0,typeof window!="undefined"?window:0];function wf(S){S=bf(S);var E=vf[S]||(typeof document!="undefined"?document.querySelector(S):void 0);return E}function ru(S){return wf(S)}function up(S,E,L){var q=ru(S);if(!q)return-4;if(q.canvasSharedPtr&&(o()[q.canvasSharedPtr>>2]=E,o()[q.canvasSharedPtr+4>>2]=L),q.offscreenCanvas||!q.controlTransferredOffscreen){q.offscreenCanvas&&(q=q.offscreenCanvas);var pe=!1;if(q.GLctxObject&&q.GLctxObject.GLctx){var le=q.GLctxObject.GLctx.getParameter(2978);pe=le[0]===0&&le[1]===0&&le[2]===q.width&&le[3]===q.height}q.width=E,q.height=L,pe&&q.GLctxObject.GLctx.viewport(0,0,E,L)}else if(q.canvasSharedPtr){var ue=o()[q.canvasSharedPtr+8>>2];return xf(ue,S,E,L),1}else return-4;return 0}function dp(S,E,L){return v?Ar(2,1,S,E,L):up(S,E,L)}function kf(S,E,L){var q=ru(S);return q?up(S,E,L):dp(S,E,L)}function If(S){}function Sf(S,E){}function Nf(S){var E=S.getExtension("ANGLE_instanced_arrays");if(E)return S.vertexAttribDivisor=function(L,q){E.vertexAttribDivisorANGLE(L,q)},S.drawArraysInstanced=function(L,q,pe,le){E.drawArraysInstancedANGLE(L,q,pe,le)},S.drawElementsInstanced=function(L,q,pe,le,ue){E.drawElementsInstancedANGLE(L,q,pe,le,ue)},1}function Tf(S){var E=S.getExtension("OES_vertex_array_object");if(E)return S.createVertexArray=function(){return E.createVertexArrayOES()},S.deleteVertexArray=function(L){E.deleteVertexArrayOES(L)},S.bindVertexArray=function(L){E.bindVertexArrayOES(L)},S.isVertexArray=function(L){return E.isVertexArrayOES(L)},1}function Ef(S){var E=S.getExtension("WEBGL_draw_buffers");if(E)return S.drawBuffers=function(L,q){E.drawBuffersWEBGL(L,q)},1}function Cf(S){return!!(S.multiDrawWebgl=S.getExtension("WEBGL_multi_draw"))}var Je={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],uniforms:[],shaders:[],vaos:[],contexts:{},offscreenCanvases:{},timerQueriesEXT:[],programInfos:{},stringCache:{},unpackAlignment:4,recordError:function(S){Je.lastError||(Je.lastError=S)},getNewId:function(S){for(var E=Je.counter++,L=S.length;L>2]:-1;pe+=De(o()[L+le*4>>2],ue<0?void 0:ue)}return pe},createContext:function(S,E){var L=S.getContext("webgl",E);if(!L)return 0;var q=Je.registerContext(L,E);return q},registerContext:function(S,E){var L=ns(8);o()[L+4>>2]=Ui();var q={handle:L,attributes:E,version:E.majorVersion,GLctx:S};return S.canvas&&(S.canvas.GLctxObject=q),Je.contexts[L]=q,(typeof E.enableExtensionsByDefault=="undefined"||E.enableExtensionsByDefault)&&Je.initExtensions(q),L},makeContextCurrent:function(S){return Je.currentContext=Je.contexts[S],u.ctx=yr=Je.currentContext&&Je.currentContext.GLctx,!(S&&!yr)},getContext:function(S){return Je.contexts[S]},deleteContext:function(S){Je.currentContext===Je.contexts[S]&&(Je.currentContext=null),typeof Pe=="object"&&Pe.removeAllHandlersOnTarget(Je.contexts[S].GLctx.canvas),Je.contexts[S]&&Je.contexts[S].GLctx.canvas&&(Je.contexts[S].GLctx.canvas.GLctxObject=void 0),lu(Je.contexts[S].handle),Je.contexts[S]=null},initExtensions:function(S){if(S||(S=Je.currentContext),!S.initExtensionsDone){S.initExtensionsDone=!0;var E=S.GLctx;Nf(E),Tf(E),Ef(E),E.disjointTimerQueryExt=E.getExtension("EXT_disjoint_timer_query"),Cf(E);var L=E.getSupportedExtensions()||[];L.forEach(function(q){q.indexOf("lose_context")<0&&q.indexOf("debug")<0&&E.getExtension(q)})}},populateUniformTable:function(S){for(var E=Je.programs[S],L=Je.programInfos[S]={uniforms:{},maxUniformLength:0,maxAttributeLength:-1,maxUniformBlockNameLength:-1},q=L.uniforms,pe=yr.getProgramParameter(E,35718),le=0;le>2,q=o()[L+(24>>2)],pe={alpha:!!o()[L+(0>>2)],depth:!!o()[L+(4>>2)],stencil:!!o()[L+(8>>2)],antialias:!!o()[L+(12>>2)],premultipliedAlpha:!!o()[L+(16>>2)],preserveDrawingBuffer:!!o()[L+(20>>2)],powerPreference:Rf[q],failIfMajorPerformanceCaveat:!!o()[L+(28>>2)],majorVersion:o()[L+(32>>2)],minorVersion:o()[L+(36>>2)],enableExtensionsByDefault:o()[L+(40>>2)],explicitSwapControl:o()[L+(44>>2)],proxyContextToMainThread:o()[L+(48>>2)],renderViaOffscreenBackBuffer:o()[L+(52>>2)]},le=ru(S);if(!le||pe.explicitSwapControl)return 0;var ue=Je.createContext(le,pe);return ue}function Ff(S,E){return Mf(S,E)}var Vi={mappings:{},buffers:[null,[],[]],printChar:function(S,E){var L=Vi.buffers[S];E===0||E===10?((S===1?X:G)(ze(L,0)),L.length=0):L.push(E)},varargs:void 0,get:function(){Vi.varargs+=4;var S=o()[Vi.varargs-4>>2];return S},getStr:function(S){var E=De(S);return E},get64:function(S,E){return S}};function pp(S){return v?Ar(3,1,S):0}function cp(S,E,L,q,pe){if(v)return Ar(4,1,S,E,L,q,pe)}function hp(S,E,L,q){if(v)return Ar(5,1,S,E,L,q);for(var pe=0,le=0;le>2],be=o()[E+(le*8+4)>>2],tt=0;tt>2]=pe,0}function $f(S){var E=we.threadExitHandlers.pop();S&&E()}function Df(S,E){we.threadExitHandlers.push(function(){ea.get(S)(E)})}function fp(S){if(v)throw"Internal Error! spawnThread() can only ever be called from main application thread!";var E=we.getNewWorker();if(E.pthread!==void 0)throw"Internal error!";if(!S.pthread_ptr)throw"Internal error, no pthread ptr!";we.runningWorkers.push(E);for(var L=ns(128*4),q=0;q<128;++q)o()[L+q*4>>2]=0;var pe=S.stackBase+S.stackSize,le=we.pthreads[S.pthread_ptr]={worker:E,stackBase:S.stackBase,stackSize:S.stackSize,allocatedOwnStack:S.allocatedOwnStack,threadInfoStruct:S.pthread_ptr},ue=le.threadInfoStruct>>2;Atomics.store(l(),ue+(64>>2),S.detached),Atomics.store(l(),ue+(100>>2),L),Atomics.store(l(),ue+(40>>2),le.threadInfoStruct),Atomics.store(l(),ue+(80>>2),S.stackSize),Atomics.store(l(),ue+(76>>2),pe),Atomics.store(l(),ue+(104>>2),S.stackSize),Atomics.store(l(),ue+(104+8>>2),pe),Atomics.store(l(),ue+(104+12>>2),S.detached);var be=Tg(),tt=be+40;Atomics.store(l(),ue+(172>>2),tt),E.pthread=le;var Bt={cmd:"run",start_routine:S.startRoutine,arg:S.arg,threadInfoStruct:S.pthread_ptr,stackBase:S.stackBase,stackSize:S.stackSize};E.runPthread=function(){Bt.time=performance.now(),E.postMessage(Bt,S.transferList)},E.loaded&&(E.runPthread(),delete E.runPthread)}function Of(S,E,L,q){if(typeof SharedArrayBuffer=="undefined")return G("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;if(!S)return G("pthread_create called with a null thread pointer!"),28;var pe=[],le=0;if(v&&(pe.length===0||le))return Mg(687865856,S,E,L,q);if(le)return le;var ue=0,be=0,tt=0;E&&E!=-1?(ue=o()[E>>2],ue+=81920,be=o()[E+8>>2],tt=o()[E+12>>2]!==0):ue=2097152;var Bt=be==0;Bt?be=Dg(16,ue):(be-=ue,ce(be>0));for(var $t=ns(228),xr=0;xr<228>>2;++xr)l()[($t>>2)+xr]=0;o()[S>>2]=$t,o()[$t+12>>2]=$t;var Xi=$t+152;o()[Xi>>2]=Xi;var bn={stackBase:be,stackSize:ue,allocatedOwnStack:Bt,detached:tt,startRoutine:L,pthread_ptr:$t,arg:q,transferList:pe};return v?(bn.cmd="spawnThread",postMessage(bn,pe)):fp(bn),0}function mp(S){if(v)return Ar(6,1,S);switch(S){case 30:return 16384;case 85:var E=2147483648;return E/16384;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return typeof navigator=="object"&&navigator.hardwareConcurrency||1}return nf(28),-1}v||we.initMainThreadBlock();var yr,zf=[null,af,dp,pp,cp,hp,mp],_f={e:ef,r:tf,x:rf,b:sf,y:of,j:lf,c:uf,d:tu,f:ts,p:df,z:pf,u:hf,q:Af,v:kf,i:If,t:Sf,w:Ff,m:pp,n:cp,g:hp,o:lp,a:Q||u.wasmMemory,k:$f,l:Df,h:Of,s:mp},Sg=G0(),Ap=u.___wasm_call_ctors=function(){return(Ap=u.___wasm_call_ctors=u.asm.A).apply(null,arguments)},Pf=u._init=function(){return(Pf=u._init=u.asm.B).apply(null,arguments)},Lf=u._register_tensor=function(){return(Lf=u._register_tensor=u.asm.C).apply(null,arguments)},Wf=u._dispose_data=function(){return(Wf=u._dispose_data=u.asm.D).apply(null,arguments)},Bf=u._dispose=function(){return(Bf=u._dispose=u.asm.E).apply(null,arguments)},Vf=u._Abs=function(){return(Vf=u._Abs=u.asm.G).apply(null,arguments)},jf=u._Add=function(){return(jf=u._Add=u.asm.H).apply(null,arguments)},Uf=u._AddN=function(){return(Uf=u._AddN=u.asm.I).apply(null,arguments)},Hf=u._All=function(){return(Hf=u._All=u.asm.J).apply(null,arguments)},Gf=u._Any=function(){return(Gf=u._Any=u.asm.K).apply(null,arguments)},qf=u._ArgMax=function(){return(qf=u._ArgMax=u.asm.L).apply(null,arguments)},Xf=u._AvgPool=function(){return(Xf=u._AvgPool=u.asm.M).apply(null,arguments)},Kf=u._BatchMatMul=function(){return(Kf=u._BatchMatMul=u.asm.N).apply(null,arguments)},Zf=u._Ceil=function(){return(Zf=u._Ceil=u.asm.O).apply(null,arguments)},Yf=u._ClipByValue=function(){return(Yf=u._ClipByValue=u.asm.P).apply(null,arguments)},Jf=u._Conv2D=function(){return(Jf=u._Conv2D=u.asm.Q).apply(null,arguments)},Qf=u._Conv2DBackpropInput=function(){return(Qf=u._Conv2DBackpropInput=u.asm.R).apply(null,arguments)},em=u._Cos=function(){return(em=u._Cos=u.asm.S).apply(null,arguments)},tm=u._CropAndResize=function(){return(tm=u._CropAndResize=u.asm.T).apply(null,arguments)},nm=u._Cumsum=function(){return(nm=u._Cumsum=u.asm.U).apply(null,arguments)},am=u._DepthToSpace=function(){return(am=u._DepthToSpace=u.asm.V).apply(null,arguments)},rm=u._DepthwiseConv2dNative=function(){return(rm=u._DepthwiseConv2dNative=u.asm.W).apply(null,arguments)},yp=u._Equal=function(){return(yp=u._Equal=u.asm.X).apply(null,arguments)},gp=u._Exp=function(){return(gp=u._Exp=u.asm.Y).apply(null,arguments)},xp=u._FlipLeftRight=function(){return(xp=u._FlipLeftRight=u.asm.Z).apply(null,arguments)},su=u._Floor=function(){return(su=u._Floor=u.asm._).apply(null,arguments)},ji=u._FloorDiv=function(){return(ji=u._FloorDiv=u.asm.$).apply(null,arguments)},sm=u._FusedBatchNorm=function(){return(sm=u._FusedBatchNorm=u.asm.aa).apply(null,arguments)},iu=u._FusedConv2D=function(){return(iu=u._FusedConv2D=u.asm.ba).apply(null,arguments)},K=u._FusedDepthwiseConv2D=function(){return(K=u._FusedDepthwiseConv2D=u.asm.ca).apply(null,arguments)},te=u._Gather=function(){return(te=u._Gather=u.asm.da).apply(null,arguments)},Te=u._GatherNd=function(){return(Te=u._GatherNd=u.asm.ea).apply(null,arguments)},Ke=u._Greater=function(){return(Ke=u._Greater=u.asm.fa).apply(null,arguments)},It=u._GreaterEqual=function(){return(It=u._GreaterEqual=u.asm.ga).apply(null,arguments)},ft=u._LeakyRelu=function(){return(ft=u._LeakyRelu=u.asm.ha).apply(null,arguments)},je=u._Less=function(){return(je=u._Less=u.asm.ia).apply(null,arguments)},He=u._LessEqual=function(){return(He=u._LessEqual=u.asm.ja).apply(null,arguments)},Zt=u._Log=function(){return(Zt=u._Log=u.asm.ka).apply(null,arguments)},Ya=u._LogicalAnd=function(){return(Ya=u._LogicalAnd=u.asm.la).apply(null,arguments)},Ja=u._Max=function(){return(Ja=u._Max=u.asm.ma).apply(null,arguments)},bp=u._MaxPool=function(){return(bp=u._MaxPool=u.asm.na).apply(null,arguments)},ou=u._Maximum=function(){return(ou=u._Maximum=u.asm.oa).apply(null,arguments)},Un=u._Mean=function(){return(Un=u._Mean=u.asm.pa).apply(null,arguments)},gr=u._Min=function(){return(gr=u._Min=u.asm.qa).apply(null,arguments)},vp=u._Minimum=function(){return(vp=u._Minimum=u.asm.ra).apply(null,arguments)},Zk=u._MirrorPad=function(){return(Zk=u._MirrorPad=u.asm.sa).apply(null,arguments)},Yk=u._Multiply=function(){return(Yk=u._Multiply=u.asm.ta).apply(null,arguments)},Jk=u._Neg=function(){return(Jk=u._Neg=u.asm.ua).apply(null,arguments)},Qk=u._NonMaxSuppressionV3=function(){return(Qk=u._NonMaxSuppressionV3=u.asm.va).apply(null,arguments)},e9=u._NonMaxSuppressionV4=function(){return(e9=u._NonMaxSuppressionV4=u.asm.wa).apply(null,arguments)},t9=u._NonMaxSuppressionV5=function(){return(t9=u._NonMaxSuppressionV5=u.asm.xa).apply(null,arguments)},n9=u._NotEqual=function(){return(n9=u._NotEqual=u.asm.ya).apply(null,arguments)},a9=u._OneHot=function(){return(a9=u._OneHot=u.asm.za).apply(null,arguments)},r9=u._PadV2=function(){return(r9=u._PadV2=u.asm.Aa).apply(null,arguments)},s9=u._Pow=function(){return(s9=u._Pow=u.asm.Ba).apply(null,arguments)},i9=u._Prelu=function(){return(i9=u._Prelu=u.asm.Ca).apply(null,arguments)},o9=u._Prod=function(){return(o9=u._Prod=u.asm.Da).apply(null,arguments)},l9=u._RealDiv=function(){return(l9=u._RealDiv=u.asm.Ea).apply(null,arguments)},u9=u._Relu=function(){return(u9=u._Relu=u.asm.Fa).apply(null,arguments)},d9=u._Relu6=function(){return(d9=u._Relu6=u.asm.Ga).apply(null,arguments)},p9=u._ResizeBilinear=function(){return(p9=u._ResizeBilinear=u.asm.Ha).apply(null,arguments)},c9=u._Reverse=function(){return(c9=u._Reverse=u.asm.Ia).apply(null,arguments)},h9=u._RotateWithOffset=function(){return(h9=u._RotateWithOffset=u.asm.Ja).apply(null,arguments)},f9=u._Round=function(){return(f9=u._Round=u.asm.Ka).apply(null,arguments)},m9=u._Rsqrt=function(){return(m9=u._Rsqrt=u.asm.La).apply(null,arguments)},A9=u._ScatterNd=function(){return(A9=u._ScatterNd=u.asm.Ma).apply(null,arguments)},y9=u._SelectV2=function(){return(y9=u._SelectV2=u.asm.Na).apply(null,arguments)},g9=u._Sigmoid=function(){return(g9=u._Sigmoid=u.asm.Oa).apply(null,arguments)},x9=u._Sin=function(){return(x9=u._Sin=u.asm.Pa).apply(null,arguments)},b9=u._Softmax=function(){return(b9=u._Softmax=u.asm.Qa).apply(null,arguments)},v9=u._Sqrt=function(){return(v9=u._Sqrt=u.asm.Ra).apply(null,arguments)},w9=u._Square=function(){return(w9=u._Square=u.asm.Sa).apply(null,arguments)},k9=u._SquaredDifference=function(){return(k9=u._SquaredDifference=u.asm.Ta).apply(null,arguments)},I9=u._Step=function(){return(I9=u._Step=u.asm.Ua).apply(null,arguments)},S9=u._StridedSlice=function(){return(S9=u._StridedSlice=u.asm.Va).apply(null,arguments)},N9=u._Sub=function(){return(N9=u._Sub=u.asm.Wa).apply(null,arguments)},T9=u._Sum=function(){return(T9=u._Sum=u.asm.Xa).apply(null,arguments)},E9=u._Tan=function(){return(E9=u._Tan=u.asm.Ya).apply(null,arguments)},C9=u._Tanh=function(){return(C9=u._Tanh=u.asm.Za).apply(null,arguments)},R9=u._Tile=function(){return(R9=u._Tile=u.asm._a).apply(null,arguments)},M9=u._TopK=function(){return(M9=u._TopK=u.asm.$a).apply(null,arguments)},F9=u._Transform=function(){return(F9=u._Transform=u.asm.ab).apply(null,arguments)},$9=u._Transpose=function(){return($9=u._Transpose=u.asm.bb).apply(null,arguments)},D9=u.__FusedMatMul=function(){return(D9=u.__FusedMatMul=u.asm.cb).apply(null,arguments)},ns=u._malloc=function(){return(ns=u._malloc=u.asm.db).apply(null,arguments)},lu=u._free=function(){return(lu=u._free=u.asm.eb).apply(null,arguments)},Ng=u.___errno_location=function(){return(Ng=u.___errno_location=u.asm.fb).apply(null,arguments)},Tg=u._emscripten_get_global_libc=function(){return(Tg=u._emscripten_get_global_libc=u.asm.gb).apply(null,arguments)},Ui=u._pthread_self=function(){return(Ui=u._pthread_self=u.asm.hb).apply(null,arguments)},Eg=u.___pthread_tsd_run_dtors=function(){return(Eg=u.___pthread_tsd_run_dtors=u.asm.ib).apply(null,arguments)},im=u._emscripten_main_thread_process_queued_calls=function(){return(im=u._emscripten_main_thread_process_queued_calls=u.asm.jb).apply(null,arguments)},O9=u._emscripten_current_thread_process_queued_calls=function(){return(O9=u._emscripten_current_thread_process_queued_calls=u.asm.kb).apply(null,arguments)},Cg=u._emscripten_register_main_browser_thread_id=function(){return(Cg=u._emscripten_register_main_browser_thread_id=u.asm.lb).apply(null,arguments)},Rg=u.__emscripten_do_dispatch_to_thread=function(){return(Rg=u.__emscripten_do_dispatch_to_thread=u.asm.mb).apply(null,arguments)},Mg=u._emscripten_sync_run_in_main_thread_4=function(){return(Mg=u._emscripten_sync_run_in_main_thread_4=u.asm.nb).apply(null,arguments)},Fg=u._emscripten_run_in_main_runtime_thread_js=function(){return(Fg=u._emscripten_run_in_main_runtime_thread_js=u.asm.ob).apply(null,arguments)},om=u.__emscripten_call_on_thread=function(){return(om=u.__emscripten_call_on_thread=u.asm.pb).apply(null,arguments)},z9=u._emscripten_tls_init=function(){return(z9=u._emscripten_tls_init=u.asm.qb).apply(null,arguments)},lm=u.__emscripten_thread_init=function(){return(lm=u.__emscripten_thread_init=u.asm.rb).apply(null,arguments)},uu=u.stackSave=function(){return(uu=u.stackSave=u.asm.sb).apply(null,arguments)},Hi=u.stackRestore=function(){return(Hi=u.stackRestore=u.asm.tb).apply(null,arguments)},Gi=u.stackAlloc=function(){return(Gi=u.stackAlloc=u.asm.ub).apply(null,arguments)},$g=u._emscripten_stack_set_limits=function(){return($g=u._emscripten_stack_set_limits=u.asm.vb).apply(null,arguments)},Dg=u._memalign=function(){return(Dg=u._memalign=u.asm.wb).apply(null,arguments)},Og=u.__emscripten_allow_main_runtime_queued_calls=9808,qi=u.__emscripten_main_thread_futex=11432;u.cwrap=$e,u.PThread=we,u.PThread=we,u.wasmMemory=Q,u.ExitStatus=du;var wp;function du(S){this.name="ExitStatus",this.message="Program terminated with exit("+S+")",this.status=S}es=function S(){wp||um(),wp||(es=S)};function um(S){if(S=S||f,Ka>0)return;if(v){p(u),eu(),postMessage({cmd:"loaded"});return}if(L0(),Ka>0)return;function E(){wp||(wp=!0,u.calledRun=!0,!oe&&(eu(),W0(),p(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),gn()))}u.setStatus?(u.setStatus("Running..."),setTimeout(function(){setTimeout(function(){u.setStatus("")},1),E()},1)):E()}u.run=um;function _9(S,E){if(!(E&&ie&&S===0)){if(!E&&v)throw postMessage({cmd:"exitProcess",returnCode:S}),new du(S);ie||(we.terminateAllThreads(),ye=S,np(),u.onExit&&u.onExit(S),oe=!0),y(S,new du(S))}}if(u.preInit)for(typeof u.preInit=="function"&&(u.preInit=[u.preInit]);u.preInit.length>0;)u.preInit.pop()();return v&&(ie=!1,we.initWorker()),um(),r.ready}}();typeof e=="object"&&typeof t=="object"?t.exports=n:typeof define=="function"&&define.amd?define([],function(){return n}):typeof e=="object"&&(e.WasmBackendModuleThreadedSimd=n)}),aI=xt((e,t)=>{var n=function(){var a=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename!="undefined"&&(a=a||__filename),function(r){r=r||{};var s=typeof r!="undefined"?r:{},i,o;s.ready=new Promise(function(K,te){i=K,o=te});var l={},d;for(d in s)s.hasOwnProperty(d)&&(l[d]=s[d]);var u=[],p="./this.program",c=function(K,te){throw te},h=!1,m=!1,f=!1,A=!1;h=typeof window=="object",m=typeof importScripts=="function",f=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",A=!h&&!f&&!m;var y="";function g(K){return s.locateFile?s.locateFile(K,y):y+K}var x,w,b,v,N,T;f?(m?y=cu().dirname(y)+"/":y=__dirname+"/",x=function(K,te){return N||(N=require("fs")),T||(T=cu()),K=T.normalize(K),N.readFileSync(K,te?null:"utf8")},b=function(K){var te=x(K,!0);return te.buffer||(te=new Uint8Array(te)),X(te.buffer),te},process.argv.length>1&&(p=process.argv[1].replace(/\\/g,"/")),u=process.argv.slice(2),process.on("uncaughtException",function(K){if(!(K instanceof sm))throw K}),process.on("unhandledRejection",Ra),c=function(K){process.exit(K)},s.inspect=function(){return"[Emscripten Module object]"}):A?(typeof read!="undefined"&&(x=function(K){return read(K)}),b=function(K){var te;return typeof readbuffer=="function"?new Uint8Array(readbuffer(K)):(te=read(K,"binary"),X(typeof te=="object"),te)},typeof scriptArgs!="undefined"?u=scriptArgs:typeof arguments!="undefined"&&(u=arguments),typeof quit=="function"&&(c=function(K){quit(K)}),typeof print!="undefined"&&(typeof console=="undefined"&&(console={}),console.log=print,console.warn=console.error=typeof printErr!="undefined"?printErr:print)):(h||m)&&(m?y=self.location.href:typeof document!="undefined"&&document.currentScript&&(y=document.currentScript.src),a&&(y=a),y.indexOf("blob:")!==0?y=y.substr(0,y.lastIndexOf("/")+1):y="",x=function(K){var te=new XMLHttpRequest;return te.open("GET",K,!1),te.send(null),te.responseText},m&&(b=function(K){var te=new XMLHttpRequest;return te.open("GET",K,!1),te.responseType="arraybuffer",te.send(null),new Uint8Array(te.response)}),w=function(K,te,Te){var Ke=new XMLHttpRequest;Ke.open("GET",K,!0),Ke.responseType="arraybuffer",Ke.onload=function(){if(Ke.status==200||Ke.status==0&&Ke.response){te(Ke.response);return}Te()},Ke.onerror=Te,Ke.send(null)},v=function(K){document.title=K});var R=s.print||console.log.bind(console),$=s.printErr||console.warn.bind(console);for(d in l)l.hasOwnProperty(d)&&(s[d]=l[d]);l=null,s.arguments&&(u=s.arguments),s.thisProgram&&(p=s.thisProgram),s.quit&&(c=s.quit);var z;s.wasmBinary&&(z=s.wasmBinary);var P=s.noExitRuntime||!0;typeof WebAssembly!="object"&&Ra("no native wasm support detected");var V,j=!1,U;function X(K,te){K||Ra("Assertion failed: "+te)}function G(K){var te=s["_"+K];return X(te,"Cannot call unknown function "+K+", make sure it is exported"),te}function ee(K,te,Te,Ke,It){var ft={string:function(Un){var gr=0;if(Un!=null&&Un!==0){var vp=(Un.length<<2)+1;gr=su(vp),de(Un,gr,vp)}return gr},array:function(Un){var gr=su(Un.length);return oe(Un,gr),gr}};function je(Un){return te==="string"?ie(Un):te==="boolean"?Boolean(Un):Un}var He=G(K),Zt=[],Ya=0;if(Ke)for(var Ja=0;Ja=Ke);)++It;if(It-te>16&&K.subarray&&re)return re.decode(K.subarray(te,It));for(var ft="";te>10,56320|Ya&1023)}}return ft}function ie(K,te){return K?ne(Ne,K,te):""}function Q(K,te,Te,Ke){if(!(Ke>0))return 0;for(var It=Te,ft=Te+Ke-1,je=0;je=55296&&He<=57343){var Zt=K.charCodeAt(++je);He=65536+((He&1023)<<10)|Zt&1023}if(He<=127){if(Te>=ft)break;te[Te++]=He}else if(He<=2047){if(Te+1>=ft)break;te[Te++]=192|He>>6,te[Te++]=128|He&63}else if(He<=65535){if(Te+2>=ft)break;te[Te++]=224|He>>12,te[Te++]=128|He>>6&63,te[Te++]=128|He&63}else{if(Te+3>=ft)break;te[Te++]=240|He>>18,te[Te++]=128|He>>12&63,te[Te++]=128|He>>6&63,te[Te++]=128|He&63}}return te[Te]=0,Te-It}function de(K,te,Te){return Q(K,Ne,te,Te)}function oe(K,te){Ie.set(K,te)}function ye(K,te){return K%te>0&&(K+=te-K%te),K}var ce,Ie,Ne,$e,ze,De,Qe,et,rt;function Xe(K){ce=K,s.HEAP8=Ie=new Int8Array(K),s.HEAP16=$e=new Int16Array(K),s.HEAP32=De=new Int32Array(K),s.HEAPU8=Ne=new Uint8Array(K),s.HEAPU16=ze=new Uint16Array(K),s.HEAPU32=Qe=new Uint32Array(K),s.HEAPF32=et=new Float32Array(K),s.HEAPF64=rt=new Float64Array(K)}var dt=s.INITIAL_MEMORY||16777216,Ve,An=[],gt=[],Vn=[],Xt=[],yn=!1;gt.push({func:function(){lp()}});function jn(){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)Ca(s.preRun.shift());mr(An)}function Rn(){yn=!0,mr(gt)}function rn(){mr(Vn)}function Kt(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)ea(s.postRun.shift());mr(Xt)}function Ca(K){An.unshift(K)}function ea(K){Xt.unshift(K)}var ta=0,hr=null,Xa=null;function fr(K){ta++,s.monitorRunDependencies&&s.monitorRunDependencies(ta)}function Li(K){if(ta--,s.monitorRunDependencies&&s.monitorRunDependencies(ta),ta==0&&(hr!==null&&(clearInterval(hr),hr=null),Xa)){var te=Xa;Xa=null,te()}}s.preloadedImages={},s.preloadedAudios={};function Ra(K){s.onAbort&&s.onAbort(K),K+="",$(K),j=!0,U=1,K="abort("+K+"). Build with -s ASSERTIONS=1 for more info.";var te=new WebAssembly.RuntimeError(K);throw o(te),te}function tp(K,te){return String.prototype.startsWith?K.startsWith(te):K.indexOf(te)===0}var L0="data:application/octet-stream;base64,";function eu(K){return tp(K,L0)}var W0="file://";function np(K){return tp(K,W0)}var gn="tfjs-backend-wasm.wasm";eu(gn)||(gn=g(gn));function ap(K){try{if(K==gn&&z)return new Uint8Array(z);if(b)return b(K);throw"both async and sync fetching of the wasm failed"}catch(te){Ra(te)}}function B0(){if(!z&&(h||m)){if(typeof fetch=="function"&&!np(gn))return fetch(gn,{credentials:"same-origin"}).then(function(K){if(!K.ok)throw"failed to load wasm binary file at '"+gn+"'";return K.arrayBuffer()}).catch(function(){return ap(gn)});if(w)return new Promise(function(K,te){w(gn,function(Te){K(new Uint8Array(Te))},te)})}return Promise.resolve().then(function(){return ap(gn)})}function Ka(){var K={a:G0};function te(je,He){var Zt=je.exports;s.asm=Zt,V=s.asm.i,Xe(V.buffer),Ve=s.asm.o,Li("wasm-instantiate")}fr("wasm-instantiate");function Te(je){te(je.instance)}function Ke(je){return B0().then(function(He){return WebAssembly.instantiate(He,K)}).then(je,function(He){$("failed to asynchronously prepare wasm: "+He),Ra(He)})}function It(){return!z&&typeof WebAssembly.instantiateStreaming=="function"&&!eu(gn)&&!np(gn)&&typeof fetch=="function"?fetch(gn,{credentials:"same-origin"}).then(function(je){var He=WebAssembly.instantiateStreaming(je,K);return He.then(Te,function(Zt){return $("wasm streaming compile failed: "+Zt),$("falling back to ArrayBuffer instantiation"),Ke(Te)})}):Ke(Te)}if(s.instantiateWasm)try{var ft=s.instantiateWasm(K,te);return ft}catch(je){return $("Module.instantiateWasm callback failed with error: "+je),!1}return It().catch(o),{}}function mr(K){for(;K.length>0;){var te=K.shift();if(typeof te=="function"){te(s);continue}var Te=te.func;typeof Te=="number"?te.arg===void 0?Ve.get(Te)():Ve.get(Te)(te.arg):Te(te.arg===void 0?null:te.arg)}}function es(){Ra()}function V0(K,te,Te){Ne.copyWithin(K,te,te+Te)}function j0(){return Ne.length}function Za(K){try{return V.grow(K-ce.byteLength+65535>>>16),Xe(V.buffer),1}catch(te){}}function rp(K){var te=j0(),Te=2147483648;if(K>Te)return!1;for(var Ke=1;Ke<=4;Ke*=2){var It=te*(1+.2/Ke);It=Math.min(It,K+100663296);var ft=Math.min(Te,ye(Math.max(K,It),65536)),je=Za(ft);if(je)return!0}return!1}var Wi={mappings:{},buffers:[null,[],[]],printChar:function(K,te){var Te=Wi.buffers[K];te===0||te===10?((K===1?R:$)(ne(Te,0)),Te.length=0):Te.push(te)},varargs:void 0,get:function(){Wi.varargs+=4;var K=De[Wi.varargs-4>>2];return K},getStr:function(K){var te=ie(K);return te},get64:function(K,te){return K}};function sp(K){return 0}function U0(K,te,Te,Ke,It){}function ip(K,te,Te,Ke){for(var It=0,ft=0;ft>2],He=De[te+(ft*8+4)>>2],Zt=0;Zt>2]=It,0}function xn(){return 6}function op(K){return De[yp()>>2]=K,K}function H0(K){switch(K){case 30:return 16384;case 85:var te=2147483648;return te/16384;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return typeof navigator=="object"&&navigator.hardwareConcurrency||1}return op(28),-1}var G0={a:es,d:V0,e:rp,f:sp,c:U0,b:ip,g:xn,h:H0},q0=Ka(),lp=s.___wasm_call_ctors=function(){return(lp=s.___wasm_call_ctors=s.asm.j).apply(null,arguments)},Bi=s._init=function(){return(Bi=s._init=s.asm.k).apply(null,arguments)},tu=s._register_tensor=function(){return(tu=s._register_tensor=s.asm.l).apply(null,arguments)},X0=s._dispose_data=function(){return(X0=s._dispose_data=s.asm.m).apply(null,arguments)},K0=s._dispose=function(){return(K0=s._dispose=s.asm.n).apply(null,arguments)},Z0=s._Abs=function(){return(Z0=s._Abs=s.asm.p).apply(null,arguments)},we=s._Add=function(){return(we=s._Add=s.asm.q).apply(null,arguments)},Y0=s._AddN=function(){return(Y0=s._AddN=s.asm.r).apply(null,arguments)},J0=s._All=function(){return(J0=s._All=s.asm.s).apply(null,arguments)},Q0=s._Any=function(){return(Q0=s._Any=s.asm.t).apply(null,arguments)},ef=s._ArgMax=function(){return(ef=s._ArgMax=s.asm.u).apply(null,arguments)},tf=s._AvgPool=function(){return(tf=s._AvgPool=s.asm.v).apply(null,arguments)},ts=s._BatchMatMul=function(){return(ts=s._BatchMatMul=s.asm.w).apply(null,arguments)},nf=s._Ceil=function(){return(nf=s._Ceil=s.asm.x).apply(null,arguments)},af=s._ClipByValue=function(){return(af=s._ClipByValue=s.asm.y).apply(null,arguments)},rf=s._Conv2D=function(){return(rf=s._Conv2D=s.asm.z).apply(null,arguments)},sf=s._Conv2DBackpropInput=function(){return(sf=s._Conv2DBackpropInput=s.asm.A).apply(null,arguments)},of=s._Cos=function(){return(of=s._Cos=s.asm.B).apply(null,arguments)},lf=s._CropAndResize=function(){return(lf=s._CropAndResize=s.asm.C).apply(null,arguments)},uf=s._Cumsum=function(){return(uf=s._Cumsum=s.asm.D).apply(null,arguments)},df=s._DepthToSpace=function(){return(df=s._DepthToSpace=s.asm.E).apply(null,arguments)},pf=s._DepthwiseConv2dNative=function(){return(pf=s._DepthwiseConv2dNative=s.asm.F).apply(null,arguments)},Ar=s._Equal=function(){return(Ar=s._Equal=s.asm.G).apply(null,arguments)},nu=s._Exp=function(){return(nu=s._Exp=s.asm.H).apply(null,arguments)},au=s._FlipLeftRight=function(){return(au=s._FlipLeftRight=s.asm.I).apply(null,arguments)},cf=s._Floor=function(){return(cf=s._Floor=s.asm.J).apply(null,arguments)},hf=s._FloorDiv=function(){return(hf=s._FloorDiv=s.asm.K).apply(null,arguments)},ff=s._FusedBatchNorm=function(){return(ff=s._FusedBatchNorm=s.asm.L).apply(null,arguments)},mf=s._FusedConv2D=function(){return(mf=s._FusedConv2D=s.asm.M).apply(null,arguments)},Af=s._FusedDepthwiseConv2D=function(){return(Af=s._FusedDepthwiseConv2D=s.asm.N).apply(null,arguments)},Pe=s._Gather=function(){return(Pe=s._Gather=s.asm.O).apply(null,arguments)},yf=s._GatherNd=function(){return(yf=s._GatherNd=s.asm.P).apply(null,arguments)},gf=s._Greater=function(){return(gf=s._Greater=s.asm.Q).apply(null,arguments)},xf=s._GreaterEqual=function(){return(xf=s._GreaterEqual=s.asm.R).apply(null,arguments)},bf=s._LeakyRelu=function(){return(bf=s._LeakyRelu=s.asm.S).apply(null,arguments)},vf=s._Less=function(){return(vf=s._Less=s.asm.T).apply(null,arguments)},wf=s._LessEqual=function(){return(wf=s._LessEqual=s.asm.U).apply(null,arguments)},ru=s._Log=function(){return(ru=s._Log=s.asm.V).apply(null,arguments)},up=s._LogicalAnd=function(){return(up=s._LogicalAnd=s.asm.W).apply(null,arguments)},dp=s._Max=function(){return(dp=s._Max=s.asm.X).apply(null,arguments)},kf=s._MaxPool=function(){return(kf=s._MaxPool=s.asm.Y).apply(null,arguments)},If=s._Maximum=function(){return(If=s._Maximum=s.asm.Z).apply(null,arguments)},Sf=s._Mean=function(){return(Sf=s._Mean=s.asm._).apply(null,arguments)},Nf=s._Min=function(){return(Nf=s._Min=s.asm.$).apply(null,arguments)},Tf=s._Minimum=function(){return(Tf=s._Minimum=s.asm.aa).apply(null,arguments)},Ef=s._MirrorPad=function(){return(Ef=s._MirrorPad=s.asm.ba).apply(null,arguments)},Cf=s._Multiply=function(){return(Cf=s._Multiply=s.asm.ca).apply(null,arguments)},Je=s._Neg=function(){return(Je=s._Neg=s.asm.da).apply(null,arguments)},Rf=s._NonMaxSuppressionV3=function(){return(Rf=s._NonMaxSuppressionV3=s.asm.ea).apply(null,arguments)},Mf=s._NonMaxSuppressionV4=function(){return(Mf=s._NonMaxSuppressionV4=s.asm.fa).apply(null,arguments)},Ff=s._NonMaxSuppressionV5=function(){return(Ff=s._NonMaxSuppressionV5=s.asm.ga).apply(null,arguments)},Vi=s._NotEqual=function(){return(Vi=s._NotEqual=s.asm.ha).apply(null,arguments)},pp=s._OneHot=function(){return(pp=s._OneHot=s.asm.ia).apply(null,arguments)},cp=s._PadV2=function(){return(cp=s._PadV2=s.asm.ja).apply(null,arguments)},hp=s._Pow=function(){return(hp=s._Pow=s.asm.ka).apply(null,arguments)},$f=s._Prelu=function(){return($f=s._Prelu=s.asm.la).apply(null,arguments)},Df=s._Prod=function(){return(Df=s._Prod=s.asm.ma).apply(null,arguments)},fp=s._RealDiv=function(){return(fp=s._RealDiv=s.asm.na).apply(null,arguments)},Of=s._Relu=function(){return(Of=s._Relu=s.asm.oa).apply(null,arguments)},mp=s._Relu6=function(){return(mp=s._Relu6=s.asm.pa).apply(null,arguments)},yr=s._ResizeBilinear=function(){return(yr=s._ResizeBilinear=s.asm.qa).apply(null,arguments)},zf=s._Reverse=function(){return(zf=s._Reverse=s.asm.ra).apply(null,arguments)},_f=s._RotateWithOffset=function(){return(_f=s._RotateWithOffset=s.asm.sa).apply(null,arguments)},Sg=s._Round=function(){return(Sg=s._Round=s.asm.ta).apply(null,arguments)},Ap=s._Rsqrt=function(){return(Ap=s._Rsqrt=s.asm.ua).apply(null,arguments)},Pf=s._ScatterNd=function(){return(Pf=s._ScatterNd=s.asm.va).apply(null,arguments)},Lf=s._SelectV2=function(){return(Lf=s._SelectV2=s.asm.wa).apply(null,arguments)},Wf=s._Sigmoid=function(){return(Wf=s._Sigmoid=s.asm.xa).apply(null,arguments)},Bf=s._Sin=function(){return(Bf=s._Sin=s.asm.ya).apply(null,arguments)},Vf=s._Softmax=function(){return(Vf=s._Softmax=s.asm.za).apply(null,arguments)},jf=s._Sqrt=function(){return(jf=s._Sqrt=s.asm.Aa).apply(null,arguments)},Uf=s._Square=function(){return(Uf=s._Square=s.asm.Ba).apply(null,arguments)},Hf=s._SquaredDifference=function(){return(Hf=s._SquaredDifference=s.asm.Ca).apply(null,arguments)},Gf=s._Step=function(){return(Gf=s._Step=s.asm.Da).apply(null,arguments)},qf=s._StridedSlice=function(){return(qf=s._StridedSlice=s.asm.Ea).apply(null,arguments)},Xf=s._Sub=function(){return(Xf=s._Sub=s.asm.Fa).apply(null,arguments)},Kf=s._Sum=function(){return(Kf=s._Sum=s.asm.Ga).apply(null,arguments)},Zf=s._Tan=function(){return(Zf=s._Tan=s.asm.Ha).apply(null,arguments)},Yf=s._Tanh=function(){return(Yf=s._Tanh=s.asm.Ia).apply(null,arguments)},Jf=s._Tile=function(){return(Jf=s._Tile=s.asm.Ja).apply(null,arguments)},Qf=s._TopK=function(){return(Qf=s._TopK=s.asm.Ka).apply(null,arguments)},em=s._Transform=function(){return(em=s._Transform=s.asm.La).apply(null,arguments)},tm=s._Transpose=function(){return(tm=s._Transpose=s.asm.Ma).apply(null,arguments)},nm=s.__FusedMatMul=function(){return(nm=s.__FusedMatMul=s.asm.Na).apply(null,arguments)},am=s._malloc=function(){return(am=s._malloc=s.asm.Oa).apply(null,arguments)},rm=s._free=function(){return(rm=s._free=s.asm.Pa).apply(null,arguments)},yp=s.___errno_location=function(){return(yp=s.___errno_location=s.asm.Qa).apply(null,arguments)},gp=s.stackSave=function(){return(gp=s.stackSave=s.asm.Ra).apply(null,arguments)},xp=s.stackRestore=function(){return(xp=s.stackRestore=s.asm.Sa).apply(null,arguments)},su=s.stackAlloc=function(){return(su=s.stackAlloc=s.asm.Ta).apply(null,arguments)};s.cwrap=Y;var ji;function sm(K){this.name="ExitStatus",this.message="Program terminated with exit("+K+")",this.status=K}Xa=function K(){ji||iu(),ji||(Xa=K)};function iu(K){if(K=K||u,ta>0||(jn(),ta>0))return;function te(){ji||(ji=!0,s.calledRun=!0,!j&&(Rn(),rn(),i(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),Kt()))}s.setStatus?(s.setStatus("Running..."),setTimeout(function(){setTimeout(function(){s.setStatus("")},1),te()},1)):te()}if(s.run=iu,s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();return iu(),r.ready}}();typeof e=="object"&&typeof t=="object"?t.exports=n:typeof define=="function"&&define.amd?define([],function(){return n}):typeof e=="object"&&(e.WasmBackendModule=n)}),rI=xt((e,t)=>{(function(n,a,r){function s(d){var u=this,p=l();u.next=function(){var c=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=c-(u.c=c|0)},u.c=1,u.s0=p(" "),u.s1=p(" "),u.s2=p(" "),u.s0-=p(d),u.s0<0&&(u.s0+=1),u.s1-=p(d),u.s1<0&&(u.s1+=1),u.s2-=p(d),u.s2<0&&(u.s2+=1),p=null}function i(d,u){return u.c=d.c,u.s0=d.s0,u.s1=d.s1,u.s2=d.s2,u}function o(d,u){var p=new s(d),c=u&&u.state,h=p.next;return h.int32=function(){return p.next()*4294967296|0},h.double=function(){return h()+(h()*2097152|0)*11102230246251565e-32},h.quick=h,c&&(typeof c=="object"&&i(c,p),h.state=function(){return i(p,{})}),h}function l(){var d=4022871197,u=function(p){p=String(p);for(var c=0;c>>0,h-=d,h*=d,d=h>>>0,h-=d,d+=h*4294967296}return(d>>>0)*23283064365386963e-26};return u}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.alea=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),sI=xt((e,t)=>{(function(n,a,r){function s(l){var d=this,u="";d.x=0,d.y=0,d.z=0,d.w=0,d.next=function(){var c=d.x^d.x<<11;return d.x=d.y,d.y=d.z,d.z=d.w,d.w^=d.w>>>19^c^c>>>8},l===(l|0)?d.x=l:u+=l;for(var p=0;p>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(typeof p=="object"&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xor128=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),iI=xt((e,t)=>{(function(n,a,r){function s(l){var d=this,u="";d.next=function(){var c=d.x^d.x>>>2;return d.x=d.y,d.y=d.z,d.z=d.w,d.w=d.v,(d.d=d.d+362437|0)+(d.v=d.v^d.v<<4^(c^c<<1))|0},d.x=0,d.y=0,d.z=0,d.w=0,d.v=0,l===(l|0)?d.x=l:u+=l;for(var p=0;p>>4),d.next()}function i(l,d){return d.x=l.x,d.y=l.y,d.z=l.z,d.w=l.w,d.v=l.v,d.d=l.d,d}function o(l,d){var u=new s(l),p=d&&d.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(typeof p=="object"&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xorwow=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),oI=xt((e,t)=>{(function(n,a,r){function s(l){var d=this;d.next=function(){var p=d.x,c=d.i,h,m,f;return h=p[c],h^=h>>>7,m=h^h<<24,h=p[c+1&7],m^=h^h>>>10,h=p[c+3&7],m^=h^h>>>3,h=p[c+4&7],m^=h^h<<7,h=p[c+7&7],h=h^h<<13,m^=h^h<<9,p[c]=m,d.i=c+1&7,m};function u(p,c){var h,m,f=[];if(c===(c|0))m=f[0]=c;else for(c=""+c,h=0;h0;--h)p.next()}u(d,l)}function i(l,d){return d.x=l.x.slice(),d.i=l.i,d}function o(l,d){l==null&&(l=+new Date);var u=new s(l),p=d&&d.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(p.x&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xorshift7=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),lI=xt((e,t)=>{(function(n,a,r){function s(l){var d=this;d.next=function(){var p=d.w,c=d.X,h=d.i,m,f;return d.w=p=p+1640531527|0,f=c[h+34&127],m=c[h=h+1&127],f^=f<<13,m^=m<<17,f^=f>>>15,m^=m>>>12,f=c[h]=f^m,d.i=h,f+(p^p>>>16)|0};function u(p,c){var h,m,f,A,y,g=[],x=128;for(c===(c|0)?(m=c,c=null):(c=c+"\0",m=0,x=Math.max(x,c.length)),f=0,A=-32;A>>15,m^=m<<4,m^=m>>>13,A>=0&&(y=y+1640531527|0,h=g[A&127]^=m+y,f=h==0?f+1:0);for(f>=128&&(g[(c&&c.length||0)&127]=-1),f=127,A=4*128;A>0;--A)m=g[f+34&127],h=g[f=f+1&127],m^=m<<13,h^=h<<17,m^=m>>>15,h^=h>>>12,g[f]=m^h;p.w=y,p.X=g,p.i=f}u(d,l)}function i(l,d){return d.i=l.i,d.w=l.w,d.X=l.X.slice(),d}function o(l,d){l==null&&(l=+new Date);var u=new s(l),p=d&&d.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(p.X&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xor4096=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),uI=xt((e,t)=>{(function(n,a,r){function s(l){var d=this,u="";d.next=function(){var c=d.b,h=d.c,m=d.d,f=d.a;return c=c<<25^c>>>7^h,h=h-m|0,m=m<<24^m>>>8^f,f=f-c|0,d.b=c=c<<20^c>>>12^h,d.c=h=h-m|0,d.d=m<<16^h>>>16^f,d.a=f-c|0},d.a=0,d.b=0,d.c=2654435769|0,d.d=1367130551,l===Math.floor(l)?(d.a=l/4294967296|0,d.b=l|0):u+=l;for(var p=0;p>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(typeof p=="object"&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.tychei=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),dI=xt((e,t)=>{(function(n,a,r){var s=256,i=6,o=52,l="random",d=r.pow(s,i),u=r.pow(2,o),p=u*2,c=s-1,h;function m(b,v,N){var T=[];v=v==!0?{entropy:!0}:v||{};var R=g(y(v.entropy?[b,w(a)]:b==null?x():b,3),T),$=new f(T),z=function(){for(var P=$.g(i),V=d,j=0;P=p;)P/=2,V/=2,j>>>=1;return(P+j)/V};return z.int32=function(){return $.g(4)|0},z.quick=function(){return $.g(4)/4294967296},z.double=z,g(w($.S),a),(v.pass||N||function(P,V,j,U){return U&&(U.S&&A(U,$),P.state=function(){return A($,{})}),j?(r[l]=P,V):P})(z,R,"global"in v?v.global:this==r,v.state)}function f(b){var v,N=b.length,T=this,R=0,$=T.i=T.j=0,z=T.S=[];for(N||(b=[N++]);R{var n=rI(),a=sI(),r=iI(),s=oI(),i=lI(),o=uI(),l=dI();l.alea=n,l.xor128=a,l.xorwow=r,l.xorshift7=s,l.xor4096=i,l.tychei=o,t.exports=l}),pI=xt(()=>{}),dm={};Fe(dm,{bin:()=>Qg,browser:()=>s5,default:()=>cI,dependencies:()=>r5,description:()=>Hg,devDependencies:()=>n5,jsdelivr:()=>Kg,license:()=>t5,main:()=>qg,miniprogram:()=>Jg,module:()=>Xg,name:()=>jg,private:()=>Gg,repository:()=>e5,scripts:()=>a5,types:()=>Yg,unpkg:()=>Zg,version:()=>Ug});var jg="@tensorflow/tfjs",Ug="3.6.0",Hg="An open-source machine learning framework.",Gg=!1,qg="dist/tf.node.js",Xg="dist/index.js",Kg="dist/tf.min.js",Zg="dist/tf.min.js",Yg="dist/index.d.ts",Jg="dist/miniprogram",Qg={"tfjs-custom-module":"dist/tools/custom_module/cli.js"},e5={type:"git",url:"https://github.com/tensorflow/tfjs.git"},t5="Apache-2.0",n5={"@babel/core":"^7.9.0","@babel/polyfill":"^7.10.4","@babel/preset-env":"^7.9.5","@rollup/plugin-commonjs":"^11.0.2","@rollup/plugin-node-resolve":"^7.1.1","@rollup/plugin-typescript":"^3.0.0","@types/argparse":"^1.0.38","@types/jasmine":"2.8.7","@types/node":"~10.17.50","@types/shelljs":"^0.8.4","@types/yargs":"^15.0.7","clang-format":"~1.2.2",commander:"~2.14.1",jasmine:"3.1.0","jasmine-core":"~3.1.0",karma:"~6.3.2","karma-browserstack-launcher":"~1.6.0","karma-chrome-launcher":"~2.2.0","karma-firefox-launcher":"~1.1.0","karma-jasmine":"~1.1.1","karma-typescript":"~5.5.1","karma-typescript-es6-transform":"^5.5.1","npm-run-all":"~4.1.3",rimraf:"~2.6.2",rollup:"~2.3.2","rollup-plugin-babel":"^4.4.0","rollup-plugin-terser":"~7.0.2","rollup-plugin-visualizer":"~4.2.2",shelljs:"~0.8.1","ts-node":"~8.8.2",tslint:"~5.11.0","tslint-no-circular-imports":"~0.5.0",typescript:"3.5.3",yalc:"1.0.0-pre.50"},a5={build:"tsc && yarn build-cli && yarn bundle","build-ci":"tsc && yarn build-cli && yarn bundle-ci",bundle:"rollup -c","bundle-ci":"rollup -c --ci","build-core":"cd ../tfjs-core && yarn && yarn build","build-core-ci":"cd ../tfjs-core && yarn && yarn build-ci","build-layers":"cd ../tfjs-layers && yarn && yarn build","build-layers-ci":"cd ../tfjs-layers && yarn && yarn build-ci","build-converter":"cd ../tfjs-converter && yarn && yarn build","build-converter-ci":"cd ../tfjs-converter && yarn && yarn build-ci","build-data":"cd ../tfjs-data && yarn && yarn build","build-data-ci":"cd ../tfjs-data && yarn && yarn build-ci","build-backend-cpu":"cd ../tfjs-backend-cpu && yarn && yarn build","build-backend-cpu-ci":"cd ../tfjs-backend-cpu && yarn && yarn build-ci","build-backend-webgl":"cd ../tfjs-backend-webgl && yarn && yarn build","build-backend-webgl-ci":"cd ../tfjs-backend-webgl && yarn && yarn build-ci","build-deps":"yarn build-core && yarn build-layers && yarn build-converter && yarn build-data && yarn build-backend-cpu && yarn build-backend-webgl","build-deps-ci":"yarn build-core-ci && yarn build-layers-ci && yarn build-converter-ci && yarn build-data-ci && yarn build-backend-cpu-ci && yarn build-backend-webgl-ci","build-cli":"tsc --project ./tools/custom_module/tsconfig.json && chmod +x ./dist/tools/custom_module/cli.js","run-custom-build":"ts-node -s ./tools/custom_module/cli.ts","build-npm":"./scripts/build-npm.sh","link-local":"yalc link","publish-local":"yarn build-npm && yalc push","publish-npm":"npm publish",lint:"tslint -p . -t verbose",coverage:"KARMA_COVERAGE=1 karma start --browsers='Chrome' --singleRun",test:"yarn && yarn build-deps && yarn build && karma start","test-dev":"karma start","test-tools":"ts-node --project ./tools/custom_module/tsconfig.json run_tools_tests.ts","test-ci":"./scripts/test-ci.sh"},r5={"@tensorflow/tfjs-backend-cpu":"3.6.0","@tensorflow/tfjs-backend-webgl":"3.6.0","@tensorflow/tfjs-converter":"3.6.0","@tensorflow/tfjs-core":"3.6.0","@tensorflow/tfjs-data":"3.6.0","@tensorflow/tfjs-layers":"3.6.0",argparse:"^1.0.10",chalk:"^4.1.0","core-js":"3","regenerator-runtime":"^0.13.5",yargs:"^16.0.3"},s5={"node-fetch":!1,util:!1,crypto:!1},cI={name:jg,version:Ug,description:Hg,private:Gg,main:qg,module:Xg,jsdelivr:Kg,unpkg:Zg,types:Yg,miniprogram:Jg,bin:Qg,repository:e5,license:t5,devDependencies:n5,scripts:a5,dependencies:r5,browser:s5},pm={};Fe(pm,{browser:()=>k5,default:()=>hI,dependencies:()=>w5,description:()=>l5,devDependencies:()=>b5,engines:()=>y5,jsdelivr:()=>p5,"jsnext:main":()=>f5,license:()=>x5,main:()=>d5,miniprogram:()=>A5,module:()=>m5,name:()=>i5,private:()=>u5,repository:()=>g5,scripts:()=>v5,sideEffects:()=>I5,types:()=>h5,unpkg:()=>c5,version:()=>o5});var i5="@tensorflow/tfjs-core",o5="3.6.0",l5="Hardware-accelerated JavaScript library for machine intelligence",u5=!1,d5="dist/tf-core.node.js",p5="dist/tf-core.min.js",c5="dist/tf-core.min.js",h5="dist/index.d.ts",f5="dist/index.js",m5="dist/index.js",A5="dist/miniprogram",y5={yarn:">= 1.3.2"},g5={type:"git",url:"https://github.com/tensorflow/tfjs-core.git"},x5="Apache-2.0",b5={"@bazel/bazelisk":"^1.3.0","@bazel/typescript":"^0.27.8","@rollup/plugin-commonjs":"^11.0.2","@rollup/plugin-node-resolve":"^7.1.1","@rollup/plugin-typescript":"^3.0.0","@tensorflow/tfjs-backend-cpu":"link:../tfjs-backend-cpu","@types/jasmine":"~3.0.0","@types/node":"~9.6.0","@types/node-fetch":"~2.1.2","clang-format":"~1.2.4",jasmine:"~3.1.0","jasmine-core":"~3.1.0",karma:"6.3.2","karma-browserstack-launcher":"~1.6.0","karma-chrome-launcher":"~3.1.0","karma-jasmine":"~4.0.1","karma-typescript":"~5.5.1","npm-run-all":"~4.1.3",rimraf:"~2.6.2",rollup:"~2.3.2","rollup-plugin-terser":"~5.3.0","rollup-plugin-visualizer":"~3.3.2",shelljs:"~0.8.3","ts-node":"~8.8.2",tslint:"~5.11.0","tslint-no-circular-imports":"~0.5.0",typescript:"3.5.3",yalc:"~1.0.0-pre.21",yargs:"~13.2.2"},v5={"build-ci":"./scripts/enumerate-tests.js --ci && tsc && yarn bundle-ci && yarn build-test-snippets",build:"node ./scripts/enumerate-tests.js && tsc && yarn bundle",bundle:"rollup -c","bundle-ci":"rollup -c --ci","build-npm":"./scripts/build-npm.sh","build-deps":"yarn build && yarn build-cpu-backend","build-cpu-backend":"cd ../tfjs-backend-cpu && yarn && yarn build","build-cpu-backend-ci":"cd ../tfjs-backend-cpu && yarn && yarn build-ci","build:bazel":"bazelisk build //...","build-test-snippets":"yarn tsc --project ./scripts/test_snippets/tsconfig.json","format-all":"clang-format -i -style=Google --glob=src/**/*.ts","link-local":"yalc link","publish-local":"rimraf dist/ && yarn build && rollup -c && yalc push","publish-npm":"npm publish",lint:"tslint -p . -t verbose",coverage:"KARMA_COVERAGE=1 karma start --browsers='Chrome' --singleRun",test:"yarn && yarn build-deps && karma start","test-dev":"karma start","test-ci":"./scripts/test-ci.sh","test-webworker":"karma start --worker","run-browserstack":"karma start --browserstack","test-bundle-size":"./scripts/test-bundle-size.js","test-node":"rimraf dist/ && yarn build-deps && yarn build && ts-node --transpile-only --skip-ignore -P tsconfig.test.json dist/test_node.js","test-node-dev":"tsc && ts-node --transpile-only --skip-ignore -P tsconfig.test.json dist/test_node.js","test-node-ci":"ts-node --transpile-only -P tsconfig.test.json dist/test_node.js","test-async-backends":"rimraf dist/ && yarn build && ts-node --transpile-only -P tsconfig.test.json dist/test_async_backends.js","test-async-backends-ci":"ts-node --transpile-only -P tsconfig.test.json dist/test_async_backends.js","test-snippets":"yarn build && yarn build-cpu-backend && ts-node -P tsconfig.test.json ./scripts/test_snippets/test_snippets.ts","test-snippets-ci":"ts-node -P tsconfig.test.json ./scripts/test_snippets/test_snippets.ts"},w5={"@types/offscreencanvas":"~2019.3.0","@types/seedrandom":"2.4.27","@types/webgl-ext":"0.0.30","node-fetch":"~2.6.1",seedrandom:"2.4.3"},k5={"node-fetch":!1,util:!1,crypto:!1,worker_threads:!1},I5=["./dist/index.js","./dist/engine.js","./dist/tensor.js","./dist/base_side_effects.js","./dist/flags.js","./dist/platforms/*.js","./dist/register_all_gradients.js","./dist/public/chained_ops/*.js","./dist/io/*.js"],hI={name:i5,version:o5,description:l5,private:u5,main:d5,jsdelivr:p5,unpkg:c5,types:h5,"jsnext:main":f5,module:m5,miniprogram:A5,engines:y5,repository:g5,license:x5,devDependencies:b5,scripts:v5,dependencies:w5,browser:k5,sideEffects:I5},cm={};Fe(cm,{browser:()=>B5,default:()=>fI,dependencies:()=>W5,description:()=>T5,devDependencies:()=>_5,jsdelivr:()=>R5,"jsnext:main":()=>$5,license:()=>z5,main:()=>C5,miniprogram:()=>O5,module:()=>D5,name:()=>S5,peerDependencies:()=>L5,private:()=>E5,scripts:()=>P5,types:()=>F5,unpkg:()=>M5,version:()=>N5});var S5="@tensorflow/tfjs-data",N5="3.6.0",T5="TensorFlow Data API in JavaScript",E5=!1,C5="dist/tf-data.node.js",R5="dist/tf-data.min.js",M5="dist/tf-data.min.js",F5="dist/index.d.ts",$5="dist/index.js",D5="dist/index.js",O5="dist/miniprogram",z5="Apache-2.0",_5={"@rollup/plugin-commonjs":"^11.0.2","@rollup/plugin-node-resolve":"^7.1.1","@rollup/plugin-typescript":"^3.0.0","@tensorflow/tfjs-backend-cpu":"3.6.0","@tensorflow/tfjs-core":"3.6.0","@tensorflow/tfjs-layers":"3.6.0","@types/jasmine":"~2.5.53","@types/seedrandom":"^2.4.27","@types/utf8":"~2.1.6","clang-format":"~1.2.2","http-server":"~0.12.3",jasmine:"3.1.0","jasmine-core":"~3.1.0",karma:"~6.3.1","karma-chrome-launcher":"~2.2.0","karma-firefox-launcher":"~1.1.0","karma-jasmine":"~1.1.1","karma-typescript":"~5.5.1","karma-typescript-es6-transform":"^5.0.2",nyc:"^15.1.0",rimraf:"~2.6.2",rollup:"~2.3.2","rollup-plugin-terser":"~7.0.2","rollup-plugin-visualizer":"~3.3.2","ts-node":"~7.0.0",tslint:"~6.1.3","tslint-no-circular-imports":"^0.7.0",typescript:"3.5.3",yalc:"^1.0.0-pre.50"},P5={build:"tsc && yarn bundle","build-ci":"tsc && yarn bundle-ci",bundle:"rollup -c","bundle-ci":"rollup -c --ci","build-core":"cd ../tfjs-core && yarn && yarn build","build-core-ci":"cd ../tfjs-core && yarn && yarn build-ci","build-layers":"cd ../tfjs-layers && yarn && yarn build","build-backend-cpu":"cd ../tfjs-backend-cpu && yarn && yarn build","build-backend-cpu-ci":"cd ../tfjs-backend-cpu && yarn && yarn build-ci","build-layers-ci":"cd ../tfjs-layers && yarn && yarn build-ci","build-deps":"yarn build-core && yarn build-layers && yarn build-backend-cpu","build-deps-ci":"yarn build-core-ci && yarn build-layers-ci && yarn build-backend-cpu-ci","build-npm":"./scripts/build-npm.sh","link-local":"yalc link","publish-local":"rimraf dist/ && yarn build-npm && yalc push","publish-npm":"npm publish",test:"yarn && yarn build-deps && yarn build && ts-node --transpile-only --project tsconfig.test.json src/test_node.ts","test-dev":"tsc && ts-node --transpile-only --project tsconfig.test.json src/test_node.ts","test-browsers":"karma start --browsers='Chrome,Firefox'","test-ci":"ts-node --transpile-only --skip-ignore -P tsconfig.test.json src/test_node.ts","test-snippets":"yarn && yarn build-deps && yarn build && ts-node --skip-ignore --project tsconfig.test.json ./scripts/test_snippets.ts","test-snippets-ci":"ts-node --skip-ignore --project tsconfig.test.json ./scripts/test_snippets.ts",coverage:"yarn nyc yarn ts-node --transpile-only -P tsconfig.test.json src/test_node.ts",lint:"tslint -p . -t verbose"},L5={"@tensorflow/tfjs-core":"3.6.0",seedrandom:"~2.4.3"},W5={"@types/node-fetch":"^2.1.2","node-fetch":"~2.6.1"},B5={fs:!1,"node-fetch":!1,string_decoder:!1,crypto:!1},fI={name:S5,version:N5,description:T5,private:E5,main:C5,jsdelivr:R5,unpkg:M5,types:F5,"jsnext:main":$5,module:D5,miniprogram:O5,license:z5,devDependencies:_5,scripts:P5,peerDependencies:L5,dependencies:W5,browser:B5},hm={};Fe(hm,{default:()=>mI,description:()=>U5,devDependencies:()=>ex,jsdelivr:()=>Y5,"jsnext:main":()=>K5,license:()=>H5,main:()=>q5,miniprogram:()=>Q5,module:()=>Z5,name:()=>V5,peerDependencies:()=>nx,private:()=>G5,scripts:()=>tx,types:()=>X5,unpkg:()=>J5,version:()=>j5});var V5="@tensorflow/tfjs-layers",j5="3.6.0",U5="TensorFlow layers API in JavaScript",H5="Apache-2.0 AND MIT",G5=!1,q5="dist/tf-layers.node.js",X5="dist/index.d.ts",K5="dist/index.js",Z5="dist/index.js",Y5="dist/tf-layers.min.js",J5="dist/tf-layers.min.js",Q5="dist/miniprogram",ex={"@babel/polyfill":"^7.8.7","@rollup/plugin-commonjs":"^11.0.2","@rollup/plugin-node-resolve":"^7.1.1","@rollup/plugin-typescript":"^3.0.0","@tensorflow/tfjs-backend-cpu":"3.6.0","@tensorflow/tfjs-backend-webgl":"3.6.0","@tensorflow/tfjs-core":"3.6.0","@types/jasmine":"~2.5.53","clang-format":"~1.2.2","http-server":"~0.12.3",jasmine:"~3.1.0","jasmine-core":"~3.1.0",karma:"~6.3.1","karma-browserstack-launcher":"~1.6.0","karma-chrome-launcher":"~2.2.0","karma-firefox-launcher":"~1.1.0","karma-jasmine":"~1.1.1","karma-typescript":"~5.5.1","karma-typescript-es6-transform":"^5.0.2",rimraf:"~2.6.2",rollup:"~2.3.2","rollup-plugin-terser":"~7.0.2","rollup-plugin-visualizer":"~3.3.2","ts-node":"~8.8.2",tslint:"~6.1.3","tslint-no-circular-imports":"^0.7.0",typescript:"3.5.3",yalc:"~1.0.0-pre.50"},tx={prep:"yarn install && yarn build-ci",build:"tsc && yarn bundle","build-ci":"tsc && yarn bundle-ci",bundle:"rollup -c","bundle-ci":"rollup -c --ci","build-core":"cd ../tfjs-core && yarn && yarn build","build-backend-cpu":"cd ../tfjs-backend-cpu && yarn && yarn build","build-backend-cpu-ci":"cd ../tfjs-backend-cpu && yarn && yarn build-ci","build-backend-webgl":"cd ../tfjs-backend-webgl && yarn && yarn build","build-backend-webgl-ci":"cd ../tfjs-backend-webgl && yarn && yarn build-ci","build-core-ci":"cd ../tfjs-core && yarn && yarn build-ci","build-deps":"yarn build-core && yarn build-backend-cpu && yarn build-backend-webgl","build-deps-ci":"yarn build-core-ci && yarn build-backend-cpu-ci && yarn build-backend-webgl-ci","build-npm":"./scripts/build-npm.sh",format:"./tools/clang_format_ts.sh","link-local":"yalc link","publish-local":"yarn build-npm && yalc push","publish-npm":"npm publish",coverage:"KARMA_COVERAGE=1 karma start --browsers='Chrome' --singleRun",test:"yarn && yarn build-deps && karma start","test-dev":"karma start","test-ci":"./scripts/test-ci.sh","test-snippets":"yarn && yarn build-deps && yarn build && ts-node --skip-ignore -s ./scripts/test_snippets.ts","test-snippets-ci":"ts-node --skip-ignore -s ./scripts/test_snippets.ts","run-browserstack":"karma start --browsers='bs_chrome_mac' --singleRun --reporters='dots,karma-typescript'",lint:"tslint -p . -t verbose"},nx={"@tensorflow/tfjs-core":"3.6.0"},mI={name:V5,version:j5,description:U5,license:H5,private:G5,main:q5,types:X5,"jsnext:main":K5,module:Z5,jsdelivr:Y5,unpkg:J5,miniprogram:Q5,devDependencies:ex,scripts:tx,peerDependencies:nx},fm={};Fe(fm,{default:()=>AI,description:()=>sx,devDependencies:()=>Ax,jsdelivr:()=>px,"jsnext:main":()=>ox,license:()=>fx,main:()=>ix,miniprogram:()=>cx,module:()=>lx,name:()=>ax,peerDependencies:()=>mx,repository:()=>hx,scripts:()=>yx,types:()=>ux,unpkg:()=>dx,version:()=>rx});var ax="@tensorflow/tfjs-converter",rx="3.6.0",sx="Tensorflow model converter for javascript",ix="dist/tf-converter.node.js",ox="dist/index.js",lx="dist/index.js",ux="dist/index.d.ts",dx="dist/tf-converter.min.js",px="dist/tf-converter.min.js",cx="dist/miniprogram",hx={type:"git",url:"https://github.com/tensorflow/tfjs-converter.git"},fx="Apache-2.0",mx={"@tensorflow/tfjs-core":"3.6.0"},Ax={"@rollup/plugin-commonjs":"^11.0.2","@rollup/plugin-node-resolve":"^7.1.1","@rollup/plugin-replace":"^2.3.3","@rollup/plugin-typescript":"^3.0.0","@tensorflow/tfjs-backend-cpu":"3.6.0","@tensorflow/tfjs-core":"3.6.0","@types/argparse":"^1.0.38","@types/deep-equal":"^1.0.1","@types/jasmine":"~2.8.6","@types/long":"~3.0.32","@types/node-fetch":"1.6.9",ajv:"~6.3.0",argparse:"^1.0.10","babel-core":"~6.26.3","babel-plugin-external-helpers":"~6.22.0","babel-preset-env":"~1.7.0","clang-format":"~1.2.2",copyfiles:"~1.2.0","deep-equal":"^1.0.1","jasmine-core":"~3.5.0","node-fetch":"~2.6.1",opn:"~5.1.0",protobufjs:"~6.8.6",rimraf:"~2.6.2",rollup:"~2.3.2","rollup-plugin-terser":"~7.0.2","rollup-plugin-visualizer":"~3.3.2","ts-morph":"^7.1.3","ts-node":"~8.8.2",tslint:"~6.1.3","tslint-no-circular-imports":"~0.7.0",typescript:"3.5.3",yalc:"~1.0.0-pre.50"},yx={build:"yarn gen-json --test && yarn gen-kernel2ops && tsc && yarn bundle","build-ci":"yarn gen-json --test && yarn gen-kernel2ops && tsc && yarn bundle-ci",bundle:"rollup -c","bundle-ci":"rollup -c --ci","build-core":"cd ../tfjs-core && yarn && yarn build","build-backend-cpu":"cd ../tfjs-backend-cpu && yarn && yarn build","build-backend-cpu-ci":"cd ../tfjs-backend-cpu && yarn && yarn build-ci","build-core-ci":"cd ../tfjs-core && yarn && yarn build-ci","build-deps":"yarn build-core && yarn build-backend-cpu","build-deps-ci":"yarn build-core-ci && yarn build-backend-cpu","build-npm":"./scripts/build-npm.sh","link-local":"yalc link","publish-local":"yarn build-npm && yalc push","publish-npm":"npm publish",test:"yarn && yarn build-deps && yarn build && yarn gen-json --test && yarn gen-kernel2ops && ts-node --transpile-only -P tsconfig.test.json src/run_tests.ts","test-ci":"ts-node --transpile-only --skip-ignore -P tsconfig.test.json src/run_tests.ts","test-dev":"tsc && ts-node --transpile-only -P tsconfig.test.json src/run_tests.ts","test-snippets":"yarn && yarn build-deps && yarn build && ts-node --skip-ignore -s ./scripts/test_snippets.ts","test-snippets-ci":"ts-node --skip-ignore -s ./scripts/test_snippets.ts",lint:"tslint -p . -t verbose","make-version":"sh -c ./scripts/make-version","gen-doc":"ts-node -s ./scripts/gen_doc.ts","gen-json":"ts-node -s ./scripts/gen_json.ts","model-summary":"ts-node -s ./tools/model_summary.ts",pb2json:"ts-node -s ./tools/pb2json_converter.ts","build-pip-package":"yarn gen-json --test && cd python && ./build-pip-package.sh --test /tmp/tfjs-pips","run-python-tests":"yarn gen-json --test && cd python && ./run-python-tests.sh","gen-kernel2ops":"ts-node -s scripts/kernels_to_ops.ts --out metadata/kernel2op.json"},AI={name:ax,version:rx,description:sx,main:ix,"jsnext:main":ox,module:lx,types:ux,unpkg:dx,jsdelivr:px,miniprogram:cx,repository:hx,license:fx,peerDependencies:mx,devDependencies:Ax,scripts:yx},yI=1e-7,gI=1e-4,Ip=class{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}},hu=class{refCount(e){return aa("refCount")}incRef(e){return aa("incRef")}timerAvailable(){return!0}time(e){return aa("time")}read(e){return aa("read")}readSync(e){return aa("readSync")}numDataIds(){return aa("numDataIds")}disposeData(e,t){return aa("disposeData")}write(e,t,n){return aa("write")}move(e,t,n,a,r){return aa("move")}memory(){return aa("memory")}floatPrecision(){return aa("floatPrecision")}epsilon(){return this.floatPrecision()===32?yI:gI}dispose(){return aa("dispose")}};function aa(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`)}function gx(e){let t=e.length,n=0,a=0;for(;t>0;)a=Math.random()*t|0,t--,n=e[t],e[t]=e[a],e[a]=n}function xI(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,a,r,s=0;for(;n>0;)s=Math.random()*n|0,n--,a=e[n],r=t[n],e[n]=e[s],t[n]=t[s],e[s]=a,t[s]=r}function fu(e,t,n){return Math.max(e,Math.min(t,n))}function bI(e){return e%2==0?e:e+1}function vI(e){let t=0;for(let n=0;nn+` Shapes ${e} and ${t} must match`)}function rs(e){F(e!=null,()=>"The input to the tensor constructor must be a non-null value.")}function ss(e,t=[],n=!1){if(t==null&&(t=[]),Array.isArray(e)||tn(e)&&!n)for(let a=0;a0,n){return new Promise((a,r)=>{let s=0,i=()=>{if(e()){a();return}s++;let o=t(s);if(n!=null&&s>=n){r();return}setTimeout(i,o)};i()})}function CI(e,t){let n=1,a=-1;for(let s=0;s=0)n*=e[s];else if(e[s]===-1){if(a!==-1)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${a} and dim ${s}`);a=s}else if(e[s]<0)throw Error(`Shapes can not be < 0. Found ${e[s]} at dim ${s}`);if(a===-1){if(t>0&&t!==n)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(n===0)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}`);let r=e.slice();return r[a]=t/n,r}function ra(e,t){let n=t.length;return e=e==null?t.map((a,r)=>r):[].concat(e),F(e.every(a=>a>=-n&&a`All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`),F(e.every(a=>Vt(a)),()=>`All values in axis param must be integers but got axis ${e}`),e.map(a=>a<0?n+a:a)}function xx(e,t){let n=[],a=[],r=t!=null&&Array.isArray(t)&&t.length===0,s=t==null||r?null:ra(t,e).sort(),i=0;for(let o=0;oo)&&e[o]===1&&(n.push(e[o]),a.push(o)),s[i]<=o&&i++}e[o]!==1&&(n.push(e[o]),a.push(o))}return{newShape:n,keptDims:a}}function bx(e,t){let n=null;if(e==null||e==="float32")n=new Float32Array(t);else if(e==="int32")n=new Int32Array(t);else if(e==="bool")n=new Uint8Array(t);else throw new Error(`Unknown data type ${e}`);return n}function vx(e,t){let n=null;if(e==null||e==="float32")n=new Float32Array(t);else if(e==="int32")n=new Int32Array(t);else if(e==="bool")n=new Uint8Array(t);else if(e==="string")n=new Array(t);else throw new Error(`Unknown data type ${e}`);return n}function wx(e,t){for(let n=0;nt+=n.length),t}function br(e){return typeof e=="string"||e instanceof String}function Sx(e){return typeof e=="boolean"}function Nx(e){return typeof e=="number"}function Sp(e){return Array.isArray(e)?Sp(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array?"int32":Nx(e)?"float32":br(e)?"string":Sx(e)?"bool":"float32"}function vr(e){return!!(e&&e.constructor&&e.call&&e.apply)}function Np(e,t){for(let n=t;n=0;--a)n[a]=n[a+1]*e[a+1];return n}function Tx(e,t,n,a=!1){let r=new Array;if(t.length===1){let s=t[0]*(a?2:1);for(let i=0;il*d)*(a?2:1);for(let l=0;lr*s)*(n?2:1);if(a===0)return[];if(a!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${n?" for a complex tensor":""}.`);return Tx(0,e,t,n)}function Am(e,t){let n=Tp(e,t);for(let a=0;aa*r,1);if(t==null||t==="float32")return Ji(e,new Float32Array(n));if(t==="int32")return Ji(e,new Int32Array(n));if(t==="bool")return Ji(e,new Uint8Array(n));throw new Error(`Unknown data type ${t}`)}function ym(e){e.forEach(t=>{F(Number.isInteger(t)&&t>=0,()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`)})}function FI(e,t,n){if(t===0)return 0;if(t===1)return e[0];let a=e[e.length-1];for(let r=0;r{let[n,a]=t.split(":");this.urlFlags[n]=OI(n,a)})}};function DI(e){let t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(n,...a)=>(zI(t,a[0],a[1]),a.join("="))),t}function zI(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}function OI(e,t){if(t=t.toLowerCase(),t==="true"||t==="false")return t==="true";if(`${+t}`===t)return+t;throw new Error(`Could not parse value flag value ${t} for flag ${e}.`)}function J(){return fa}var fa=null;function _I(e){fa=e}var xm;function Rx(){if(xm==null){let e;if(typeof window!="undefined")e=window;else if(typeof global!="undefined")e=global;else if(typeof process!="undefined")e=process;else if(typeof self!="undefined")e=self;else throw new Error("Could not find a global object");xm=e}return xm}function PI(){let e=Rx();return e._tfGlobals==null&&(e._tfGlobals=new Map),e._tfGlobals}function bm(e,t){let n=PI();if(n.has(e))return n.get(e);{let a=t();return n.set(e,a),n.get(e)}}var Qi="Abs",eo="Acos",to="Acosh",wr="Add",is="AddN",no="All",ao="Any",os="ArgMax",Au="ArgMin",ro="Asin",so="Asinh",io="Atan",oo="Atanh",lo="Atan2",ls="AvgPool",Ep="AvgPoolGrad",yu="AvgPool3D",Cp="AvgPool3DGrad",us="BatchMatMul",gu="BatchToSpaceND",Rp="Bincount",Mx="BroadcastTo",ds="Cast",ps="Ceil",kr="ClipByValue",Mp="Complex",xu="ComplexAbs",uo="Concat",cs="Conv2D",Fp="Conv2DBackpropFilter",hs="Conv2DBackpropInput",bu="Conv3D",$p="Conv3DBackpropFilterV2",Dp="Conv3DBackpropInputV2",fs="Cos",po="Cosh",ms="Cumsum",co="CropAndResize",Op="DenseBincount",ho="DepthToSpace",As="DepthwiseConv2dNative",zp="DepthwiseConv2dNativeBackpropFilter",_p="DepthwiseConv2dNativeBackpropInput",Pp="Diag",vu="Dilation2D",Lp="Dilation2DBackpropInput",Wp="Dilation2DBackpropFilter",ys="RealDiv",Bp="Einsum",fo="Elu",Vp="EluGrad",mo="Erf",Ao="Equal",gs="Exp",yo="ExpandDims",go="Expm1",jp="FFT",wu="Fill",xo="FlipLeftRight",xs="Floor",bs="FloorDiv",vs="FusedBatchNorm",bo="GatherV2",vo="GatherNd",wo="Greater",ws="GreaterEqual",ks="Identity",Up="IFFT",Hp="Imag",ko="IsFinite",Io="IsInf",So="IsNan",Is="LeakyRelu",No="Less",To="LessEqual",Gp="LinSpace",Ss="Log",Eo="Log1p",Co="LogicalAnd",ku="LogicalNot",Iu="LogicalOr",Fx="LogSoftmax",Su="LRN",qp="LRNGrad",Ns="Max",Ts="Maximum",Es="MaxPool",Xp="MaxPoolGrad",Nu="MaxPool3D",Kp="MaxPool3DGrad",Zp="MaxPoolWithArgmax",Cs="Mean",Rs="Min",Ms="Minimum",Fs="MirrorPad",Ro="Mod",Yp="Multinomial",$s="Multiply",Mo="Neg",Fo="NotEqual",$o="NonMaxSuppressionV3",Do="NonMaxSuppressionV4",Oo="NonMaxSuppressionV5",zo="OnesLike",Ds="OneHot",_o="Pack",Os="PadV2",LI="Pool",zs="Pow",_s="Prelu",Po="Prod",Tu="Range",Jp="Real",Lo="Reciprocal",Ps="Relu",Wo="Reshape",Eu="ResizeNearestNeighbor",Qp="ResizeNearestNeighborGrad",Ls="ResizeBilinear",ec="ResizeBilinearGrad",Ws="Relu6",Bs="Reverse",Vs="Round",js="Rsqrt",Bo="ScatterNd",Vo="Select",jo="Selu",Uo="Slice",Us="Sin",Ho="Sinh",Go="Sign",Hs="Sigmoid",qo="Softplus",Gs="Sqrt",qs="Sum",Cu="SpaceToBatchND",Xo="SplitV",Xs="Softmax",tc="SparseFillEmptyRows",nc="SparseReshape",ac="SparseToDense",Ks="SquaredDifference",Ru="Square",Ko="StridedSlice",Zs="Sub",Ys="Tan",Js="Tanh",Ir="Tile",Zo="TopK",Yo="Transform",Qs="Transpose",rc="Unique",Jo="Unpack",Mu="UnsortedSegmentSum",Qo="ZerosLike",Sr="Step",sc="FromPixels",el="RotateWithOffset",ei="_FusedMatMul",ti="FusedConv2D",ni="FusedDepthwiseConv2D",tl=bm("kernelRegistry",()=>new Map),Fu=bm("gradRegistry",()=>new Map);function ic(e,t){let n=vm(e,t);return tl.get(n)}function wm(e){return Fu.get(e)}function nl(e){let t=tl.entries(),n=[];for(;;){let{done:a,value:r}=t.next();if(a)break;let[s,i]=r,[o]=s.split("_");o===e&&n.push(i)}return n}function ai(e){let{kernelName:t,backendName:n}=e,a=vm(t,n);tl.has(a)&&console.warn(`The kernel '${t}' for backend '${n}' is already registered`),tl.set(a,e)}function $x(e){let{kernelName:t}=e;Fu.has(t)&&J().getBool("DEBUG")&&console.warn(`Overriding the gradient for '${t}'`),Fu.set(t,e)}function WI(e,t){let n=vm(e,t);if(!tl.has(n))throw new Error(`The kernel '${e}' for backend '${t}' is not registered`);tl.delete(n)}function BI(e){if(!Fu.has(e))throw new Error(`The gradient '${e}' for backend is not registered`);Fu.delete(e)}function VI(e,t){nl(e).forEach(n=>{let a=Object.assign({},n,{backendName:t});ai(a)})}function vm(e,t){return`${t}_${e}`}var k={};Fe(k,{arraysEqual:()=>Qa,assert:()=>F,assertNonNegativeIntegerDimensions:()=>ym,assertNonNull:()=>rs,assertShapesMatch:()=>sn,bytesFromStringArray:()=>Ix,bytesPerElement:()=>mm,checkConversionForErrors:()=>wx,clamp:()=>fu,computeStrides:()=>Yi,createScalarValue:()=>jI,createShuffledIndices:()=>TI,decodeString:()=>lc,distSquared:()=>kI,encodeString:()=>Du,fetch:()=>UI,flatten:()=>ss,getArrayFromDType:()=>vx,getTypedArrayFromDType:()=>bx,hasEncodingLoss:()=>RI,indexToLoc:()=>$I,inferDtype:()=>Sp,inferFromImplicitShape:()=>CI,isBoolean:()=>Sx,isFunction:()=>vr,isInt:()=>Vt,isNumber:()=>Nx,isPromise:()=>gm,isScalarShape:()=>II,isString:()=>br,isTypedArray:()=>tn,isValidDtype:()=>kx,locToIndex:()=>FI,makeOnesTypedArray:()=>Am,makeZerosNestedTypedArray:()=>MI,makeZerosTypedArray:()=>Tp,nearestDivisor:()=>Np,nearestLargerEven:()=>bI,now:()=>$u,parseAxisParam:()=>ra,randUniform:()=>wI,repeatedTry:()=>EI,rightPad:()=>mu,shuffle:()=>gx,shuffleCombo:()=>xI,sizeFromShape:()=>Nt,sizeToSquarishShape:()=>NI,squeezeShape:()=>xx,sum:()=>vI,tanh:()=>SI,toNestedArray:()=>Ji,toTypedArray:()=>oc});function jI(e,t){return t==="string"?Du(e):oc([e],t)}function HI(e,t){return e instanceof Float32Array&&t==="float32"||e instanceof Int32Array&&t==="int32"||e instanceof Uint8Array&&t==="bool"}function oc(e,t){if(t==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=ss(e)),J().getBool("DEBUG")&&wx(e,t),HI(e,t))return e;if(t==null||t==="float32"||t==="complex64")return new Float32Array(e);if(t==="int32")return new Int32Array(e);if(t==="bool"){let n=new Uint8Array(e.length);for(let a=0;a{a=n()},s,i=$u();if(this.backendTimer.timerAvailable())s=this.backendTimer.time(r);else{r();for(let o of a)o.dataSync();s=Promise.resolve({kernelMs:$u()-i})}if(J().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let o=0;o{GI(d,l.dtype,e)})}return{kernelName:e,outputs:a,inputs:t,timeMs:s.then(o=>o.kernelMs),extraInfo:s.then(o=>o.getExtraProfileInfo!=null?o.getExtraProfileInfo():"")}}logKernelProfile(e){let{kernelName:t,outputs:n,timeMs:a,inputs:r,extraInfo:s}=e;n.forEach(i=>{Promise.all([i.data(),a,s]).then(o=>{this.logger.logKernelProfile(t,i,o[0],o[1],r,o[2])})})}};function GI(e,t,n){if(t!=="float32")return!1;for(let a=0;a0?m:""} `}}console.log(`%c${o} %c${i} %c${l}D ${u} %c${d} %c${p} %c${s}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}};function KI(e,t,n){let a={},r={};for(let l=0;la[f.id]=!0),h=!0,r[d.id]=!0;break}if(h)break}}let s={};s[n.id]=!0;let i={};for(let l=e.length-1;l>=0;l--){let d=e[l],u=d.inputs;for(let p=0;p=0;r--){let s=t[r],i=[];if(s.outputs.forEach(l=>{let d=e[l.id];d!=null?i.push(d):i.push(null)}),s.gradient==null)throw new Error(`Cannot compute gradient: gradient function not found for ${s.kernelName}.`);let o=s.gradient(i);for(let l in s.inputs){if(!(l in o))throw new Error(`Cannot backprop through input ${l}. Available gradients found: ${Object.keys(o)}.`);let d=n(()=>o[l]());if(d.dtype!=="float32")throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input ${l} must have 'float32' dtype, but has '${d.dtype}'`);let u=s.inputs[l];if(!Qa(d.shape,u.shape))throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input '${l}' has shape '${d.shape}', which does not match the shape of the input '${u.shape}'`);if(e[u.id]==null)e[u.id]=d;else{let p=e[u.id];e[u.id]=a(p,d),p.dispose()}}}}var Dx=20,Ou=3,km=7;function JI(e,t,n,a){let r=Yi(t),s=YI(e,t,n,r),i=t.length,o=uc(e,t,n,r,s),l=["Tensor"];return a&&(l.push(` dtype: ${n}`),l.push(` rank: ${i}`),l.push(` shape: [${t}]`),l.push(" values:")),l.push(o.map(d=>" "+d).join(` +var L9=Object.defineProperty;var Ma=(e,t)=>{for(var n in t)L9(e,n,{get:t[n],enumerable:!0})};var Pg=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var na=(e,t,n)=>(Pg(e,t,"read from private field"),n?n.call(e):t.get(e)),Fa=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},rs=(e,t,n,a)=>(Pg(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n);function Yt(e,t){let n=e.endsWith("/")?"":"/",r=t.startsWith(".")||t.startsWith("/")||t.startsWith("http:")||t.startsWith("https:")||t.startsWith("file:")?`${t}`:`${e}${n}${t}`;if(!r.toLocaleLowerCase().includes(".json"))throw new Error(`Human: ModelPath Error: ${r} Expecting JSON file`);return r}function he(...e){let t=new Date,n=`${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}:${t.getSeconds().toString().padStart(2,"0")}.${t.getMilliseconds().toString().padStart(3,"0")}`;e&&console.log(n,"Human:",...e)}var it=()=>typeof performance!="undefined"?performance.now():parseInt((Number(process.hrtime.bigint())/1e3/1e3).toString());function Hn(...e){let t=n=>n&&typeof n=="object";return e.reduce((n,a)=>(Object.keys(a||{}).forEach(r=>{let s=n[r],i=a[r];Array.isArray(s)&&Array.isArray(i)?n[r]=s.concat(...i):t(s)&&t(i)?n[r]=Hn(s,i):n[r]=i}),n),{})}var Lg={backend:"webgl",modelBasePath:"../models/",wasmPath:"../node_modules/@tensorflow/tfjs-backend-wasm/dist//",debug:!0,async:!0,videoOptimized:!0,warmup:"full",filter:{enabled:!0,width:0,height:0,flip:!1,return:!0,brightness:0,contrast:0,sharpness:0,blur:0,saturation:0,hue:0,negative:!1,sepia:!1,vintage:!1,kodachrome:!1,technicolor:!1,polaroid:!1,pixelate:0},gesture:{enabled:!0},face:{enabled:!0,detector:{modelPath:"blazeface.json",rotation:!1,maxDetected:10,skipFrames:21,skipInitial:!1,minConfidence:.2,iouThreshold:.1,return:!1},mesh:{enabled:!0,modelPath:"facemesh.json"},iris:{enabled:!0,modelPath:"iris.json"},description:{enabled:!0,modelPath:"faceres.json",skipFrames:31,minConfidence:.1},emotion:{enabled:!0,minConfidence:.1,skipFrames:32,modelPath:"emotion.json"}},body:{enabled:!0,modelPath:"posenet.json",maxDetected:1,minConfidence:.1},hand:{enabled:!0,rotation:!1,skipFrames:12,skipInitial:!1,minConfidence:.1,iouThreshold:.1,maxDetected:2,landmarks:!0,detector:{modelPath:"handdetect.json"},skeleton:{modelPath:"handskeleton.json"}},object:{enabled:!1,modelPath:"nanodet.json",minConfidence:.2,iouThreshold:.4,maxDetected:10,skipFrames:41}};function Wg(){let e,t;if(typeof navigator!="undefined"){let n=navigator.userAgent.match(/\(([^()]+)\)/g);if(n&&n[0]){let a=n[0].match(/\(([^()]+)\)/g);e=a?a[0].replace(/\(|\)/g,""):"",t=navigator.userAgent.replace(n[0],""),e[1]&&(t=t.replace(n[1],"")),t=t.replace(/ /g," ")}}else typeof process!="undefined"&&(e=`${process.platform} ${process.arch}`,t=`NodeJS ${process.version}`);return{platform:e,agent:t}}var cu={};Ma(cu,{Abs:()=>eo,Acos:()=>to,Acosh:()=>no,AdadeltaOptimizer:()=>Zc,AdagradOptimizer:()=>Yc,AdamOptimizer:()=>Jc,AdamaxOptimizer:()=>Qc,Add:()=>kr,AddN:()=>os,All:()=>ao,Any:()=>ro,ArgMax:()=>ls,ArgMin:()=>yu,Asin:()=>so,Asinh:()=>io,Atan:()=>oo,Atan2:()=>uo,Atanh:()=>lo,AvgPool:()=>us,AvgPool3D:()=>gu,AvgPool3DGrad:()=>Rp,AvgPoolGrad:()=>Cp,BackendWasm:()=>c6,BatchMatMul:()=>ds,BatchToSpaceND:()=>xu,Bincount:()=>Mp,BroadcastTo:()=>Fx,Callback:()=>r8,CallbackList:()=>t4,Cast:()=>ps,Ceil:()=>cs,ClipByValue:()=>Ir,Complex:()=>Fp,ComplexAbs:()=>bu,Concat:()=>po,Conv2D:()=>hs,Conv2DBackpropFilter:()=>$p,Conv2DBackpropInput:()=>fs,Conv3D:()=>vu,Conv3DBackpropFilterV2:()=>Dp,Conv3DBackpropInputV2:()=>Op,Cos:()=>ms,Cosh:()=>co,CropAndResize:()=>ho,Cumsum:()=>As,CustomCallback:()=>a4,DataStorage:()=>Sp,DenseBincount:()=>zp,DepthToSpace:()=>fo,DepthwiseConv2dNative:()=>ys,DepthwiseConv2dNativeBackpropFilter:()=>_p,DepthwiseConv2dNativeBackpropInput:()=>Pp,Diag:()=>Lp,Dilation2D:()=>wu,Dilation2DBackpropFilter:()=>Bp,Dilation2DBackpropInput:()=>Wp,ENV:()=>fa,EarlyStopping:()=>i8,Einsum:()=>Vp,Elu:()=>mo,EluGrad:()=>jp,Environment:()=>Rx,Equal:()=>yo,Erf:()=>Ao,Exp:()=>xs,ExpandDims:()=>go,Expm1:()=>xo,FFT:()=>Up,Fill:()=>ku,FlipLeftRight:()=>bo,Floor:()=>bs,FloorDiv:()=>vs,FromPixels:()=>ic,FusedBatchNorm:()=>ws,FusedConv2D:()=>ni,FusedDepthwiseConv2D:()=>ai,GPGPUContext:()=>Ah,GatherNd:()=>wo,GatherV2:()=>vo,GraphModel:()=>z8,Greater:()=>ko,GreaterEqual:()=>ks,History:()=>n4,IFFT:()=>Hp,Identity:()=>Is,Imag:()=>Gp,InputSpec:()=>Mt,IsFinite:()=>Io,IsInf:()=>So,IsNan:()=>No,KernelBackend:()=>fu,LRN:()=>Nu,LRNGrad:()=>Xp,LayerVariable:()=>Z6,LayersModel:()=>pr,LeakyRelu:()=>Ss,Less:()=>To,LessEqual:()=>Eo,LinSpace:()=>qp,Log:()=>Ns,Log1p:()=>Co,LogSoftmax:()=>$x,LogicalAnd:()=>Ro,LogicalNot:()=>Iu,LogicalOr:()=>Su,MathBackendCPU:()=>ah,MathBackendWebGL:()=>zl,Max:()=>Ts,MaxPool:()=>Cs,MaxPool3D:()=>Tu,MaxPool3DGrad:()=>Zp,MaxPoolGrad:()=>Kp,MaxPoolWithArgmax:()=>Yp,Maximum:()=>Es,Mean:()=>Rs,Min:()=>Ms,Minimum:()=>Fs,MirrorPad:()=>$s,Mod:()=>Mo,MomentumOptimizer:()=>eh,Multinomial:()=>Jp,Multiply:()=>Ds,Neg:()=>Fo,NonMaxSuppressionV3:()=>Do,NonMaxSuppressionV4:()=>Oo,NonMaxSuppressionV5:()=>zo,NotEqual:()=>$o,OP_SCOPE_SUFFIX:()=>Ux,OneHot:()=>Os,OnesLike:()=>_o,Optimizer:()=>or,Pack:()=>Po,PadV2:()=>zs,Pool:()=>WI,Pow:()=>_s,Prelu:()=>Ps,Prod:()=>Lo,RMSPropOptimizer:()=>th,RNN:()=>Ha,Range:()=>Eu,Rank:()=>Nm,Real:()=>Qp,RealDiv:()=>gs,Reciprocal:()=>Wo,Reduction:()=>un,Relu:()=>Ls,Relu6:()=>Bs,Reshape:()=>Bo,ResizeBilinear:()=>Ws,ResizeBilinearGrad:()=>tc,ResizeNearestNeighbor:()=>Cu,ResizeNearestNeighborGrad:()=>ec,Reverse:()=>Vs,RotateWithOffset:()=>tl,Round:()=>js,Rsqrt:()=>Us,SGDOptimizer:()=>id,ScatterNd:()=>Vo,Select:()=>jo,Selu:()=>Uo,Sequential:()=>Hl,Sigmoid:()=>Gs,Sign:()=>qo,Sin:()=>Hs,Sinh:()=>Go,Slice:()=>Ho,Softmax:()=>Ks,Softplus:()=>Xo,SpaceToBatchND:()=>Ru,SparseFillEmptyRows:()=>nc,SparseReshape:()=>ac,SparseToDense:()=>rc,SplitV:()=>Ko,Sqrt:()=>qs,Square:()=>Mu,SquaredDifference:()=>Zs,Step:()=>Nr,StridedSlice:()=>Zo,Sub:()=>Ys,Sum:()=>Xs,SymbolicTensor:()=>Ia,Tan:()=>Js,Tanh:()=>Qs,Tensor:()=>Le,TensorBuffer:()=>Dt,Tile:()=>Sr,TopK:()=>Yo,Transform:()=>Jo,Transpose:()=>ei,Unique:()=>sc,Unpack:()=>Qo,UnsortedSegmentSum:()=>Fu,Variable:()=>Lu,ZerosLike:()=>el,_FusedMatMul:()=>ti,abs:()=>Ot,acos:()=>Jm,acosh:()=>Qm,add:()=>se,addN:()=>gc,all:()=>xc,any:()=>Uu,argMax:()=>Hu,argMin:()=>eA,asin:()=>tA,asinh:()=>nA,atan:()=>aA,atan2:()=>rA,atanh:()=>sA,avgPool:()=>qu,avgPool3d:()=>lA,backend:()=>Sb,backend_util:()=>C,basicLSTMCell:()=>xT,batchNorm:()=>ci,batchNorm2d:()=>Cb,batchNorm3d:()=>Rb,batchNorm4d:()=>Mb,batchToSpaceND:()=>Xu,bincount:()=>uA,booleanMaskAsync:()=>SR,broadcastTo:()=>cl,browser:()=>li,buffer:()=>We,callbacks:()=>zre,cast:()=>fe,ceil:()=>dA,clipByValue:()=>kn,clone:()=>Oa,complex:()=>Tr,concat:()=>ot,concat1d:()=>Fb,concat2d:()=>hl,concat3d:()=>$b,concat4d:()=>Db,constraints:()=>k6,conv1d:()=>vc,conv2d:()=>ar,conv2dTranspose:()=>wc,conv3d:()=>cA,conv3dTranspose:()=>zb,copyRegisteredKernels:()=>jI,cos:()=>Ku,cosh:()=>kc,cosineWindow:()=>LA,cumsum:()=>Ic,customGrad:()=>_a,data:()=>_8,denseBincount:()=>_b,deprecationWarn:()=>Zm,depthToSpace:()=>hA,depthwiseConv2d:()=>fl,deregisterOp:()=>Pre,device_util:()=>Bu,diag:()=>XT,dilation2d:()=>fA,disableDeprecationWarnings:()=>FN,dispose:()=>Ee,disposeVariables:()=>$N,div:()=>me,divNoNan:()=>mA,dot:()=>Pb,dropout:()=>s3,einsum:()=>Lb,elu:()=>ml,enableDebugMode:()=>MN,enableProdMode:()=>RN,enclosingPowerOfTwo:()=>i3,engine:()=>nr,env:()=>J,equal:()=>Fr,erf:()=>AA,exp:()=>qn,expandDims:()=>ln,expm1:()=>yA,eye:()=>gA,fft:()=>rd,fill:()=>Al,findBackend:()=>Ym,findBackendFactory:()=>WN,floor:()=>yl,floorDiv:()=>yc,forceHalfFloat:()=>kv,fused:()=>_r,gather:()=>hi,gatherND:()=>r3,gather_util:()=>jm,getBackend:()=>PN,getGradient:()=>km,getKernel:()=>oc,getKernelsForBackend:()=>al,gpgpu_util:()=>q7,grad:()=>IE,grads:()=>SE,greater:()=>Mn,greaterEqual:()=>Dr,ifft:()=>wl,imag:()=>Sc,image:()=>Ye,inTopKAsync:()=>zR,initializers:()=>R6,input:()=>j6,io:()=>vn,irfft:()=>Bc,isFinite:()=>Wb,isInf:()=>Bb,isNaN:()=>xA,keep:()=>jt,kernel_impls:()=>Wa,layers:()=>V6,leakyRelu:()=>Zu,less:()=>Nc,lessEqual:()=>Or,linalg:()=>g3,linspace:()=>Vb,loadGraphModel:()=>Gt,loadLayersModel:()=>nre,localResponseNormalization:()=>bA,log:()=>Fn,log1p:()=>Tc,logSigmoid:()=>Ub,logSoftmax:()=>Cc,logSumExp:()=>kA,logicalAnd:()=>oa,logicalNot:()=>Yu,logicalOr:()=>Rc,logicalXor:()=>Xb,losses:()=>iF,matMul:()=>Be,math:()=>ib,max:()=>Xn,maxPool:()=>Ju,maxPool3d:()=>IA,maxPoolWithArgmax:()=>Kb,maximum:()=>Pa,mean:()=>wt,memory:()=>Ac,meshgrid:()=>qE,metrics:()=>t8,min:()=>gl,minimum:()=>xl,mirrorPad:()=>SA,mod:()=>NA,model:()=>ere,models:()=>n8,moments:()=>Mc,movingAverage:()=>ER,mul:()=>_,multiRNNCell:()=>tC,multinomial:()=>Zb,neg:()=>vt,nextFrame:()=>nh,norm:()=>Hc,notEqual:()=>Ai,oneHot:()=>ll,ones:()=>$n,onesLike:()=>Dn,op:()=>O,outerProduct:()=>iC,pad:()=>rr,pad1d:()=>uC,pad2d:()=>pC,pad3d:()=>hC,pad4d:()=>mC,pool:()=>Yb,pow:()=>sr,prelu:()=>ed,print:()=>eb,prod:()=>Fc,profile:()=>DN,rand:()=>IC,randomGamma:()=>EC,randomNormal:()=>Jb,randomUniform:()=>bl,range:()=>vl,ready:()=>_N,real:()=>td,reciprocal:()=>CA,registerBackend:()=>dl,registerCallbackConstructor:()=>are,registerGradient:()=>Dx,registerKernel:()=>ri,registerOp:()=>_re,regularizers:()=>a8,relu:()=>La,relu6:()=>$c,removeBackend:()=>LN,reshape:()=>H,reverse:()=>On,reverse1d:()=>_C,reverse2d:()=>LC,reverse3d:()=>BC,reverse4d:()=>jC,rfft:()=>sd,round:()=>Dc,rsqrt:()=>Oc,scalar:()=>Se,scatterND:()=>a3,scatter_util:()=>Um,selu:()=>zc,separableConv2d:()=>RA,sequential:()=>tre,serialization:()=>ae,setBackend:()=>zN,setPlatform:()=>BN,setWasmPath:()=>ZJ,setWasmPaths:()=>YJ,setWebGLContext:()=>ch,setdiff1dAsync:()=>Qb,shared:()=>UA,sigmoid:()=>wn,sign:()=>MA,signal:()=>sF,sin:()=>_c,sinh:()=>Pc,slice:()=>Re,slice1d:()=>Lc,slice2d:()=>FA,slice3d:()=>Wc,slice4d:()=>nd,slice_util:()=>on,softmax:()=>ad,softplus:()=>fi,spaceToBatchND:()=>Qu,sparse:()=>x3,sparseToDense:()=>PA,spectral:()=>rF,split:()=>an,sqrt:()=>Jt,square:()=>st,squaredDifference:()=>Vc,squeeze:()=>zr,stack:()=>zn,step:()=>kl,stridedSlice:()=>$A,sub:()=>ge,sum:()=>ke,sumOutType:()=>pc,tan:()=>DA,tanh:()=>pi,tensor:()=>ia,tensor1d:()=>Tt,tensor2d:()=>ya,tensor3d:()=>fc,tensor4d:()=>mR,tensor5d:()=>AR,tensor6d:()=>yR,tensor_util:()=>ma,test_util:()=>wb,tidy:()=>W,tile:()=>$r,time:()=>ON,topk:()=>OA,train:()=>gi,transpose:()=>Ze,truncatedNormal:()=>jc,unique:()=>Uc,unregisterGradient:()=>VI,unregisterKernel:()=>BI,unsortedSegmentSum:()=>zA,unstack:()=>la,upcastType:()=>sa,util:()=>k,valueAndGrad:()=>NE,valueAndGrads:()=>TE,variable:()=>e3,variableGrads:()=>jb,version:()=>Iie,version_converter:()=>Pse,version_core:()=>CN,version_cpu:()=>Q3,version_layers:()=>uy,version_wasm:()=>f6,version_webgl:()=>wv,webgl:()=>qW,webgl_util:()=>v7,where:()=>nn,whereAsync:()=>_A,zeros:()=>Ct,zerosLike:()=>Ue});var W9=Object.create,Ip=Object.defineProperty,B9=Object.getOwnPropertyDescriptor,V9=Object.getOwnPropertyNames,j9=Object.getPrototypeOf,U9=Object.prototype.hasOwnProperty,H9=e=>Ip(e,"__esModule",{value:!0}),xt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Fe=(e,t)=>{for(var n in t)Ip(e,n,{get:t[n],enumerable:!0})},G9=(e,t,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of V9(t))!U9.call(e,a)&&a!=="default"&&Ip(e,a,{get:()=>t[a],enumerable:!(n=B9(t,a))||n.enumerable});return e},Yi=e=>G9(H9(Ip(e!=null?W9(j9(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),q9=xt(()=>{}),X9=xt((e,t)=>{(function(n,a,r){function s(d){var u=this,p=l();u.next=function(){var c=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=c-(u.c=c|0)},u.c=1,u.s0=p(" "),u.s1=p(" "),u.s2=p(" "),u.s0-=p(d),u.s0<0&&(u.s0+=1),u.s1-=p(d),u.s1<0&&(u.s1+=1),u.s2-=p(d),u.s2<0&&(u.s2+=1),p=null}function i(d,u){return u.c=d.c,u.s0=d.s0,u.s1=d.s1,u.s2=d.s2,u}function o(d,u){var p=new s(d),c=u&&u.state,h=p.next;return h.int32=function(){return p.next()*4294967296|0},h.double=function(){return h()+(h()*2097152|0)*11102230246251565e-32},h.quick=h,c&&(typeof c=="object"&&i(c,p),h.state=function(){return i(p,{})}),h}function l(){var d=4022871197,u=function(p){p=p.toString();for(var c=0;c>>0,h-=d,h*=d,d=h>>>0,h-=d,d+=h*4294967296}return(d>>>0)*23283064365386963e-26};return u}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.alea=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),K9=xt((e,t)=>{(function(n,a,r){function s(l){var d=this,u="";d.x=0,d.y=0,d.z=0,d.w=0,d.next=function(){var c=d.x^d.x<<11;return d.x=d.y,d.y=d.z,d.z=d.w,d.w^=d.w>>>19^c^c>>>8},l===(l|0)?d.x=l:u+=l;for(var p=0;p>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(typeof p=="object"&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xor128=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),Z9=xt((e,t)=>{(function(n,a,r){function s(l){var d=this,u="";d.next=function(){var c=d.x^d.x>>>2;return d.x=d.y,d.y=d.z,d.z=d.w,d.w=d.v,(d.d=d.d+362437|0)+(d.v=d.v^d.v<<4^(c^c<<1))|0},d.x=0,d.y=0,d.z=0,d.w=0,d.v=0,l===(l|0)?d.x=l:u+=l;for(var p=0;p>>4),d.next()}function i(l,d){return d.x=l.x,d.y=l.y,d.z=l.z,d.w=l.w,d.v=l.v,d.d=l.d,d}function o(l,d){var u=new s(l),p=d&&d.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(typeof p=="object"&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xorwow=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),Y9=xt((e,t)=>{(function(n,a,r){function s(l){var d=this;d.next=function(){var p=d.x,c=d.i,h,m,f;return h=p[c],h^=h>>>7,m=h^h<<24,h=p[c+1&7],m^=h^h>>>10,h=p[c+3&7],m^=h^h>>>3,h=p[c+4&7],m^=h^h<<7,h=p[c+7&7],h=h^h<<13,m^=h^h<<9,p[c]=m,d.i=c+1&7,m};function u(p,c){var h,m,f=[];if(c===(c|0))m=f[0]=c;else for(c=""+c,h=0;h0;--h)p.next()}u(d,l)}function i(l,d){return d.x=l.x.slice(),d.i=l.i,d}function o(l,d){l==null&&(l=+new Date);var u=new s(l),p=d&&d.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(p.x&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xorshift7=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),J9=xt((e,t)=>{(function(n,a,r){function s(l){var d=this;d.next=function(){var p=d.w,c=d.X,h=d.i,m,f;return d.w=p=p+1640531527|0,f=c[h+34&127],m=c[h=h+1&127],f^=f<<13,m^=m<<17,f^=f>>>15,m^=m>>>12,f=c[h]=f^m,d.i=h,f+(p^p>>>16)|0};function u(p,c){var h,m,f,A,y,g=[],x=128;for(c===(c|0)?(m=c,c=null):(c=c+"\0",m=0,x=Math.max(x,c.length)),f=0,A=-32;A>>15,m^=m<<4,m^=m>>>13,A>=0&&(y=y+1640531527|0,h=g[A&127]^=m+y,f=h==0?f+1:0);for(f>=128&&(g[(c&&c.length||0)&127]=-1),f=127,A=4*128;A>0;--A)m=g[f+34&127],h=g[f=f+1&127],m^=m<<13,h^=h<<17,m^=m>>>15,h^=h>>>12,g[f]=m^h;p.w=y,p.X=g,p.i=f}u(d,l)}function i(l,d){return d.i=l.i,d.w=l.w,d.X=l.X.slice(),d}function o(l,d){l==null&&(l=+new Date);var u=new s(l),p=d&&d.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(p.X&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xor4096=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),Q9=xt((e,t)=>{(function(n,a,r){function s(l){var d=this,u="";d.next=function(){var c=d.b,h=d.c,m=d.d,f=d.a;return c=c<<25^c>>>7^h,h=h-m|0,m=m<<24^m>>>8^f,f=f-c|0,d.b=c=c<<20^c>>>12^h,d.c=h=h-m|0,d.d=m<<16^h>>>16^f,d.a=f-c|0},d.a=0,d.b=0,d.c=2654435769|0,d.d=1367130551,l===Math.floor(l)?(d.a=l/4294967296|0,d.b=l|0):u+=l;for(var p=0;p>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(typeof p=="object"&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.tychei=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),Bg=xt(()=>{}),eI=xt((e,t)=>{(function(n,a){var r=this,s=256,i=6,o=52,l="random",d=a.pow(s,i),u=a.pow(2,o),p=u*2,c=s-1,h;function m(b,v,N){var T=[];v=v==!0?{entropy:!0}:v||{};var R=g(y(v.entropy?[b,w(n)]:b==null?x():b,3),T),$=new f(T),z=function(){for(var P=$.g(i),V=d,j=0;P=p;)P/=2,V/=2,j>>>=1;return(P+j)/V};return z.int32=function(){return $.g(4)|0},z.quick=function(){return $.g(4)/4294967296},z.double=z,g(w($.S),n),(v.pass||N||function(P,V,j,U){return U&&(U.S&&A(U,$),P.state=function(){return A($,{})}),j?(a[l]=P,V):P})(z,R,"global"in v?v.global:this==a,v.state)}a["seed"+l]=m;function f(b){var v,N=b.length,T=this,R=0,$=T.i=T.j=0,z=T.S=[];for(N||(b=[N++]);R{var n=X9(),a=K9(),r=Z9(),s=Y9(),i=J9(),o=Q9(),l=eI();l.alea=n,l.xor128=a,l.xorwow=r,l.xorshift7=s,l.xor4096=i,l.tychei=o,t.exports=l}),hu=xt(()=>{}),tI=xt(()=>{}),nI=xt(()=>{}),aI=xt((e,t)=>{var n=function(){var a=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename!="undefined"&&(a=a||__filename),function(r){r=r||{};function s(){return Q.buffer!=Ve&&Kt(Q.buffer),An}function i(){return Q.buffer!=Ve&&Kt(Q.buffer),gt}function o(){return Q.buffer!=Ve&&Kt(Q.buffer),yn}function l(){return Q.buffer!=Ve&&Kt(Q.buffer),jn}function d(){return Q.buffer!=Ve&&Kt(Q.buffer),rn}var u=typeof r!="undefined"?r:{},p,c;u.ready=new Promise(function(S,E){p=S,c=E});var h={},m;for(m in u)u.hasOwnProperty(m)&&(h[m]=u[m]);var f=[],A="./this.program",y=function(S,E){throw E},g=!1,x=!1,w=!1,b=!1;g=typeof window=="object",x=typeof importScripts=="function",w=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",b=!g&&!w&&!x;var v=u.ENVIRONMENT_IS_PTHREAD||!1;v&&(Ve=u.buffer);var N="";function T(S){return u.locateFile?u.locateFile(S,N):N+S}var R,$,z,P,V,j;if(w){x?N=hu().dirname(N)+"/":N=__dirname+"/",R=function(S,E){return V||(V=require("fs")),j||(j=hu()),S=j.normalize(S),V.readFileSync(S,E?null:"utf8")},z=function(S){var E=R(S,!0);return E.buffer||(E=new Uint8Array(E)),ce(E.buffer),E},process.argv.length>1&&(A=process.argv[1].replace(/\\/g,"/")),f=process.argv.slice(2),process.on("uncaughtException",function(S){if(!(S instanceof pu))throw S}),process.on("unhandledRejection",Ya),y=function(S){process.exit(S)},u.inspect=function(){return"[Emscripten Module object]"};var U;try{U=tI()}catch(S){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),S}global.Worker=U.Worker}else b?(typeof read!="undefined"&&(R=function(S){return read(S)}),z=function(S){var E;return typeof readbuffer=="function"?new Uint8Array(readbuffer(S)):(E=read(S,"binary"),ce(typeof E=="object"),E)},typeof scriptArgs!="undefined"?f=scriptArgs:typeof arguments!="undefined"&&(f=arguments),typeof quit=="function"&&(y=function(S){quit(S)}),typeof print!="undefined"&&(typeof console=="undefined"&&(console={}),console.log=print,console.warn=console.error=typeof printErr!="undefined"?printErr:print)):(g||x)&&(x?N=self.location.href:typeof document!="undefined"&&document.currentScript&&(N=document.currentScript.src),typeof a!="undefined"&&a&&(N=a),N.indexOf("blob:")!==0?N=N.substr(0,N.lastIndexOf("/")+1):N="",w?(R=function(S,E){return V||(V=require("fs")),j||(j=hu()),S=j.normalize(S),V.readFileSync(S,E?null:"utf8")},z=function(S){var E=R(S,!0);return E.buffer||(E=new Uint8Array(E)),ce(E.buffer),E}):(R=function(S){var E=new XMLHttpRequest;return E.open("GET",S,!1),E.send(null),E.responseText},x&&(z=function(S){var E=new XMLHttpRequest;return E.open("GET",S,!1),E.responseType="arraybuffer",E.send(null),new Uint8Array(E.response)}),$=function(S,E,L){var q=new XMLHttpRequest;q.open("GET",S,!0),q.responseType="arraybuffer",q.onload=function(){if(q.status==200||q.status==0&&q.response){E(q.response);return}L()},q.onerror=L,q.send(null)}),P=function(S){document.title=S});w&&typeof performance=="undefined"&&(global.performance=nI().performance);var X=u.print||console.log.bind(console),G=u.printErr||console.warn.bind(console);for(m in h)h.hasOwnProperty(m)&&(u[m]=h[m]);h=null,u.arguments&&(f=u.arguments),u.thisProgram&&(A=u.thisProgram),u.quit&&(y=u.quit);var ee=Atomics.load,Y=Atomics.store,re=Atomics.compareExchange,ne;u.wasmBinary&&(ne=u.wasmBinary);var ie=u.noExitRuntime||!0;typeof WebAssembly!="object"&&Ya("no native wasm support detected");var Q,de,oe=!1,ye;function ce(S,E){S||Ya("Assertion failed: "+E)}function Ie(S){var E=u["_"+S];return ce(E,"Cannot call unknown function "+S+", make sure it is exported"),E}function Ne(S,E,L,q,pe){var le={string:function(bn){var Zi=0;if(bn!=null&&bn!==0){var _g=(bn.length<<2)+1;Zi=qi(_g),et(bn,Zi,_g)}return Zi},array:function(bn){var Zi=qi(bn.length);return Xe(bn,Zi),Zi}};function ue(bn){return E==="string"?De(bn):E==="boolean"?Boolean(bn):bn}var be=Ie(S),tt=[],Bt=0;if(q)for(var $t=0;$t=q);){var le=S[E++];if(!le)return pe;if(!(le&128)){pe+=String.fromCharCode(le);continue}var ue=S[E++]&63;if((le&224)==192){pe+=String.fromCharCode((le&31)<<6|ue);continue}var be=S[E++]&63;if((le&240)==224?le=(le&15)<<12|ue<<6|be:le=(le&7)<<18|ue<<12|be<<6|S[E++]&63,le<65536)pe+=String.fromCharCode(le);else{var tt=le-65536;pe+=String.fromCharCode(55296|tt>>10,56320|tt&1023)}}return pe}function De(S,E){return S?ze(i(),S,E):""}function Qe(S,E,L,q){if(!(q>0))return 0;for(var pe=L,le=L+q-1,ue=0;ue=55296&&be<=57343){var tt=S.charCodeAt(++ue);be=65536+((be&1023)<<10)|tt&1023}if(be<=127){if(L>=le)break;E[L++]=be}else if(be<=2047){if(L+1>=le)break;E[L++]=192|be>>6,E[L++]=128|be&63}else if(be<=65535){if(L+2>=le)break;E[L++]=224|be>>12,E[L++]=128|be>>6&63,E[L++]=128|be&63}else{if(L+3>=le)break;E[L++]=240|be>>18,E[L++]=128|be>>12&63,E[L++]=128|be>>6&63,E[L++]=128|be&63}}return E[L]=0,L-pe}function et(S,E,L){return Qe(S,i(),E,L)}function rt(S){for(var E=0,L=0;L=55296&&q<=57343&&(q=65536+((q&1023)<<10)|S.charCodeAt(++L)&1023),q<=127?++E:q<=2047?E+=2:q<=65535?E+=3:E+=4}return E}function Xe(S,E){s().set(S,E)}function dt(S,E){return S%E>0&&(S+=E-S%E),S}var Ve,An,gt,Vn,Xt,yn,jn,Rn,rn;function Kt(S){Ve=S,u.HEAP8=An=new Int8Array(S),u.HEAP16=Vn=new Int16Array(S),u.HEAP32=yn=new Int32Array(S),u.HEAPU8=gt=new Uint8Array(S),u.HEAPU16=Xt=new Uint16Array(S),u.HEAPU32=jn=new Uint32Array(S),u.HEAPF32=Rn=new Float32Array(S),u.HEAPF64=rn=new Float64Array(S)}var Ca=u.INITIAL_MEMORY||16777216;if(v)Q=u.wasmMemory,Ve=u.buffer;else if(u.wasmMemory)Q=u.wasmMemory;else if(Q=new WebAssembly.Memory({initial:Ca/65536,maximum:2147483648/65536,shared:!0}),!(Q.buffer instanceof SharedArrayBuffer))throw G("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),w&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");Q&&(Ve=Q.buffer),Ca=Ve.byteLength,Kt(Ve);var ea,ta=[],fr=[],Ka=[],mr=[],Wi=[],Ra=!1,np=!1;v||fr.push({func:function(){yp()}});function W0(){if(!v){if(u.preRun)for(typeof u.preRun=="function"&&(u.preRun=[u.preRun]);u.preRun.length;)rp(u.preRun.shift());Vi(ta)}}function tu(){Ra=!0,!v&&Vi(fr)}function B0(){v||Vi(Ka)}function ap(){v||(np=!0)}function gn(){if(!v){if(u.postRun)for(typeof u.postRun=="function"&&(u.postRun=[u.postRun]);u.postRun.length;)V0(u.postRun.shift());Vi(Wi)}}function rp(S){ta.unshift(S)}function V0(S){Wi.unshift(S)}var Za=0,Ar=null,ts=null;function j0(S){ce(!v,"addRunDependency cannot be used in a pthread worker"),Za++,u.monitorRunDependencies&&u.monitorRunDependencies(Za)}function U0(S){if(Za--,u.monitorRunDependencies&&u.monitorRunDependencies(Za),Za==0&&(Ar!==null&&(clearInterval(Ar),Ar=null),ts)){var E=ts;ts=null,E()}}u.preloadedImages={},u.preloadedAudios={};function Ya(S){u.onAbort&&u.onAbort(S),v&&console.error("Pthread aborting at "+new Error().stack),S+="",G(S),oe=!0,ye=1,S="abort("+S+"). Build with -s ASSERTIONS=1 for more info.";var E=new WebAssembly.RuntimeError(S);throw c(E),E}function sp(S,E){return String.prototype.startsWith?S.startsWith(E):S.indexOf(E)===0}var Bi="data:application/octet-stream;base64,";function ip(S){return sp(S,Bi)}var H0="file://";function op(S){return sp(S,H0)}var xn="tfjs-backend-wasm-threaded-simd.wasm";ip(xn)||(xn=T(xn));function lp(S){try{if(S==xn&&ne)return new Uint8Array(ne);if(z)return z(S);throw"both async and sync fetching of the wasm failed"}catch(E){Ya(E)}}function G0(){if(!ne&&(g||x)){if(typeof fetch=="function"&&!op(xn))return fetch(xn,{credentials:"same-origin"}).then(function(S){if(!S.ok)throw"failed to load wasm binary file at '"+xn+"'";return S.arrayBuffer()}).catch(function(){return lp(xn)});if($)return new Promise(function(S,E){$(xn,function(L){S(new Uint8Array(L))},E)})}return Promise.resolve().then(function(){return lp(xn)})}function q0(){var S={a:Pf};function E(ue,be){var tt=ue.exports;if(u.asm=tt,ea=u.asm.F,de=be,!v){var Bt=we.unusedWorkers.length;we.unusedWorkers.forEach(function($t){we.loadWasmModuleToWorker($t,function(){--Bt||U0("wasm-instantiate")})})}}v||j0("wasm-instantiate");function L(ue){E(ue.instance,ue.module)}function q(ue){return G0().then(function(be){return WebAssembly.instantiate(be,S)}).then(ue,function(be){G("failed to asynchronously prepare wasm: "+be),Ya(be)})}function pe(){return!ne&&typeof WebAssembly.instantiateStreaming=="function"&&!ip(xn)&&!op(xn)&&typeof fetch=="function"?fetch(xn,{credentials:"same-origin"}).then(function(ue){var be=WebAssembly.instantiateStreaming(ue,S);return be.then(L,function(tt){return G("wasm streaming compile failed: "+tt),G("falling back to ArrayBuffer instantiation"),q(L)})}):q(L)}if(u.instantiateWasm)try{var le=u.instantiateWasm(S,E);return le}catch(ue){return G("Module.instantiateWasm callback failed with error: "+ue),!1}return pe().catch(c),{}}var X0={9816:function(){throw"Canceled!"},9834:function(S,E){setTimeout(function(){Mg(S,E)},0)}};function up(){we.initRuntime()}function Vi(S){for(;S.length>0;){var E=S.shift();if(typeof E=="function"){E(u);continue}var L=E.func;typeof L=="number"?E.arg===void 0?ea.get(L)():ea.get(L)(E.arg):L(E.arg===void 0?null:E.arg)}}function nu(S,E){if(S<=0||S>s().length||S&!0||E<0)return-28;if(E==0)return 0;E>=2147483647&&(E=Infinity);var L=Atomics.load(o(),Xi>>2),q=0;if(L==S){var pe=Atomics.compareExchange(o(),Xi>>2,L,0);if(pe==L&&(--E,q=1,E<=0))return 1}var le=Atomics.notify(o(),S>>2,E);if(le>=0)return le+q;throw"Atomics.notify returned an unexpected value "+le}u._emscripten_futex_wake=nu;function K0(S){if(v)throw"Internal Error! killThread() can only ever be called from main application thread!";if(!S)throw"Internal Error! Null pthread_ptr in killThread!";o()[S+12>>2]=0;var E=we.pthreads[S];E.worker.terminate(),we.freeThreadData(E),we.runningWorkers.splice(we.runningWorkers.indexOf(E.worker),1),E.worker.pthread=void 0}function Z0(S){if(v)throw"Internal Error! cancelThread() can only ever be called from main application thread!";if(!S)throw"Internal Error! Null pthread_ptr in cancelThread!";var E=we.pthreads[S];E.worker.postMessage({cmd:"cancel"})}function Y0(S){if(v)throw"Internal Error! cleanupThread() can only ever be called from main application thread!";if(!S)throw"Internal Error! Null pthread_ptr in cleanupThread!";var E=we.pthreads[S];if(E){o()[S+12>>2]=0;var L=E.worker;we.returnWorkerToPool(L)}}var we={unusedWorkers:[],runningWorkers:[],initMainThreadBlock:function(){for(var S=Math.min(4,Math.max(1,(navigator.hardwareConcurrency||1)/2)),E=0;E>2]=S;var L=S+152;o()[L>>2]=L;for(var q=as(512),E=0;E<128;++E)l()[q/4+E]=0;Atomics.store(l(),S+100>>2,q),Atomics.store(l(),S+40>>2,S),um(S,!x,1),Rg(S)},initWorker:function(){},pthreads:{},threadExitHandlers:[],setThreadStatus:function(){},runExitHandlers:function(){for(;we.threadExitHandlers.length>0;)we.threadExitHandlers.pop()();v&&Hi()&&Cg()},runExitHandlersAndDeinitThread:function(S,E){Atomics.store(l(),S+56>>2,1),Atomics.store(l(),S+60>>2,0),we.runExitHandlers(),Atomics.store(l(),S+4>>2,E),Atomics.store(l(),S+0>>2,1),nu(S+0,2147483647),um(0,0,0)},threadExit:function(S){var E=Hi();E&&(we.runExitHandlersAndDeinitThread(E,S),v&&postMessage({cmd:"exit"}))},threadCancel:function(){we.runExitHandlersAndDeinitThread(Hi(),-1),postMessage({cmd:"cancelDone"})},terminateAllThreads:function(){for(var S in we.pthreads){var E=we.pthreads[S];E&&E.worker&&we.returnWorkerToPool(E.worker)}we.pthreads={};for(var L=0;L>2];o()[S.threadInfoStruct+100>>2]=0,uu(E),uu(S.threadInfoStruct)}S.threadInfoStruct=0,S.allocatedOwnStack&&S.stackBase&&uu(S.stackBase),S.stackBase=0,S.worker&&(S.worker.pthread=null)}},returnWorkerToPool:function(S){we.runWithoutMainThreadQueuedCalls(function(){delete we.pthreads[S.pthread.threadInfoStruct],we.unusedWorkers.push(S),we.runningWorkers.splice(we.runningWorkers.indexOf(S),1),we.freeThreadData(S.pthread),S.pthread=void 0})},runWithoutMainThreadQueuedCalls:function(S){o()[zg>>2]=0;try{S()}finally{o()[zg>>2]=1}},receiveObjectTransfer:function(S){},loadWasmModuleToWorker:function(S,E){S.onmessage=function(L){var q=L.data,pe=q.cmd;if(S.pthread&&(we.currentProxiedOperationCallerThread=S.pthread.threadInfoStruct),q.targetThread&&q.targetThread!=Hi()){var le=we.pthreads[q.targetThread];le?le.worker.postMessage(L.data,q.transferList):console.error('Internal error! Worker sent a message "'+pe+'" to target pthread '+q.targetThread+", but that thread no longer exists!"),we.currentProxiedOperationCallerThread=void 0;return}if(pe==="processQueuedMainThreadWork")om();else if(pe==="spawnThread")mp(L.data);else if(pe==="cleanupThread")Y0(q.thread);else if(pe==="killThread")K0(q.thread);else if(pe==="cancelThread")Z0(q.thread);else if(pe==="loaded")S.loaded=!0,E&&E(S),S.runPthread&&(S.runPthread(),delete S.runPthread);else if(pe==="print")X("Thread "+q.threadId+": "+q.text);else if(pe==="printErr")G("Thread "+q.threadId+": "+q.text);else if(pe==="alert")alert("Thread "+q.threadId+": "+q.text);else if(pe==="exit"){var ue=S.pthread&&Atomics.load(l(),S.pthread.threadInfoStruct+64>>2);ue&&we.returnWorkerToPool(S)}else if(pe==="exitProcess")try{P9(q.returnCode)}catch(be){if(be instanceof pu)return;throw be}else pe==="cancelDone"?we.returnWorkerToPool(S):pe==="objectTransfer"?we.receiveObjectTransfer(L.data):L.data.target==="setimmediate"?S.postMessage(L.data):G("worker sent an unknown command "+pe);we.currentProxiedOperationCallerThread=void 0},S.onerror=function(L){G("pthread sent an error! "+L.filename+":"+L.lineno+": "+L.message)},w&&(S.on("message",function(L){S.onmessage({data:L})}),S.on("error",function(L){S.onerror(L)}),S.on("exit",function(L){})),S.postMessage({cmd:"load",urlOrBlob:u.mainScriptUrlOrBlob||a,wasmMemory:Q,wasmModule:de})},allocateUnusedWorker:function(){var S=T("tfjs-backend-wasm-threaded-simd.worker.js");we.unusedWorkers.push(new Worker(S))},getNewWorker:function(){return we.unusedWorkers.length==0&&(we.allocateUnusedWorker(),we.loadWasmModuleToWorker(we.unusedWorkers[0])),we.unusedWorkers.length>0?we.unusedWorkers.pop():null},busySpinWait:function(S){for(var E=performance.now()+S;performance.now()>2]=S,S}function rf(S,E){if(v)return yr(1,1,S,E)}function sf(S,E){if(S==E)postMessage({cmd:"processQueuedMainThreadWork"});else if(v)postMessage({targetThread:S,cmd:"processThreadQueue"});else{var L=we.pthreads[S],q=L&&L.worker;if(!q)return;q.postMessage({cmd:"processThreadQueue"})}return 1}function of(){Ya()}function lf(S,E,L){var q=hf(E,L);return X0[S].apply(null,q)}function uf(S,E){}function df(S,E,L){if(S<=0||S>s().length||S&!0)return-28;if(g){if(Atomics.load(o(),S>>2)!=E)return-6;for(var q=performance.now(),pe=q+L,le=Atomics.exchange(o(),Xi>>2,S);;){if(q=performance.now(),q>pe)return le=Atomics.exchange(o(),Xi>>2,0),-73;if(le=Atomics.exchange(o(),Xi>>2,0),le==0)break;if(om(),Atomics.load(o(),S>>2)!=E)return-6;le=Atomics.exchange(o(),Xi>>2,S)}return 0}else{var ue=Atomics.wait(o(),S>>2,E,L);if(ue==="timed-out")return-73;if(ue==="not-equal")return-6;if(ue==="ok")return 0;throw"Atomics.wait returned an unexpected value "+ue}}function pf(S,E,L){i().copyWithin(S,E,E+L)}function cf(){return w?require("os").cpus().length:navigator.hardwareConcurrency}function yr(S,E){for(var L=arguments.length-2,q=du(),pe=L,le=qi(pe*8),ue=le>>3,be=0;be>=2;L=i()[S++];){var q=L<105;q&&E&1&&E++,ru.push(q?d()[E++>>1]:o()[E]),++E}return ru}function ff(S,E,L){au.length=E;for(var q=L>>3,pe=0;pe>>16),Kt(Q.buffer),1}catch(E){}}function yf(S){var E=mf();if(S<=E)return!1;var L=2147483648;if(S>L)return!1;for(var q=1;q<=4;q*=2){var pe=E*(1+.2/q);pe=Math.min(pe,S+100663296);var le=Math.min(L,dt(Math.max(S,pe),65536)),ue=Af(le);if(ue)return!0}return!1}var Pe={inEventHandler:0,removeAllEventListeners:function(){for(var S=Pe.eventHandlers.length-1;S>=0;--S)Pe._removeHandler(S);Pe.eventHandlers=[],Pe.deferredCalls=[]},registerRemoveEventListeners:function(){Pe.removeEventListenersRegistered||(mr.push(Pe.removeAllEventListeners),Pe.removeEventListenersRegistered=!0)},deferredCalls:[],deferCall:function(S,E,L){function q(ue,be){if(ue.length!=be.length)return!1;for(var tt in ue)if(ue[tt]!=be[tt])return!1;return!0}for(var pe in Pe.deferredCalls){var le=Pe.deferredCalls[pe];if(le.targetFunction==S&&q(le.argsList,L))return}Pe.deferredCalls.push({targetFunction:S,precedence:E,argsList:L}),Pe.deferredCalls.sort(function(ue,be){return ue.precedence>2]=L,o()[ue+4>>2]=q,o()[ue+8>>2]=pe,lm(0,S,637534208,E,q,ue),Gi(le)},getTargetThreadForEventCallback:function(S){switch(S){case 1:return 0;case 2:return we.currentProxiedOperationCallerThread;default:return S}},getNodeNameForTarget:function(S){return S?S==window?"#window":S==screen?"#screen":S&&S.nodeName?S.nodeName:"":""},fullscreenEnabled:function(){return document.fullscreenEnabled||document.webkitFullscreenEnabled}};function gf(S){var E=rt(S)+1,L=as(E);return et(S,L,E),L}function xf(S,E,L,q){var pe=du(),le=qi(12),ue=0;E&&(ue=gf(E)),o()[le>>2]=ue,o()[le+4>>2]=L,o()[le+8>>2]=q,lm(0,S,657457152,0,ue,le),Gi(pe)}function bf(S,E,L,q){E=E?De(E):"",xf(S,E,L,q)}function vf(S){return S>2?De(S):S}var wf=[0,typeof document!="undefined"?document:0,typeof window!="undefined"?window:0];function kf(S){S=vf(S);var E=wf[S]||(typeof document!="undefined"?document.querySelector(S):void 0);return E}function su(S){return kf(S)}function dp(S,E,L){var q=su(S);if(!q)return-4;if(q.canvasSharedPtr&&(o()[q.canvasSharedPtr>>2]=E,o()[q.canvasSharedPtr+4>>2]=L),q.offscreenCanvas||!q.controlTransferredOffscreen){q.offscreenCanvas&&(q=q.offscreenCanvas);var pe=!1;if(q.GLctxObject&&q.GLctxObject.GLctx){var le=q.GLctxObject.GLctx.getParameter(2978);pe=le[0]===0&&le[1]===0&&le[2]===q.width&&le[3]===q.height}q.width=E,q.height=L,pe&&q.GLctxObject.GLctx.viewport(0,0,E,L)}else if(q.canvasSharedPtr){var ue=o()[q.canvasSharedPtr+8>>2];return bf(ue,S,E,L),1}else return-4;return 0}function pp(S,E,L){return v?yr(2,1,S,E,L):dp(S,E,L)}function If(S,E,L){var q=su(S);return q?dp(S,E,L):pp(S,E,L)}function Sf(S){}function Nf(S,E){}function Tf(S){var E=S.getExtension("ANGLE_instanced_arrays");if(E)return S.vertexAttribDivisor=function(L,q){E.vertexAttribDivisorANGLE(L,q)},S.drawArraysInstanced=function(L,q,pe,le){E.drawArraysInstancedANGLE(L,q,pe,le)},S.drawElementsInstanced=function(L,q,pe,le,ue){E.drawElementsInstancedANGLE(L,q,pe,le,ue)},1}function Ef(S){var E=S.getExtension("OES_vertex_array_object");if(E)return S.createVertexArray=function(){return E.createVertexArrayOES()},S.deleteVertexArray=function(L){E.deleteVertexArrayOES(L)},S.bindVertexArray=function(L){E.bindVertexArrayOES(L)},S.isVertexArray=function(L){return E.isVertexArrayOES(L)},1}function Cf(S){var E=S.getExtension("WEBGL_draw_buffers");if(E)return S.drawBuffers=function(L,q){E.drawBuffersWEBGL(L,q)},1}function Rf(S){return!!(S.multiDrawWebgl=S.getExtension("WEBGL_multi_draw"))}var Je={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],uniforms:[],shaders:[],vaos:[],contexts:{},offscreenCanvases:{},timerQueriesEXT:[],programInfos:{},stringCache:{},unpackAlignment:4,recordError:function(S){Je.lastError||(Je.lastError=S)},getNewId:function(S){for(var E=Je.counter++,L=S.length;L>2]:-1;pe+=De(o()[L+le*4>>2],ue<0?void 0:ue)}return pe},createContext:function(S,E){var L=S.getContext("webgl",E);if(!L)return 0;var q=Je.registerContext(L,E);return q},registerContext:function(S,E){var L=as(8);o()[L+4>>2]=Hi();var q={handle:L,attributes:E,version:E.majorVersion,GLctx:S};return S.canvas&&(S.canvas.GLctxObject=q),Je.contexts[L]=q,(typeof E.enableExtensionsByDefault=="undefined"||E.enableExtensionsByDefault)&&Je.initExtensions(q),L},makeContextCurrent:function(S){return Je.currentContext=Je.contexts[S],u.ctx=gr=Je.currentContext&&Je.currentContext.GLctx,!(S&&!gr)},getContext:function(S){return Je.contexts[S]},deleteContext:function(S){Je.currentContext===Je.contexts[S]&&(Je.currentContext=null),typeof Pe=="object"&&Pe.removeAllHandlersOnTarget(Je.contexts[S].GLctx.canvas),Je.contexts[S]&&Je.contexts[S].GLctx.canvas&&(Je.contexts[S].GLctx.canvas.GLctxObject=void 0),uu(Je.contexts[S].handle),Je.contexts[S]=null},initExtensions:function(S){if(S||(S=Je.currentContext),!S.initExtensionsDone){S.initExtensionsDone=!0;var E=S.GLctx;Tf(E),Ef(E),Cf(E),E.disjointTimerQueryExt=E.getExtension("EXT_disjoint_timer_query"),Rf(E);var L=E.getSupportedExtensions()||[];L.forEach(function(q){q.indexOf("lose_context")<0&&q.indexOf("debug")<0&&E.getExtension(q)})}},populateUniformTable:function(S){for(var E=Je.programs[S],L=Je.programInfos[S]={uniforms:{},maxUniformLength:0,maxAttributeLength:-1,maxUniformBlockNameLength:-1},q=L.uniforms,pe=gr.getProgramParameter(E,35718),le=0;le>2,q=o()[L+(24>>2)],pe={alpha:!!o()[L+(0>>2)],depth:!!o()[L+(4>>2)],stencil:!!o()[L+(8>>2)],antialias:!!o()[L+(12>>2)],premultipliedAlpha:!!o()[L+(16>>2)],preserveDrawingBuffer:!!o()[L+(20>>2)],powerPreference:Mf[q],failIfMajorPerformanceCaveat:!!o()[L+(28>>2)],majorVersion:o()[L+(32>>2)],minorVersion:o()[L+(36>>2)],enableExtensionsByDefault:o()[L+(40>>2)],explicitSwapControl:o()[L+(44>>2)],proxyContextToMainThread:o()[L+(48>>2)],renderViaOffscreenBackBuffer:o()[L+(52>>2)]},le=su(S);if(!le||pe.explicitSwapControl)return 0;var ue=Je.createContext(le,pe);return ue}function $f(S,E){return Ff(S,E)}var ji={mappings:{},buffers:[null,[],[]],printChar:function(S,E){var L=ji.buffers[S];E===0||E===10?((S===1?X:G)(ze(L,0)),L.length=0):L.push(E)},varargs:void 0,get:function(){ji.varargs+=4;var S=o()[ji.varargs-4>>2];return S},getStr:function(S){var E=De(S);return E},get64:function(S,E){return S}};function cp(S){return v?yr(3,1,S):0}function hp(S,E,L,q,pe){if(v)return yr(4,1,S,E,L,q,pe)}function fp(S,E,L,q){if(v)return yr(5,1,S,E,L,q);for(var pe=0,le=0;le>2],be=o()[E+(le*8+4)>>2],tt=0;tt>2]=pe,0}function Df(S){var E=we.threadExitHandlers.pop();S&&E()}function Of(S,E){we.threadExitHandlers.push(function(){ea.get(S)(E)})}function mp(S){if(v)throw"Internal Error! spawnThread() can only ever be called from main application thread!";var E=we.getNewWorker();if(E.pthread!==void 0)throw"Internal error!";if(!S.pthread_ptr)throw"Internal error, no pthread ptr!";we.runningWorkers.push(E);for(var L=as(128*4),q=0;q<128;++q)o()[L+q*4>>2]=0;var pe=S.stackBase+S.stackSize,le=we.pthreads[S.pthread_ptr]={worker:E,stackBase:S.stackBase,stackSize:S.stackSize,allocatedOwnStack:S.allocatedOwnStack,threadInfoStruct:S.pthread_ptr},ue=le.threadInfoStruct>>2;Atomics.store(l(),ue+(64>>2),S.detached),Atomics.store(l(),ue+(100>>2),L),Atomics.store(l(),ue+(40>>2),le.threadInfoStruct),Atomics.store(l(),ue+(80>>2),S.stackSize),Atomics.store(l(),ue+(76>>2),pe),Atomics.store(l(),ue+(104>>2),S.stackSize),Atomics.store(l(),ue+(104+8>>2),pe),Atomics.store(l(),ue+(104+12>>2),S.detached);var be=Eg(),tt=be+40;Atomics.store(l(),ue+(172>>2),tt),E.pthread=le;var Bt={cmd:"run",start_routine:S.startRoutine,arg:S.arg,threadInfoStruct:S.pthread_ptr,stackBase:S.stackBase,stackSize:S.stackSize};E.runPthread=function(){Bt.time=performance.now(),E.postMessage(Bt,S.transferList)},E.loaded&&(E.runPthread(),delete E.runPthread)}function zf(S,E,L,q){if(typeof SharedArrayBuffer=="undefined")return G("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;if(!S)return G("pthread_create called with a null thread pointer!"),28;var pe=[],le=0;if(v&&(pe.length===0||le))return Fg(687865856,S,E,L,q);if(le)return le;var ue=0,be=0,tt=0;E&&E!=-1?(ue=o()[E>>2],ue+=81920,be=o()[E+8>>2],tt=o()[E+12>>2]!==0):ue=2097152;var Bt=be==0;Bt?be=Og(16,ue):(be-=ue,ce(be>0));for(var $t=as(228),br=0;br<228>>2;++br)l()[($t>>2)+br]=0;o()[S>>2]=$t,o()[$t+12>>2]=$t;var Ki=$t+152;o()[Ki>>2]=Ki;var bn={stackBase:be,stackSize:ue,allocatedOwnStack:Bt,detached:tt,startRoutine:L,pthread_ptr:$t,arg:q,transferList:pe};return v?(bn.cmd="spawnThread",postMessage(bn,pe)):mp(bn),0}function Ap(S){if(v)return yr(6,1,S);switch(S){case 30:return 16384;case 85:var E=2147483648;return E/16384;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return typeof navigator=="object"&&navigator.hardwareConcurrency||1}return af(28),-1}v||we.initMainThreadBlock();var gr,_f=[null,rf,pp,cp,hp,fp,Ap],Pf={e:tf,r:nf,x:sf,b:of,y:lf,j:uf,c:df,d:nu,f:ns,p:pf,z:cf,u:ff,q:yf,v:If,i:Sf,t:Nf,w:$f,m:cp,n:hp,g:fp,o:up,a:Q||u.wasmMemory,k:Df,l:Of,h:zf,s:Ap},Ng=q0(),yp=u.___wasm_call_ctors=function(){return(yp=u.___wasm_call_ctors=u.asm.A).apply(null,arguments)},Lf=u._init=function(){return(Lf=u._init=u.asm.B).apply(null,arguments)},Wf=u._register_tensor=function(){return(Wf=u._register_tensor=u.asm.C).apply(null,arguments)},Bf=u._dispose_data=function(){return(Bf=u._dispose_data=u.asm.D).apply(null,arguments)},Vf=u._dispose=function(){return(Vf=u._dispose=u.asm.E).apply(null,arguments)},jf=u._Abs=function(){return(jf=u._Abs=u.asm.G).apply(null,arguments)},Uf=u._Add=function(){return(Uf=u._Add=u.asm.H).apply(null,arguments)},Hf=u._AddN=function(){return(Hf=u._AddN=u.asm.I).apply(null,arguments)},Gf=u._All=function(){return(Gf=u._All=u.asm.J).apply(null,arguments)},qf=u._Any=function(){return(qf=u._Any=u.asm.K).apply(null,arguments)},Xf=u._ArgMax=function(){return(Xf=u._ArgMax=u.asm.L).apply(null,arguments)},Kf=u._AvgPool=function(){return(Kf=u._AvgPool=u.asm.M).apply(null,arguments)},Zf=u._BatchMatMul=function(){return(Zf=u._BatchMatMul=u.asm.N).apply(null,arguments)},Yf=u._Ceil=function(){return(Yf=u._Ceil=u.asm.O).apply(null,arguments)},Jf=u._ClipByValue=function(){return(Jf=u._ClipByValue=u.asm.P).apply(null,arguments)},Qf=u._Conv2D=function(){return(Qf=u._Conv2D=u.asm.Q).apply(null,arguments)},em=u._Conv2DBackpropInput=function(){return(em=u._Conv2DBackpropInput=u.asm.R).apply(null,arguments)},tm=u._Cos=function(){return(tm=u._Cos=u.asm.S).apply(null,arguments)},nm=u._CropAndResize=function(){return(nm=u._CropAndResize=u.asm.T).apply(null,arguments)},am=u._Cumsum=function(){return(am=u._Cumsum=u.asm.U).apply(null,arguments)},rm=u._DepthToSpace=function(){return(rm=u._DepthToSpace=u.asm.V).apply(null,arguments)},sm=u._DepthwiseConv2dNative=function(){return(sm=u._DepthwiseConv2dNative=u.asm.W).apply(null,arguments)},gp=u._Equal=function(){return(gp=u._Equal=u.asm.X).apply(null,arguments)},xp=u._Exp=function(){return(xp=u._Exp=u.asm.Y).apply(null,arguments)},bp=u._FlipLeftRight=function(){return(bp=u._FlipLeftRight=u.asm.Z).apply(null,arguments)},iu=u._Floor=function(){return(iu=u._Floor=u.asm._).apply(null,arguments)},Ui=u._FloorDiv=function(){return(Ui=u._FloorDiv=u.asm.$).apply(null,arguments)},im=u._FusedBatchNorm=function(){return(im=u._FusedBatchNorm=u.asm.aa).apply(null,arguments)},ou=u._FusedConv2D=function(){return(ou=u._FusedConv2D=u.asm.ba).apply(null,arguments)},K=u._FusedDepthwiseConv2D=function(){return(K=u._FusedDepthwiseConv2D=u.asm.ca).apply(null,arguments)},te=u._Gather=function(){return(te=u._Gather=u.asm.da).apply(null,arguments)},Te=u._GatherNd=function(){return(Te=u._GatherNd=u.asm.ea).apply(null,arguments)},Ke=u._Greater=function(){return(Ke=u._Greater=u.asm.fa).apply(null,arguments)},It=u._GreaterEqual=function(){return(It=u._GreaterEqual=u.asm.ga).apply(null,arguments)},ft=u._LeakyRelu=function(){return(ft=u._LeakyRelu=u.asm.ha).apply(null,arguments)},je=u._Less=function(){return(je=u._Less=u.asm.ia).apply(null,arguments)},He=u._LessEqual=function(){return(He=u._LessEqual=u.asm.ja).apply(null,arguments)},Zt=u._Log=function(){return(Zt=u._Log=u.asm.ka).apply(null,arguments)},Ja=u._LogicalAnd=function(){return(Ja=u._LogicalAnd=u.asm.la).apply(null,arguments)},Qa=u._Max=function(){return(Qa=u._Max=u.asm.ma).apply(null,arguments)},vp=u._MaxPool=function(){return(vp=u._MaxPool=u.asm.na).apply(null,arguments)},lu=u._Maximum=function(){return(lu=u._Maximum=u.asm.oa).apply(null,arguments)},Un=u._Mean=function(){return(Un=u._Mean=u.asm.pa).apply(null,arguments)},xr=u._Min=function(){return(xr=u._Min=u.asm.qa).apply(null,arguments)},wp=u._Minimum=function(){return(wp=u._Minimum=u.asm.ra).apply(null,arguments)},Yk=u._MirrorPad=function(){return(Yk=u._MirrorPad=u.asm.sa).apply(null,arguments)},Jk=u._Multiply=function(){return(Jk=u._Multiply=u.asm.ta).apply(null,arguments)},Qk=u._Neg=function(){return(Qk=u._Neg=u.asm.ua).apply(null,arguments)},e9=u._NonMaxSuppressionV3=function(){return(e9=u._NonMaxSuppressionV3=u.asm.va).apply(null,arguments)},t9=u._NonMaxSuppressionV4=function(){return(t9=u._NonMaxSuppressionV4=u.asm.wa).apply(null,arguments)},n9=u._NonMaxSuppressionV5=function(){return(n9=u._NonMaxSuppressionV5=u.asm.xa).apply(null,arguments)},a9=u._NotEqual=function(){return(a9=u._NotEqual=u.asm.ya).apply(null,arguments)},r9=u._OneHot=function(){return(r9=u._OneHot=u.asm.za).apply(null,arguments)},s9=u._PadV2=function(){return(s9=u._PadV2=u.asm.Aa).apply(null,arguments)},i9=u._Pow=function(){return(i9=u._Pow=u.asm.Ba).apply(null,arguments)},o9=u._Prelu=function(){return(o9=u._Prelu=u.asm.Ca).apply(null,arguments)},l9=u._Prod=function(){return(l9=u._Prod=u.asm.Da).apply(null,arguments)},u9=u._RealDiv=function(){return(u9=u._RealDiv=u.asm.Ea).apply(null,arguments)},d9=u._Relu=function(){return(d9=u._Relu=u.asm.Fa).apply(null,arguments)},p9=u._Relu6=function(){return(p9=u._Relu6=u.asm.Ga).apply(null,arguments)},c9=u._ResizeBilinear=function(){return(c9=u._ResizeBilinear=u.asm.Ha).apply(null,arguments)},h9=u._Reverse=function(){return(h9=u._Reverse=u.asm.Ia).apply(null,arguments)},f9=u._RotateWithOffset=function(){return(f9=u._RotateWithOffset=u.asm.Ja).apply(null,arguments)},m9=u._Round=function(){return(m9=u._Round=u.asm.Ka).apply(null,arguments)},A9=u._Rsqrt=function(){return(A9=u._Rsqrt=u.asm.La).apply(null,arguments)},y9=u._ScatterNd=function(){return(y9=u._ScatterNd=u.asm.Ma).apply(null,arguments)},g9=u._SelectV2=function(){return(g9=u._SelectV2=u.asm.Na).apply(null,arguments)},x9=u._Sigmoid=function(){return(x9=u._Sigmoid=u.asm.Oa).apply(null,arguments)},b9=u._Sin=function(){return(b9=u._Sin=u.asm.Pa).apply(null,arguments)},v9=u._Softmax=function(){return(v9=u._Softmax=u.asm.Qa).apply(null,arguments)},w9=u._Sqrt=function(){return(w9=u._Sqrt=u.asm.Ra).apply(null,arguments)},k9=u._Square=function(){return(k9=u._Square=u.asm.Sa).apply(null,arguments)},I9=u._SquaredDifference=function(){return(I9=u._SquaredDifference=u.asm.Ta).apply(null,arguments)},S9=u._Step=function(){return(S9=u._Step=u.asm.Ua).apply(null,arguments)},N9=u._StridedSlice=function(){return(N9=u._StridedSlice=u.asm.Va).apply(null,arguments)},T9=u._Sub=function(){return(T9=u._Sub=u.asm.Wa).apply(null,arguments)},E9=u._Sum=function(){return(E9=u._Sum=u.asm.Xa).apply(null,arguments)},C9=u._Tan=function(){return(C9=u._Tan=u.asm.Ya).apply(null,arguments)},R9=u._Tanh=function(){return(R9=u._Tanh=u.asm.Za).apply(null,arguments)},M9=u._Tile=function(){return(M9=u._Tile=u.asm._a).apply(null,arguments)},F9=u._TopK=function(){return(F9=u._TopK=u.asm.$a).apply(null,arguments)},$9=u._Transform=function(){return($9=u._Transform=u.asm.ab).apply(null,arguments)},D9=u._Transpose=function(){return(D9=u._Transpose=u.asm.bb).apply(null,arguments)},O9=u.__FusedMatMul=function(){return(O9=u.__FusedMatMul=u.asm.cb).apply(null,arguments)},as=u._malloc=function(){return(as=u._malloc=u.asm.db).apply(null,arguments)},uu=u._free=function(){return(uu=u._free=u.asm.eb).apply(null,arguments)},Tg=u.___errno_location=function(){return(Tg=u.___errno_location=u.asm.fb).apply(null,arguments)},Eg=u._emscripten_get_global_libc=function(){return(Eg=u._emscripten_get_global_libc=u.asm.gb).apply(null,arguments)},Hi=u._pthread_self=function(){return(Hi=u._pthread_self=u.asm.hb).apply(null,arguments)},Cg=u.___pthread_tsd_run_dtors=function(){return(Cg=u.___pthread_tsd_run_dtors=u.asm.ib).apply(null,arguments)},om=u._emscripten_main_thread_process_queued_calls=function(){return(om=u._emscripten_main_thread_process_queued_calls=u.asm.jb).apply(null,arguments)},z9=u._emscripten_current_thread_process_queued_calls=function(){return(z9=u._emscripten_current_thread_process_queued_calls=u.asm.kb).apply(null,arguments)},Rg=u._emscripten_register_main_browser_thread_id=function(){return(Rg=u._emscripten_register_main_browser_thread_id=u.asm.lb).apply(null,arguments)},Mg=u.__emscripten_do_dispatch_to_thread=function(){return(Mg=u.__emscripten_do_dispatch_to_thread=u.asm.mb).apply(null,arguments)},Fg=u._emscripten_sync_run_in_main_thread_4=function(){return(Fg=u._emscripten_sync_run_in_main_thread_4=u.asm.nb).apply(null,arguments)},$g=u._emscripten_run_in_main_runtime_thread_js=function(){return($g=u._emscripten_run_in_main_runtime_thread_js=u.asm.ob).apply(null,arguments)},lm=u.__emscripten_call_on_thread=function(){return(lm=u.__emscripten_call_on_thread=u.asm.pb).apply(null,arguments)},_9=u._emscripten_tls_init=function(){return(_9=u._emscripten_tls_init=u.asm.qb).apply(null,arguments)},um=u.__emscripten_thread_init=function(){return(um=u.__emscripten_thread_init=u.asm.rb).apply(null,arguments)},du=u.stackSave=function(){return(du=u.stackSave=u.asm.sb).apply(null,arguments)},Gi=u.stackRestore=function(){return(Gi=u.stackRestore=u.asm.tb).apply(null,arguments)},qi=u.stackAlloc=function(){return(qi=u.stackAlloc=u.asm.ub).apply(null,arguments)},Dg=u._emscripten_stack_set_limits=function(){return(Dg=u._emscripten_stack_set_limits=u.asm.vb).apply(null,arguments)},Og=u._memalign=function(){return(Og=u._memalign=u.asm.wb).apply(null,arguments)},zg=u.__emscripten_allow_main_runtime_queued_calls=9808,Xi=u.__emscripten_main_thread_futex=11432;u.cwrap=$e,u.PThread=we,u.PThread=we,u.wasmMemory=Q,u.ExitStatus=pu;var kp;function pu(S){this.name="ExitStatus",this.message="Program terminated with exit("+S+")",this.status=S}ts=function S(){kp||dm(),kp||(ts=S)};function dm(S){if(S=S||f,Za>0)return;if(v){p(u),tu(),postMessage({cmd:"loaded"});return}if(W0(),Za>0)return;function E(){kp||(kp=!0,u.calledRun=!0,!oe&&(tu(),B0(),p(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),gn()))}u.setStatus?(u.setStatus("Running..."),setTimeout(function(){setTimeout(function(){u.setStatus("")},1),E()},1)):E()}u.run=dm;function P9(S,E){if(!(E&&ie&&S===0)){if(!E&&v)throw postMessage({cmd:"exitProcess",returnCode:S}),new pu(S);ie||(we.terminateAllThreads(),ye=S,ap(),u.onExit&&u.onExit(S),oe=!0),y(S,new pu(S))}}if(u.preInit)for(typeof u.preInit=="function"&&(u.preInit=[u.preInit]);u.preInit.length>0;)u.preInit.pop()();return v&&(ie=!1,we.initWorker()),dm(),r.ready}}();typeof e=="object"&&typeof t=="object"?t.exports=n:typeof define=="function"&&define.amd?define([],function(){return n}):typeof e=="object"&&(e.WasmBackendModuleThreadedSimd=n)}),rI=xt((e,t)=>{var n=function(){var a=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename!="undefined"&&(a=a||__filename),function(r){r=r||{};var s=typeof r!="undefined"?r:{},i,o;s.ready=new Promise(function(K,te){i=K,o=te});var l={},d;for(d in s)s.hasOwnProperty(d)&&(l[d]=s[d]);var u=[],p="./this.program",c=function(K,te){throw te},h=!1,m=!1,f=!1,A=!1;h=typeof window=="object",m=typeof importScripts=="function",f=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",A=!h&&!f&&!m;var y="";function g(K){return s.locateFile?s.locateFile(K,y):y+K}var x,w,b,v,N,T;f?(m?y=hu().dirname(y)+"/":y=__dirname+"/",x=function(K,te){return N||(N=require("fs")),T||(T=hu()),K=T.normalize(K),N.readFileSync(K,te?null:"utf8")},b=function(K){var te=x(K,!0);return te.buffer||(te=new Uint8Array(te)),X(te.buffer),te},process.argv.length>1&&(p=process.argv[1].replace(/\\/g,"/")),u=process.argv.slice(2),process.on("uncaughtException",function(K){if(!(K instanceof im))throw K}),process.on("unhandledRejection",Ra),c=function(K){process.exit(K)},s.inspect=function(){return"[Emscripten Module object]"}):A?(typeof read!="undefined"&&(x=function(K){return read(K)}),b=function(K){var te;return typeof readbuffer=="function"?new Uint8Array(readbuffer(K)):(te=read(K,"binary"),X(typeof te=="object"),te)},typeof scriptArgs!="undefined"?u=scriptArgs:typeof arguments!="undefined"&&(u=arguments),typeof quit=="function"&&(c=function(K){quit(K)}),typeof print!="undefined"&&(typeof console=="undefined"&&(console={}),console.log=print,console.warn=console.error=typeof printErr!="undefined"?printErr:print)):(h||m)&&(m?y=self.location.href:typeof document!="undefined"&&document.currentScript&&(y=document.currentScript.src),a&&(y=a),y.indexOf("blob:")!==0?y=y.substr(0,y.lastIndexOf("/")+1):y="",x=function(K){var te=new XMLHttpRequest;return te.open("GET",K,!1),te.send(null),te.responseText},m&&(b=function(K){var te=new XMLHttpRequest;return te.open("GET",K,!1),te.responseType="arraybuffer",te.send(null),new Uint8Array(te.response)}),w=function(K,te,Te){var Ke=new XMLHttpRequest;Ke.open("GET",K,!0),Ke.responseType="arraybuffer",Ke.onload=function(){if(Ke.status==200||Ke.status==0&&Ke.response){te(Ke.response);return}Te()},Ke.onerror=Te,Ke.send(null)},v=function(K){document.title=K});var R=s.print||console.log.bind(console),$=s.printErr||console.warn.bind(console);for(d in l)l.hasOwnProperty(d)&&(s[d]=l[d]);l=null,s.arguments&&(u=s.arguments),s.thisProgram&&(p=s.thisProgram),s.quit&&(c=s.quit);var z;s.wasmBinary&&(z=s.wasmBinary);var P=s.noExitRuntime||!0;typeof WebAssembly!="object"&&Ra("no native wasm support detected");var V,j=!1,U;function X(K,te){K||Ra("Assertion failed: "+te)}function G(K){var te=s["_"+K];return X(te,"Cannot call unknown function "+K+", make sure it is exported"),te}function ee(K,te,Te,Ke,It){var ft={string:function(Un){var xr=0;if(Un!=null&&Un!==0){var wp=(Un.length<<2)+1;xr=iu(wp),de(Un,xr,wp)}return xr},array:function(Un){var xr=iu(Un.length);return oe(Un,xr),xr}};function je(Un){return te==="string"?ie(Un):te==="boolean"?Boolean(Un):Un}var He=G(K),Zt=[],Ja=0;if(Ke)for(var Qa=0;Qa=Ke);)++It;if(It-te>16&&K.subarray&&re)return re.decode(K.subarray(te,It));for(var ft="";te>10,56320|Ja&1023)}}return ft}function ie(K,te){return K?ne(Ne,K,te):""}function Q(K,te,Te,Ke){if(!(Ke>0))return 0;for(var It=Te,ft=Te+Ke-1,je=0;je=55296&&He<=57343){var Zt=K.charCodeAt(++je);He=65536+((He&1023)<<10)|Zt&1023}if(He<=127){if(Te>=ft)break;te[Te++]=He}else if(He<=2047){if(Te+1>=ft)break;te[Te++]=192|He>>6,te[Te++]=128|He&63}else if(He<=65535){if(Te+2>=ft)break;te[Te++]=224|He>>12,te[Te++]=128|He>>6&63,te[Te++]=128|He&63}else{if(Te+3>=ft)break;te[Te++]=240|He>>18,te[Te++]=128|He>>12&63,te[Te++]=128|He>>6&63,te[Te++]=128|He&63}}return te[Te]=0,Te-It}function de(K,te,Te){return Q(K,Ne,te,Te)}function oe(K,te){Ie.set(K,te)}function ye(K,te){return K%te>0&&(K+=te-K%te),K}var ce,Ie,Ne,$e,ze,De,Qe,et,rt;function Xe(K){ce=K,s.HEAP8=Ie=new Int8Array(K),s.HEAP16=$e=new Int16Array(K),s.HEAP32=De=new Int32Array(K),s.HEAPU8=Ne=new Uint8Array(K),s.HEAPU16=ze=new Uint16Array(K),s.HEAPU32=Qe=new Uint32Array(K),s.HEAPF32=et=new Float32Array(K),s.HEAPF64=rt=new Float64Array(K)}var dt=s.INITIAL_MEMORY||16777216,Ve,An=[],gt=[],Vn=[],Xt=[],yn=!1;gt.push({func:function(){up()}});function jn(){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)Ca(s.preRun.shift());Ar(An)}function Rn(){yn=!0,Ar(gt)}function rn(){Ar(Vn)}function Kt(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)ea(s.postRun.shift());Ar(Xt)}function Ca(K){An.unshift(K)}function ea(K){Xt.unshift(K)}var ta=0,fr=null,Ka=null;function mr(K){ta++,s.monitorRunDependencies&&s.monitorRunDependencies(ta)}function Wi(K){if(ta--,s.monitorRunDependencies&&s.monitorRunDependencies(ta),ta==0&&(fr!==null&&(clearInterval(fr),fr=null),Ka)){var te=Ka;Ka=null,te()}}s.preloadedImages={},s.preloadedAudios={};function Ra(K){s.onAbort&&s.onAbort(K),K+="",$(K),j=!0,U=1,K="abort("+K+"). Build with -s ASSERTIONS=1 for more info.";var te=new WebAssembly.RuntimeError(K);throw o(te),te}function np(K,te){return String.prototype.startsWith?K.startsWith(te):K.indexOf(te)===0}var W0="data:application/octet-stream;base64,";function tu(K){return np(K,W0)}var B0="file://";function ap(K){return np(K,B0)}var gn="tfjs-backend-wasm.wasm";tu(gn)||(gn=g(gn));function rp(K){try{if(K==gn&&z)return new Uint8Array(z);if(b)return b(K);throw"both async and sync fetching of the wasm failed"}catch(te){Ra(te)}}function V0(){if(!z&&(h||m)){if(typeof fetch=="function"&&!ap(gn))return fetch(gn,{credentials:"same-origin"}).then(function(K){if(!K.ok)throw"failed to load wasm binary file at '"+gn+"'";return K.arrayBuffer()}).catch(function(){return rp(gn)});if(w)return new Promise(function(K,te){w(gn,function(Te){K(new Uint8Array(Te))},te)})}return Promise.resolve().then(function(){return rp(gn)})}function Za(){var K={a:q0};function te(je,He){var Zt=je.exports;s.asm=Zt,V=s.asm.i,Xe(V.buffer),Ve=s.asm.o,Wi("wasm-instantiate")}mr("wasm-instantiate");function Te(je){te(je.instance)}function Ke(je){return V0().then(function(He){return WebAssembly.instantiate(He,K)}).then(je,function(He){$("failed to asynchronously prepare wasm: "+He),Ra(He)})}function It(){return!z&&typeof WebAssembly.instantiateStreaming=="function"&&!tu(gn)&&!ap(gn)&&typeof fetch=="function"?fetch(gn,{credentials:"same-origin"}).then(function(je){var He=WebAssembly.instantiateStreaming(je,K);return He.then(Te,function(Zt){return $("wasm streaming compile failed: "+Zt),$("falling back to ArrayBuffer instantiation"),Ke(Te)})}):Ke(Te)}if(s.instantiateWasm)try{var ft=s.instantiateWasm(K,te);return ft}catch(je){return $("Module.instantiateWasm callback failed with error: "+je),!1}return It().catch(o),{}}function Ar(K){for(;K.length>0;){var te=K.shift();if(typeof te=="function"){te(s);continue}var Te=te.func;typeof Te=="number"?te.arg===void 0?Ve.get(Te)():Ve.get(Te)(te.arg):Te(te.arg===void 0?null:te.arg)}}function ts(){Ra()}function j0(K,te,Te){Ne.copyWithin(K,te,te+Te)}function U0(){return Ne.length}function Ya(K){try{return V.grow(K-ce.byteLength+65535>>>16),Xe(V.buffer),1}catch(te){}}function sp(K){var te=U0(),Te=2147483648;if(K>Te)return!1;for(var Ke=1;Ke<=4;Ke*=2){var It=te*(1+.2/Ke);It=Math.min(It,K+100663296);var ft=Math.min(Te,ye(Math.max(K,It),65536)),je=Ya(ft);if(je)return!0}return!1}var Bi={mappings:{},buffers:[null,[],[]],printChar:function(K,te){var Te=Bi.buffers[K];te===0||te===10?((K===1?R:$)(ne(Te,0)),Te.length=0):Te.push(te)},varargs:void 0,get:function(){Bi.varargs+=4;var K=De[Bi.varargs-4>>2];return K},getStr:function(K){var te=ie(K);return te},get64:function(K,te){return K}};function ip(K){return 0}function H0(K,te,Te,Ke,It){}function op(K,te,Te,Ke){for(var It=0,ft=0;ft>2],He=De[te+(ft*8+4)>>2],Zt=0;Zt>2]=It,0}function xn(){return 6}function lp(K){return De[gp()>>2]=K,K}function G0(K){switch(K){case 30:return 16384;case 85:var te=2147483648;return te/16384;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return typeof navigator=="object"&&navigator.hardwareConcurrency||1}return lp(28),-1}var q0={a:ts,d:j0,e:sp,f:ip,c:H0,b:op,g:xn,h:G0},X0=Za(),up=s.___wasm_call_ctors=function(){return(up=s.___wasm_call_ctors=s.asm.j).apply(null,arguments)},Vi=s._init=function(){return(Vi=s._init=s.asm.k).apply(null,arguments)},nu=s._register_tensor=function(){return(nu=s._register_tensor=s.asm.l).apply(null,arguments)},K0=s._dispose_data=function(){return(K0=s._dispose_data=s.asm.m).apply(null,arguments)},Z0=s._dispose=function(){return(Z0=s._dispose=s.asm.n).apply(null,arguments)},Y0=s._Abs=function(){return(Y0=s._Abs=s.asm.p).apply(null,arguments)},we=s._Add=function(){return(we=s._Add=s.asm.q).apply(null,arguments)},J0=s._AddN=function(){return(J0=s._AddN=s.asm.r).apply(null,arguments)},Q0=s._All=function(){return(Q0=s._All=s.asm.s).apply(null,arguments)},ef=s._Any=function(){return(ef=s._Any=s.asm.t).apply(null,arguments)},tf=s._ArgMax=function(){return(tf=s._ArgMax=s.asm.u).apply(null,arguments)},nf=s._AvgPool=function(){return(nf=s._AvgPool=s.asm.v).apply(null,arguments)},ns=s._BatchMatMul=function(){return(ns=s._BatchMatMul=s.asm.w).apply(null,arguments)},af=s._Ceil=function(){return(af=s._Ceil=s.asm.x).apply(null,arguments)},rf=s._ClipByValue=function(){return(rf=s._ClipByValue=s.asm.y).apply(null,arguments)},sf=s._Conv2D=function(){return(sf=s._Conv2D=s.asm.z).apply(null,arguments)},of=s._Conv2DBackpropInput=function(){return(of=s._Conv2DBackpropInput=s.asm.A).apply(null,arguments)},lf=s._Cos=function(){return(lf=s._Cos=s.asm.B).apply(null,arguments)},uf=s._CropAndResize=function(){return(uf=s._CropAndResize=s.asm.C).apply(null,arguments)},df=s._Cumsum=function(){return(df=s._Cumsum=s.asm.D).apply(null,arguments)},pf=s._DepthToSpace=function(){return(pf=s._DepthToSpace=s.asm.E).apply(null,arguments)},cf=s._DepthwiseConv2dNative=function(){return(cf=s._DepthwiseConv2dNative=s.asm.F).apply(null,arguments)},yr=s._Equal=function(){return(yr=s._Equal=s.asm.G).apply(null,arguments)},au=s._Exp=function(){return(au=s._Exp=s.asm.H).apply(null,arguments)},ru=s._FlipLeftRight=function(){return(ru=s._FlipLeftRight=s.asm.I).apply(null,arguments)},hf=s._Floor=function(){return(hf=s._Floor=s.asm.J).apply(null,arguments)},ff=s._FloorDiv=function(){return(ff=s._FloorDiv=s.asm.K).apply(null,arguments)},mf=s._FusedBatchNorm=function(){return(mf=s._FusedBatchNorm=s.asm.L).apply(null,arguments)},Af=s._FusedConv2D=function(){return(Af=s._FusedConv2D=s.asm.M).apply(null,arguments)},yf=s._FusedDepthwiseConv2D=function(){return(yf=s._FusedDepthwiseConv2D=s.asm.N).apply(null,arguments)},Pe=s._Gather=function(){return(Pe=s._Gather=s.asm.O).apply(null,arguments)},gf=s._GatherNd=function(){return(gf=s._GatherNd=s.asm.P).apply(null,arguments)},xf=s._Greater=function(){return(xf=s._Greater=s.asm.Q).apply(null,arguments)},bf=s._GreaterEqual=function(){return(bf=s._GreaterEqual=s.asm.R).apply(null,arguments)},vf=s._LeakyRelu=function(){return(vf=s._LeakyRelu=s.asm.S).apply(null,arguments)},wf=s._Less=function(){return(wf=s._Less=s.asm.T).apply(null,arguments)},kf=s._LessEqual=function(){return(kf=s._LessEqual=s.asm.U).apply(null,arguments)},su=s._Log=function(){return(su=s._Log=s.asm.V).apply(null,arguments)},dp=s._LogicalAnd=function(){return(dp=s._LogicalAnd=s.asm.W).apply(null,arguments)},pp=s._Max=function(){return(pp=s._Max=s.asm.X).apply(null,arguments)},If=s._MaxPool=function(){return(If=s._MaxPool=s.asm.Y).apply(null,arguments)},Sf=s._Maximum=function(){return(Sf=s._Maximum=s.asm.Z).apply(null,arguments)},Nf=s._Mean=function(){return(Nf=s._Mean=s.asm._).apply(null,arguments)},Tf=s._Min=function(){return(Tf=s._Min=s.asm.$).apply(null,arguments)},Ef=s._Minimum=function(){return(Ef=s._Minimum=s.asm.aa).apply(null,arguments)},Cf=s._MirrorPad=function(){return(Cf=s._MirrorPad=s.asm.ba).apply(null,arguments)},Rf=s._Multiply=function(){return(Rf=s._Multiply=s.asm.ca).apply(null,arguments)},Je=s._Neg=function(){return(Je=s._Neg=s.asm.da).apply(null,arguments)},Mf=s._NonMaxSuppressionV3=function(){return(Mf=s._NonMaxSuppressionV3=s.asm.ea).apply(null,arguments)},Ff=s._NonMaxSuppressionV4=function(){return(Ff=s._NonMaxSuppressionV4=s.asm.fa).apply(null,arguments)},$f=s._NonMaxSuppressionV5=function(){return($f=s._NonMaxSuppressionV5=s.asm.ga).apply(null,arguments)},ji=s._NotEqual=function(){return(ji=s._NotEqual=s.asm.ha).apply(null,arguments)},cp=s._OneHot=function(){return(cp=s._OneHot=s.asm.ia).apply(null,arguments)},hp=s._PadV2=function(){return(hp=s._PadV2=s.asm.ja).apply(null,arguments)},fp=s._Pow=function(){return(fp=s._Pow=s.asm.ka).apply(null,arguments)},Df=s._Prelu=function(){return(Df=s._Prelu=s.asm.la).apply(null,arguments)},Of=s._Prod=function(){return(Of=s._Prod=s.asm.ma).apply(null,arguments)},mp=s._RealDiv=function(){return(mp=s._RealDiv=s.asm.na).apply(null,arguments)},zf=s._Relu=function(){return(zf=s._Relu=s.asm.oa).apply(null,arguments)},Ap=s._Relu6=function(){return(Ap=s._Relu6=s.asm.pa).apply(null,arguments)},gr=s._ResizeBilinear=function(){return(gr=s._ResizeBilinear=s.asm.qa).apply(null,arguments)},_f=s._Reverse=function(){return(_f=s._Reverse=s.asm.ra).apply(null,arguments)},Pf=s._RotateWithOffset=function(){return(Pf=s._RotateWithOffset=s.asm.sa).apply(null,arguments)},Ng=s._Round=function(){return(Ng=s._Round=s.asm.ta).apply(null,arguments)},yp=s._Rsqrt=function(){return(yp=s._Rsqrt=s.asm.ua).apply(null,arguments)},Lf=s._ScatterNd=function(){return(Lf=s._ScatterNd=s.asm.va).apply(null,arguments)},Wf=s._SelectV2=function(){return(Wf=s._SelectV2=s.asm.wa).apply(null,arguments)},Bf=s._Sigmoid=function(){return(Bf=s._Sigmoid=s.asm.xa).apply(null,arguments)},Vf=s._Sin=function(){return(Vf=s._Sin=s.asm.ya).apply(null,arguments)},jf=s._Softmax=function(){return(jf=s._Softmax=s.asm.za).apply(null,arguments)},Uf=s._Sqrt=function(){return(Uf=s._Sqrt=s.asm.Aa).apply(null,arguments)},Hf=s._Square=function(){return(Hf=s._Square=s.asm.Ba).apply(null,arguments)},Gf=s._SquaredDifference=function(){return(Gf=s._SquaredDifference=s.asm.Ca).apply(null,arguments)},qf=s._Step=function(){return(qf=s._Step=s.asm.Da).apply(null,arguments)},Xf=s._StridedSlice=function(){return(Xf=s._StridedSlice=s.asm.Ea).apply(null,arguments)},Kf=s._Sub=function(){return(Kf=s._Sub=s.asm.Fa).apply(null,arguments)},Zf=s._Sum=function(){return(Zf=s._Sum=s.asm.Ga).apply(null,arguments)},Yf=s._Tan=function(){return(Yf=s._Tan=s.asm.Ha).apply(null,arguments)},Jf=s._Tanh=function(){return(Jf=s._Tanh=s.asm.Ia).apply(null,arguments)},Qf=s._Tile=function(){return(Qf=s._Tile=s.asm.Ja).apply(null,arguments)},em=s._TopK=function(){return(em=s._TopK=s.asm.Ka).apply(null,arguments)},tm=s._Transform=function(){return(tm=s._Transform=s.asm.La).apply(null,arguments)},nm=s._Transpose=function(){return(nm=s._Transpose=s.asm.Ma).apply(null,arguments)},am=s.__FusedMatMul=function(){return(am=s.__FusedMatMul=s.asm.Na).apply(null,arguments)},rm=s._malloc=function(){return(rm=s._malloc=s.asm.Oa).apply(null,arguments)},sm=s._free=function(){return(sm=s._free=s.asm.Pa).apply(null,arguments)},gp=s.___errno_location=function(){return(gp=s.___errno_location=s.asm.Qa).apply(null,arguments)},xp=s.stackSave=function(){return(xp=s.stackSave=s.asm.Ra).apply(null,arguments)},bp=s.stackRestore=function(){return(bp=s.stackRestore=s.asm.Sa).apply(null,arguments)},iu=s.stackAlloc=function(){return(iu=s.stackAlloc=s.asm.Ta).apply(null,arguments)};s.cwrap=Y;var Ui;function im(K){this.name="ExitStatus",this.message="Program terminated with exit("+K+")",this.status=K}Ka=function K(){Ui||ou(),Ui||(Ka=K)};function ou(K){if(K=K||u,ta>0||(jn(),ta>0))return;function te(){Ui||(Ui=!0,s.calledRun=!0,!j&&(Rn(),rn(),i(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),Kt()))}s.setStatus?(s.setStatus("Running..."),setTimeout(function(){setTimeout(function(){s.setStatus("")},1),te()},1)):te()}if(s.run=ou,s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();return ou(),r.ready}}();typeof e=="object"&&typeof t=="object"?t.exports=n:typeof define=="function"&&define.amd?define([],function(){return n}):typeof e=="object"&&(e.WasmBackendModule=n)}),sI=xt((e,t)=>{(function(n,a,r){function s(d){var u=this,p=l();u.next=function(){var c=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=c-(u.c=c|0)},u.c=1,u.s0=p(" "),u.s1=p(" "),u.s2=p(" "),u.s0-=p(d),u.s0<0&&(u.s0+=1),u.s1-=p(d),u.s1<0&&(u.s1+=1),u.s2-=p(d),u.s2<0&&(u.s2+=1),p=null}function i(d,u){return u.c=d.c,u.s0=d.s0,u.s1=d.s1,u.s2=d.s2,u}function o(d,u){var p=new s(d),c=u&&u.state,h=p.next;return h.int32=function(){return p.next()*4294967296|0},h.double=function(){return h()+(h()*2097152|0)*11102230246251565e-32},h.quick=h,c&&(typeof c=="object"&&i(c,p),h.state=function(){return i(p,{})}),h}function l(){var d=4022871197,u=function(p){p=String(p);for(var c=0;c>>0,h-=d,h*=d,d=h>>>0,h-=d,d+=h*4294967296}return(d>>>0)*23283064365386963e-26};return u}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.alea=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),iI=xt((e,t)=>{(function(n,a,r){function s(l){var d=this,u="";d.x=0,d.y=0,d.z=0,d.w=0,d.next=function(){var c=d.x^d.x<<11;return d.x=d.y,d.y=d.z,d.z=d.w,d.w^=d.w>>>19^c^c>>>8},l===(l|0)?d.x=l:u+=l;for(var p=0;p>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(typeof p=="object"&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xor128=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),oI=xt((e,t)=>{(function(n,a,r){function s(l){var d=this,u="";d.next=function(){var c=d.x^d.x>>>2;return d.x=d.y,d.y=d.z,d.z=d.w,d.w=d.v,(d.d=d.d+362437|0)+(d.v=d.v^d.v<<4^(c^c<<1))|0},d.x=0,d.y=0,d.z=0,d.w=0,d.v=0,l===(l|0)?d.x=l:u+=l;for(var p=0;p>>4),d.next()}function i(l,d){return d.x=l.x,d.y=l.y,d.z=l.z,d.w=l.w,d.v=l.v,d.d=l.d,d}function o(l,d){var u=new s(l),p=d&&d.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(typeof p=="object"&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xorwow=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),lI=xt((e,t)=>{(function(n,a,r){function s(l){var d=this;d.next=function(){var p=d.x,c=d.i,h,m,f;return h=p[c],h^=h>>>7,m=h^h<<24,h=p[c+1&7],m^=h^h>>>10,h=p[c+3&7],m^=h^h>>>3,h=p[c+4&7],m^=h^h<<7,h=p[c+7&7],h=h^h<<13,m^=h^h<<9,p[c]=m,d.i=c+1&7,m};function u(p,c){var h,m,f=[];if(c===(c|0))m=f[0]=c;else for(c=""+c,h=0;h0;--h)p.next()}u(d,l)}function i(l,d){return d.x=l.x.slice(),d.i=l.i,d}function o(l,d){l==null&&(l=+new Date);var u=new s(l),p=d&&d.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(p.x&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xorshift7=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),uI=xt((e,t)=>{(function(n,a,r){function s(l){var d=this;d.next=function(){var p=d.w,c=d.X,h=d.i,m,f;return d.w=p=p+1640531527|0,f=c[h+34&127],m=c[h=h+1&127],f^=f<<13,m^=m<<17,f^=f>>>15,m^=m>>>12,f=c[h]=f^m,d.i=h,f+(p^p>>>16)|0};function u(p,c){var h,m,f,A,y,g=[],x=128;for(c===(c|0)?(m=c,c=null):(c=c+"\0",m=0,x=Math.max(x,c.length)),f=0,A=-32;A>>15,m^=m<<4,m^=m>>>13,A>=0&&(y=y+1640531527|0,h=g[A&127]^=m+y,f=h==0?f+1:0);for(f>=128&&(g[(c&&c.length||0)&127]=-1),f=127,A=4*128;A>0;--A)m=g[f+34&127],h=g[f=f+1&127],m^=m<<13,h^=h<<17,m^=m>>>15,h^=h>>>12,g[f]=m^h;p.w=y,p.X=g,p.i=f}u(d,l)}function i(l,d){return d.i=l.i,d.w=l.w,d.X=l.X.slice(),d}function o(l,d){l==null&&(l=+new Date);var u=new s(l),p=d&&d.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(p.X&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.xor4096=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),dI=xt((e,t)=>{(function(n,a,r){function s(l){var d=this,u="";d.next=function(){var c=d.b,h=d.c,m=d.d,f=d.a;return c=c<<25^c>>>7^h,h=h-m|0,m=m<<24^m>>>8^f,f=f-c|0,d.b=c=c<<20^c>>>12^h,d.c=h=h-m|0,d.d=m<<16^h>>>16^f,d.a=f-c|0},d.a=0,d.b=0,d.c=2654435769|0,d.d=1367130551,l===Math.floor(l)?(d.a=l/4294967296|0,d.b=l|0):u+=l;for(var p=0;p>>0)/4294967296};return c.double=function(){do var h=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(h+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,p&&(typeof p=="object"&&i(p,u),c.state=function(){return i(u,{})}),c}a&&a.exports?a.exports=o:r&&r.amd?r(function(){return o}):this.tychei=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}),pI=xt((e,t)=>{(function(n,a,r){var s=256,i=6,o=52,l="random",d=r.pow(s,i),u=r.pow(2,o),p=u*2,c=s-1,h;function m(b,v,N){var T=[];v=v==!0?{entropy:!0}:v||{};var R=g(y(v.entropy?[b,w(a)]:b==null?x():b,3),T),$=new f(T),z=function(){for(var P=$.g(i),V=d,j=0;P=p;)P/=2,V/=2,j>>>=1;return(P+j)/V};return z.int32=function(){return $.g(4)|0},z.quick=function(){return $.g(4)/4294967296},z.double=z,g(w($.S),a),(v.pass||N||function(P,V,j,U){return U&&(U.S&&A(U,$),P.state=function(){return A($,{})}),j?(r[l]=P,V):P})(z,R,"global"in v?v.global:this==r,v.state)}function f(b){var v,N=b.length,T=this,R=0,$=T.i=T.j=0,z=T.S=[];for(N||(b=[N++]);R{var n=sI(),a=iI(),r=oI(),s=lI(),i=uI(),o=dI(),l=pI();l.alea=n,l.xor128=a,l.xorwow=r,l.xorshift7=s,l.xor4096=i,l.tychei=o,t.exports=l}),cI=xt(()=>{}),pm={};Fe(pm,{bin:()=>e5,browser:()=>i5,default:()=>hI,dependencies:()=>s5,description:()=>Gg,devDependencies:()=>a5,jsdelivr:()=>Zg,license:()=>n5,main:()=>Xg,miniprogram:()=>Qg,module:()=>Kg,name:()=>Ug,private:()=>qg,repository:()=>t5,scripts:()=>r5,types:()=>Jg,unpkg:()=>Yg,version:()=>Hg});var Ug="@tensorflow/tfjs",Hg="3.6.0",Gg="An open-source machine learning framework.",qg=!1,Xg="dist/tf.node.js",Kg="dist/index.js",Zg="dist/tf.min.js",Yg="dist/tf.min.js",Jg="dist/index.d.ts",Qg="dist/miniprogram",e5={"tfjs-custom-module":"dist/tools/custom_module/cli.js"},t5={type:"git",url:"https://github.com/tensorflow/tfjs.git"},n5="Apache-2.0",a5={"@babel/core":"^7.9.0","@babel/polyfill":"^7.10.4","@babel/preset-env":"^7.9.5","@rollup/plugin-commonjs":"^11.0.2","@rollup/plugin-node-resolve":"^7.1.1","@rollup/plugin-typescript":"^3.0.0","@types/argparse":"^1.0.38","@types/jasmine":"2.8.7","@types/node":"~10.17.50","@types/shelljs":"^0.8.4","@types/yargs":"^15.0.7","clang-format":"~1.2.2",commander:"~2.14.1",jasmine:"3.1.0","jasmine-core":"~3.1.0",karma:"~6.3.2","karma-browserstack-launcher":"~1.6.0","karma-chrome-launcher":"~2.2.0","karma-firefox-launcher":"~1.1.0","karma-jasmine":"~1.1.1","karma-typescript":"~5.5.1","karma-typescript-es6-transform":"^5.5.1","npm-run-all":"~4.1.3",rimraf:"~2.6.2",rollup:"~2.3.2","rollup-plugin-babel":"^4.4.0","rollup-plugin-terser":"~7.0.2","rollup-plugin-visualizer":"~4.2.2",shelljs:"~0.8.1","ts-node":"~8.8.2",tslint:"~5.11.0","tslint-no-circular-imports":"~0.5.0",typescript:"3.5.3",yalc:"1.0.0-pre.50"},r5={build:"tsc && yarn build-cli && yarn bundle","build-ci":"tsc && yarn build-cli && yarn bundle-ci",bundle:"rollup -c","bundle-ci":"rollup -c --ci","build-core":"cd ../tfjs-core && yarn && yarn build","build-core-ci":"cd ../tfjs-core && yarn && yarn build-ci","build-layers":"cd ../tfjs-layers && yarn && yarn build","build-layers-ci":"cd ../tfjs-layers && yarn && yarn build-ci","build-converter":"cd ../tfjs-converter && yarn && yarn build","build-converter-ci":"cd ../tfjs-converter && yarn && yarn build-ci","build-data":"cd ../tfjs-data && yarn && yarn build","build-data-ci":"cd ../tfjs-data && yarn && yarn build-ci","build-backend-cpu":"cd ../tfjs-backend-cpu && yarn && yarn build","build-backend-cpu-ci":"cd ../tfjs-backend-cpu && yarn && yarn build-ci","build-backend-webgl":"cd ../tfjs-backend-webgl && yarn && yarn build","build-backend-webgl-ci":"cd ../tfjs-backend-webgl && yarn && yarn build-ci","build-deps":"yarn build-core && yarn build-layers && yarn build-converter && yarn build-data && yarn build-backend-cpu && yarn build-backend-webgl","build-deps-ci":"yarn build-core-ci && yarn build-layers-ci && yarn build-converter-ci && yarn build-data-ci && yarn build-backend-cpu-ci && yarn build-backend-webgl-ci","build-cli":"tsc --project ./tools/custom_module/tsconfig.json && chmod +x ./dist/tools/custom_module/cli.js","run-custom-build":"ts-node -s ./tools/custom_module/cli.ts","build-npm":"./scripts/build-npm.sh","link-local":"yalc link","publish-local":"yarn build-npm && yalc push","publish-npm":"npm publish",lint:"tslint -p . -t verbose",coverage:"KARMA_COVERAGE=1 karma start --browsers='Chrome' --singleRun",test:"yarn && yarn build-deps && yarn build && karma start","test-dev":"karma start","test-tools":"ts-node --project ./tools/custom_module/tsconfig.json run_tools_tests.ts","test-ci":"./scripts/test-ci.sh"},s5={"@tensorflow/tfjs-backend-cpu":"3.6.0","@tensorflow/tfjs-backend-webgl":"3.6.0","@tensorflow/tfjs-converter":"3.6.0","@tensorflow/tfjs-core":"3.6.0","@tensorflow/tfjs-data":"3.6.0","@tensorflow/tfjs-layers":"3.6.0",argparse:"^1.0.10",chalk:"^4.1.0","core-js":"3","regenerator-runtime":"^0.13.5",yargs:"^16.0.3"},i5={"node-fetch":!1,util:!1,crypto:!1},hI={name:Ug,version:Hg,description:Gg,private:qg,main:Xg,module:Kg,jsdelivr:Zg,unpkg:Yg,types:Jg,miniprogram:Qg,bin:e5,repository:t5,license:n5,devDependencies:a5,scripts:r5,dependencies:s5,browser:i5},cm={};Fe(cm,{browser:()=>I5,default:()=>fI,dependencies:()=>k5,description:()=>u5,devDependencies:()=>v5,engines:()=>g5,jsdelivr:()=>c5,"jsnext:main":()=>m5,license:()=>b5,main:()=>p5,miniprogram:()=>y5,module:()=>A5,name:()=>o5,private:()=>d5,repository:()=>x5,scripts:()=>w5,sideEffects:()=>S5,types:()=>f5,unpkg:()=>h5,version:()=>l5});var o5="@tensorflow/tfjs-core",l5="3.6.0",u5="Hardware-accelerated JavaScript library for machine intelligence",d5=!1,p5="dist/tf-core.node.js",c5="dist/tf-core.min.js",h5="dist/tf-core.min.js",f5="dist/index.d.ts",m5="dist/index.js",A5="dist/index.js",y5="dist/miniprogram",g5={yarn:">= 1.3.2"},x5={type:"git",url:"https://github.com/tensorflow/tfjs-core.git"},b5="Apache-2.0",v5={"@bazel/bazelisk":"^1.3.0","@bazel/typescript":"^0.27.8","@rollup/plugin-commonjs":"^11.0.2","@rollup/plugin-node-resolve":"^7.1.1","@rollup/plugin-typescript":"^3.0.0","@tensorflow/tfjs-backend-cpu":"link:../tfjs-backend-cpu","@types/jasmine":"~3.0.0","@types/node":"~9.6.0","@types/node-fetch":"~2.1.2","clang-format":"~1.2.4",jasmine:"~3.1.0","jasmine-core":"~3.1.0",karma:"6.3.2","karma-browserstack-launcher":"~1.6.0","karma-chrome-launcher":"~3.1.0","karma-jasmine":"~4.0.1","karma-typescript":"~5.5.1","npm-run-all":"~4.1.3",rimraf:"~2.6.2",rollup:"~2.3.2","rollup-plugin-terser":"~5.3.0","rollup-plugin-visualizer":"~3.3.2",shelljs:"~0.8.3","ts-node":"~8.8.2",tslint:"~5.11.0","tslint-no-circular-imports":"~0.5.0",typescript:"3.5.3",yalc:"~1.0.0-pre.21",yargs:"~13.2.2"},w5={"build-ci":"./scripts/enumerate-tests.js --ci && tsc && yarn bundle-ci && yarn build-test-snippets",build:"node ./scripts/enumerate-tests.js && tsc && yarn bundle",bundle:"rollup -c","bundle-ci":"rollup -c --ci","build-npm":"./scripts/build-npm.sh","build-deps":"yarn build && yarn build-cpu-backend","build-cpu-backend":"cd ../tfjs-backend-cpu && yarn && yarn build","build-cpu-backend-ci":"cd ../tfjs-backend-cpu && yarn && yarn build-ci","build:bazel":"bazelisk build //...","build-test-snippets":"yarn tsc --project ./scripts/test_snippets/tsconfig.json","format-all":"clang-format -i -style=Google --glob=src/**/*.ts","link-local":"yalc link","publish-local":"rimraf dist/ && yarn build && rollup -c && yalc push","publish-npm":"npm publish",lint:"tslint -p . -t verbose",coverage:"KARMA_COVERAGE=1 karma start --browsers='Chrome' --singleRun",test:"yarn && yarn build-deps && karma start","test-dev":"karma start","test-ci":"./scripts/test-ci.sh","test-webworker":"karma start --worker","run-browserstack":"karma start --browserstack","test-bundle-size":"./scripts/test-bundle-size.js","test-node":"rimraf dist/ && yarn build-deps && yarn build && ts-node --transpile-only --skip-ignore -P tsconfig.test.json dist/test_node.js","test-node-dev":"tsc && ts-node --transpile-only --skip-ignore -P tsconfig.test.json dist/test_node.js","test-node-ci":"ts-node --transpile-only -P tsconfig.test.json dist/test_node.js","test-async-backends":"rimraf dist/ && yarn build && ts-node --transpile-only -P tsconfig.test.json dist/test_async_backends.js","test-async-backends-ci":"ts-node --transpile-only -P tsconfig.test.json dist/test_async_backends.js","test-snippets":"yarn build && yarn build-cpu-backend && ts-node -P tsconfig.test.json ./scripts/test_snippets/test_snippets.ts","test-snippets-ci":"ts-node -P tsconfig.test.json ./scripts/test_snippets/test_snippets.ts"},k5={"@types/offscreencanvas":"~2019.3.0","@types/seedrandom":"2.4.27","@types/webgl-ext":"0.0.30","node-fetch":"~2.6.1",seedrandom:"2.4.3"},I5={"node-fetch":!1,util:!1,crypto:!1,worker_threads:!1},S5=["./dist/index.js","./dist/engine.js","./dist/tensor.js","./dist/base_side_effects.js","./dist/flags.js","./dist/platforms/*.js","./dist/register_all_gradients.js","./dist/public/chained_ops/*.js","./dist/io/*.js"],fI={name:o5,version:l5,description:u5,private:d5,main:p5,jsdelivr:c5,unpkg:h5,types:f5,"jsnext:main":m5,module:A5,miniprogram:y5,engines:g5,repository:x5,license:b5,devDependencies:v5,scripts:w5,dependencies:k5,browser:I5,sideEffects:S5},hm={};Fe(hm,{browser:()=>V5,default:()=>mI,dependencies:()=>B5,description:()=>E5,devDependencies:()=>P5,jsdelivr:()=>M5,"jsnext:main":()=>D5,license:()=>_5,main:()=>R5,miniprogram:()=>z5,module:()=>O5,name:()=>N5,peerDependencies:()=>W5,private:()=>C5,scripts:()=>L5,types:()=>$5,unpkg:()=>F5,version:()=>T5});var N5="@tensorflow/tfjs-data",T5="3.6.0",E5="TensorFlow Data API in JavaScript",C5=!1,R5="dist/tf-data.node.js",M5="dist/tf-data.min.js",F5="dist/tf-data.min.js",$5="dist/index.d.ts",D5="dist/index.js",O5="dist/index.js",z5="dist/miniprogram",_5="Apache-2.0",P5={"@rollup/plugin-commonjs":"^11.0.2","@rollup/plugin-node-resolve":"^7.1.1","@rollup/plugin-typescript":"^3.0.0","@tensorflow/tfjs-backend-cpu":"3.6.0","@tensorflow/tfjs-core":"3.6.0","@tensorflow/tfjs-layers":"3.6.0","@types/jasmine":"~2.5.53","@types/seedrandom":"^2.4.27","@types/utf8":"~2.1.6","clang-format":"~1.2.2","http-server":"~0.12.3",jasmine:"3.1.0","jasmine-core":"~3.1.0",karma:"~6.3.1","karma-chrome-launcher":"~2.2.0","karma-firefox-launcher":"~1.1.0","karma-jasmine":"~1.1.1","karma-typescript":"~5.5.1","karma-typescript-es6-transform":"^5.0.2",nyc:"^15.1.0",rimraf:"~2.6.2",rollup:"~2.3.2","rollup-plugin-terser":"~7.0.2","rollup-plugin-visualizer":"~3.3.2","ts-node":"~7.0.0",tslint:"~6.1.3","tslint-no-circular-imports":"^0.7.0",typescript:"3.5.3",yalc:"^1.0.0-pre.50"},L5={build:"tsc && yarn bundle","build-ci":"tsc && yarn bundle-ci",bundle:"rollup -c","bundle-ci":"rollup -c --ci","build-core":"cd ../tfjs-core && yarn && yarn build","build-core-ci":"cd ../tfjs-core && yarn && yarn build-ci","build-layers":"cd ../tfjs-layers && yarn && yarn build","build-backend-cpu":"cd ../tfjs-backend-cpu && yarn && yarn build","build-backend-cpu-ci":"cd ../tfjs-backend-cpu && yarn && yarn build-ci","build-layers-ci":"cd ../tfjs-layers && yarn && yarn build-ci","build-deps":"yarn build-core && yarn build-layers && yarn build-backend-cpu","build-deps-ci":"yarn build-core-ci && yarn build-layers-ci && yarn build-backend-cpu-ci","build-npm":"./scripts/build-npm.sh","link-local":"yalc link","publish-local":"rimraf dist/ && yarn build-npm && yalc push","publish-npm":"npm publish",test:"yarn && yarn build-deps && yarn build && ts-node --transpile-only --project tsconfig.test.json src/test_node.ts","test-dev":"tsc && ts-node --transpile-only --project tsconfig.test.json src/test_node.ts","test-browsers":"karma start --browsers='Chrome,Firefox'","test-ci":"ts-node --transpile-only --skip-ignore -P tsconfig.test.json src/test_node.ts","test-snippets":"yarn && yarn build-deps && yarn build && ts-node --skip-ignore --project tsconfig.test.json ./scripts/test_snippets.ts","test-snippets-ci":"ts-node --skip-ignore --project tsconfig.test.json ./scripts/test_snippets.ts",coverage:"yarn nyc yarn ts-node --transpile-only -P tsconfig.test.json src/test_node.ts",lint:"tslint -p . -t verbose"},W5={"@tensorflow/tfjs-core":"3.6.0",seedrandom:"~2.4.3"},B5={"@types/node-fetch":"^2.1.2","node-fetch":"~2.6.1"},V5={fs:!1,"node-fetch":!1,string_decoder:!1,crypto:!1},mI={name:N5,version:T5,description:E5,private:C5,main:R5,jsdelivr:M5,unpkg:F5,types:$5,"jsnext:main":D5,module:O5,miniprogram:z5,license:_5,devDependencies:P5,scripts:L5,peerDependencies:W5,dependencies:B5,browser:V5},fm={};Fe(fm,{default:()=>AI,description:()=>H5,devDependencies:()=>tx,jsdelivr:()=>J5,"jsnext:main":()=>Z5,license:()=>G5,main:()=>X5,miniprogram:()=>ex,module:()=>Y5,name:()=>j5,peerDependencies:()=>ax,private:()=>q5,scripts:()=>nx,types:()=>K5,unpkg:()=>Q5,version:()=>U5});var j5="@tensorflow/tfjs-layers",U5="3.6.0",H5="TensorFlow layers API in JavaScript",G5="Apache-2.0 AND MIT",q5=!1,X5="dist/tf-layers.node.js",K5="dist/index.d.ts",Z5="dist/index.js",Y5="dist/index.js",J5="dist/tf-layers.min.js",Q5="dist/tf-layers.min.js",ex="dist/miniprogram",tx={"@babel/polyfill":"^7.8.7","@rollup/plugin-commonjs":"^11.0.2","@rollup/plugin-node-resolve":"^7.1.1","@rollup/plugin-typescript":"^3.0.0","@tensorflow/tfjs-backend-cpu":"3.6.0","@tensorflow/tfjs-backend-webgl":"3.6.0","@tensorflow/tfjs-core":"3.6.0","@types/jasmine":"~2.5.53","clang-format":"~1.2.2","http-server":"~0.12.3",jasmine:"~3.1.0","jasmine-core":"~3.1.0",karma:"~6.3.1","karma-browserstack-launcher":"~1.6.0","karma-chrome-launcher":"~2.2.0","karma-firefox-launcher":"~1.1.0","karma-jasmine":"~1.1.1","karma-typescript":"~5.5.1","karma-typescript-es6-transform":"^5.0.2",rimraf:"~2.6.2",rollup:"~2.3.2","rollup-plugin-terser":"~7.0.2","rollup-plugin-visualizer":"~3.3.2","ts-node":"~8.8.2",tslint:"~6.1.3","tslint-no-circular-imports":"^0.7.0",typescript:"3.5.3",yalc:"~1.0.0-pre.50"},nx={prep:"yarn install && yarn build-ci",build:"tsc && yarn bundle","build-ci":"tsc && yarn bundle-ci",bundle:"rollup -c","bundle-ci":"rollup -c --ci","build-core":"cd ../tfjs-core && yarn && yarn build","build-backend-cpu":"cd ../tfjs-backend-cpu && yarn && yarn build","build-backend-cpu-ci":"cd ../tfjs-backend-cpu && yarn && yarn build-ci","build-backend-webgl":"cd ../tfjs-backend-webgl && yarn && yarn build","build-backend-webgl-ci":"cd ../tfjs-backend-webgl && yarn && yarn build-ci","build-core-ci":"cd ../tfjs-core && yarn && yarn build-ci","build-deps":"yarn build-core && yarn build-backend-cpu && yarn build-backend-webgl","build-deps-ci":"yarn build-core-ci && yarn build-backend-cpu-ci && yarn build-backend-webgl-ci","build-npm":"./scripts/build-npm.sh",format:"./tools/clang_format_ts.sh","link-local":"yalc link","publish-local":"yarn build-npm && yalc push","publish-npm":"npm publish",coverage:"KARMA_COVERAGE=1 karma start --browsers='Chrome' --singleRun",test:"yarn && yarn build-deps && karma start","test-dev":"karma start","test-ci":"./scripts/test-ci.sh","test-snippets":"yarn && yarn build-deps && yarn build && ts-node --skip-ignore -s ./scripts/test_snippets.ts","test-snippets-ci":"ts-node --skip-ignore -s ./scripts/test_snippets.ts","run-browserstack":"karma start --browsers='bs_chrome_mac' --singleRun --reporters='dots,karma-typescript'",lint:"tslint -p . -t verbose"},ax={"@tensorflow/tfjs-core":"3.6.0"},AI={name:j5,version:U5,description:H5,license:G5,private:q5,main:X5,types:K5,"jsnext:main":Z5,module:Y5,jsdelivr:J5,unpkg:Q5,miniprogram:ex,devDependencies:tx,scripts:nx,peerDependencies:ax},mm={};Fe(mm,{default:()=>yI,description:()=>ix,devDependencies:()=>yx,jsdelivr:()=>cx,"jsnext:main":()=>lx,license:()=>mx,main:()=>ox,miniprogram:()=>hx,module:()=>ux,name:()=>rx,peerDependencies:()=>Ax,repository:()=>fx,scripts:()=>gx,types:()=>dx,unpkg:()=>px,version:()=>sx});var rx="@tensorflow/tfjs-converter",sx="3.6.0",ix="Tensorflow model converter for javascript",ox="dist/tf-converter.node.js",lx="dist/index.js",ux="dist/index.js",dx="dist/index.d.ts",px="dist/tf-converter.min.js",cx="dist/tf-converter.min.js",hx="dist/miniprogram",fx={type:"git",url:"https://github.com/tensorflow/tfjs-converter.git"},mx="Apache-2.0",Ax={"@tensorflow/tfjs-core":"3.6.0"},yx={"@rollup/plugin-commonjs":"^11.0.2","@rollup/plugin-node-resolve":"^7.1.1","@rollup/plugin-replace":"^2.3.3","@rollup/plugin-typescript":"^3.0.0","@tensorflow/tfjs-backend-cpu":"3.6.0","@tensorflow/tfjs-core":"3.6.0","@types/argparse":"^1.0.38","@types/deep-equal":"^1.0.1","@types/jasmine":"~2.8.6","@types/long":"~3.0.32","@types/node-fetch":"1.6.9",ajv:"~6.3.0",argparse:"^1.0.10","babel-core":"~6.26.3","babel-plugin-external-helpers":"~6.22.0","babel-preset-env":"~1.7.0","clang-format":"~1.2.2",copyfiles:"~1.2.0","deep-equal":"^1.0.1","jasmine-core":"~3.5.0","node-fetch":"~2.6.1",opn:"~5.1.0",protobufjs:"~6.8.6",rimraf:"~2.6.2",rollup:"~2.3.2","rollup-plugin-terser":"~7.0.2","rollup-plugin-visualizer":"~3.3.2","ts-morph":"^7.1.3","ts-node":"~8.8.2",tslint:"~6.1.3","tslint-no-circular-imports":"~0.7.0",typescript:"3.5.3",yalc:"~1.0.0-pre.50"},gx={build:"yarn gen-json --test && yarn gen-kernel2ops && tsc && yarn bundle","build-ci":"yarn gen-json --test && yarn gen-kernel2ops && tsc && yarn bundle-ci",bundle:"rollup -c","bundle-ci":"rollup -c --ci","build-core":"cd ../tfjs-core && yarn && yarn build","build-backend-cpu":"cd ../tfjs-backend-cpu && yarn && yarn build","build-backend-cpu-ci":"cd ../tfjs-backend-cpu && yarn && yarn build-ci","build-core-ci":"cd ../tfjs-core && yarn && yarn build-ci","build-deps":"yarn build-core && yarn build-backend-cpu","build-deps-ci":"yarn build-core-ci && yarn build-backend-cpu","build-npm":"./scripts/build-npm.sh","link-local":"yalc link","publish-local":"yarn build-npm && yalc push","publish-npm":"npm publish",test:"yarn && yarn build-deps && yarn build && yarn gen-json --test && yarn gen-kernel2ops && ts-node --transpile-only -P tsconfig.test.json src/run_tests.ts","test-ci":"ts-node --transpile-only --skip-ignore -P tsconfig.test.json src/run_tests.ts","test-dev":"tsc && ts-node --transpile-only -P tsconfig.test.json src/run_tests.ts","test-snippets":"yarn && yarn build-deps && yarn build && ts-node --skip-ignore -s ./scripts/test_snippets.ts","test-snippets-ci":"ts-node --skip-ignore -s ./scripts/test_snippets.ts",lint:"tslint -p . -t verbose","make-version":"sh -c ./scripts/make-version","gen-doc":"ts-node -s ./scripts/gen_doc.ts","gen-json":"ts-node -s ./scripts/gen_json.ts","model-summary":"ts-node -s ./tools/model_summary.ts",pb2json:"ts-node -s ./tools/pb2json_converter.ts","build-pip-package":"yarn gen-json --test && cd python && ./build-pip-package.sh --test /tmp/tfjs-pips","run-python-tests":"yarn gen-json --test && cd python && ./run-python-tests.sh","gen-kernel2ops":"ts-node -s scripts/kernels_to_ops.ts --out metadata/kernel2op.json"},yI={name:rx,version:sx,description:ix,main:ox,"jsnext:main":lx,module:ux,types:dx,unpkg:px,jsdelivr:cx,miniprogram:hx,repository:fx,license:mx,peerDependencies:Ax,devDependencies:yx,scripts:gx},gI=1e-7,xI=1e-4,Sp=class{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}},fu=class{refCount(e){return aa("refCount")}incRef(e){return aa("incRef")}timerAvailable(){return!0}time(e){return aa("time")}read(e){return aa("read")}readSync(e){return aa("readSync")}numDataIds(){return aa("numDataIds")}disposeData(e,t){return aa("disposeData")}write(e,t,n){return aa("write")}move(e,t,n,a,r){return aa("move")}memory(){return aa("memory")}floatPrecision(){return aa("floatPrecision")}epsilon(){return this.floatPrecision()===32?gI:xI}dispose(){return aa("dispose")}};function aa(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`)}function xx(e){let t=e.length,n=0,a=0;for(;t>0;)a=Math.random()*t|0,t--,n=e[t],e[t]=e[a],e[a]=n}function bI(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,a,r,s=0;for(;n>0;)s=Math.random()*n|0,n--,a=e[n],r=t[n],e[n]=e[s],t[n]=t[s],e[s]=a,t[s]=r}function mu(e,t,n){return Math.max(e,Math.min(t,n))}function vI(e){return e%2==0?e:e+1}function wI(e){let t=0;for(let n=0;nn+` Shapes ${e} and ${t} must match`)}function ss(e){F(e!=null,()=>"The input to the tensor constructor must be a non-null value.")}function is(e,t=[],n=!1){if(t==null&&(t=[]),Array.isArray(e)||tn(e)&&!n)for(let a=0;a0,n){return new Promise((a,r)=>{let s=0,i=()=>{if(e()){a();return}s++;let o=t(s);if(n!=null&&s>=n){r();return}setTimeout(i,o)};i()})}function RI(e,t){let n=1,a=-1;for(let s=0;s=0)n*=e[s];else if(e[s]===-1){if(a!==-1)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${a} and dim ${s}`);a=s}else if(e[s]<0)throw Error(`Shapes can not be < 0. Found ${e[s]} at dim ${s}`);if(a===-1){if(t>0&&t!==n)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(n===0)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}`);let r=e.slice();return r[a]=t/n,r}function ra(e,t){let n=t.length;return e=e==null?t.map((a,r)=>r):[].concat(e),F(e.every(a=>a>=-n&&a`All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`),F(e.every(a=>Vt(a)),()=>`All values in axis param must be integers but got axis ${e}`),e.map(a=>a<0?n+a:a)}function bx(e,t){let n=[],a=[],r=t!=null&&Array.isArray(t)&&t.length===0,s=t==null||r?null:ra(t,e).sort(),i=0;for(let o=0;oo)&&e[o]===1&&(n.push(e[o]),a.push(o)),s[i]<=o&&i++}e[o]!==1&&(n.push(e[o]),a.push(o))}return{newShape:n,keptDims:a}}function vx(e,t){let n=null;if(e==null||e==="float32")n=new Float32Array(t);else if(e==="int32")n=new Int32Array(t);else if(e==="bool")n=new Uint8Array(t);else throw new Error(`Unknown data type ${e}`);return n}function wx(e,t){let n=null;if(e==null||e==="float32")n=new Float32Array(t);else if(e==="int32")n=new Int32Array(t);else if(e==="bool")n=new Uint8Array(t);else if(e==="string")n=new Array(t);else throw new Error(`Unknown data type ${e}`);return n}function kx(e,t){for(let n=0;nt+=n.length),t}function vr(e){return typeof e=="string"||e instanceof String}function Nx(e){return typeof e=="boolean"}function Tx(e){return typeof e=="number"}function Np(e){return Array.isArray(e)?Np(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array?"int32":Tx(e)?"float32":vr(e)?"string":Nx(e)?"bool":"float32"}function wr(e){return!!(e&&e.constructor&&e.call&&e.apply)}function Tp(e,t){for(let n=t;n=0;--a)n[a]=n[a+1]*e[a+1];return n}function Ex(e,t,n,a=!1){let r=new Array;if(t.length===1){let s=t[0]*(a?2:1);for(let i=0;il*d)*(a?2:1);for(let l=0;lr*s)*(n?2:1);if(a===0)return[];if(a!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${n?" for a complex tensor":""}.`);return Ex(0,e,t,n)}function ym(e,t){let n=Ep(e,t);for(let a=0;aa*r,1);if(t==null||t==="float32")return Qi(e,new Float32Array(n));if(t==="int32")return Qi(e,new Int32Array(n));if(t==="bool")return Qi(e,new Uint8Array(n));throw new Error(`Unknown data type ${t}`)}function gm(e){e.forEach(t=>{F(Number.isInteger(t)&&t>=0,()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`)})}function $I(e,t,n){if(t===0)return 0;if(t===1)return e[0];let a=e[e.length-1];for(let r=0;r{let[n,a]=t.split(":");this.urlFlags[n]=zI(n,a)})}};function OI(e){let t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(n,...a)=>(_I(t,a[0],a[1]),a.join("="))),t}function _I(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}function zI(e,t){if(t=t.toLowerCase(),t==="true"||t==="false")return t==="true";if(`${+t}`===t)return+t;throw new Error(`Could not parse value flag value ${t} for flag ${e}.`)}function J(){return fa}var fa=null;function PI(e){fa=e}var bm;function Mx(){if(bm==null){let e;if(typeof window!="undefined")e=window;else if(typeof global!="undefined")e=global;else if(typeof process!="undefined")e=process;else if(typeof self!="undefined")e=self;else throw new Error("Could not find a global object");bm=e}return bm}function LI(){let e=Mx();return e._tfGlobals==null&&(e._tfGlobals=new Map),e._tfGlobals}function vm(e,t){let n=LI();if(n.has(e))return n.get(e);{let a=t();return n.set(e,a),n.get(e)}}var eo="Abs",to="Acos",no="Acosh",kr="Add",os="AddN",ao="All",ro="Any",ls="ArgMax",yu="ArgMin",so="Asin",io="Asinh",oo="Atan",lo="Atanh",uo="Atan2",us="AvgPool",Cp="AvgPoolGrad",gu="AvgPool3D",Rp="AvgPool3DGrad",ds="BatchMatMul",xu="BatchToSpaceND",Mp="Bincount",Fx="BroadcastTo",ps="Cast",cs="Ceil",Ir="ClipByValue",Fp="Complex",bu="ComplexAbs",po="Concat",hs="Conv2D",$p="Conv2DBackpropFilter",fs="Conv2DBackpropInput",vu="Conv3D",Dp="Conv3DBackpropFilterV2",Op="Conv3DBackpropInputV2",ms="Cos",co="Cosh",As="Cumsum",ho="CropAndResize",zp="DenseBincount",fo="DepthToSpace",ys="DepthwiseConv2dNative",_p="DepthwiseConv2dNativeBackpropFilter",Pp="DepthwiseConv2dNativeBackpropInput",Lp="Diag",wu="Dilation2D",Wp="Dilation2DBackpropInput",Bp="Dilation2DBackpropFilter",gs="RealDiv",Vp="Einsum",mo="Elu",jp="EluGrad",Ao="Erf",yo="Equal",xs="Exp",go="ExpandDims",xo="Expm1",Up="FFT",ku="Fill",bo="FlipLeftRight",bs="Floor",vs="FloorDiv",ws="FusedBatchNorm",vo="GatherV2",wo="GatherNd",ko="Greater",ks="GreaterEqual",Is="Identity",Hp="IFFT",Gp="Imag",Io="IsFinite",So="IsInf",No="IsNan",Ss="LeakyRelu",To="Less",Eo="LessEqual",qp="LinSpace",Ns="Log",Co="Log1p",Ro="LogicalAnd",Iu="LogicalNot",Su="LogicalOr",$x="LogSoftmax",Nu="LRN",Xp="LRNGrad",Ts="Max",Es="Maximum",Cs="MaxPool",Kp="MaxPoolGrad",Tu="MaxPool3D",Zp="MaxPool3DGrad",Yp="MaxPoolWithArgmax",Rs="Mean",Ms="Min",Fs="Minimum",$s="MirrorPad",Mo="Mod",Jp="Multinomial",Ds="Multiply",Fo="Neg",$o="NotEqual",Do="NonMaxSuppressionV3",Oo="NonMaxSuppressionV4",zo="NonMaxSuppressionV5",_o="OnesLike",Os="OneHot",Po="Pack",zs="PadV2",WI="Pool",_s="Pow",Ps="Prelu",Lo="Prod",Eu="Range",Qp="Real",Wo="Reciprocal",Ls="Relu",Bo="Reshape",Cu="ResizeNearestNeighbor",ec="ResizeNearestNeighborGrad",Ws="ResizeBilinear",tc="ResizeBilinearGrad",Bs="Relu6",Vs="Reverse",js="Round",Us="Rsqrt",Vo="ScatterNd",jo="Select",Uo="Selu",Ho="Slice",Hs="Sin",Go="Sinh",qo="Sign",Gs="Sigmoid",Xo="Softplus",qs="Sqrt",Xs="Sum",Ru="SpaceToBatchND",Ko="SplitV",Ks="Softmax",nc="SparseFillEmptyRows",ac="SparseReshape",rc="SparseToDense",Zs="SquaredDifference",Mu="Square",Zo="StridedSlice",Ys="Sub",Js="Tan",Qs="Tanh",Sr="Tile",Yo="TopK",Jo="Transform",ei="Transpose",sc="Unique",Qo="Unpack",Fu="UnsortedSegmentSum",el="ZerosLike",Nr="Step",ic="FromPixels",tl="RotateWithOffset",ti="_FusedMatMul",ni="FusedConv2D",ai="FusedDepthwiseConv2D",nl=vm("kernelRegistry",()=>new Map),$u=vm("gradRegistry",()=>new Map);function oc(e,t){let n=wm(e,t);return nl.get(n)}function km(e){return $u.get(e)}function al(e){let t=nl.entries(),n=[];for(;;){let{done:a,value:r}=t.next();if(a)break;let[s,i]=r,[o]=s.split("_");o===e&&n.push(i)}return n}function ri(e){let{kernelName:t,backendName:n}=e,a=wm(t,n);nl.has(a)&&console.warn(`The kernel '${t}' for backend '${n}' is already registered`),nl.set(a,e)}function Dx(e){let{kernelName:t}=e;$u.has(t)&&J().getBool("DEBUG")&&console.warn(`Overriding the gradient for '${t}'`),$u.set(t,e)}function BI(e,t){let n=wm(e,t);if(!nl.has(n))throw new Error(`The kernel '${e}' for backend '${t}' is not registered`);nl.delete(n)}function VI(e){if(!$u.has(e))throw new Error(`The gradient '${e}' for backend is not registered`);$u.delete(e)}function jI(e,t){al(e).forEach(n=>{let a=Object.assign({},n,{backendName:t});ri(a)})}function wm(e,t){return`${t}_${e}`}var k={};Fe(k,{arraysEqual:()=>er,assert:()=>F,assertNonNegativeIntegerDimensions:()=>gm,assertNonNull:()=>ss,assertShapesMatch:()=>sn,bytesFromStringArray:()=>Sx,bytesPerElement:()=>Am,checkConversionForErrors:()=>kx,clamp:()=>mu,computeStrides:()=>Ji,createScalarValue:()=>UI,createShuffledIndices:()=>EI,decodeString:()=>uc,distSquared:()=>II,encodeString:()=>Ou,fetch:()=>HI,flatten:()=>is,getArrayFromDType:()=>wx,getTypedArrayFromDType:()=>vx,hasEncodingLoss:()=>MI,indexToLoc:()=>DI,inferDtype:()=>Np,inferFromImplicitShape:()=>RI,isBoolean:()=>Nx,isFunction:()=>wr,isInt:()=>Vt,isNumber:()=>Tx,isPromise:()=>xm,isScalarShape:()=>SI,isString:()=>vr,isTypedArray:()=>tn,isValidDtype:()=>Ix,locToIndex:()=>$I,makeOnesTypedArray:()=>ym,makeZerosNestedTypedArray:()=>FI,makeZerosTypedArray:()=>Ep,nearestDivisor:()=>Tp,nearestLargerEven:()=>vI,now:()=>Du,parseAxisParam:()=>ra,randUniform:()=>kI,repeatedTry:()=>CI,rightPad:()=>Au,shuffle:()=>xx,shuffleCombo:()=>bI,sizeFromShape:()=>Nt,sizeToSquarishShape:()=>TI,squeezeShape:()=>bx,sum:()=>wI,tanh:()=>NI,toNestedArray:()=>Qi,toTypedArray:()=>lc});function UI(e,t){return t==="string"?Ou(e):lc([e],t)}function GI(e,t){return e instanceof Float32Array&&t==="float32"||e instanceof Int32Array&&t==="int32"||e instanceof Uint8Array&&t==="bool"}function lc(e,t){if(t==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=is(e)),J().getBool("DEBUG")&&kx(e,t),GI(e,t))return e;if(t==null||t==="float32"||t==="complex64")return new Float32Array(e);if(t==="int32")return new Int32Array(e);if(t==="bool"){let n=new Uint8Array(e.length);for(let a=0;a{a=n()},s,i=Du();if(this.backendTimer.timerAvailable())s=this.backendTimer.time(r);else{r();for(let o of a)o.dataSync();s=Promise.resolve({kernelMs:Du()-i})}if(J().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let o=0;o{qI(d,l.dtype,e)})}return{kernelName:e,outputs:a,inputs:t,timeMs:s.then(o=>o.kernelMs),extraInfo:s.then(o=>o.getExtraProfileInfo!=null?o.getExtraProfileInfo():"")}}logKernelProfile(e){let{kernelName:t,outputs:n,timeMs:a,inputs:r,extraInfo:s}=e;n.forEach(i=>{Promise.all([i.data(),a,s]).then(o=>{this.logger.logKernelProfile(t,i,o[0],o[1],r,o[2])})})}};function qI(e,t,n){if(t!=="float32")return!1;for(let a=0;a0?m:""} `}}console.log(`%c${o} %c${i} %c${l}D ${u} %c${d} %c${p} %c${s}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}};function ZI(e,t,n){let a={},r={};for(let l=0;la[f.id]=!0),h=!0,r[d.id]=!0;break}if(h)break}}let s={};s[n.id]=!0;let i={};for(let l=e.length-1;l>=0;l--){let d=e[l],u=d.inputs;for(let p=0;p=0;r--){let s=t[r],i=[];if(s.outputs.forEach(l=>{let d=e[l.id];d!=null?i.push(d):i.push(null)}),s.gradient==null)throw new Error(`Cannot compute gradient: gradient function not found for ${s.kernelName}.`);let o=s.gradient(i);for(let l in s.inputs){if(!(l in o))throw new Error(`Cannot backprop through input ${l}. Available gradients found: ${Object.keys(o)}.`);let d=n(()=>o[l]());if(d.dtype!=="float32")throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input ${l} must have 'float32' dtype, but has '${d.dtype}'`);let u=s.inputs[l];if(!er(d.shape,u.shape))throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input '${l}' has shape '${d.shape}', which does not match the shape of the input '${u.shape}'`);if(e[u.id]==null)e[u.id]=d;else{let p=e[u.id];e[u.id]=a(p,d),p.dispose()}}}}var Ox=20,zu=3,Im=7;function QI(e,t,n,a){let r=Ji(t),s=JI(e,t,n,r),i=t.length,o=dc(e,t,n,r,s),l=["Tensor"];return a&&(l.push(` dtype: ${n}`),l.push(` rank: ${i}`),l.push(` shape: [${t}]`),l.push(" values:")),l.push(o.map(d=>" "+d).join(` `)),l.join(` -`)}function YI(e,t,n,a){let r=Nt(t),s=a[a.length-1],i=new Array(s).fill(0),o=t.length,l=n==="complex64"?_u(e):e;if(o>1)for(let d=0;dDx){let A=Ou*i,y=Array.from(e.slice(0,A)),g=Array.from(e.slice((o-Ou)*i,o*i));return n==="complex64"&&(y=_u(y),g=_u(g)),["["+y.map((x,w)=>zu(x,r[w],n)).join(", ")+", ..., "+g.map((x,w)=>zu(x,r[o-Ou+w],n)).join(", ")+"]"]}let f=n==="complex64"?_u(e):Array.from(e);return["["+f.map((A,y)=>zu(A,r[y],n)).join(", ")+"]"]}let d=t.slice(1),u=a.slice(1),p=a[0]*i,c=[];if(o>Dx){for(let f=0;f1)for(let d=0;dOx){let A=zu*i,y=Array.from(e.slice(0,A)),g=Array.from(e.slice((o-zu)*i,o*i));return n==="complex64"&&(y=Pu(y),g=Pu(g)),["["+y.map((x,w)=>_u(x,r[w],n)).join(", ")+", ..., "+g.map((x,w)=>_u(x,r[o-zu+w],n)).join(", ")+"]"]}let f=n==="complex64"?Pu(e):Array.from(e);return["["+f.map((A,y)=>_u(A,r[y],n)).join(", ")+"]"]}let d=t.slice(1),u=a.slice(1),p=a[0]*i,c=[];if(o>Ox){for(let f=0;f`Length of values '${a}' does not match the size inferred by the shape '${this.size}'.`)}if(t==="complex64")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||vx(t,this.size),this.strides=Yi(e)}set(e,...t){t.length===0&&(t=[0]),F(t.length===this.rank,()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`);let n=this.locToIndex(t);this.values[n]=e}get(...e){e.length===0&&(e=[0]);let t=0;for(let a of e){if(a<0||a>=this.shape[t]){let r=`Requested out of range element at ${e}. Buffer shape=${this.shape}`;throw new Error(r)}t++}let n=e[e.length-1];for(let a=0;alc(n))}catch(n){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataSync(){this.throwIfDisposed();let e=Fa().readSync(this.dataId);if(this.dtype==="string")try{return e.map(t=>lc(t))}catch(t){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();let e=await Fa().read(this.dataId);return this.dtype==="string"?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(Fa().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return al.print(this,e)}clone(){return this.throwIfDisposed(),al.clone(this)}toString(e=!1){let t=this.dataSync();return JI(t,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),al.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),Fa().makeVariable(this,e,t,n)}};Object.defineProperty(Le,Symbol.hasInstance,{value:e=>!!e&&e.data!=null&&e.dataSync!=null&&e.throwIfDisposed!=null});function Z(){return bm("Tensor",()=>Le)}Z();var Pu=class extends Le{constructor(e,t,n,a){super(e.shape,e.dtype,e.dataId,a);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(!Qa(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);Fa().disposeTensor(this),this.dataId=e.dataId,Fa().incRef(this,null)}dispose(){Fa().disposeVariable(this),this.isDisposedInternal=!0}};Object.defineProperty(Pu,Symbol.hasInstance,{value:e=>e instanceof Le&&e.assign!=null&&e.assign instanceof Function});var ma={};Fe(ma,{assertTypesMatch:()=>zx,getTensorsInContainer:()=>Im,isTensorInList:()=>aS,makeTypesMatch:()=>bt});var Sm;(function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R5="R5",e.R6="R6"})(Sm||(Sm={}));var Nm;(function(e){e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64"})(Nm||(Nm={}));var Tm;(function(e){e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64"})(Tm||(Tm={}));var Em;(function(e){e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64"})(Em||(Em={}));var Cm;(function(e){e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64"})(Cm||(Cm={}));var rS={float32:Em,int32:Nm,bool:Tm,complex64:Cm};function sa(e,t){if(e==="string"||t==="string"){if(e==="string"&&t==="string")return"string";throw new Error(`Can not upcast ${e} with ${t}`)}return rS[e][t]}function dc(e){return sa(e,"int32")}function bt(e,t){if(e.dtype===t.dtype)return[e,t];let n=sa(e.dtype,t.dtype);return[e.cast(n),t.cast(n)]}function zx(e,t){F(e.dtype===t.dtype,()=>`The dtypes of the first(${e.dtype}) and second(${t.dtype}) input must match`)}function aS(e,t){return t.some(n=>n.id===e.id)}function Im(e){let t=[],n=new Set;return _x(e,t,n),t}function _x(e,t,n){if(e==null)return;if(e instanceof Le){t.push(e);return}if(!sS(e))return;let a=e;for(let r in a){let s=a[r];n.has(s)||(n.add(s),_x(s,t,n))}}function sS(e){return Array.isArray(e)||typeof e=="object"}function Rm(e){return e.kernelName!=null}var Px=class{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(let e in this.registeredVariables)this.registeredVariables[e].dispose()}},Lu=class{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new Px}async ready(){if(this.pendingBackendInit!=null)return this.pendingBackendInit.then(()=>{});if(this.backendInstance!=null)return;let e=this.getSortedBackends();for(let t=0;t{e.setupFunc!=null&&e.setupFunc(this.backendInstance)})}disposeRegisteredKernels(e){nl(e).forEach(t=>{t.disposeFunc!=null&&t.disposeFunc(this.registry[e])})}initializeBackend(e){let t=this.registryFactory[e];if(t==null)throw new Error(`Cannot initialize backend ${e}, no registration found.`);try{let n=t.factory();if(n&&!(n instanceof hu)&&typeof n.then=="function"){let a=++this.pendingBackendInitId,r=n.then(s=>a(athis.registryFactory[t].priority-this.registryFactory[e].priority)}initializeBackendsAndReturnBest(){let e=this.getSortedBackends();for(let t=0;tthis.startScope(n),()=>this.endScope(a),()=>(a=t(),a instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),a))}scopedRun(e,t,n){e();try{let a=n();return t(),a}catch(a){throw t(),a}}nextTensorId(){return Lu.nextTensorId++}nextVariableId(){return Lu.nextVariableId++}clone(e){let t=D.runKernel(ks,{x:e}),n={x:e},a=s=>({x:()=>{let i="float32",o={x:s},l={dtype:i};return D.runKernel(ds,o,l)}}),r=[];return this.addTapeNode(this.state.activeScope.name,n,[t],a,r,{}),t}runKernel(e,t,n){if(ic(e,this.backendName)==null)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){let a=this.backend.numDataIds(),r=0;n.forEach(o=>{r+=o.dtype==="complex64"?3:1});let s=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],i=a-t-r-s;if(i>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${i} data ids) after running '${e}'`)}runKernelFunc(e){let t,n=[],a=this.isTapeOn(),r=this.state.numBytes,s=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);let i;this.backendName==null&&this.backend;let o,l=Rm(e)?e.kernelName:this.state.activeScope!=null?this.state.activeScope.name:"";if(Rm(e)){let{kernelName:h,inputs:m,attrs:f}=e;this.backendName==null&&this.backend;let A=ic(h,this.backendName);F(A!=null,()=>`Cannot find registered kernel '${h}' for backend '${this.backendName}'`),i=()=>{let y=this.backend.numDataIds();o=A.kernelFunc({inputs:m,attrs:f,backend:this.backend});let g=Array.isArray(o)?o:[o];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(h,y,g);let x=g.map(w=>{if(w.rank!=null)return w;let{dataId:b,shape:v,dtype:N}=w;return this.makeTensorFromDataId(b,v,N)});if(a){let w=this.getTensorsForGradient(h,m,x);n=this.saveTensorsForBackwardMode(w)}return x}}else{let{forwardFunc:h}=e,m=f=>{!a||(n=f.map(A=>this.keep(this.clone(A))))};i=()=>{let f=this.backend.numDataIds();o=this.tidy(()=>h(this.backend,m));let A=Array.isArray(o)?o:[o];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(l,f,A),A}}let{inputs:d,attrs:u}=e,p=Rm(e)?null:e.backwardsFunc,c;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{!this.ENV.getBool("DEBUG")&&!this.state.profiling?t=i():(c=this.profiler.profileKernel(l,d,()=>i()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(c),t=c.outputs)}),a&&this.addTapeNode(l,d,t,p,n,u),this.state.profiling&&this.state.activeProfile.kernels.push({name:l,bytesAdded:this.state.numBytes-r,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-s,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(d).map(h=>d[h]!=null?d[h].shape:null),outputShapes:t.map(h=>h.shape),kernelTimeMs:c.timeMs,extraInfo:c.extraInfo}),Array.isArray(o)?t:t[0]}saveTensorsForBackwardMode(e){return e.map(t=>this.keep(this.clone(t)))}getTensorsForGradient(e,t,n){let a=wm(e);if(a!=null){let r=a.inputsToSave||[],s=a.outputsToSave||[],i;a.saveAllInputs?(F(Array.isArray(t),()=>"saveAllInputs is true, expected inputs to be an array."),i=Object.keys(t).map(l=>t[l])):i=r.map(l=>t[l]);let o=n.filter((l,d)=>s[d]);return i.concat(o)}return[]}makeTensor(e,t,n,a){if(e==null)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",a=a||this.backend;let r=e;n==="string"&&br(e[0])&&(r=e.map(o=>Du(o)));let s=a.write(r,t,n),i=new Le(t,n,s,this.nextTensorId());if(this.trackTensor(i,a),n==="string"){let o=this.state.tensorInfo.get(s),l=Ix(r);this.state.numBytes+=l-o.bytes,o.bytes=l}return i}makeTensorFromDataId(e,t,n,a){n=n||"float32";let r=new Le(t,n,e,this.nextTensorId());return this.trackTensor(r,a),r}makeVariable(e,t=!0,n,a){n=n||this.nextVariableId().toString(),a!=null&&a!==e.dtype&&(e=e.cast(a));let r=new Pu(e,t,n,this.nextTensorId());if(this.state.registeredVariables[r.name]!=null)throw new Error(`Variable with name ${r.name} was already registered`);return this.state.registeredVariables[r.name]=r,this.incRef(r,this.backend),r}trackTensor(e,t){this.state.numTensors++,e.dtype==="string"&&this.state.numStringTensors++;let n=0;e.dtype!=="complex64"&&e.dtype!=="string"&&(n=e.size*mm(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 Pu||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;let t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,e.dtype==="string"&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),e.dtype!=="complex64"&&e.dtype!=="string"){let n=e.size*mm(e.dtype);this.state.numBytes-=n}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}disposeVariables(){for(let e in this.state.registeredVariables){let t=this.state.registeredVariables[e];this.disposeVariable(t)}}disposeVariable(e){this.disposeTensor(e),this.state.registeredVariables[e.name]!=null&&delete this.state.registeredVariables[e.name]}memory(){let 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,e.reasons==null&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;let 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(a=>a.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-n;for(let a of this.state.activeProfile.kernels)a.kernelTimeMs=await a.kernelTimeMs,a.extraInfo=await a.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&this.state.kernelDepth===0}addTapeNode(e,t,n,a,r,s){let i={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:n,saved:r},o=wm(e);o!=null&&(a=o.gradFunc),a!=null&&(i.gradient=l=>(l=l.map((d,u)=>{if(d==null){let p=n[u],c=Tp(p.size,p.dtype);return this.makeTensor(c,p.shape,p.dtype)}return d}),a(l.length>1?l:l[0],r,s))),this.state.activeTape.push(i)}keep(e){return e.kept=!0,e}startTape(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){let t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}endScope(e){let t=Im(e),n=new Set(t.map(r=>r.id));for(let r=0;r{!r.kept&&r.scopeId===a.id&&this.track(r)})}gradients(e,t,n,a=!1){if(F(t.length>0,()=>"gradients() received an empty list of xs."),n!=null&&n.dtype!=="float32")throw new Error(`dy must have 'float32' dtype, but has '${n.dtype}'`);let r=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",e));F(r instanceof Le,()=>"The result y returned by f() must be a tensor.");let s=KI(this.state.activeTape,t,r);if(!a&&s.length===0&&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",()=>{let i={};i[r.id]=n==null?iS(r.shape):n,ZI(i,s,l=>this.tidy(l),oS);let o=t.map(l=>i[l.id]);return this.state.gradientDepth===0&&(this.state.activeTape.forEach(l=>{for(let d of l.saved)d.dispose()}),this.state.activeTape=null),{value:r,grads:o}})}customGrad(e){return F(vr(e),()=>"The f passed in customGrad(f) must be a function."),(...t)=>{F(t.every(i=>i instanceof Le),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");let n,a={};t.forEach((i,o)=>{a[o]=i});let r=(i,o)=>(n=e(...t,o),F(n.value instanceof Le,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),F(vr(n.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),n.value),s=(i,o)=>{let l=n.gradFunc(i,o),d=Array.isArray(l)?l:[l];F(d.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(...)."),F(d.every(p=>p instanceof Le),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");let u={};return d.forEach((p,c)=>{u[c]=()=>p}),u};return this.runKernelFunc({forwardFunc:r,backwardsFunc:s,inputs:a})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}async time(e){let t=$u(),n=await this.backend.time(e);return n.wallMs=$u()-t,n}track(e){return this.state.activeScope!=null&&(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 Px;for(let e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}};Lu.nextTensorId=0;Lu.nextVariableId=0;function iS(e){let t=Am(Nt(e),"float32");return D.makeTensor(t,e,"float32")}function Lx(){let e=Rx();if(e._tfengine==null){let t=new Cx(e);e._tfengine=new Lu(t)}return _I(e._tfengine.ENV),eS(()=>e._tfengine),e._tfengine}var D=Lx();function oS(e,t){let n={a:e,b:t};return D.runKernel(wr,n)}var Wu={};Fe(Wu,{isBrowser:()=>Wx,isMobile:()=>lS});function uS(){return typeof navigator!="undefined"&&navigator!=null}function lS(e){if(e||uS()){if(e||(e=navigator),e.product==="ReactNative")return!0;let t=e.userAgent||e.vendor||window.opera;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 Wx(){return typeof window!="undefined"&&window.document!=null||typeof WorkerGlobalScope!="undefined"}var Aa=J();Aa.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.")});Aa.registerFlag("IS_BROWSER",()=>Wx());Aa.registerFlag("IS_NODE",()=>typeof process!="undefined"&&typeof process.versions!="undefined"&&typeof process.versions.node!="undefined");Aa.registerFlag("IS_CHROME",()=>typeof navigator!="undefined"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor));Aa.registerFlag("PROD",()=>!1);Aa.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>Aa.getBool("DEBUG"));Aa.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0);Aa.registerFlag("IS_TEST",()=>!1);Aa.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>!0);Aa.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1);function $a(e,t){let n=e;if(tn(e))return t==="string"?[]:[e.length];if(!Array.isArray(e))return[];let a=[];for(;Array.isArray(n)||tn(n)&&t!=="string";)a.push(n.length),n=n[0];return Array.isArray(e)&&J().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&Bx(e,a,[]),a}function Bx(e,t,n){if(n=n||[],!Array.isArray(e)&&!tn(e)){F(t.length===0,()=>`Element arr[${n.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`);return}F(t.length>0,()=>`Element arr[${n.join("][")}] should be a primitive, but is an array of ${e.length} elements`),F(e.length===t[0],()=>`Element arr[${n.join("][")}] should have ${t[0]} elements, but has ${e.length} elements`);let a=t.slice(1);for(let r=0;r=0&&(r=a),Vx(a,r,t,n),e==null||!tn(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string"){let o=e==null?"null":e.constructor.name;throw new Error(`Argument '${t}' passed to '${n}' must be a Tensor or TensorLike, but got '${o}'`)}let s=$a(e,r);!tn(e)&&!Array.isArray(e)&&(e=[e]);let i=r!=="string"?oc(e,r):ss(e,[],!0);return D.makeTensor(i,s,r)}function Bu(e,t,n,a="numeric"){if(!Array.isArray(e))throw new Error(`Argument ${t} passed to ${n} must be a \`Tensor[]\` or \`TensorLike[]\``);return e.map((r,s)=>M(r,`${t}[${s}]`,n,a))}var jx="__op";function O(e){let t=Object.keys(e);if(t.length!==1)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],a=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n=n+jx;let r=(...s)=>{D.startScope(n);try{let i=a(...s);return gm(i)&&console.error("Cannot return a Promise inside of tidy."),D.endScope(i),i}catch(i){throw D.endScope(null),i}};return Object.defineProperty(r,"name",{value:n,configurable:!0}),r}function dS(e,t){let n=M(e,"real","complex"),a=M(t,"imag","complex");sn(n.shape,a.shape,`real and imag shapes, ${n.shape} and ${a.shape}, must match in call to tf.complex().`);let r={real:n,imag:a};return D.runKernel(Mp,r)}var Nr=O({complex_:dS});function Tr(e,t,n,a){if(a==null&&(a=Sp(e)),a==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!tn(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string")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(t!=null){ym(t);let r=Nt(t),s=Nt(n);F(r===s,()=>`Based on the provided shape, [${t}], the tensor should have ${r} values but has ${s}`);for(let i=0;i`Error creating a new Tensor. Inferred shape (${n}) does not match the provided shape (${t}). `)}}return!tn(e)&&!Array.isArray(e)&&(e=[e]),t=t||n,e=a!=="string"?oc(e,a):ss(e,[],!0),D.makeTensor(e,t,a)}function ia(e,t,n){let a=$a(e,n);return Tr(e,t,a,n)}var Mm={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8},pc=4;async function cS(e,t){let n=[],a=[],r=Array.isArray(e)?e.map(i=>i.name):Object.keys(e);for(let i=0;i{let c=await l.bytes(),h=c.reduce((A,y)=>A+y.length,0)+pc*c.length,m=new Uint8Array(h),f=0;for(let A=0;A{if(t+=s.byteLength,n.push(s.byteLength===s.buffer.byteLength?s:new s.constructor(s)),!(s instanceof Float32Array||s instanceof Int32Array||s instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${s.constructor.name}`)});let a=new Uint8Array(t),r=0;return n.forEach(s=>{a.set(new Uint8Array(s.buffer),r),r+=s.byteLength}),a.buffer}var Fm=typeof Buffer!="undefined"&&(typeof Blob=="undefined"||typeof atob=="undefined"||typeof btoa=="undefined");function Hx(e){return Fm?Buffer.byteLength(e):new Blob([e]).size}function fS(e){if(Fm)return Buffer.from(e).toString("base64");let t=new Uint8Array(e),n="";for(let a=0,r=t.length;a{t+=r.byteLength});let n=new Uint8Array(t),a=0;return e.forEach(r=>{n.set(new Uint8Array(r),a),a+=r.byteLength}),n.buffer}function Gx(e){let t="/";for(e=e.trim();e.endsWith(t);)e=e.slice(0,e.length-1);let n=e.split(t);return n[n.length-1]}function Vu(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:e.modelTopology==null?0:Hx(JSON.stringify(e.modelTopology)),weightSpecsBytes:e.weightSpecs==null?0:Hx(JSON.stringify(e.weightSpecs)),weightDataBytes:e.weightData==null?0:e.weightData.byteLength}}function AS(){let e=n=>{let a=n<<13,r=0;for(;(a&8388608)==0;)r-=8388608,a<<=1;return a&=~8388608,r+=947912704,a|r},t=new Uint32Array(2048);t[0]=0;for(let n=1;n<1024;n++)t[n]=e(n);for(let n=1024;n<2048;n++)t[n]=939524096+(n-1024<<13);return t}function yS(){let 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}function gS(){let e=new Uint32Array(64);for(let t=0;t<64;t++)e[t]=1024;return e[0]=e[32]=0,e}function hS(){let e=AS(),t=yS(),n=gS();return a=>{let r=new ArrayBuffer(4*a.length),s=new Uint32Array(r);for(let i=0;i>10]+(o&1023)]+t[o>>10];s[i]=l}return new Float32Array(r)}}var St=class{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return St.instance==null&&(St.instance=new St),St.instance}static registerSaveRouter(e){St.getInstance().saveRouters.push(e)}static registerLoadRouter(e){St.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return St.getHandlers(e,"save")}static getLoadHandlers(e,t){return St.getHandlers(e,"load",t)}static getHandlers(e,t,n){let a=[];return(t==="load"?St.getInstance().loadRouters:St.getInstance().saveRouters).forEach(r=>{let s=r(e,n);s!==null&&a.push(s)}),a}},xS=e=>St.registerSaveRouter(e),bS=e=>St.registerLoadRouter(e),vS=e=>St.getSaveHandlers(e),wS=(e,t)=>St.getLoadHandlers(e,t),Dm="tensorflowjs",Om=1,ri="models_store",Er="model_info_store";function qx(){if(!J().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");let e=typeof window=="undefined"?self:window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(t==null)throw new Error("The current browser does not appear to support IndexedDB.");return t}function zm(e){let t=e.result;t.createObjectStore(ri,{keyPath:"modelPath"}),t.createObjectStore(Er,{keyPath:"modelPath"})}var si=class{constructor(e){if(this.indexedDB=qx(),e==null||!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((n,a)=>{let r=this.indexedDB.open(Dm,Om);r.onupgradeneeded=()=>zm(r),r.onsuccess=()=>{let s=r.result;if(t==null){let i=s.transaction(ri,"readonly"),o=i.objectStore(ri).get(this.modelPath);o.onsuccess=()=>{if(o.result==null)return s.close(),a(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));n(o.result.modelArtifacts)},o.onerror=l=>(s.close(),a(o.error)),i.oncomplete=()=>s.close()}else{let i=Vu(t),o=s.transaction(Er,"readwrite"),l=o.objectStore(Er),d=l.put({modelPath:this.modelPath,modelArtifactsInfo:i}),u;d.onsuccess=()=>{u=s.transaction(ri,"readwrite");let p=u.objectStore(ri).put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:i});p.onsuccess=()=>n({modelArtifactsInfo:i}),p.onerror=c=>{l=o.objectStore(Er);let h=l.delete(this.modelPath);h.onsuccess=()=>(s.close(),a(p.error)),h.onerror=m=>(s.close(),a(p.error))}},d.onerror=p=>(s.close(),a(d.error)),o.oncomplete=()=>{u==null?s.close():u.oncomplete=()=>s.close()}}},r.onerror=s=>a(r.error)})}};si.URL_SCHEME="indexeddb://";var Xx=e=>J().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(si.URL_SCHEME)?kS(e.slice(si.URL_SCHEME.length)):null;St.registerSaveRouter(Xx);St.registerLoadRouter(Xx);function kS(e){return new si(e)}function IS(e){return e.startsWith(si.URL_SCHEME)?e.slice(si.URL_SCHEME.length):e}var SS=class{constructor(){this.indexedDB=qx()}async listModels(){return new Promise((e,t)=>{let n=this.indexedDB.open(Dm,Om);n.onupgradeneeded=()=>zm(n),n.onsuccess=()=>{let a=n.result,r=a.transaction(Er,"readonly"),s=r.objectStore(Er).getAll();s.onsuccess=()=>{let i={};for(let o of s.result)i[o.modelPath]=o.modelArtifactsInfo;e(i)},s.onerror=i=>(a.close(),t(s.error)),r.oncomplete=()=>a.close()},n.onerror=a=>t(n.error)})}async removeModel(e){return e=IS(e),new Promise((t,n)=>{let a=this.indexedDB.open(Dm,Om);a.onupgradeneeded=()=>zm(a),a.onsuccess=()=>{let r=a.result,s=r.transaction(Er,"readwrite"),i=s.objectStore(Er),o=i.get(e),l;o.onsuccess=()=>{if(o.result==null)return r.close(),n(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{let d=i.delete(e),u=()=>{l=r.transaction(ri,"readwrite");let p=l.objectStore(ri).delete(e);p.onsuccess=()=>t(o.result.modelArtifactsInfo),p.onerror=c=>n(o.error)};d.onsuccess=u,d.onerror=p=>(u(),r.close(),n(o.error))}},o.onerror=d=>(r.close(),n(o.error)),s.oncomplete=()=>{l==null?r.close():l.oncomplete=()=>r.close()}},a.onerror=r=>n(a.error)})}},er="/",rl="tensorflowjs_models",Kx="info",NS="model_topology",TS="weight_specs",ES="weight_data",CS="model_metadata";function Zx(e){return{info:[rl,e,Kx].join(er),topology:[rl,e,NS].join(er),weightSpecs:[rl,e,TS].join(er),weightData:[rl,e,ES].join(er),modelMetadata:[rl,e,CS].join(er)}}function RS(e){let t=e.split(er);if(t.length<3)throw new Error(`Invalid key format: ${e}`);return t.slice(1,t.length-1).join(er)}function MS(e){return e.startsWith(ii.URL_SCHEME)?e.slice(ii.URL_SCHEME.length):e}var ii=class{constructor(e){if(!J().getBool("IS_BROWSER")||typeof window=="undefined"||typeof window.localStorage=="undefined")throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,e==null||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=Zx(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.");{let t=JSON.stringify(e.modelTopology),n=JSON.stringify(e.weightSpecs),a=Vu(e);try{this.LS.setItem(this.keys.info,JSON.stringify(a)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,fS(e.weightData));let r={format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy};return e.signature!=null&&(r.signature=e.signature),e.userDefinedMetadata!=null&&(r.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(r.modelInitializer=e.modelInitializer),this.LS.setItem(this.keys.modelMetadata,JSON.stringify(r)),{modelArtifactsInfo:a}}catch(r){throw this.LS.removeItem(this.keys.info),this.LS.removeItem(this.keys.topology),this.LS.removeItem(this.keys.weightSpecs),this.LS.removeItem(this.keys.weightData),this.LS.removeItem(this.keys.modelMetadata),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${a.modelTopologyBytes}, weightSpecsBytes=${a.weightSpecsBytes}, weightDataBytes=${a.weightDataBytes}.`)}}}async load(){let e=JSON.parse(this.LS.getItem(this.keys.info));if(e==null)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if(e.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");let t={},n=JSON.parse(this.LS.getItem(this.keys.topology));if(n==null)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);t.modelTopology=n;let a=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(a==null)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);t.weightSpecs=a;let r=this.LS.getItem(this.keys.modelMetadata);if(r!=null){let i=JSON.parse(r);t.format=i.format,t.generatedBy=i.generatedBy,t.convertedBy=i.convertedBy,i.signature!=null&&(t.signature=i.signature),i.userDefinedMetadata!=null&&(t.userDefinedMetadata=i.userDefinedMetadata),i.modelInitializer!=null&&(t.modelInitializer=i.modelInitializer)}let s=this.LS.getItem(this.keys.weightData);if(s==null)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return t.weightData=mS(s),t}};ii.URL_SCHEME="localstorage://";var Yx=e=>J().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(ii.URL_SCHEME)?FS(e.slice(ii.URL_SCHEME.length)):null;St.registerSaveRouter(Yx);St.registerLoadRouter(Yx);function FS(e){return new ii(e)}var $S=class{constructor(){F(J().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),F(typeof window=="undefined"||typeof window.localStorage!="undefined",()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){let e={},t=rl+er,n=er+Kx;for(let a=0;a"scheme must not be undefined or null."),e.endsWith(sl)&&(e=e.slice(0,e.indexOf(sl))),F(e.length>0,()=>"scheme must not be an empty string.");let n=Gn.getInstance();F(n.managers[e]==null,()=>`A model store manager is already registered for scheme '${e}'.`),n.managers[e]=t}static getManager(e){let t=this.getInstance().managers[e];if(t==null)throw new Error(`Cannot find model manager for scheme '${e}'`);return t}static getSchemes(){return Object.keys(this.getInstance().managers)}};function cc(e){if(e.indexOf(sl)===-1)throw new Error(`The url string provided does not contain a scheme. Supported schemes are: ${Gn.getSchemes().join(",")}`);return{scheme:e.split(sl)[0],path:e.split(sl)[1]}}async function Jx(e,t,n=!1){F(e!==t,()=>`Old path and new path are the same: '${e}'`);let a=St.getLoadHandlers(e);F(a.length>0,()=>`Copying failed because no load handler is found for source URL ${e}.`),F(a.length<2,()=>`Copying failed because more than one (${a.length}) load handlers for source URL ${e}.`);let r=a[0],s=St.getSaveHandlers(t);F(s.length>0,()=>`Copying failed because no save handler is found for destination URL ${t}.`),F(s.length<2,()=>`Copying failed because more than one (${a.length}) save handlers for destination URL ${t}.`);let i=s[0],o=cc(e).scheme,l=cc(e).path,d=o===cc(e).scheme,u=await r.load();n&&d&&await Gn.getManager(o).removeModel(l);let p=await i.save(u);return n&&!d&&await Gn.getManager(o).removeModel(l),p.modelArtifactsInfo}async function DS(){let e=Gn.getSchemes(),t={};for(let n of e){let a=await Gn.getManager(n).listModels();for(let r in a){let s=n+sl+r;t[s]=a[r]}}return t}async function OS(e){let t=cc(e);return Gn.getManager(t.scheme).removeModel(t.path)}async function zS(e,t){return Jx(e,t,!1)}async function _S(e,t){return Jx(e,t,!0)}var PS=class{fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Browser's encoder only supports utf-8, but got ${t}`);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}};if(J().get("IS_BROWSER")){J().setPlatform("browser",new PS);try{Gn.registerManager(ii.URL_SCHEME,new $S)}catch(e){}try{Gn.registerManager(si.URL_SCHEME,new SS)}catch(e){}}var LS={importFetch:()=>G9()},_m,WS=class{constructor(){this.util=require("util"),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return J().global.fetch!=null?J().global.fetch(e,t):(_m==null&&(_m=LS.importFetch()),_m(e,t))}now(){let e=process.hrtime();return e[0]*1e3+e[1]/1e6}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Node built-in encoder only supports utf-8, but got ${t}`);return this.textEncoder.encode(e)}decode(e,t){return e.length===0?"":new this.util.TextDecoder(t).decode(e)}};J().get("IS_NODE")&&J().setPlatform("node",new WS);function We(e,t="float32",n){return t=t||"float32",ym(e),new Dt(e,t,n)}function BS(e,t){let n=M(e,"x","cast");if(!kx(t))throw new Error(`Failed to cast to unknown dtype ${t}`);if(t==="string"&&n.dtype!=="string"||t!=="string"&&n.dtype==="string")throw new Error("Only strings can be casted to strings");let a={x:n},r={dtype:t};return D.runKernel(ds,a,r)}var fe=O({cast_:BS});function VS(e){let t={x:M(e,"x","clone","string_or_numeric")};return D.runKernel(ks,t)}var Da=O({clone_:VS});function Qx(e,t=!1){console.log(e.toString(t))}Lx();var jS={buffer:We,cast:fe,clone:Da,print:Qx};tS(jS);var vn={};Fe(vn,{browserFiles:()=>US,browserHTTPRequest:()=>GS,concatenateArrayBuffers:()=>$m,copyModel:()=>zS,decodeWeights:()=>Ux,encodeWeights:()=>cS,fromMemory:()=>qS,getLoadHandlers:()=>wS,getModelArtifactsInfoForJSON:()=>Vu,getSaveHandlers:()=>vS,http:()=>Lm,isHTTPScheme:()=>Pm,listModels:()=>DS,loadWeights:()=>HS,moveModel:()=>_S,registerLoadRouter:()=>bS,registerSaveRouter:()=>xS,removeModel:()=>OS,weightsLoaderFactory:()=>eb,withSaveHandler:()=>XS});var KS="model",ZS=".json",YS=".weights.bin";function tb(e){return new Promise(t=>setTimeout(t)).then(e)}var il=class{constructor(e){if(!J().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(il.URL_SCHEME)&&(e=e.slice(il.URL_SCHEME.length)),(e==null||e.length===0)&&(e=KS),this.modelTopologyFileName=e+ZS,this.weightDataFileName=e+YS}async save(e){if(typeof document=="undefined")throw new Error("Browser downloads are not supported in this environment since `document` is not present");let 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.");{let n=[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}],a={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:n};e.signature!=null&&(a.signature=e.signature),e.userDefinedMetadata!=null&&(a.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(a.modelInitializer=e.modelInitializer);let r=window.URL.createObjectURL(new Blob([JSON.stringify(a)],{type:"application/json"})),s=this.jsonAnchor==null?document.createElement("a"):this.jsonAnchor;if(s.download=this.modelTopologyFileName,s.href=r,await tb(()=>s.dispatchEvent(new MouseEvent("click"))),e.weightData!=null){let i=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor;i.download=this.weightDataFileName,i.href=t,await tb(()=>i.dispatchEvent(new MouseEvent("click")))}return{modelArtifactsInfo:Vu(e)}}}};il.URL_SCHEME="downloads://";var JS=class{constructor(e){if(e==null||e.length<1)throw new Error(`When calling browserFiles, at least 1 file is required, but received ${e}`);this.files=e}async load(){let e=this.files[0],t=this.files.slice(1);return new Promise((n,a)=>{let r=new FileReader;r.onload=s=>{let i=JSON.parse(s.target.result),o=i.modelTopology;if(o==null){a(new Error(`modelTopology field is missing from file ${e.name}`));return}t.length===0&&n({modelTopology:o});let l=i.weightsManifest;if(l==null){a(new Error(`weightManifest field is missing from file ${e.name}`));return}let d;try{d=this.checkManifestAndWeightFiles(l,t)}catch(h){a(h);return}let u=[],p=[],c=[];l.forEach(h=>{h.paths.forEach(m=>{p.push(m),c.push(null)}),u.push(...h.weights)}),l.forEach(h=>{h.paths.forEach(m=>{let f=new FileReader;f.onload=A=>{let y=A.target.result,g=p.indexOf(m);if(c[g]=y,c.indexOf(null)===-1){let x={modelTopology:o,weightSpecs:u,weightData:$m(c),format:i.format,generatedBy:i.generatedBy,convertedBy:i.convertedBy};i.signature!=null&&(x.signature=i.signature),i.userDefinedMetadata!=null&&(x.userDefinedMetadata=i.userDefinedMetadata),i.modelInitializer!=null&&(x.modelInitializer=i.modelInitializer),n(x)}},f.onerror=A=>a(`Failed to weights data from file of path '${m}'.`),f.readAsArrayBuffer(d[m])})})},r.onerror=s=>a(`Failed to read model topology and weights manifest JSON from file '${e.name}'. BrowserFiles supports loading Keras-style tf.Model artifacts only.`),r.readAsText(e)})}checkManifestAndWeightFiles(e,t){let n=[],a=t.map(s=>Gx(s.name)),r={};for(let s of e)s.paths.forEach(i=>{let o=Gx(i);if(n.indexOf(o)!==-1)throw new Error(`Duplicate file basename found in weights manifest: '${o}'`);if(n.push(o),a.indexOf(o)===-1)throw new Error(`Weight file with basename '${o}' is not provided.`);r[i]=t[a.indexOf(o)]});if(n.length!==t.length)throw new Error(`Mismatch in the number of files in weights manifest (${n.length}) and the number of weight files provided (${t.length}).`);return r}},eN=e=>J().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(il.URL_SCHEME)?QS(e.slice(il.URL_SCHEME.length)):null;St.registerSaveRouter(eN);function QS(e="model"){return new il(e)}function US(e){return new JS(e)}function nb(e,t,n,a){i(e),n=n==null?0:n,a=a==null?1:a,o(n,a);let r=0,s=l=>(l.then(d=>{let u=n+ ++r/e.length*(a-n);return t(u),d}),l);function i(l){F(l!=null&&Array.isArray(l)&&l.length>0,()=>"promises must be a none empty array")}function o(l,d){F(l>=0&&l<=1,()=>`Progress fraction must be in range [0, 1], but got startFraction ${l}`),F(d>=0&&d<=1,()=>`Progress fraction must be in range [0, 1], but got endFraction ${d}`),F(d>=l,()=>`startFraction must be no more than endFraction, but got startFraction ${l} and endFraction ${d}`)}return Promise.all(e.map(s))}async function ab(e,t){t==null&&(t={});let n=t.fetchFunc==null?J().platform.fetch:t.fetchFunc,a=e.map(d=>n(d,t.requestInit,{isBinary:!0})),r=0,s=.5,i=(t.onProgress==null?await Promise.all(a):await nb(a,t.onProgress,r,s)).map(d=>d.arrayBuffer()),o=.5,l=1;return t.onProgress==null?await Promise.all(i):await nb(i,t.onProgress,o,l)}async function HS(e,t="",n,a){return eb(r=>ab(r,{requestInit:a}))(e,t,n)}function eb(e){return async(t,n="",a)=>{let r=t.map(()=>!1),s={},i=a!=null?a.map(()=>!1):[],o=[];if(t.forEach((h,m)=>{let f=0;h.weights.forEach(A=>{let y="quantization"in A?A.quantization.dtype:A.dtype,g=Mm[y]*Nt(A.shape),x=()=>{r[m]=!0,s[m]==null&&(s[m]=[]),s[m].push({manifestEntry:A,groupOffset:f,sizeBytes:g})};a!=null?a.forEach((w,b)=>{w===A.name&&(x(),i[b]=!0)}):x(),o.push(A.name),f+=g})}),!i.every(h=>h)){let h=a.filter((m,f)=>!i[f]);throw new Error(`Could not find weights in manifest with names: ${h.join(", ")}. -Manifest JSON has weights with names: ${o.join(", ")}.`)}let l=r.reduce((h,m,f)=>(m&&h.push(f),h),[]),d=[];l.forEach(h=>{t[h].paths.forEach(m=>{let f=n+(n.endsWith("/")?"":"/")+m;d.push(f)})});let u=await e(d),p={},c=0;return l.forEach(h=>{let m=t[h].paths.length,f=0;for(let x=0;x{let w=A.slice(x.groupOffset,x.groupOffset+x.sizeBytes),b=Ux(w,[x.manifestEntry]);for(let v in b)p[v]=b[v]}),c+=m}),p}}var tN="application/octet-stream",nN="application/json",Wm=class{constructor(e,t){if(this.DEFAULT_METHOD="POST",t==null&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.onProgress=t.onProgress,this.weightUrlConverter=t.weightUrlConverter,t.fetchFunc!=null?(F(typeof t.fetchFunc=="function",()=>"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=J().platform.fetch,F(e!=null&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&F(e.length===2,()=>`URL paths for http must have a length of 2, (actual length is ${e.length}).`),this.path=e,t.requestInit!=null&&t.requestInit.body!=null)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.");let t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData;let n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],a={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:n};e.signature!=null&&(a.signature=e.signature),e.userDefinedMetadata!=null&&(a.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(a.modelInitializer=e.modelInitializer),t.body.append("model.json",new Blob([JSON.stringify(a)],{type:nN}),"model.json"),e.weightData!=null&&t.body.append("model.weights.bin",new Blob([e.weightData],{type:tN}),"model.weights.bin");let r=await this.fetch(this.path,t);if(r.ok)return{modelArtifactsInfo:Vu(e),responses:[r]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${r.status}.`)}async load(){let 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(h){let m=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?m+=" 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.":m+=" Please make sure the server is serving valid JSON for this request.",new Error(m)}let n=t.modelTopology,a=t.weightsManifest,r=t.generatedBy,s=t.convertedBy,i=t.format,o=t.signature,l=t.userDefinedMetadata;if(n==null&&a==null)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);let d,u;a!=null&&([d,u]=await this.loadWeights(a));let p={modelTopology:n,weightSpecs:d,weightData:u,generatedBy:r,convertedBy:s,format:i};o!=null&&(p.signature=o),l!=null&&(p.userDefinedMetadata=l);let c=t.modelInitializer;return c&&(p.modelInitializer=c),p}async loadWeights(e){let t=Array.isArray(this.path)?this.path[1]:this.path,[n,a]=aN(t),r=this.weightPathPrefix||n,s=[];for(let d of e)s.push(...d.weights);let i=[],o=[];for(let d of e)for(let u of d.paths)this.weightUrlConverter!=null?o.push(this.weightUrlConverter(u)):i.push(r+u+a);this.weightUrlConverter&&i.push(...await Promise.all(o));let l=await ab(i,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress});return[s,$m(l)]}};Wm.URL_SCHEME_REGEX=/^https?:\/\//;function aN(e){let t=e.lastIndexOf("/"),n=e.lastIndexOf("?"),a=e.substring(0,t),r=n>t?e.substring(n):"";return[a+"/",r]}function Pm(e){return e.match(Wm.URL_SCHEME_REGEX)!=null}var rb=(e,t)=>{if(typeof fetch=="undefined"&&(t==null||t.fetchFunc==null))return null;{let n=!0;if(Array.isArray(e)?n=e.every(a=>Pm(a)):n=Pm(e),n)return Lm(e,t)}return null};St.registerSaveRouter(rb);St.registerLoadRouter(rb);function Lm(e,t){return new Wm(e,t)}function GS(e,t){return Lm(e,t)}var Bm=class{constructor(e){this.modelArtifacts=e}async load(){return this.modelArtifacts}},rN=class{constructor(e){this.saveHandler=e}async save(e){return this.saveHandler(e)}};function qS(e,t,n,a){return arguments.length===1?e.modelTopology!=null||e.weightSpecs!=null?new Bm(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 Bm({modelTopology: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 Bm({modelTopology:e,weightSpecs:t,weightData:n,trainingConfig:a}))}function XS(e){return new rN(e)}var sb={};Fe(sb,{confusionMatrix:()=>sN});function iN(e,t,n=!1,a=!1){let r=M(e,"a","matMul"),s=M(t,"b","matMul");[r,s]=bt(r,s);let i={a:r,b:s},o={transposeA:n,transposeB:a};return D.runKernel(us,i,o)}var Be=O({matMul_:iN});function oN(e,t,n=1,a=0){if(t<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${t}`);let r={indices:M(e,"indices","oneHot","int32")},s={depth:t,onValue:n,offValue:a};return D.runKernel(Ds,r,s)}var ol=O({oneHot_:oN});function lN(e,t){let n=M(e,"x","transpose");if(t==null&&(t=n.shape.map((s,i)=>i).reverse()),F(n.rank===t.length,()=>`Error in transpose: rank of input ${n.rank} must match length of perm ${t}.`),t.forEach(s=>{F(s>=0&&s`All entries in 'perm' must be between 0 and ${n.rank-1} but got ${t}`)}),n.rank<=1)return n.clone();let a={x:n},r={perm:t};return D.runKernel(Qs,a,r)}var Ze=O({transpose_:lN});function uN(e,t,n){let a=M(e,"labels","confusionMatrix"),r=M(t,"predictions","confusionMatrix");F(n==null||n>0&&Number.isInteger(n),()=>`If provided, numClasses must be a positive integer, but got ${n}`),F(a.rank===1,()=>`Expected the rank of labels to be 1, but got ${a.rank}`),F(r.rank===1,()=>`Expected the rank of predictions to be 1, but got ${r.rank}`),F(a.shape[0]===r.shape[0],()=>`Mismatch in the number of examples: ${a.shape[0]} vs. ${r.shape[0]}. Labels and predictions should have the same number of elements.`),F(n>0&&Number.isInteger(n),()=>`numClasses is required to be a positive integer, but got ${n}`);let s=ol(fe(a,"int32"),n),i=ol(fe(r,"int32"),n),o=Ze(s),l=Be(o,i);return fe(l,"int32")}var sN=O({confusionMatrix_:uN}),oi={};Fe(oi,{fromPixels:()=>cN,fromPixelsAsync:()=>dN,toPixels:()=>pN});function hc(e,t,n){if(rs(e),t!=null&&t.length!==3)throw new Error("tensor3d() requires shape to have three numbers");let a=$a(e,n);if(a.length!==3&&a.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return Tr(e,t,a,n)}var ll;function ib(e,t=3){if(t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(e==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let n=!1,a=!1,r=!1,s=!1,i=!1,o=!1;if(e.data instanceof Uint8Array)n=!0;else if(typeof ImageData!="undefined"&&e instanceof ImageData)a=!0;else if(typeof HTMLVideoElement!="undefined"&&e instanceof HTMLVideoElement)r=!0;else if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement)s=!0;else if(e.getContext!=null)i=!0;else if(typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap)o=!0;else 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}`);if(r){let c=2;if(r&&e.readyState element.")}if(ic(sc,D.backendName)!=null){let c={pixels:e},h={numChannels:t};return D.runKernel(sc,c,h)}let[l,d]=r?[e.videoWidth,e.videoHeight]:[e.width,e.height],u;i?u=e.getContext("2d").getImageData(0,0,l,d).data:a||n?u=e.data:(s||r||o)&&(ll==null&&(ll=document.createElement("canvas").getContext("2d")),ll.canvas.width=l,ll.canvas.height=d,ll.drawImage(e,0,0,l,d),u=ll.getImageData(0,0,l,d).data);let p;if(t===4)p=new Int32Array(u);else{let c=l*d;p=new Int32Array(c*t);for(let h=0;h4||s===2)throw new Error(`toPixels only supports depth of size 1, 3 or 4 but got ${s}`);if(n.dtype!=="float32"&&n.dtype!=="int32")throw new Error(`Unsupported type for toPixels: ${n.dtype}. Please use float32 or int32 tensors.`);let i=await n.data(),o=n.dtype==="float32"?255:1,l=new Uint8ClampedArray(r*a*4);for(let d=0;d1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${h}.`)}else if(n.dtype==="int32"&&(h<0||h>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${h}.`);s===1?(u[0]=h*o,u[1]=h*o,u[2]=h*o):u[c]=h*o}let p=d*4;l[p+0]=Math.round(u[0]),l[p+1]=Math.round(u[1]),l[p+2]=Math.round(u[2]),l[p+3]=Math.round(u[3])}if(t!=null){t.width=r,t.height=a;let d=t.getContext("2d"),u=new ImageData(l,r,a);d.putImageData(u,0,0)}return n!==e&&n.dispose(),l}var cN=O({fromPixels_:ib}),Vm={};Fe(Vm,{prepareAndValidate:()=>ob});function ob(e,t){let n=e.shape.length,a=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(a<1)throw new Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${a}.`);if(t.dtype!=="int32")throw new Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${t.dtype}.`);if(t.shape[a-1]>n)throw new Error(`index innermost dimension length must be <= tensor rank; saw: ${t.shape[a-1]} vs. ${n}`);if(Nt(e.shape)===0)throw new Error(`Requested more than 0 entries, but input is empty. Input shape: ${e.shape}.`);let r=t.shape,s=r[r.length-1],i=1;for(let p=0;pp/d),1].slice(0,s);return[l,i,d,u]}var jm={};Fe(jm,{calculateShapes:()=>lb,validateInput:()=>Hm,validateUpdateShape:()=>Um});function Um(e,t,n){let a=t.rank>1?t.shape[t.rank-1]:1,r=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: ${a}, and batchDim: ${r}.`;if(n.rank1?t.shape[a-1]:1,s=n.length,i=1;for(let p=r;pyN,computeFlatOffset:()=>xN,computeOutShape:()=>ub,getNormalizedAxes:()=>pb,isSliceContinous:()=>gN,maskToAxes:()=>fc,parseSliceParams:()=>yb,sliceInfo:()=>bN,startForAxis:()=>mb,startIndicesWithElidedDims:()=>cb,stopForAxis:()=>Ab,stopIndicesWithElidedDims:()=>hb,stridesForAxis:()=>fb,stridesWithElidedDims:()=>db});function yN(e,t,n){let a=e.shape.length;F(a===t.length,()=>`Error in slice${a}D: Length of begin ${t} must match the rank of the array (${a}).`),F(a===n.length,()=>`Error in slice${a}D: Length of size ${n} must match the rank of the array (${a}).`);for(let r=0;r`Error in slice${a}D: begin[${r}] + size[${r}] (${t[r]+n[r]}) would overflow input.shape[${r}] (${e.shape[r]})`)}function fc(e){let t=[],n=0;for(;e>0;)e&1&&t.push(n),e/=2,n++;return t}function ub(e,t,n){let a=[];for(let r=0;r0){let h=t[0],m=n+1;u=cb(i,h,m,a,e),p=hb(o,h,m,r,e),c=db(s,h,m,e)}else for(let h=0;h-1)s[o]=0;else{let l=gb(t,n,o),d=a[l];e&1<-1)s[o]=Number.MAX_SAFE_INTEGER;else{let l=gb(t,n,o),d=a[l];e&1<0?i=Number.MIN_SAFE_INTEGER:i=Number.MAX_SAFE_INTEGER);let l=a[r];return i<0&&(i+=l),i=fu(0,i,l-1),i}function Ab(e,t,n,a,r,s){let i=t[r],o=n[r]||1;(e&1<0?i=Number.MAX_SAFE_INTEGER:i=Number.MIN_SAFE_INTEGER);let l=a[r];return i<0&&(i+=l),o>0?i=fu(0,i,l):i=fu(-1,i,l-1),i}function gN(e,t,n){let a=n.length;for(let r=0;r1){a=r;break}for(let r=a+1;r0||n[r]!==e[r])return!1;return!0}function xN(e,t){let n=e.length>0?e[e.length-1]:1;for(let a=0;a{F(i!==-1,()=>"slice() does not support negative begin indexing.")});let s;return n==null?s=new Array(r).fill(-1):typeof n=="number"?s=[n,...new Array(r-1).fill(-1)]:n.lengthi>=0?i:(F(i===-1,()=>`Negative size values should be exactly -1 but got ${i} for the slice() size at index ${o}.`),e.shape[o]-a[o])),[a,s]}function bN(e,t,n,a,r,s,i,o,l){let d=t.slice(),u=n.slice(),p=a;a==null&&(p=new Array(d.length));let c=fc(i);if(c.length>1)throw new Error("Multiple ellipses in slice is not allowed.");if(i!==0&&o!==0)throw new Error("Using both ellipsisMask and newAxisMask is not yet supported.");if(i!==0&&l!==0)throw new Error("Using both ellipsisMask and shrinkAxisMask is not yet supported.");let h=e.length-d.length,m=fc(o),f=e.slice();m.forEach(v=>{d[v]=0,u[v]=1,f.splice(v,0,1)});let{begin:A,end:y,strides:g}=pb(f,c,h,d,u,p,r,s,i);d=A,u=y,p=g;let x=fc(l);x.forEach(v=>{u[v]=d[v]+1,p[v]=1});let w=ub(d,u,p),b=w.filter((v,N)=>x.indexOf(N)===-1);return{nonStrided:p.every(v=>v===1),$begin:d,$end:u,$strides:p,size:w,newShape:f,outShape:b}}var ae={};Fe(ae,{Serializable:()=>bb,SerializationMap:()=>li,registerClass:()=>Cr});var bb=class{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}},li=class{constructor(){this.classNameMap={}}static getMap(){return li.instance==null&&(li.instance=new li),li.instance}static register(e){li.getMap().classNameMap[e.className]=[e,e.fromConfig]}};function Cr(e){F(e.className!=null,()=>"Class being registered does not have the static className property defined."),F(typeof e.className=="string",()=>"className is required to be a string, but got type "+typeof e.className),F(e.className.length>0,()=>"Class being registered has an empty-string as its className, which is disallowed."),li.register(e)}var vb={};Fe(vb,{TEST_EPSILON_FLOAT16:()=>wb,encodeStrings:()=>kb,expectArrayBuffersEqual:()=>NN,expectArraysClose:()=>vN,expectArraysEqual:()=>kN,expectNumbersClose:()=>IN,expectPromiseToFail:()=>wN,expectValuesInRange:()=>SN,testEpsilon:()=>Gm});var TN=.001,wb=.1;function vN(e,t,n){return n==null&&(n=Gm()),qm(e,t,(a,r)=>Xm(a,r,n))}function Gm(){return D.backend.floatPrecision()===32?TN:wb}function qm(e,t,n){let a=!0;if((tn(e)||tn(t))&&(a=!1),tn(e)&&tn(t)&&(a=!0),a){let i=e.constructor.name,o=t.constructor.name;if(i!==o)throw new Error(`Arrays are of different type. Actual: ${i}. Expected: ${o}`)}if(Array.isArray(e)&&Array.isArray(t)){let i=$a(e),o=$a(t);if(!Qa(i,o))throw new Error(`Arrays have different shapes. Actual: [${i}]. Expected: [${o}]`)}let r=tn(e)?e:ss(e),s=tn(t)?t:ss(t);if(r.length!==s.length)throw new Error(`Arrays have different lengths actual: ${r.length} vs expected: ${s.length}. +`;return c[c.length-1]=" "+c[c.length-1]+"]"+(s?"":m),c}function Pu(e){let t=[];for(let n=0;n`Length of values '${a}' does not match the size inferred by the shape '${this.size}'.`)}if(t==="complex64")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||wx(t,this.size),this.strides=Ji(e)}set(e,...t){t.length===0&&(t=[0]),F(t.length===this.rank,()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`);let n=this.locToIndex(t);this.values[n]=e}get(...e){e.length===0&&(e=[0]);let t=0;for(let a of e){if(a<0||a>=this.shape[t]){let r=`Requested out of range element at ${e}. Buffer shape=${this.shape}`;throw new Error(r)}t++}let n=e[e.length-1];for(let a=0;auc(n))}catch(n){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataSync(){this.throwIfDisposed();let e=$a().readSync(this.dataId);if(this.dtype==="string")try{return e.map(t=>uc(t))}catch(t){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();let e=await $a().read(this.dataId);return this.dtype==="string"?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||($a().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return rl.print(this,e)}clone(){return this.throwIfDisposed(),rl.clone(this)}toString(e=!1){let t=this.dataSync();return QI(t,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),rl.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),$a().makeVariable(this,e,t,n)}};Object.defineProperty(Le,Symbol.hasInstance,{value:e=>!!e&&e.data!=null&&e.dataSync!=null&&e.throwIfDisposed!=null});function Z(){return vm("Tensor",()=>Le)}Z();var Lu=class extends Le{constructor(e,t,n,a){super(e.shape,e.dtype,e.dataId,a);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(!er(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);$a().disposeTensor(this),this.dataId=e.dataId,$a().incRef(this,null)}dispose(){$a().disposeVariable(this),this.isDisposedInternal=!0}};Object.defineProperty(Lu,Symbol.hasInstance,{value:e=>e instanceof Le&&e.assign!=null&&e.assign instanceof Function});var ma={};Fe(ma,{assertTypesMatch:()=>_x,getTensorsInContainer:()=>Sm,isTensorInList:()=>rS,makeTypesMatch:()=>bt});var Nm;(function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R5="R5",e.R6="R6"})(Nm||(Nm={}));var Tm;(function(e){e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64"})(Tm||(Tm={}));var Em;(function(e){e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64"})(Em||(Em={}));var Cm;(function(e){e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64"})(Cm||(Cm={}));var Rm;(function(e){e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64"})(Rm||(Rm={}));var sS={float32:Cm,int32:Tm,bool:Em,complex64:Rm};function sa(e,t){if(e==="string"||t==="string"){if(e==="string"&&t==="string")return"string";throw new Error(`Can not upcast ${e} with ${t}`)}return sS[e][t]}function pc(e){return sa(e,"int32")}function bt(e,t){if(e.dtype===t.dtype)return[e,t];let n=sa(e.dtype,t.dtype);return[e.cast(n),t.cast(n)]}function _x(e,t){F(e.dtype===t.dtype,()=>`The dtypes of the first(${e.dtype}) and second(${t.dtype}) input must match`)}function rS(e,t){return t.some(n=>n.id===e.id)}function Sm(e){let t=[],n=new Set;return Px(e,t,n),t}function Px(e,t,n){if(e==null)return;if(e instanceof Le){t.push(e);return}if(!iS(e))return;let a=e;for(let r in a){let s=a[r];n.has(s)||(n.add(s),Px(s,t,n))}}function iS(e){return Array.isArray(e)||typeof e=="object"}function Mm(e){return e.kernelName!=null}var Lx=class{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(let e in this.registeredVariables)this.registeredVariables[e].dispose()}},Wu=class{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new Lx}async ready(){if(this.pendingBackendInit!=null)return this.pendingBackendInit.then(()=>{});if(this.backendInstance!=null)return;let e=this.getSortedBackends();for(let t=0;t{e.setupFunc!=null&&e.setupFunc(this.backendInstance)})}disposeRegisteredKernels(e){al(e).forEach(t=>{t.disposeFunc!=null&&t.disposeFunc(this.registry[e])})}initializeBackend(e){let t=this.registryFactory[e];if(t==null)throw new Error(`Cannot initialize backend ${e}, no registration found.`);try{let n=t.factory();if(n&&!(n instanceof fu)&&typeof n.then=="function"){let a=++this.pendingBackendInitId,r=n.then(s=>a(athis.registryFactory[t].priority-this.registryFactory[e].priority)}initializeBackendsAndReturnBest(){let e=this.getSortedBackends();for(let t=0;tthis.startScope(n),()=>this.endScope(a),()=>(a=t(),a instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),a))}scopedRun(e,t,n){e();try{let a=n();return t(),a}catch(a){throw t(),a}}nextTensorId(){return Wu.nextTensorId++}nextVariableId(){return Wu.nextVariableId++}clone(e){let t=D.runKernel(Is,{x:e}),n={x:e},a=s=>({x:()=>{let i="float32",o={x:s},l={dtype:i};return D.runKernel(ps,o,l)}}),r=[];return this.addTapeNode(this.state.activeScope.name,n,[t],a,r,{}),t}runKernel(e,t,n){if(oc(e,this.backendName)==null)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){let a=this.backend.numDataIds(),r=0;n.forEach(o=>{r+=o.dtype==="complex64"?3:1});let s=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],i=a-t-r-s;if(i>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${i} data ids) after running '${e}'`)}runKernelFunc(e){let t,n=[],a=this.isTapeOn(),r=this.state.numBytes,s=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);let i;this.backendName==null&&this.backend;let o,l=Mm(e)?e.kernelName:this.state.activeScope!=null?this.state.activeScope.name:"";if(Mm(e)){let{kernelName:h,inputs:m,attrs:f}=e;this.backendName==null&&this.backend;let A=oc(h,this.backendName);F(A!=null,()=>`Cannot find registered kernel '${h}' for backend '${this.backendName}'`),i=()=>{let y=this.backend.numDataIds();o=A.kernelFunc({inputs:m,attrs:f,backend:this.backend});let g=Array.isArray(o)?o:[o];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(h,y,g);let x=g.map(w=>{if(w.rank!=null)return w;let{dataId:b,shape:v,dtype:N}=w;return this.makeTensorFromDataId(b,v,N)});if(a){let w=this.getTensorsForGradient(h,m,x);n=this.saveTensorsForBackwardMode(w)}return x}}else{let{forwardFunc:h}=e,m=f=>{!a||(n=f.map(A=>this.keep(this.clone(A))))};i=()=>{let f=this.backend.numDataIds();o=this.tidy(()=>h(this.backend,m));let A=Array.isArray(o)?o:[o];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(l,f,A),A}}let{inputs:d,attrs:u}=e,p=Mm(e)?null:e.backwardsFunc,c;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{!this.ENV.getBool("DEBUG")&&!this.state.profiling?t=i():(c=this.profiler.profileKernel(l,d,()=>i()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(c),t=c.outputs)}),a&&this.addTapeNode(l,d,t,p,n,u),this.state.profiling&&this.state.activeProfile.kernels.push({name:l,bytesAdded:this.state.numBytes-r,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-s,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(d).map(h=>d[h]!=null?d[h].shape:null),outputShapes:t.map(h=>h.shape),kernelTimeMs:c.timeMs,extraInfo:c.extraInfo}),Array.isArray(o)?t:t[0]}saveTensorsForBackwardMode(e){return e.map(t=>this.keep(this.clone(t)))}getTensorsForGradient(e,t,n){let a=km(e);if(a!=null){let r=a.inputsToSave||[],s=a.outputsToSave||[],i;a.saveAllInputs?(F(Array.isArray(t),()=>"saveAllInputs is true, expected inputs to be an array."),i=Object.keys(t).map(l=>t[l])):i=r.map(l=>t[l]);let o=n.filter((l,d)=>s[d]);return i.concat(o)}return[]}makeTensor(e,t,n,a){if(e==null)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",a=a||this.backend;let r=e;n==="string"&&vr(e[0])&&(r=e.map(o=>Ou(o)));let s=a.write(r,t,n),i=new Le(t,n,s,this.nextTensorId());if(this.trackTensor(i,a),n==="string"){let o=this.state.tensorInfo.get(s),l=Sx(r);this.state.numBytes+=l-o.bytes,o.bytes=l}return i}makeTensorFromDataId(e,t,n,a){n=n||"float32";let r=new Le(t,n,e,this.nextTensorId());return this.trackTensor(r,a),r}makeVariable(e,t=!0,n,a){n=n||this.nextVariableId().toString(),a!=null&&a!==e.dtype&&(e=e.cast(a));let r=new Lu(e,t,n,this.nextTensorId());if(this.state.registeredVariables[r.name]!=null)throw new Error(`Variable with name ${r.name} was already registered`);return this.state.registeredVariables[r.name]=r,this.incRef(r,this.backend),r}trackTensor(e,t){this.state.numTensors++,e.dtype==="string"&&this.state.numStringTensors++;let n=0;e.dtype!=="complex64"&&e.dtype!=="string"&&(n=e.size*Am(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 Lu||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;let t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,e.dtype==="string"&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),e.dtype!=="complex64"&&e.dtype!=="string"){let n=e.size*Am(e.dtype);this.state.numBytes-=n}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}disposeVariables(){for(let e in this.state.registeredVariables){let t=this.state.registeredVariables[e];this.disposeVariable(t)}}disposeVariable(e){this.disposeTensor(e),this.state.registeredVariables[e.name]!=null&&delete this.state.registeredVariables[e.name]}memory(){let 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,e.reasons==null&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;let 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(a=>a.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-n;for(let a of this.state.activeProfile.kernels)a.kernelTimeMs=await a.kernelTimeMs,a.extraInfo=await a.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&this.state.kernelDepth===0}addTapeNode(e,t,n,a,r,s){let i={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:n,saved:r},o=km(e);o!=null&&(a=o.gradFunc),a!=null&&(i.gradient=l=>(l=l.map((d,u)=>{if(d==null){let p=n[u],c=Ep(p.size,p.dtype);return this.makeTensor(c,p.shape,p.dtype)}return d}),a(l.length>1?l:l[0],r,s))),this.state.activeTape.push(i)}keep(e){return e.kept=!0,e}startTape(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){let t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}endScope(e){let t=Sm(e),n=new Set(t.map(r=>r.id));for(let r=0;r{!r.kept&&r.scopeId===a.id&&this.track(r)})}gradients(e,t,n,a=!1){if(F(t.length>0,()=>"gradients() received an empty list of xs."),n!=null&&n.dtype!=="float32")throw new Error(`dy must have 'float32' dtype, but has '${n.dtype}'`);let r=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",e));F(r instanceof Le,()=>"The result y returned by f() must be a tensor.");let s=ZI(this.state.activeTape,t,r);if(!a&&s.length===0&&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",()=>{let i={};i[r.id]=n==null?oS(r.shape):n,YI(i,s,l=>this.tidy(l),lS);let o=t.map(l=>i[l.id]);return this.state.gradientDepth===0&&(this.state.activeTape.forEach(l=>{for(let d of l.saved)d.dispose()}),this.state.activeTape=null),{value:r,grads:o}})}customGrad(e){return F(wr(e),()=>"The f passed in customGrad(f) must be a function."),(...t)=>{F(t.every(i=>i instanceof Le),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");let n,a={};t.forEach((i,o)=>{a[o]=i});let r=(i,o)=>(n=e(...t,o),F(n.value instanceof Le,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),F(wr(n.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),n.value),s=(i,o)=>{let l=n.gradFunc(i,o),d=Array.isArray(l)?l:[l];F(d.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(...)."),F(d.every(p=>p instanceof Le),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");let u={};return d.forEach((p,c)=>{u[c]=()=>p}),u};return this.runKernelFunc({forwardFunc:r,backwardsFunc:s,inputs:a})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}async time(e){let t=Du(),n=await this.backend.time(e);return n.wallMs=Du()-t,n}track(e){return this.state.activeScope!=null&&(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 Lx;for(let e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}};Wu.nextTensorId=0;Wu.nextVariableId=0;function oS(e){let t=ym(Nt(e),"float32");return D.makeTensor(t,e,"float32")}function Wx(){let e=Mx();if(e._tfengine==null){let t=new Rx(e);e._tfengine=new Wu(t)}return PI(e._tfengine.ENV),tS(()=>e._tfengine),e._tfengine}var D=Wx();function lS(e,t){let n={a:e,b:t};return D.runKernel(kr,n)}var Bu={};Fe(Bu,{isBrowser:()=>Bx,isMobile:()=>uS});function dS(){return typeof navigator!="undefined"&&navigator!=null}function uS(e){if(e||dS()){if(e||(e=navigator),e.product==="ReactNative")return!0;let t=e.userAgent||e.vendor||window.opera;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 Bx(){return typeof window!="undefined"&&window.document!=null||typeof WorkerGlobalScope!="undefined"}var Aa=J();Aa.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.")});Aa.registerFlag("IS_BROWSER",()=>Bx());Aa.registerFlag("IS_NODE",()=>typeof process!="undefined"&&typeof process.versions!="undefined"&&typeof process.versions.node!="undefined");Aa.registerFlag("IS_CHROME",()=>typeof navigator!="undefined"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor));Aa.registerFlag("PROD",()=>!1);Aa.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>Aa.getBool("DEBUG"));Aa.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0);Aa.registerFlag("IS_TEST",()=>!1);Aa.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>!0);Aa.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1);function Da(e,t){let n=e;if(tn(e))return t==="string"?[]:[e.length];if(!Array.isArray(e))return[];let a=[];for(;Array.isArray(n)||tn(n)&&t!=="string";)a.push(n.length),n=n[0];return Array.isArray(e)&&J().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&Vx(e,a,[]),a}function Vx(e,t,n){if(n=n||[],!Array.isArray(e)&&!tn(e)){F(t.length===0,()=>`Element arr[${n.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`);return}F(t.length>0,()=>`Element arr[${n.join("][")}] should be a primitive, but is an array of ${e.length} elements`),F(e.length===t[0],()=>`Element arr[${n.join("][")}] should have ${t[0]} elements, but has ${e.length} elements`);let a=t.slice(1);for(let r=0;r=0&&(r=a),jx(a,r,t,n),e==null||!tn(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string"){let o=e==null?"null":e.constructor.name;throw new Error(`Argument '${t}' passed to '${n}' must be a Tensor or TensorLike, but got '${o}'`)}let s=Da(e,r);!tn(e)&&!Array.isArray(e)&&(e=[e]);let i=r!=="string"?lc(e,r):is(e,[],!0);return D.makeTensor(i,s,r)}function Vu(e,t,n,a="numeric"){if(!Array.isArray(e))throw new Error(`Argument ${t} passed to ${n} must be a \`Tensor[]\` or \`TensorLike[]\``);return e.map((r,s)=>M(r,`${t}[${s}]`,n,a))}var Ux="__op";function O(e){let t=Object.keys(e);if(t.length!==1)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],a=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n=n+Ux;let r=(...s)=>{D.startScope(n);try{let i=a(...s);return xm(i)&&console.error("Cannot return a Promise inside of tidy."),D.endScope(i),i}catch(i){throw D.endScope(null),i}};return Object.defineProperty(r,"name",{value:n,configurable:!0}),r}function pS(e,t){let n=M(e,"real","complex"),a=M(t,"imag","complex");sn(n.shape,a.shape,`real and imag shapes, ${n.shape} and ${a.shape}, must match in call to tf.complex().`);let r={real:n,imag:a};return D.runKernel(Fp,r)}var Tr=O({complex_:pS});function Er(e,t,n,a){if(a==null&&(a=Np(e)),a==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!tn(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string")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(t!=null){gm(t);let r=Nt(t),s=Nt(n);F(r===s,()=>`Based on the provided shape, [${t}], the tensor should have ${r} values but has ${s}`);for(let i=0;i`Error creating a new Tensor. Inferred shape (${n}) does not match the provided shape (${t}). `)}}return!tn(e)&&!Array.isArray(e)&&(e=[e]),t=t||n,e=a!=="string"?lc(e,a):is(e,[],!0),D.makeTensor(e,t,a)}function ia(e,t,n){let a=Da(e,n);return Er(e,t,a,n)}var Fm={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8},cc=4;async function hS(e,t){let n=[],a=[],r=Array.isArray(e)?e.map(i=>i.name):Object.keys(e);for(let i=0;i{let c=await l.bytes(),h=c.reduce((A,y)=>A+y.length,0)+cc*c.length,m=new Uint8Array(h),f=0;for(let A=0;A{if(t+=s.byteLength,n.push(s.byteLength===s.buffer.byteLength?s:new s.constructor(s)),!(s instanceof Float32Array||s instanceof Int32Array||s instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${s.constructor.name}`)});let a=new Uint8Array(t),r=0;return n.forEach(s=>{a.set(new Uint8Array(s.buffer),r),r+=s.byteLength}),a.buffer}var $m=typeof Buffer!="undefined"&&(typeof Blob=="undefined"||typeof atob=="undefined"||typeof btoa=="undefined");function Gx(e){return $m?Buffer.byteLength(e):new Blob([e]).size}function mS(e){if($m)return Buffer.from(e).toString("base64");let t=new Uint8Array(e),n="";for(let a=0,r=t.length;a{t+=r.byteLength});let n=new Uint8Array(t),a=0;return e.forEach(r=>{n.set(new Uint8Array(r),a),a+=r.byteLength}),n.buffer}function qx(e){let t="/";for(e=e.trim();e.endsWith(t);)e=e.slice(0,e.length-1);let n=e.split(t);return n[n.length-1]}function ju(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:e.modelTopology==null?0:Gx(JSON.stringify(e.modelTopology)),weightSpecsBytes:e.weightSpecs==null?0:Gx(JSON.stringify(e.weightSpecs)),weightDataBytes:e.weightData==null?0:e.weightData.byteLength}}function yS(){let e=n=>{let a=n<<13,r=0;for(;(a&8388608)==0;)r-=8388608,a<<=1;return a&=~8388608,r+=947912704,a|r},t=new Uint32Array(2048);t[0]=0;for(let n=1;n<1024;n++)t[n]=e(n);for(let n=1024;n<2048;n++)t[n]=939524096+(n-1024<<13);return t}function gS(){let 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}function xS(){let e=new Uint32Array(64);for(let t=0;t<64;t++)e[t]=1024;return e[0]=e[32]=0,e}function fS(){let e=yS(),t=gS(),n=xS();return a=>{let r=new ArrayBuffer(4*a.length),s=new Uint32Array(r);for(let i=0;i>10]+(o&1023)]+t[o>>10];s[i]=l}return new Float32Array(r)}}var St=class{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return St.instance==null&&(St.instance=new St),St.instance}static registerSaveRouter(e){St.getInstance().saveRouters.push(e)}static registerLoadRouter(e){St.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return St.getHandlers(e,"save")}static getLoadHandlers(e,t){return St.getHandlers(e,"load",t)}static getHandlers(e,t,n){let a=[];return(t==="load"?St.getInstance().loadRouters:St.getInstance().saveRouters).forEach(r=>{let s=r(e,n);s!==null&&a.push(s)}),a}},bS=e=>St.registerSaveRouter(e),vS=e=>St.registerLoadRouter(e),wS=e=>St.getSaveHandlers(e),kS=(e,t)=>St.getLoadHandlers(e,t),Om="tensorflowjs",zm=1,si="models_store",Cr="model_info_store";function Xx(){if(!J().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");let e=typeof window=="undefined"?self:window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(t==null)throw new Error("The current browser does not appear to support IndexedDB.");return t}function _m(e){let t=e.result;t.createObjectStore(si,{keyPath:"modelPath"}),t.createObjectStore(Cr,{keyPath:"modelPath"})}var ii=class{constructor(e){if(this.indexedDB=Xx(),e==null||!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((n,a)=>{let r=this.indexedDB.open(Om,zm);r.onupgradeneeded=()=>_m(r),r.onsuccess=()=>{let s=r.result;if(t==null){let i=s.transaction(si,"readonly"),o=i.objectStore(si).get(this.modelPath);o.onsuccess=()=>{if(o.result==null)return s.close(),a(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));n(o.result.modelArtifacts)},o.onerror=l=>(s.close(),a(o.error)),i.oncomplete=()=>s.close()}else{let i=ju(t),o=s.transaction(Cr,"readwrite"),l=o.objectStore(Cr),d=l.put({modelPath:this.modelPath,modelArtifactsInfo:i}),u;d.onsuccess=()=>{u=s.transaction(si,"readwrite");let p=u.objectStore(si).put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:i});p.onsuccess=()=>n({modelArtifactsInfo:i}),p.onerror=c=>{l=o.objectStore(Cr);let h=l.delete(this.modelPath);h.onsuccess=()=>(s.close(),a(p.error)),h.onerror=m=>(s.close(),a(p.error))}},d.onerror=p=>(s.close(),a(d.error)),o.oncomplete=()=>{u==null?s.close():u.oncomplete=()=>s.close()}}},r.onerror=s=>a(r.error)})}};ii.URL_SCHEME="indexeddb://";var Kx=e=>J().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(ii.URL_SCHEME)?IS(e.slice(ii.URL_SCHEME.length)):null;St.registerSaveRouter(Kx);St.registerLoadRouter(Kx);function IS(e){return new ii(e)}function SS(e){return e.startsWith(ii.URL_SCHEME)?e.slice(ii.URL_SCHEME.length):e}var NS=class{constructor(){this.indexedDB=Xx()}async listModels(){return new Promise((e,t)=>{let n=this.indexedDB.open(Om,zm);n.onupgradeneeded=()=>_m(n),n.onsuccess=()=>{let a=n.result,r=a.transaction(Cr,"readonly"),s=r.objectStore(Cr).getAll();s.onsuccess=()=>{let i={};for(let o of s.result)i[o.modelPath]=o.modelArtifactsInfo;e(i)},s.onerror=i=>(a.close(),t(s.error)),r.oncomplete=()=>a.close()},n.onerror=a=>t(n.error)})}async removeModel(e){return e=SS(e),new Promise((t,n)=>{let a=this.indexedDB.open(Om,zm);a.onupgradeneeded=()=>_m(a),a.onsuccess=()=>{let r=a.result,s=r.transaction(Cr,"readwrite"),i=s.objectStore(Cr),o=i.get(e),l;o.onsuccess=()=>{if(o.result==null)return r.close(),n(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{let d=i.delete(e),u=()=>{l=r.transaction(si,"readwrite");let p=l.objectStore(si).delete(e);p.onsuccess=()=>t(o.result.modelArtifactsInfo),p.onerror=c=>n(o.error)};d.onsuccess=u,d.onerror=p=>(u(),r.close(),n(o.error))}},o.onerror=d=>(r.close(),n(o.error)),s.oncomplete=()=>{l==null?r.close():l.oncomplete=()=>r.close()}},a.onerror=r=>n(a.error)})}},tr="/",sl="tensorflowjs_models",Zx="info",TS="model_topology",ES="weight_specs",CS="weight_data",RS="model_metadata";function Yx(e){return{info:[sl,e,Zx].join(tr),topology:[sl,e,TS].join(tr),weightSpecs:[sl,e,ES].join(tr),weightData:[sl,e,CS].join(tr),modelMetadata:[sl,e,RS].join(tr)}}function MS(e){let t=e.split(tr);if(t.length<3)throw new Error(`Invalid key format: ${e}`);return t.slice(1,t.length-1).join(tr)}function FS(e){return e.startsWith(oi.URL_SCHEME)?e.slice(oi.URL_SCHEME.length):e}var oi=class{constructor(e){if(!J().getBool("IS_BROWSER")||typeof window=="undefined"||typeof window.localStorage=="undefined")throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,e==null||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=Yx(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.");{let t=JSON.stringify(e.modelTopology),n=JSON.stringify(e.weightSpecs),a=ju(e);try{this.LS.setItem(this.keys.info,JSON.stringify(a)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,mS(e.weightData));let r={format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy};return e.signature!=null&&(r.signature=e.signature),e.userDefinedMetadata!=null&&(r.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(r.modelInitializer=e.modelInitializer),this.LS.setItem(this.keys.modelMetadata,JSON.stringify(r)),{modelArtifactsInfo:a}}catch(r){throw this.LS.removeItem(this.keys.info),this.LS.removeItem(this.keys.topology),this.LS.removeItem(this.keys.weightSpecs),this.LS.removeItem(this.keys.weightData),this.LS.removeItem(this.keys.modelMetadata),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${a.modelTopologyBytes}, weightSpecsBytes=${a.weightSpecsBytes}, weightDataBytes=${a.weightDataBytes}.`)}}}async load(){let e=JSON.parse(this.LS.getItem(this.keys.info));if(e==null)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if(e.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");let t={},n=JSON.parse(this.LS.getItem(this.keys.topology));if(n==null)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);t.modelTopology=n;let a=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(a==null)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);t.weightSpecs=a;let r=this.LS.getItem(this.keys.modelMetadata);if(r!=null){let i=JSON.parse(r);t.format=i.format,t.generatedBy=i.generatedBy,t.convertedBy=i.convertedBy,i.signature!=null&&(t.signature=i.signature),i.userDefinedMetadata!=null&&(t.userDefinedMetadata=i.userDefinedMetadata),i.modelInitializer!=null&&(t.modelInitializer=i.modelInitializer)}let s=this.LS.getItem(this.keys.weightData);if(s==null)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return t.weightData=AS(s),t}};oi.URL_SCHEME="localstorage://";var Jx=e=>J().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(oi.URL_SCHEME)?$S(e.slice(oi.URL_SCHEME.length)):null;St.registerSaveRouter(Jx);St.registerLoadRouter(Jx);function $S(e){return new oi(e)}var DS=class{constructor(){F(J().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),F(typeof window=="undefined"||typeof window.localStorage!="undefined",()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){let e={},t=sl+tr,n=tr+Zx;for(let a=0;a"scheme must not be undefined or null."),e.endsWith(il)&&(e=e.slice(0,e.indexOf(il))),F(e.length>0,()=>"scheme must not be an empty string.");let n=Gn.getInstance();F(n.managers[e]==null,()=>`A model store manager is already registered for scheme '${e}'.`),n.managers[e]=t}static getManager(e){let t=this.getInstance().managers[e];if(t==null)throw new Error(`Cannot find model manager for scheme '${e}'`);return t}static getSchemes(){return Object.keys(this.getInstance().managers)}};function hc(e){if(e.indexOf(il)===-1)throw new Error(`The url string provided does not contain a scheme. Supported schemes are: ${Gn.getSchemes().join(",")}`);return{scheme:e.split(il)[0],path:e.split(il)[1]}}async function Qx(e,t,n=!1){F(e!==t,()=>`Old path and new path are the same: '${e}'`);let a=St.getLoadHandlers(e);F(a.length>0,()=>`Copying failed because no load handler is found for source URL ${e}.`),F(a.length<2,()=>`Copying failed because more than one (${a.length}) load handlers for source URL ${e}.`);let r=a[0],s=St.getSaveHandlers(t);F(s.length>0,()=>`Copying failed because no save handler is found for destination URL ${t}.`),F(s.length<2,()=>`Copying failed because more than one (${a.length}) save handlers for destination URL ${t}.`);let i=s[0],o=hc(e).scheme,l=hc(e).path,d=o===hc(e).scheme,u=await r.load();n&&d&&await Gn.getManager(o).removeModel(l);let p=await i.save(u);return n&&!d&&await Gn.getManager(o).removeModel(l),p.modelArtifactsInfo}async function OS(){let e=Gn.getSchemes(),t={};for(let n of e){let a=await Gn.getManager(n).listModels();for(let r in a){let s=n+il+r;t[s]=a[r]}}return t}async function zS(e){let t=hc(e);return Gn.getManager(t.scheme).removeModel(t.path)}async function _S(e,t){return Qx(e,t,!1)}async function PS(e,t){return Qx(e,t,!0)}var LS=class{fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Browser's encoder only supports utf-8, but got ${t}`);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}};if(J().get("IS_BROWSER")){J().setPlatform("browser",new LS);try{Gn.registerManager(oi.URL_SCHEME,new DS)}catch(e){}try{Gn.registerManager(ii.URL_SCHEME,new NS)}catch(e){}}var WS={importFetch:()=>q9()},Pm,BS=class{constructor(){this.util=require("util"),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return J().global.fetch!=null?J().global.fetch(e,t):(Pm==null&&(Pm=WS.importFetch()),Pm(e,t))}now(){let e=process.hrtime();return e[0]*1e3+e[1]/1e6}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Node built-in encoder only supports utf-8, but got ${t}`);return this.textEncoder.encode(e)}decode(e,t){return e.length===0?"":new this.util.TextDecoder(t).decode(e)}};J().get("IS_NODE")&&J().setPlatform("node",new BS);function We(e,t="float32",n){return t=t||"float32",gm(e),new Dt(e,t,n)}function VS(e,t){let n=M(e,"x","cast");if(!Ix(t))throw new Error(`Failed to cast to unknown dtype ${t}`);if(t==="string"&&n.dtype!=="string"||t!=="string"&&n.dtype==="string")throw new Error("Only strings can be casted to strings");let a={x:n},r={dtype:t};return D.runKernel(ps,a,r)}var fe=O({cast_:VS});function jS(e){let t={x:M(e,"x","clone","string_or_numeric")};return D.runKernel(Is,t)}var Oa=O({clone_:jS});function eb(e,t=!1){console.log(e.toString(t))}Wx();var US={buffer:We,cast:fe,clone:Oa,print:eb};nS(US);var vn={};Fe(vn,{browserFiles:()=>HS,browserHTTPRequest:()=>qS,concatenateArrayBuffers:()=>Dm,copyModel:()=>_S,decodeWeights:()=>Hx,encodeWeights:()=>hS,fromMemory:()=>XS,getLoadHandlers:()=>kS,getModelArtifactsInfoForJSON:()=>ju,getSaveHandlers:()=>wS,http:()=>Wm,isHTTPScheme:()=>Lm,listModels:()=>OS,loadWeights:()=>GS,moveModel:()=>PS,registerLoadRouter:()=>vS,registerSaveRouter:()=>bS,removeModel:()=>zS,weightsLoaderFactory:()=>tb,withSaveHandler:()=>KS});var ZS="model",YS=".json",JS=".weights.bin";function nb(e){return new Promise(t=>setTimeout(t)).then(e)}var ol=class{constructor(e){if(!J().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(ol.URL_SCHEME)&&(e=e.slice(ol.URL_SCHEME.length)),(e==null||e.length===0)&&(e=ZS),this.modelTopologyFileName=e+YS,this.weightDataFileName=e+JS}async save(e){if(typeof document=="undefined")throw new Error("Browser downloads are not supported in this environment since `document` is not present");let 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.");{let n=[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}],a={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:n};e.signature!=null&&(a.signature=e.signature),e.userDefinedMetadata!=null&&(a.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(a.modelInitializer=e.modelInitializer);let r=window.URL.createObjectURL(new Blob([JSON.stringify(a)],{type:"application/json"})),s=this.jsonAnchor==null?document.createElement("a"):this.jsonAnchor;if(s.download=this.modelTopologyFileName,s.href=r,await nb(()=>s.dispatchEvent(new MouseEvent("click"))),e.weightData!=null){let i=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor;i.download=this.weightDataFileName,i.href=t,await nb(()=>i.dispatchEvent(new MouseEvent("click")))}return{modelArtifactsInfo:ju(e)}}}};ol.URL_SCHEME="downloads://";var QS=class{constructor(e){if(e==null||e.length<1)throw new Error(`When calling browserFiles, at least 1 file is required, but received ${e}`);this.files=e}async load(){let e=this.files[0],t=this.files.slice(1);return new Promise((n,a)=>{let r=new FileReader;r.onload=s=>{let i=JSON.parse(s.target.result),o=i.modelTopology;if(o==null){a(new Error(`modelTopology field is missing from file ${e.name}`));return}t.length===0&&n({modelTopology:o});let l=i.weightsManifest;if(l==null){a(new Error(`weightManifest field is missing from file ${e.name}`));return}let d;try{d=this.checkManifestAndWeightFiles(l,t)}catch(h){a(h);return}let u=[],p=[],c=[];l.forEach(h=>{h.paths.forEach(m=>{p.push(m),c.push(null)}),u.push(...h.weights)}),l.forEach(h=>{h.paths.forEach(m=>{let f=new FileReader;f.onload=A=>{let y=A.target.result,g=p.indexOf(m);if(c[g]=y,c.indexOf(null)===-1){let x={modelTopology:o,weightSpecs:u,weightData:Dm(c),format:i.format,generatedBy:i.generatedBy,convertedBy:i.convertedBy};i.signature!=null&&(x.signature=i.signature),i.userDefinedMetadata!=null&&(x.userDefinedMetadata=i.userDefinedMetadata),i.modelInitializer!=null&&(x.modelInitializer=i.modelInitializer),n(x)}},f.onerror=A=>a(`Failed to weights data from file of path '${m}'.`),f.readAsArrayBuffer(d[m])})})},r.onerror=s=>a(`Failed to read model topology and weights manifest JSON from file '${e.name}'. BrowserFiles supports loading Keras-style tf.Model artifacts only.`),r.readAsText(e)})}checkManifestAndWeightFiles(e,t){let n=[],a=t.map(s=>qx(s.name)),r={};for(let s of e)s.paths.forEach(i=>{let o=qx(i);if(n.indexOf(o)!==-1)throw new Error(`Duplicate file basename found in weights manifest: '${o}'`);if(n.push(o),a.indexOf(o)===-1)throw new Error(`Weight file with basename '${o}' is not provided.`);r[i]=t[a.indexOf(o)]});if(n.length!==t.length)throw new Error(`Mismatch in the number of files in weights manifest (${n.length}) and the number of weight files provided (${t.length}).`);return r}},tN=e=>J().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(ol.URL_SCHEME)?eN(e.slice(ol.URL_SCHEME.length)):null;St.registerSaveRouter(tN);function eN(e="model"){return new ol(e)}function HS(e){return new QS(e)}function ab(e,t,n,a){i(e),n=n==null?0:n,a=a==null?1:a,o(n,a);let r=0,s=l=>(l.then(d=>{let u=n+ ++r/e.length*(a-n);return t(u),d}),l);function i(l){F(l!=null&&Array.isArray(l)&&l.length>0,()=>"promises must be a none empty array")}function o(l,d){F(l>=0&&l<=1,()=>`Progress fraction must be in range [0, 1], but got startFraction ${l}`),F(d>=0&&d<=1,()=>`Progress fraction must be in range [0, 1], but got endFraction ${d}`),F(d>=l,()=>`startFraction must be no more than endFraction, but got startFraction ${l} and endFraction ${d}`)}return Promise.all(e.map(s))}async function rb(e,t){t==null&&(t={});let n=t.fetchFunc==null?J().platform.fetch:t.fetchFunc,a=e.map(d=>n(d,t.requestInit,{isBinary:!0})),r=0,s=.5,i=(t.onProgress==null?await Promise.all(a):await ab(a,t.onProgress,r,s)).map(d=>d.arrayBuffer()),o=.5,l=1;return t.onProgress==null?await Promise.all(i):await ab(i,t.onProgress,o,l)}async function GS(e,t="",n,a){return tb(r=>rb(r,{requestInit:a}))(e,t,n)}function tb(e){return async(t,n="",a)=>{let r=t.map(()=>!1),s={},i=a!=null?a.map(()=>!1):[],o=[];if(t.forEach((h,m)=>{let f=0;h.weights.forEach(A=>{let y="quantization"in A?A.quantization.dtype:A.dtype,g=Fm[y]*Nt(A.shape),x=()=>{r[m]=!0,s[m]==null&&(s[m]=[]),s[m].push({manifestEntry:A,groupOffset:f,sizeBytes:g})};a!=null?a.forEach((w,b)=>{w===A.name&&(x(),i[b]=!0)}):x(),o.push(A.name),f+=g})}),!i.every(h=>h)){let h=a.filter((m,f)=>!i[f]);throw new Error(`Could not find weights in manifest with names: ${h.join(", ")}. +Manifest JSON has weights with names: ${o.join(", ")}.`)}let l=r.reduce((h,m,f)=>(m&&h.push(f),h),[]),d=[];l.forEach(h=>{t[h].paths.forEach(m=>{let f=n+(n.endsWith("/")?"":"/")+m;d.push(f)})});let u=await e(d),p={},c=0;return l.forEach(h=>{let m=t[h].paths.length,f=0;for(let x=0;x{let w=A.slice(x.groupOffset,x.groupOffset+x.sizeBytes),b=Hx(w,[x.manifestEntry]);for(let v in b)p[v]=b[v]}),c+=m}),p}}var nN="application/octet-stream",aN="application/json",Bm=class{constructor(e,t){if(this.DEFAULT_METHOD="POST",t==null&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.onProgress=t.onProgress,this.weightUrlConverter=t.weightUrlConverter,t.fetchFunc!=null?(F(typeof t.fetchFunc=="function",()=>"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=J().platform.fetch,F(e!=null&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&F(e.length===2,()=>`URL paths for http must have a length of 2, (actual length is ${e.length}).`),this.path=e,t.requestInit!=null&&t.requestInit.body!=null)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.");let t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData;let n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],a={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:n};e.signature!=null&&(a.signature=e.signature),e.userDefinedMetadata!=null&&(a.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(a.modelInitializer=e.modelInitializer),t.body.append("model.json",new Blob([JSON.stringify(a)],{type:aN}),"model.json"),e.weightData!=null&&t.body.append("model.weights.bin",new Blob([e.weightData],{type:nN}),"model.weights.bin");let r=await this.fetch(this.path,t);if(r.ok)return{modelArtifactsInfo:ju(e),responses:[r]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${r.status}.`)}async load(){let 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(h){let m=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?m+=" 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.":m+=" Please make sure the server is serving valid JSON for this request.",new Error(m)}let n=t.modelTopology,a=t.weightsManifest,r=t.generatedBy,s=t.convertedBy,i=t.format,o=t.signature,l=t.userDefinedMetadata;if(n==null&&a==null)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);let d,u;a!=null&&([d,u]=await this.loadWeights(a));let p={modelTopology:n,weightSpecs:d,weightData:u,generatedBy:r,convertedBy:s,format:i};o!=null&&(p.signature=o),l!=null&&(p.userDefinedMetadata=l);let c=t.modelInitializer;return c&&(p.modelInitializer=c),p}async loadWeights(e){let t=Array.isArray(this.path)?this.path[1]:this.path,[n,a]=rN(t),r=this.weightPathPrefix||n,s=[];for(let d of e)s.push(...d.weights);let i=[],o=[];for(let d of e)for(let u of d.paths)this.weightUrlConverter!=null?o.push(this.weightUrlConverter(u)):i.push(r+u+a);this.weightUrlConverter&&i.push(...await Promise.all(o));let l=await rb(i,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress});return[s,Dm(l)]}};Bm.URL_SCHEME_REGEX=/^https?:\/\//;function rN(e){let t=e.lastIndexOf("/"),n=e.lastIndexOf("?"),a=e.substring(0,t),r=n>t?e.substring(n):"";return[a+"/",r]}function Lm(e){return e.match(Bm.URL_SCHEME_REGEX)!=null}var sb=(e,t)=>{if(typeof fetch=="undefined"&&(t==null||t.fetchFunc==null))return null;{let n=!0;if(Array.isArray(e)?n=e.every(a=>Lm(a)):n=Lm(e),n)return Wm(e,t)}return null};St.registerSaveRouter(sb);St.registerLoadRouter(sb);function Wm(e,t){return new Bm(e,t)}function qS(e,t){return Wm(e,t)}var Vm=class{constructor(e){this.modelArtifacts=e}async load(){return this.modelArtifacts}},sN=class{constructor(e){this.saveHandler=e}async save(e){return this.saveHandler(e)}};function XS(e,t,n,a){return arguments.length===1?e.modelTopology!=null||e.weightSpecs!=null?new Vm(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 Vm({modelTopology: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 Vm({modelTopology:e,weightSpecs:t,weightData:n,trainingConfig:a}))}function KS(e){return new sN(e)}var ib={};Fe(ib,{confusionMatrix:()=>iN});function oN(e,t,n=!1,a=!1){let r=M(e,"a","matMul"),s=M(t,"b","matMul");[r,s]=bt(r,s);let i={a:r,b:s},o={transposeA:n,transposeB:a};return D.runKernel(ds,i,o)}var Be=O({matMul_:oN});function lN(e,t,n=1,a=0){if(t<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${t}`);let r={indices:M(e,"indices","oneHot","int32")},s={depth:t,onValue:n,offValue:a};return D.runKernel(Os,r,s)}var ll=O({oneHot_:lN});function uN(e,t){let n=M(e,"x","transpose");if(t==null&&(t=n.shape.map((s,i)=>i).reverse()),F(n.rank===t.length,()=>`Error in transpose: rank of input ${n.rank} must match length of perm ${t}.`),t.forEach(s=>{F(s>=0&&s`All entries in 'perm' must be between 0 and ${n.rank-1} but got ${t}`)}),n.rank<=1)return n.clone();let a={x:n},r={perm:t};return D.runKernel(ei,a,r)}var Ze=O({transpose_:uN});function dN(e,t,n){let a=M(e,"labels","confusionMatrix"),r=M(t,"predictions","confusionMatrix");F(n==null||n>0&&Number.isInteger(n),()=>`If provided, numClasses must be a positive integer, but got ${n}`),F(a.rank===1,()=>`Expected the rank of labels to be 1, but got ${a.rank}`),F(r.rank===1,()=>`Expected the rank of predictions to be 1, but got ${r.rank}`),F(a.shape[0]===r.shape[0],()=>`Mismatch in the number of examples: ${a.shape[0]} vs. ${r.shape[0]}. Labels and predictions should have the same number of elements.`),F(n>0&&Number.isInteger(n),()=>`numClasses is required to be a positive integer, but got ${n}`);let s=ll(fe(a,"int32"),n),i=ll(fe(r,"int32"),n),o=Ze(s),l=Be(o,i);return fe(l,"int32")}var iN=O({confusionMatrix_:dN}),li={};Fe(li,{fromPixels:()=>hN,fromPixelsAsync:()=>pN,toPixels:()=>cN});function fc(e,t,n){if(ss(e),t!=null&&t.length!==3)throw new Error("tensor3d() requires shape to have three numbers");let a=Da(e,n);if(a.length!==3&&a.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return Er(e,t,a,n)}var ul;function ob(e,t=3){if(t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(e==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let n=!1,a=!1,r=!1,s=!1,i=!1,o=!1;if(e.data instanceof Uint8Array)n=!0;else if(typeof ImageData!="undefined"&&e instanceof ImageData)a=!0;else if(typeof HTMLVideoElement!="undefined"&&e instanceof HTMLVideoElement)r=!0;else if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement)s=!0;else if(e.getContext!=null)i=!0;else if(typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap)o=!0;else 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}`);if(r){let c=2;if(r&&e.readyState element.")}if(oc(ic,D.backendName)!=null){let c={pixels:e},h={numChannels:t};return D.runKernel(ic,c,h)}let[l,d]=r?[e.videoWidth,e.videoHeight]:[e.width,e.height],u;i?u=e.getContext("2d").getImageData(0,0,l,d).data:a||n?u=e.data:(s||r||o)&&(ul==null&&(ul=document.createElement("canvas").getContext("2d")),ul.canvas.width=l,ul.canvas.height=d,ul.drawImage(e,0,0,l,d),u=ul.getImageData(0,0,l,d).data);let p;if(t===4)p=new Int32Array(u);else{let c=l*d;p=new Int32Array(c*t);for(let h=0;h4||s===2)throw new Error(`toPixels only supports depth of size 1, 3 or 4 but got ${s}`);if(n.dtype!=="float32"&&n.dtype!=="int32")throw new Error(`Unsupported type for toPixels: ${n.dtype}. Please use float32 or int32 tensors.`);let i=await n.data(),o=n.dtype==="float32"?255:1,l=new Uint8ClampedArray(r*a*4);for(let d=0;d1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${h}.`)}else if(n.dtype==="int32"&&(h<0||h>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${h}.`);s===1?(u[0]=h*o,u[1]=h*o,u[2]=h*o):u[c]=h*o}let p=d*4;l[p+0]=Math.round(u[0]),l[p+1]=Math.round(u[1]),l[p+2]=Math.round(u[2]),l[p+3]=Math.round(u[3])}if(t!=null){t.width=r,t.height=a;let d=t.getContext("2d"),u=new ImageData(l,r,a);d.putImageData(u,0,0)}return n!==e&&n.dispose(),l}var hN=O({fromPixels_:ob}),jm={};Fe(jm,{prepareAndValidate:()=>lb});function lb(e,t){let n=e.shape.length,a=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(a<1)throw new Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${a}.`);if(t.dtype!=="int32")throw new Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${t.dtype}.`);if(t.shape[a-1]>n)throw new Error(`index innermost dimension length must be <= tensor rank; saw: ${t.shape[a-1]} vs. ${n}`);if(Nt(e.shape)===0)throw new Error(`Requested more than 0 entries, but input is empty. Input shape: ${e.shape}.`);let r=t.shape,s=r[r.length-1],i=1;for(let p=0;pp/d),1].slice(0,s);return[l,i,d,u]}var Um={};Fe(Um,{calculateShapes:()=>ub,validateInput:()=>Gm,validateUpdateShape:()=>Hm});function Hm(e,t,n){let a=t.rank>1?t.shape[t.rank-1]:1,r=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: ${a}, and batchDim: ${r}.`;if(n.rank1?t.shape[a-1]:1,s=n.length,i=1;for(let p=r;pgN,computeFlatOffset:()=>bN,computeOutShape:()=>db,getNormalizedAxes:()=>cb,isSliceContinous:()=>xN,maskToAxes:()=>mc,parseSliceParams:()=>gb,sliceInfo:()=>vN,startForAxis:()=>Ab,startIndicesWithElidedDims:()=>hb,stopForAxis:()=>yb,stopIndicesWithElidedDims:()=>fb,stridesForAxis:()=>mb,stridesWithElidedDims:()=>pb});function gN(e,t,n){let a=e.shape.length;F(a===t.length,()=>`Error in slice${a}D: Length of begin ${t} must match the rank of the array (${a}).`),F(a===n.length,()=>`Error in slice${a}D: Length of size ${n} must match the rank of the array (${a}).`);for(let r=0;r`Error in slice${a}D: begin[${r}] + size[${r}] (${t[r]+n[r]}) would overflow input.shape[${r}] (${e.shape[r]})`)}function mc(e){let t=[],n=0;for(;e>0;)e&1&&t.push(n),e/=2,n++;return t}function db(e,t,n){let a=[];for(let r=0;r0){let h=t[0],m=n+1;u=hb(i,h,m,a,e),p=fb(o,h,m,r,e),c=pb(s,h,m,e)}else for(let h=0;h-1)s[o]=0;else{let l=xb(t,n,o),d=a[l];e&1<-1)s[o]=Number.MAX_SAFE_INTEGER;else{let l=xb(t,n,o),d=a[l];e&1<0?i=Number.MIN_SAFE_INTEGER:i=Number.MAX_SAFE_INTEGER);let l=a[r];return i<0&&(i+=l),i=mu(0,i,l-1),i}function yb(e,t,n,a,r,s){let i=t[r],o=n[r]||1;(e&1<0?i=Number.MAX_SAFE_INTEGER:i=Number.MIN_SAFE_INTEGER);let l=a[r];return i<0&&(i+=l),o>0?i=mu(0,i,l):i=mu(-1,i,l-1),i}function xN(e,t,n){let a=n.length;for(let r=0;r1){a=r;break}for(let r=a+1;r0||n[r]!==e[r])return!1;return!0}function bN(e,t){let n=e.length>0?e[e.length-1]:1;for(let a=0;a{F(i!==-1,()=>"slice() does not support negative begin indexing.")});let s;return n==null?s=new Array(r).fill(-1):typeof n=="number"?s=[n,...new Array(r-1).fill(-1)]:n.lengthi>=0?i:(F(i===-1,()=>`Negative size values should be exactly -1 but got ${i} for the slice() size at index ${o}.`),e.shape[o]-a[o])),[a,s]}function vN(e,t,n,a,r,s,i,o,l){let d=t.slice(),u=n.slice(),p=a;a==null&&(p=new Array(d.length));let c=mc(i);if(c.length>1)throw new Error("Multiple ellipses in slice is not allowed.");if(i!==0&&o!==0)throw new Error("Using both ellipsisMask and newAxisMask is not yet supported.");if(i!==0&&l!==0)throw new Error("Using both ellipsisMask and shrinkAxisMask is not yet supported.");let h=e.length-d.length,m=mc(o),f=e.slice();m.forEach(v=>{d[v]=0,u[v]=1,f.splice(v,0,1)});let{begin:A,end:y,strides:g}=cb(f,c,h,d,u,p,r,s,i);d=A,u=y,p=g;let x=mc(l);x.forEach(v=>{u[v]=d[v]+1,p[v]=1});let w=db(d,u,p),b=w.filter((v,N)=>x.indexOf(N)===-1);return{nonStrided:p.every(v=>v===1),$begin:d,$end:u,$strides:p,size:w,newShape:f,outShape:b}}var ae={};Fe(ae,{Serializable:()=>vb,SerializationMap:()=>ui,registerClass:()=>Rr});var vb=class{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}},ui=class{constructor(){this.classNameMap={}}static getMap(){return ui.instance==null&&(ui.instance=new ui),ui.instance}static register(e){ui.getMap().classNameMap[e.className]=[e,e.fromConfig]}};function Rr(e){F(e.className!=null,()=>"Class being registered does not have the static className property defined."),F(typeof e.className=="string",()=>"className is required to be a string, but got type "+typeof e.className),F(e.className.length>0,()=>"Class being registered has an empty-string as its className, which is disallowed."),ui.register(e)}var wb={};Fe(wb,{TEST_EPSILON_FLOAT16:()=>kb,encodeStrings:()=>Ib,expectArrayBuffersEqual:()=>TN,expectArraysClose:()=>wN,expectArraysEqual:()=>IN,expectNumbersClose:()=>SN,expectPromiseToFail:()=>kN,expectValuesInRange:()=>NN,testEpsilon:()=>qm});var EN=.001,kb=.1;function wN(e,t,n){return n==null&&(n=qm()),Xm(e,t,(a,r)=>Km(a,r,n))}function qm(){return D.backend.floatPrecision()===32?EN:kb}function Xm(e,t,n){let a=!0;if((tn(e)||tn(t))&&(a=!1),tn(e)&&tn(t)&&(a=!0),a){let i=e.constructor.name,o=t.constructor.name;if(i!==o)throw new Error(`Arrays are of different type. Actual: ${i}. Expected: ${o}`)}if(Array.isArray(e)&&Array.isArray(t)){let i=Da(e),o=Da(t);if(!er(i,o))throw new Error(`Arrays have different shapes. Actual: [${i}]. Expected: [${o}]`)}let r=tn(e)?e:is(e),s=tn(t)?t:is(t);if(r.length!==s.length)throw new Error(`Arrays have different lengths actual: ${r.length} vs expected: ${s.length}. Actual: ${r}. Expected: ${s}.`);for(let i=0;it.fail(),()=>t())}function kN(e,t){let n=typeof t=="string"||typeof t=="number"||typeof t=="boolean"?[t]:t;return br(e)||br(e[0])||br(t)||br(t[0])?qm(e,n,(a,r)=>a==r):qm(e,t,(a,r)=>Xm(a,r,0))}function IN(e,t,n){if(n==null&&(n=Gm()),!Xm(e,t,n))throw new Error(`Numbers differ: actual === ${e}, expected === ${t}`)}function Xm(e,t,n){return!isFinite(e)&&!isFinite(t)?!0:!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}function SN(e,t,n){for(let a=0;an)throw new Error(`Value out of range:${e[a]} low: ${t}, high: ${n}`)}function NN(e,t){expect(new Float32Array(e)).toEqual(new Float32Array(t))}function kb(e){for(let t=0;tt.dispose())}function jt(e){return D.keep(e)}function DN(e){return D.time(e)}function ON(e){return D.setBackend(e)}function zN(){return D.ready()}function _N(){return D.backendName}function PN(e){D.removeBackend(e)}function Zm(e){return D.findBackend(e)}function LN(e){return D.findBackendFactory(e)}function ul(e,t,n=1){return D.registerBackend(e,t,n)}function Ib(){return D.backend}function WN(e,t){J().setPlatform(e,t)}function BN(e,t){let n=M(e,"a","add"),a=M(t,"b","add");[n,a]=bt(n,a);let r={a:n,b:a};return D.runKernel(wr,r)}var se=O({add_:BN});function VN(e,t){let n=M(e,"a","floorDiv"),a=M(t,"b","floorDiv");[n,a]=bt(n,a);let r={a:n,b:a};return D.runKernel(bs,r)}var Ac=O({floorDiv_:VN});function jN(e,t){let n=M(e,"a","div"),a=M(t,"b","div");if([n,a]=bt(n,a),n.dtype==="int32"&&a.dtype==="int32")return Ac(n,a);let r={a:n,b:a},s={};return D.runKernel(ys,r,s)}var me=O({div_:jN});function UN(e,t){let n=M(e,"a","mul"),a=M(t,"b","mul");[n,a]=bt(n,a);let r={a:n,b:a};return D.runKernel($s,r)}var _=O({mul_:UN});function HN(e){let t=M(e,"x","abs");if(t.dtype==="complex64"){let n={x:t};return D.runKernel(xu,n)}else{let n={x:t};return D.runKernel(Qi,n)}}var Ot=O({abs_:HN});function GN(e){let t={x:M(e,"x","acos")};return D.runKernel(eo,t)}var Ym=O({acos_:GN});function qN(e){let t={x:M(e,"x","acosh")};return D.runKernel(to,t)}var Jm=O({acosh_:qN});function XN(e){F(Array.isArray(e),()=>"The argument passed to tf.addN() must be a list of tensors"),F(e.length>=1,()=>`Must pass at least one tensor to tf.addN(), but got ${e.length}`);let t=e.map((r,s)=>M(r,`tensors${s}`,"addN")),n=t[0];t.forEach(r=>{if(r.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),t.forEach(r=>{if(!Qa(r.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});let a=t;return D.runKernel(is,a)}var yc=O({addN_:XN});function KN(e,t=null,n=!1){let a={x:M(e,"x","all","bool")},r={axis:t,keepDims:n};return D.runKernel(no,a,r)}var gc=O({all_:KN});function ZN(e,t=null,n=!1){let a={x:M(e,"x","any","bool")},r={axis:t,keepDims:n};return D.runKernel(ao,a,r)}var ju=O({any_:ZN});function YN(e,t=0){let n={x:M(e,"x","argMax")},a={axis:t};return D.runKernel(os,n,a)}var Uu=O({argMax_:YN});function JN(e,t=0){let n={x:M(e,"x","argMin")},a={axis:t};return D.runKernel(Au,n,a)}var Qm=O({argMin_:JN});function QN(e){let t={x:M(e,"x","asin")};return D.runKernel(ro,t)}var eA=O({asin_:QN});function eT(e){let t={x:M(e,"x","asinh")};return D.runKernel(so,t)}var tA=O({asinh_:eT});function tT(e){let t={x:M(e,"x","atan")};return D.runKernel(io,t)}var nA=O({atan_:tT});function nT(e,t){let n=M(e,"a","atan2"),a=M(t,"b","atan2");[n,a]=bt(n,a);let r={a:n,b:a};return D.runKernel(lo,r)}var aA=O({atan2_:nT});function aT(e){let t={x:M(e,"x","atanh")};return D.runKernel(oo,t)}var rA=O({atanh_:aT});function rT(e,t,n,a,r="NHWC",s){let i=e[3],o=[...t,i],l=Sb(r);return Hu(e,o,n,s,a,null,null,l)}function Nb(e,t,n,a,r,s,i="channelsLast"){let[o,l]=xc(t),d;if(i==="channelsLast")d=[o,l,e[3],e[3]];else if(i==="channelsFirst")d=[o,l,e[1],e[1]];else throw new Error(`Unknown dataFormat ${i}`);return Hu(e,d,n,a,r,s,!1,i)}function sT(e,t,n,a,r,s,i="NDHWC"){let[o,l,d]=sA(t),u,p;if(i==="NDHWC")p="channelsLast",u=[o,l,d,e[4],e[4]];else if(i==="NCDHW")p="channelsFirst",u=[o,l,d,e[1],e[1]];else throw new Error(`Unknown dataFormat ${i}`);return Tb(e,u,n,a,r,!1,p,s)}function Hu(e,t,n,a,r,s,i=!1,o="channelsLast"){let[l,d,u,p]=[-1,-1,-1,-1];if(o==="channelsLast")[l,d,u,p]=e;else if(o==="channelsFirst")[l,p,d,u]=e;else throw new Error(`Unknown dataFormat ${o}`);let[c,h,,m]=t,[f,A]=xc(n),[y,g]=xc(a),x=dl(c,y),w=dl(h,g),{padInfo:b,outHeight:v,outWidth:N}=iT(r,d,u,f,A,x,w,s,o),T=i?m*p:m,R;return o==="channelsFirst"?R=[l,T,v,N]:o==="channelsLast"&&(R=[l,v,N,T]),{batchSize:l,dataFormat:o,inHeight:d,inWidth:u,inChannels:p,outHeight:v,outWidth:N,outChannels:T,padInfo:b,strideHeight:f,strideWidth:A,filterHeight:c,filterWidth:h,effectiveFilterHeight:x,effectiveFilterWidth:w,dilationHeight:y,dilationWidth:g,inShape:e,outShape:R,filterShape:t}}function Tb(e,t,n,a,r,s=!1,i="channelsLast",o){let[l,d,u,p,c]=[-1,-1,-1,-1,-1];if(i==="channelsLast")[l,d,u,p,c]=e;else if(i==="channelsFirst")[l,c,d,u,p]=e;else throw new Error(`Unknown dataFormat ${i}`);let[h,m,f,,A]=t,[y,g,x]=sA(n),[w,b,v]=sA(a),N=dl(h,w),T=dl(m,b),R=dl(f,v),{padInfo:$,outDepth:z,outHeight:P,outWidth:V}=oT(r,d,u,p,y,g,x,N,T,R,o),j=s?A*c:A,U;return i==="channelsFirst"?U=[l,j,z,P,V]:i==="channelsLast"&&(U=[l,z,P,V,j]),{batchSize:l,dataFormat:i,inDepth:d,inHeight:u,inWidth:p,inChannels:c,outDepth:z,outHeight:P,outWidth:V,outChannels:j,padInfo:$,strideDepth:y,strideHeight:g,strideWidth:x,filterDepth:h,filterHeight:m,filterWidth:f,effectiveFilterDepth:N,effectiveFilterHeight:T,effectiveFilterWidth:R,dilationDepth:w,dilationHeight:b,dilationWidth:v,inShape:e,outShape:U,filterShape:t}}function lT(e,t,n,a,r){a==null&&(a=iA(e,t,n));let s=e[0],i=e[1],o=ui((s-t+2*a)/n+1,r),l=ui((i-t+2*a)/n+1,r);return[o,l]}function uT(e,t,n,a,r,s){r==null&&(r=iA(e,t,a));let i=e[0],o=e[1],l=e[2],d=ui((i-t+2*r)/a+1,s),u=ui((o-t+2*r)/a+1,s),p=ui((l-t+2*r)/a+1,s);return[d,u,p,n]}function iA(e,t,n,a=1){let r=dl(t,a);return Math.floor((e[0]*(n-1)-n+r)/2)}function xc(e){return typeof e=="number"?[e,e,e]:e.length===2?[e[0],e[1],1]:e}function sA(e){return typeof e=="number"?[e,e,e]:e}function dl(e,t){return t<=1?e:e+(e-1)*(t-1)}function iT(e,t,n,a,r,s,i,o,l){let d,u,p;if(typeof e=="number"){d={top:e,bottom:e,left:e,right:e,type:e===0?"VALID":"NUMBER"};let c=lT([t,n],s,a,e,o);u=c[0],p=c[1]}else if(e==="same"){u=Math.ceil(t/a),p=Math.ceil(n/r);let c=Math.max(0,(u-1)*a+s-t),h=Math.max(0,(p-1)*r+i-n),m=Math.floor(c/2),f=c-m,A=Math.floor(h/2),y=h-A;d={top:m,bottom:f,left:A,right:y,type:"SAME"}}else if(e==="valid")d={top:0,bottom:0,left:0,right:0,type:"VALID"},u=Math.ceil((t-s+1)/a),p=Math.ceil((n-i+1)/r);else if(typeof e=="object"){let c=l==="channelsLast"?e[1][0]:e[2][0],h=l==="channelsLast"?e[1][1]:e[2][1],m=l==="channelsLast"?e[2][0]:e[3][0],f=l==="channelsLast"?e[2][1]:e[3][1];d={top:c,bottom:h,left:m,right:f,type:c===0&&h===0&&m===0&&f===0?"VALID":"EXPLICIT"},u=ui((t-s+c+h)/a+1,o),p=ui((n-i+m+f)/r+1,o)}else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:d,outHeight:u,outWidth:p}}function oT(e,t,n,a,r,s,i,o,l,d,u){let p,c,h,m;if(typeof e=="number"){p={top:e,bottom:e,left:e,right:e,front:e,back:e,type:e===0?"VALID":"NUMBER"};let f=uT([t,n,a,1],o,1,r,e,u);c=f[0],h=f[1],m=f[2]}else if(e==="same"){c=Math.ceil(t/r),h=Math.ceil(n/s),m=Math.ceil(a/i);let f=(c-1)*r+o-t,A=(h-1)*s+l-n,y=(m-1)*i+d-a,g=Math.floor(f/2),x=f-g,w=Math.floor(A/2),b=A-w,v=Math.floor(y/2),N=y-v;p={top:w,bottom:b,left:v,right:N,front:g,back:x,type:"SAME"}}else if(e==="valid")p={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},c=Math.ceil((t-o+1)/r),h=Math.ceil((n-l+1)/s),m=Math.ceil((a-d+1)/i);else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:p,outDepth:c,outHeight:h,outWidth:m}}function ui(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 Rr(e){let[t,n,a]=xc(e);return t===1&&n===1&&a===1}function Oa(e,t){return Rr(e)||Rr(t)}function Sb(e){if(e==="NHWC")return"channelsLast";if(e==="NCHW")return"channelsFirst";throw new Error(`Unknown dataFormat ${e}`)}function dT(e,t){let n={x:M(e,"x","reshape","string_or_numeric")},a={shape:t};return D.runKernel(Wo,n,a)}var H=O({reshape_:dT});function pT(e,t,n,a,r){let s=M(e,"x","avgPool","float32"),i=1;F(Oa(n,i),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${i}'`);let o=s,l=!1;s.rank===3&&(l=!0,o=H(s,[1,s.shape[0],s.shape[1],s.shape[2]])),F(o.rank===4,()=>`Error in avgPool: x must be rank 4 but got rank ${o.rank}.`),r!=null&&F(Vt(a),()=>`Error in avgPool: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let d={x:o},u={filterSize:t,strides:n,pad:a,dimRoundingMode:r},p=D.runKernel(ls,d,u);return p=fe(p,s.dtype),l?H(p,[p.shape[1],p.shape[2],p.shape[3]]):p}var Gu=O({avgPool_:pT});function cT(e,t,n,a,r,s="NDHWC"){let i=M(e,"x","avgPool3d","float32"),o=i,l=!1;i.rank===4&&(l=!0,o=H(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),F(o.rank===5,()=>`Error in avgPool3d: x must be rank 5 but got rank ${o.rank}.`),F(s==="NDHWC",()=>`Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`),r!=null&&F(Vt(a),()=>`Error in avgPool3d: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let d={x:o},u={filterSize:t,strides:n,pad:a,dimRoundingMode:r,dataFormat:s},p=D.runKernel(yu,d,u);return p=fe(p,o.dtype),l?H(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}var oA=O({avgPool3d_:cT});function hT(e,t=0){F(e.length>=1,()=>"Pass at least one tensor to concat");let n=Bu(e,"tensors","concat","string_or_numeric");if(n[0].dtype==="complex64"&&n.forEach(s=>{if(s.dtype!=="complex64")throw new Error(`Cannot concatenate complex64 tensors with a tensor - with dtype ${s.dtype}. `)}),n.length===1)return Da(n[0]);let a=n,r={axis:t};return D.runKernel(uo,a,r)}var ot=O({concat_:hT});function fT(e){let t={x:M(e,"x","sigmoid")};return D.runKernel(Hs,t)}var wn=O({sigmoid_:fT});function mT(e,t,n){let a=M(e,"x","slice","string_or_numeric");if(a.rank===0)throw new Error("Slicing scalar is not possible");let r={x:a},s={begin:t,size:n};return D.runKernel(Uo,r,s)}var Re=O({slice_:mT});function AT(e){let t={x:M(e,"x","tanh")};return D.runKernel(Js,t)}var di=O({tanh_:AT});function yT(e,t,n,a,r,s){let i=M(e,"forgetBias","basicLSTMCell"),o=M(t,"lstmKernel","basicLSTMCell"),l=M(n,"lstmBias","basicLSTMCell"),d=M(a,"data","basicLSTMCell"),u=M(r,"c","basicLSTMCell"),p=M(s,"h","basicLSTMCell"),c=ot([d,p],1),h=Be(c,o),m=se(h,l),f=m.shape[0],A=m.shape[1]/4,y=[f,A],g=Re(m,[0,0],y),x=Re(m,[0,A],y),w=Re(m,[0,A*2],y),b=Re(m,[0,A*3],y),v=se(_(wn(g),di(x)),_(u,wn(se(i,w)))),N=_(di(v),wn(b));return[v,N]}var gT=O({basicLSTMCell_:yT});function xT(e,t,n){let a=M(e,"x","batchToSpaceND"),r=t.reduce((o,l)=>o*l);F(a.rank>=1+t.length,()=>`input rank is ${a.rank} but should be > than blockShape.length ${t.length}`),F(n.length===t.length,()=>`crops.length is ${n.length} but should be equal to blockShape.length ${t.length}`),F(a.shape[0]%r==0,()=>`input tensor batch is ${a.shape[0]} but is not divisible by the product of the elements of blockShape ${t.join(" * ")} === ${r}`);let s={x:a},i={blockShape:t,crops:n};return D.runKernel(gu,s,i)}var qu=O({batchToSpaceND_:xT});function bT(e){let t;return e.rank===0||e.rank===1?t=H(e,[1,1,1,e.size]):e.rank===2?t=H(e,[1,1,e.shape[0],e.shape[1]]):e.rank===3?t=H(e,[1,e.shape[0],e.shape[1],e.shape[2]]):t=e,t}function vT(e,t,n,a,r,s){s==null&&(s=.001);let i=M(e,"x","batchNorm"),o=M(t,"mean","batchNorm"),l=M(n,"variance","batchNorm"),d;r!=null&&(d=M(r,"scale","batchNorm"));let u;a!=null&&(u=M(a,"offset","batchNorm")),F(o.rank===l.rank,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),F(u==null||o.rank===u.rank,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),F(d==null||o.rank===d.rank,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let p={x:bT(i),scale:d,offset:u,mean:o,variance:l},c={varianceEpsilon:s},h=D.runKernel(vs,p,c);return H(h,i.shape)}var pi=O({batchNorm_:vT});function wT(e,t,n,a,r,s){let i=M(e,"x","batchNorm"),o=M(t,"mean","batchNorm"),l=M(n,"variance","batchNorm"),d;r!=null&&(d=M(r,"scale","batchNorm"));let u;return a!=null&&(u=M(a,"offset","batchNorm")),F(i.rank===2,()=>`Error in batchNorm2D: x must be rank 2 but got rank ${i.rank}.`),F(o.rank===2||o.rank===1,()=>`Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${o.rank}.`),F(l.rank===2||l.rank===1,()=>`Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${l.rank}.`),d!=null&&F(d.rank===2||d.rank===1,()=>`Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${d.rank}.`),u!=null&&F(u.rank===2||u.rank===1,()=>`Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${u.rank}.`),pi(i,o,l,u,d,s)}var Eb=O({batchNorm2d_:wT});function kT(e,t,n,a,r,s){let i=M(e,"x","batchNorm"),o=M(t,"mean","batchNorm"),l=M(n,"variance","batchNorm"),d;r!=null&&(d=M(r,"scale","batchNorm"));let u;return a!=null&&(u=M(a,"offset","batchNorm")),F(i.rank===3,()=>`Error in batchNorm3D: x must be rank 3 but got rank ${i.rank}.`),F(o.rank===3||o.rank===1,()=>`Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${o.rank}.`),F(l.rank===3||l.rank===1,()=>`Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${l.rank}.`),d!=null&&F(d.rank===3||d.rank===1,()=>`Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${d.rank}.`),u!=null&&F(u.rank===3||u.rank===1,()=>`Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${u.rank}.`),pi(i,o,l,u,d,s)}var Cb=O({batchNorm3d_:kT});function IT(e,t,n,a,r,s){let i=M(e,"x","batchNorm"),o=M(t,"mean","batchNorm"),l=M(n,"variance","batchNorm"),d;r!=null&&(d=M(r,"scale","batchNorm"));let u;return a!=null&&(u=M(a,"offset","batchNorm")),F(i.rank===4,()=>`Error in batchNorm4D: x must be rank 4 but got rank ${i.rank}.`),F(o.rank===4||o.rank===1,()=>`Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${o.rank}.`),F(l.rank===4||l.rank===1,()=>`Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${l.rank}.`),d!=null&&F(d.rank===4||d.rank===1,()=>`Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${d.rank}.`),u!=null&&F(u.rank===4||u.rank===1,()=>`Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${u.rank}.`),pi(i,o,l,u,d,s)}var Rb=O({batchNorm4d_:IT});function ST(e,t,n){let a=M(e,"x","bincount"),r=M(t,"weights","bincount");F(a.dtype==="int32",()=>`Error in bincount: input dtype must be int32, but got ${a.dtype}`),F(n>=0,()=>`size must be non-negative, but got ${n}.`),F(r.size===a.size||r.size===0,()=>`Error in bincount: weights must have the same size as input or0-length, but got input shape: ${a.shape}, weights shape: ${r.shape}.`);let s={x:a,weights:r},i={size:n};return D.runKernel(Rp,s,i)}var lA=O({bincount_:ST});function NT(e,t){let n=M(e,"broadcastTo","x"),a=n.shape;if(t.some(l=>!(l>0)||l%1!=0))throw new Error(`broadcastTo(): Invalid broadcast shape [${t}].`);if(t.lengthn.rank){let l=n.shape.slice();for(;l.length=0;l--)if(r[l]===t[l])s[l]=1;else if(n.shape[l]!==1)throw new Error(`broadcastTo(): [${a}] cannot be broadcast to [${t}].`);if(s.map((l,d)=>l>1?d:-1).filter(l=>l>=0).length===0)return Da(n);let i={x:n},o={reps:s};return D.runKernel(Ir,i,o)}var pl=O({broadcastTo_:NT});function TT(e){let t={x:M(e,"x","ceil")};return D.runKernel(ps,t)}var uA=O({ceil_:TT});function ET(e,t,n){let a=M(e,"x","clipByValue");F(t<=n,()=>`Error in clip: min (${t}) must be less than or equal to max (${n}).`);let r={x:a},s={clipValueMin:t,clipValueMax:n};return D.runKernel(kr,r,s)}var kn=O({clipByValue_:ET});function CT(e){return ot(e,0)}var Mb=O({concat1d_:CT});function RT(e,t){return ot(e,t)}var cl=O({concat2d_:RT});function MT(e,t){return ot(e,t)}var Fb=O({concat3d_:MT});function FT(e,t){return ot(e,t)}var $b=O({concat4d_:FT});function $T(e,t,n,a,r="NHWC",s=[1,1],i){let o=M(e,"x","conv2d"),l=M(t,"filter","conv2d"),d=o,u=!1;o.rank===3&&(u=!0,d=H(o,[1,o.shape[0],o.shape[1],o.shape[2]])),F(d.rank===4,()=>`Error in conv2d: input must be rank 4, but got rank ${d.rank}.`),F(l.rank===4,()=>`Error in conv2d: filter must be rank 4, but got rank ${l.rank}.`),i!=null&&F(Vt(a),()=>`Error in conv2d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`);let p=r==="NHWC"?d.shape[3]:d.shape[1];F(p===l.shape[2],()=>`Error in conv2d: depth of input (${p}) must match input depth for filter ${l.shape[2]}.`),F(Oa(n,s),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`);let c={x:d,filter:l},h={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i},m=D.runKernel(cs,c,h);return u?H(m,[m.shape[1],m.shape[2],m.shape[3]]):m}var nr=O({conv2d_:$T});function DT(e,t,n,a,r="NWC",s=1,i){let o=M(e,"x","conv1d"),l=M(t,"filter","conv1d"),d=o,u=!1;o.rank===2&&(u=!0,d=H(o,[1,o.shape[0],o.shape[1]])),F(d.rank===3,()=>`Error in conv1d: input must be rank 3, but got rank ${d.rank}.`),F(l.rank===3,()=>`Error in conv1d: filter must be rank 3, but got rank ${l.rank}.`),i!=null&&F(Vt(a),()=>`Error in conv1d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`),F(d.shape[2]===l.shape[1],()=>`Error in conv1d: depth of input (${d.shape[2]}) must match input depth for filter ${l.shape[1]}.`),F(Oa(n,s),()=>`Error in conv1D: Either stride or dilation must be 1. Got stride ${n} and dilation '${s}'`),F(r==="NWC",()=>`Error in conv1d: got dataFormat of ${r} but only NWC is currently supported.`);let p=H(l,[1,l.shape[0],l.shape[1],l.shape[2]]),c=H(d,[d.shape[0],1,d.shape[1],d.shape[2]]),h=nr(c,p,[1,n],a,"NHWC",[1,s],i);return u?H(h,[h.shape[2],h.shape[3]]):H(h,[h.shape[0],h.shape[2],h.shape[3]])}var bc=O({conv1d_:DT});function OT(e,t,n,a,r,s="NHWC",i){F(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let o=e,l=t,d=!1;t.rank===3&&(d=!0,l=H(t,[1,t.shape[0],t.shape[1],t.shape[2]]),o=[1,e[0],e[1],e[2]]),F(o.length===4,()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${o.length}.`),F(l.rank===4,()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${l.rank}`),F(n.rank===4,()=>`Error in conv2dDerInput: filter must be rank 4, but got rank ${n.rank}`);let u=s==="NHWC"?o[3]:o[1],p=s==="NHWC"?l.shape[3]:l.shape[1];F(u===n.shape[2],()=>`Error in conv2dDerInput: depth of input (${u}) must match input depth for filter ${n.shape[2]}.`),F(p===n.shape[3],()=>`Error in conv2dDerInput: depth of output (${p}) must match output depth for filter ${n.shape[3]}.`),i!=null&&F(Vt(r),()=>`Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode ${i} but got pad ${r}.`);let c={dy:l,filter:n},h={strides:a,pad:r,dataFormat:s,dimRoundingMode:i,inputShape:o},m=D.runKernel(hs,c,h);return d?H(m,[m.shape[1],m.shape[2],m.shape[3]]):m}var dA=O({conv2DBackpropInput_:OT});function zT(e,t,n,a,r,s){let i=M(e,"x","conv2dTranspose"),o=M(t,"filter","conv2dTranspose");return dA(n,i,o,a,r,"NHWC",s)}var vc=O({conv2dTranspose_:zT});function _T(e,t,n,a,r="NDHWC",s=[1,1,1]){let i=M(e,"x","conv3d"),o=M(t,"filter","conv3d"),l=i,d=!1;i.rank===4&&(d=!0,l=H(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),F(l.rank===5,()=>`Error in conv3d: input must be rank 5, but got rank ${l.rank}.`),F(o.rank===5,()=>`Error in conv3d: filter must be rank 5, but got rank ${o.rank}.`),F(l.shape[4]===o.shape[3],()=>`Error in conv3d: depth of input (${l.shape[4]}) must match input depth for filter ${o.shape[3]}.`),F(Oa(n,s),()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),F(r==="NDHWC",()=>`Error in conv3d: got dataFormat of ${r} but only NDHWC is currently supported.`);let u={x:l,filter:o},p={strides:n,pad:a,dataFormat:r,dilations:s},c=D.runKernel(bu,u,p);return d?H(c,[c.shape[1],c.shape[2],c.shape[3],c.shape[4]]):c}var pA=O({conv3d_:_T});function PT(e,t,n,a,r){F(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let s=e,i=t,o=!1;t.rank===4&&(o=!0,i=H(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]]),s=[1,e[0],e[1],e[2],e[3]]);let l=s[4],d=i.shape[4];F(s.length===5,()=>`Error in conv3dDerInput: inShape must be length 5, but got length ${s.length}.`),F(i.rank===5,()=>`Error in conv3dDerInput: dy must be rank 5, but got rank ${i.rank}`),F(n.rank===5,()=>`Error in conv3dDerInput: filter must be rank 5, but got rank ${n.rank}`),F(l===n.shape[3],()=>`Error in conv3dDerInput: depth of input (${l}) must match input depth for filter ${n.shape[3]}.`),F(d===n.shape[4],()=>`Error in conv3dDerInput: depth of output (${d}) must match output depth for filter ${n.shape[4]}.`);let u={dy:i,filter:n},p={pad:r,strides:a,inputShape:s},c=D.runKernel(Dp,u,p);return o?H(c,[c.shape[1],c.shape[2],c.shape[3],c.shape[4]]):c}var Db=O({conv3DBackpropInput_:PT});function LT(e,t,n,a,r){let s=M(e,"x","conv3dTranspose"),i=M(t,"filter","conv3dTranspose");return Db(n,s,i,a,r)}var Ob=O({conv3dTranspose_:LT});function WT(e){let t={x:M(e,"x","cos")};return D.runKernel(fs,t)}var Xu=O({cos_:WT});function BT(e){let t={x:M(e,"x","cosh")};return D.runKernel(po,t)}var wc=O({cosh_:BT});function VT(e,t=0,n=!1,a=!1){let r={x:M(e,"x","cumsum")},s={axis:t,exclusive:n,reverse:a};return D.runKernel(ms,r,s)}var kc=O({cumsum_:VT});function jT(e,t,n,a=!1){let r=M(e,"x","denseBincount"),s=M(t,"weights","denseBincount");F(r.dtype==="int32",()=>`Error in denseBincount: input dtype must be int32, but got ${r.dtype}`),F(r.rank<=2,()=>`Error in denseBincount: input must be at most rank 2, but got rank ${r.rank}.`),F(n>=0,()=>`size must be non-negative, but got ${n}.`),F(s.size===r.size||s.size===0,()=>`Error in denseBincount: weights must have the same shape as x or 0-length, but got x shape: ${r.shape}, weights shape: ${s.shape}.`);let i={x:r,weights:s},o={size:n,binaryOutput:a};return D.runKernel(Op,i,o)}var zb=O({denseBincount_:jT});function UT(e,t,n="NHWC"){let a=M(e,"x","depthToSpace"),r=n==="NHWC"?a.shape[1]:a.shape[2],s=n==="NHWC"?a.shape[2]:a.shape[3],i=n==="NHWC"?a.shape[3]:a.shape[1];F(r*t>=0,()=>`Negative dimension size caused by overflow when multiplying +Expected: ${s}.`)}}function kN(e,t){e().then(()=>t.fail(),()=>t())}function IN(e,t){let n=typeof t=="string"||typeof t=="number"||typeof t=="boolean"?[t]:t;return vr(e)||vr(e[0])||vr(t)||vr(t[0])?Xm(e,n,(a,r)=>a==r):Xm(e,t,(a,r)=>Km(a,r,0))}function SN(e,t,n){if(n==null&&(n=qm()),!Km(e,t,n))throw new Error(`Numbers differ: actual === ${e}, expected === ${t}`)}function Km(e,t,n){return!isFinite(e)&&!isFinite(t)?!0:!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}function NN(e,t,n){for(let a=0;an)throw new Error(`Value out of range:${e[a]} low: ${t}, high: ${n}`)}function TN(e,t){expect(new Float32Array(e)).toEqual(new Float32Array(t))}function Ib(e){for(let t=0;tt.dispose())}function jt(e){return D.keep(e)}function ON(e){return D.time(e)}function zN(e){return D.setBackend(e)}function _N(){return D.ready()}function PN(){return D.backendName}function LN(e){D.removeBackend(e)}function Ym(e){return D.findBackend(e)}function WN(e){return D.findBackendFactory(e)}function dl(e,t,n=1){return D.registerBackend(e,t,n)}function Sb(){return D.backend}function BN(e,t){J().setPlatform(e,t)}function VN(e,t){let n=M(e,"a","add"),a=M(t,"b","add");[n,a]=bt(n,a);let r={a:n,b:a};return D.runKernel(kr,r)}var se=O({add_:VN});function jN(e,t){let n=M(e,"a","floorDiv"),a=M(t,"b","floorDiv");[n,a]=bt(n,a);let r={a:n,b:a};return D.runKernel(vs,r)}var yc=O({floorDiv_:jN});function UN(e,t){let n=M(e,"a","div"),a=M(t,"b","div");if([n,a]=bt(n,a),n.dtype==="int32"&&a.dtype==="int32")return yc(n,a);let r={a:n,b:a},s={};return D.runKernel(gs,r,s)}var me=O({div_:UN});function HN(e,t){let n=M(e,"a","mul"),a=M(t,"b","mul");[n,a]=bt(n,a);let r={a:n,b:a};return D.runKernel(Ds,r)}var _=O({mul_:HN});function GN(e){let t=M(e,"x","abs");if(t.dtype==="complex64"){let n={x:t};return D.runKernel(bu,n)}else{let n={x:t};return D.runKernel(eo,n)}}var Ot=O({abs_:GN});function qN(e){let t={x:M(e,"x","acos")};return D.runKernel(to,t)}var Jm=O({acos_:qN});function XN(e){let t={x:M(e,"x","acosh")};return D.runKernel(no,t)}var Qm=O({acosh_:XN});function KN(e){F(Array.isArray(e),()=>"The argument passed to tf.addN() must be a list of tensors"),F(e.length>=1,()=>`Must pass at least one tensor to tf.addN(), but got ${e.length}`);let t=e.map((r,s)=>M(r,`tensors${s}`,"addN")),n=t[0];t.forEach(r=>{if(r.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),t.forEach(r=>{if(!er(r.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});let a=t;return D.runKernel(os,a)}var gc=O({addN_:KN});function ZN(e,t=null,n=!1){let a={x:M(e,"x","all","bool")},r={axis:t,keepDims:n};return D.runKernel(ao,a,r)}var xc=O({all_:ZN});function YN(e,t=null,n=!1){let a={x:M(e,"x","any","bool")},r={axis:t,keepDims:n};return D.runKernel(ro,a,r)}var Uu=O({any_:YN});function JN(e,t=0){let n={x:M(e,"x","argMax")},a={axis:t};return D.runKernel(ls,n,a)}var Hu=O({argMax_:JN});function QN(e,t=0){let n={x:M(e,"x","argMin")},a={axis:t};return D.runKernel(yu,n,a)}var eA=O({argMin_:QN});function eT(e){let t={x:M(e,"x","asin")};return D.runKernel(so,t)}var tA=O({asin_:eT});function tT(e){let t={x:M(e,"x","asinh")};return D.runKernel(io,t)}var nA=O({asinh_:tT});function nT(e){let t={x:M(e,"x","atan")};return D.runKernel(oo,t)}var aA=O({atan_:nT});function aT(e,t){let n=M(e,"a","atan2"),a=M(t,"b","atan2");[n,a]=bt(n,a);let r={a:n,b:a};return D.runKernel(uo,r)}var rA=O({atan2_:aT});function rT(e){let t={x:M(e,"x","atanh")};return D.runKernel(lo,t)}var sA=O({atanh_:rT});function sT(e,t,n,a,r="NHWC",s){let i=e[3],o=[...t,i],l=Nb(r);return Gu(e,o,n,s,a,null,null,l)}function Tb(e,t,n,a,r,s,i="channelsLast"){let[o,l]=bc(t),d;if(i==="channelsLast")d=[o,l,e[3],e[3]];else if(i==="channelsFirst")d=[o,l,e[1],e[1]];else throw new Error(`Unknown dataFormat ${i}`);return Gu(e,d,n,a,r,s,!1,i)}function iT(e,t,n,a,r,s,i="NDHWC"){let[o,l,d]=iA(t),u,p;if(i==="NDHWC")p="channelsLast",u=[o,l,d,e[4],e[4]];else if(i==="NCDHW")p="channelsFirst",u=[o,l,d,e[1],e[1]];else throw new Error(`Unknown dataFormat ${i}`);return Eb(e,u,n,a,r,!1,p,s)}function Gu(e,t,n,a,r,s,i=!1,o="channelsLast"){let[l,d,u,p]=[-1,-1,-1,-1];if(o==="channelsLast")[l,d,u,p]=e;else if(o==="channelsFirst")[l,p,d,u]=e;else throw new Error(`Unknown dataFormat ${o}`);let[c,h,,m]=t,[f,A]=bc(n),[y,g]=bc(a),x=pl(c,y),w=pl(h,g),{padInfo:b,outHeight:v,outWidth:N}=oT(r,d,u,f,A,x,w,s,o),T=i?m*p:m,R;return o==="channelsFirst"?R=[l,T,v,N]:o==="channelsLast"&&(R=[l,v,N,T]),{batchSize:l,dataFormat:o,inHeight:d,inWidth:u,inChannels:p,outHeight:v,outWidth:N,outChannels:T,padInfo:b,strideHeight:f,strideWidth:A,filterHeight:c,filterWidth:h,effectiveFilterHeight:x,effectiveFilterWidth:w,dilationHeight:y,dilationWidth:g,inShape:e,outShape:R,filterShape:t}}function Eb(e,t,n,a,r,s=!1,i="channelsLast",o){let[l,d,u,p,c]=[-1,-1,-1,-1,-1];if(i==="channelsLast")[l,d,u,p,c]=e;else if(i==="channelsFirst")[l,c,d,u,p]=e;else throw new Error(`Unknown dataFormat ${i}`);let[h,m,f,,A]=t,[y,g,x]=iA(n),[w,b,v]=iA(a),N=pl(h,w),T=pl(m,b),R=pl(f,v),{padInfo:$,outDepth:z,outHeight:P,outWidth:V}=lT(r,d,u,p,y,g,x,N,T,R,o),j=s?A*c:A,U;return i==="channelsFirst"?U=[l,j,z,P,V]:i==="channelsLast"&&(U=[l,z,P,V,j]),{batchSize:l,dataFormat:i,inDepth:d,inHeight:u,inWidth:p,inChannels:c,outDepth:z,outHeight:P,outWidth:V,outChannels:j,padInfo:$,strideDepth:y,strideHeight:g,strideWidth:x,filterDepth:h,filterHeight:m,filterWidth:f,effectiveFilterDepth:N,effectiveFilterHeight:T,effectiveFilterWidth:R,dilationDepth:w,dilationHeight:b,dilationWidth:v,inShape:e,outShape:U,filterShape:t}}function uT(e,t,n,a,r){a==null&&(a=oA(e,t,n));let s=e[0],i=e[1],o=di((s-t+2*a)/n+1,r),l=di((i-t+2*a)/n+1,r);return[o,l]}function dT(e,t,n,a,r,s){r==null&&(r=oA(e,t,a));let i=e[0],o=e[1],l=e[2],d=di((i-t+2*r)/a+1,s),u=di((o-t+2*r)/a+1,s),p=di((l-t+2*r)/a+1,s);return[d,u,p,n]}function oA(e,t,n,a=1){let r=pl(t,a);return Math.floor((e[0]*(n-1)-n+r)/2)}function bc(e){return typeof e=="number"?[e,e,e]:e.length===2?[e[0],e[1],1]:e}function iA(e){return typeof e=="number"?[e,e,e]:e}function pl(e,t){return t<=1?e:e+(e-1)*(t-1)}function oT(e,t,n,a,r,s,i,o,l){let d,u,p;if(typeof e=="number"){d={top:e,bottom:e,left:e,right:e,type:e===0?"VALID":"NUMBER"};let c=uT([t,n],s,a,e,o);u=c[0],p=c[1]}else if(e==="same"){u=Math.ceil(t/a),p=Math.ceil(n/r);let c=Math.max(0,(u-1)*a+s-t),h=Math.max(0,(p-1)*r+i-n),m=Math.floor(c/2),f=c-m,A=Math.floor(h/2),y=h-A;d={top:m,bottom:f,left:A,right:y,type:"SAME"}}else if(e==="valid")d={top:0,bottom:0,left:0,right:0,type:"VALID"},u=Math.ceil((t-s+1)/a),p=Math.ceil((n-i+1)/r);else if(typeof e=="object"){let c=l==="channelsLast"?e[1][0]:e[2][0],h=l==="channelsLast"?e[1][1]:e[2][1],m=l==="channelsLast"?e[2][0]:e[3][0],f=l==="channelsLast"?e[2][1]:e[3][1];d={top:c,bottom:h,left:m,right:f,type:c===0&&h===0&&m===0&&f===0?"VALID":"EXPLICIT"},u=di((t-s+c+h)/a+1,o),p=di((n-i+m+f)/r+1,o)}else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:d,outHeight:u,outWidth:p}}function lT(e,t,n,a,r,s,i,o,l,d,u){let p,c,h,m;if(typeof e=="number"){p={top:e,bottom:e,left:e,right:e,front:e,back:e,type:e===0?"VALID":"NUMBER"};let f=dT([t,n,a,1],o,1,r,e,u);c=f[0],h=f[1],m=f[2]}else if(e==="same"){c=Math.ceil(t/r),h=Math.ceil(n/s),m=Math.ceil(a/i);let f=(c-1)*r+o-t,A=(h-1)*s+l-n,y=(m-1)*i+d-a,g=Math.floor(f/2),x=f-g,w=Math.floor(A/2),b=A-w,v=Math.floor(y/2),N=y-v;p={top:w,bottom:b,left:v,right:N,front:g,back:x,type:"SAME"}}else if(e==="valid")p={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},c=Math.ceil((t-o+1)/r),h=Math.ceil((n-l+1)/s),m=Math.ceil((a-d+1)/i);else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:p,outDepth:c,outHeight:h,outWidth:m}}function di(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 Mr(e){let[t,n,a]=bc(e);return t===1&&n===1&&a===1}function za(e,t){return Mr(e)||Mr(t)}function Nb(e){if(e==="NHWC")return"channelsLast";if(e==="NCHW")return"channelsFirst";throw new Error(`Unknown dataFormat ${e}`)}function pT(e,t){let n={x:M(e,"x","reshape","string_or_numeric")},a={shape:t};return D.runKernel(Bo,n,a)}var H=O({reshape_:pT});function cT(e,t,n,a,r){let s=M(e,"x","avgPool","float32"),i=1;F(za(n,i),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${i}'`);let o=s,l=!1;s.rank===3&&(l=!0,o=H(s,[1,s.shape[0],s.shape[1],s.shape[2]])),F(o.rank===4,()=>`Error in avgPool: x must be rank 4 but got rank ${o.rank}.`),r!=null&&F(Vt(a),()=>`Error in avgPool: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let d={x:o},u={filterSize:t,strides:n,pad:a,dimRoundingMode:r},p=D.runKernel(us,d,u);return p=fe(p,s.dtype),l?H(p,[p.shape[1],p.shape[2],p.shape[3]]):p}var qu=O({avgPool_:cT});function hT(e,t,n,a,r,s="NDHWC"){let i=M(e,"x","avgPool3d","float32"),o=i,l=!1;i.rank===4&&(l=!0,o=H(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),F(o.rank===5,()=>`Error in avgPool3d: x must be rank 5 but got rank ${o.rank}.`),F(s==="NDHWC",()=>`Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`),r!=null&&F(Vt(a),()=>`Error in avgPool3d: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let d={x:o},u={filterSize:t,strides:n,pad:a,dimRoundingMode:r,dataFormat:s},p=D.runKernel(gu,d,u);return p=fe(p,o.dtype),l?H(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}var lA=O({avgPool3d_:hT});function fT(e,t=0){F(e.length>=1,()=>"Pass at least one tensor to concat");let n=Vu(e,"tensors","concat","string_or_numeric");if(n[0].dtype==="complex64"&&n.forEach(s=>{if(s.dtype!=="complex64")throw new Error(`Cannot concatenate complex64 tensors with a tensor + with dtype ${s.dtype}. `)}),n.length===1)return Oa(n[0]);let a=n,r={axis:t};return D.runKernel(po,a,r)}var ot=O({concat_:fT});function mT(e){let t={x:M(e,"x","sigmoid")};return D.runKernel(Gs,t)}var wn=O({sigmoid_:mT});function AT(e,t,n){let a=M(e,"x","slice","string_or_numeric");if(a.rank===0)throw new Error("Slicing scalar is not possible");let r={x:a},s={begin:t,size:n};return D.runKernel(Ho,r,s)}var Re=O({slice_:AT});function yT(e){let t={x:M(e,"x","tanh")};return D.runKernel(Qs,t)}var pi=O({tanh_:yT});function gT(e,t,n,a,r,s){let i=M(e,"forgetBias","basicLSTMCell"),o=M(t,"lstmKernel","basicLSTMCell"),l=M(n,"lstmBias","basicLSTMCell"),d=M(a,"data","basicLSTMCell"),u=M(r,"c","basicLSTMCell"),p=M(s,"h","basicLSTMCell"),c=ot([d,p],1),h=Be(c,o),m=se(h,l),f=m.shape[0],A=m.shape[1]/4,y=[f,A],g=Re(m,[0,0],y),x=Re(m,[0,A],y),w=Re(m,[0,A*2],y),b=Re(m,[0,A*3],y),v=se(_(wn(g),pi(x)),_(u,wn(se(i,w)))),N=_(pi(v),wn(b));return[v,N]}var xT=O({basicLSTMCell_:gT});function bT(e,t,n){let a=M(e,"x","batchToSpaceND"),r=t.reduce((o,l)=>o*l);F(a.rank>=1+t.length,()=>`input rank is ${a.rank} but should be > than blockShape.length ${t.length}`),F(n.length===t.length,()=>`crops.length is ${n.length} but should be equal to blockShape.length ${t.length}`),F(a.shape[0]%r==0,()=>`input tensor batch is ${a.shape[0]} but is not divisible by the product of the elements of blockShape ${t.join(" * ")} === ${r}`);let s={x:a},i={blockShape:t,crops:n};return D.runKernel(xu,s,i)}var Xu=O({batchToSpaceND_:bT});function vT(e){let t;return e.rank===0||e.rank===1?t=H(e,[1,1,1,e.size]):e.rank===2?t=H(e,[1,1,e.shape[0],e.shape[1]]):e.rank===3?t=H(e,[1,e.shape[0],e.shape[1],e.shape[2]]):t=e,t}function wT(e,t,n,a,r,s){s==null&&(s=.001);let i=M(e,"x","batchNorm"),o=M(t,"mean","batchNorm"),l=M(n,"variance","batchNorm"),d;r!=null&&(d=M(r,"scale","batchNorm"));let u;a!=null&&(u=M(a,"offset","batchNorm")),F(o.rank===l.rank,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),F(u==null||o.rank===u.rank,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),F(d==null||o.rank===d.rank,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let p={x:vT(i),scale:d,offset:u,mean:o,variance:l},c={varianceEpsilon:s},h=D.runKernel(ws,p,c);return H(h,i.shape)}var ci=O({batchNorm_:wT});function kT(e,t,n,a,r,s){let i=M(e,"x","batchNorm"),o=M(t,"mean","batchNorm"),l=M(n,"variance","batchNorm"),d;r!=null&&(d=M(r,"scale","batchNorm"));let u;return a!=null&&(u=M(a,"offset","batchNorm")),F(i.rank===2,()=>`Error in batchNorm2D: x must be rank 2 but got rank ${i.rank}.`),F(o.rank===2||o.rank===1,()=>`Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${o.rank}.`),F(l.rank===2||l.rank===1,()=>`Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${l.rank}.`),d!=null&&F(d.rank===2||d.rank===1,()=>`Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${d.rank}.`),u!=null&&F(u.rank===2||u.rank===1,()=>`Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${u.rank}.`),ci(i,o,l,u,d,s)}var Cb=O({batchNorm2d_:kT});function IT(e,t,n,a,r,s){let i=M(e,"x","batchNorm"),o=M(t,"mean","batchNorm"),l=M(n,"variance","batchNorm"),d;r!=null&&(d=M(r,"scale","batchNorm"));let u;return a!=null&&(u=M(a,"offset","batchNorm")),F(i.rank===3,()=>`Error in batchNorm3D: x must be rank 3 but got rank ${i.rank}.`),F(o.rank===3||o.rank===1,()=>`Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${o.rank}.`),F(l.rank===3||l.rank===1,()=>`Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${l.rank}.`),d!=null&&F(d.rank===3||d.rank===1,()=>`Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${d.rank}.`),u!=null&&F(u.rank===3||u.rank===1,()=>`Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${u.rank}.`),ci(i,o,l,u,d,s)}var Rb=O({batchNorm3d_:IT});function ST(e,t,n,a,r,s){let i=M(e,"x","batchNorm"),o=M(t,"mean","batchNorm"),l=M(n,"variance","batchNorm"),d;r!=null&&(d=M(r,"scale","batchNorm"));let u;return a!=null&&(u=M(a,"offset","batchNorm")),F(i.rank===4,()=>`Error in batchNorm4D: x must be rank 4 but got rank ${i.rank}.`),F(o.rank===4||o.rank===1,()=>`Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${o.rank}.`),F(l.rank===4||l.rank===1,()=>`Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${l.rank}.`),d!=null&&F(d.rank===4||d.rank===1,()=>`Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${d.rank}.`),u!=null&&F(u.rank===4||u.rank===1,()=>`Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${u.rank}.`),ci(i,o,l,u,d,s)}var Mb=O({batchNorm4d_:ST});function NT(e,t,n){let a=M(e,"x","bincount"),r=M(t,"weights","bincount");F(a.dtype==="int32",()=>`Error in bincount: input dtype must be int32, but got ${a.dtype}`),F(n>=0,()=>`size must be non-negative, but got ${n}.`),F(r.size===a.size||r.size===0,()=>`Error in bincount: weights must have the same size as input or0-length, but got input shape: ${a.shape}, weights shape: ${r.shape}.`);let s={x:a,weights:r},i={size:n};return D.runKernel(Mp,s,i)}var uA=O({bincount_:NT});function TT(e,t){let n=M(e,"broadcastTo","x"),a=n.shape;if(t.some(l=>!(l>0)||l%1!=0))throw new Error(`broadcastTo(): Invalid broadcast shape [${t}].`);if(t.lengthn.rank){let l=n.shape.slice();for(;l.length=0;l--)if(r[l]===t[l])s[l]=1;else if(n.shape[l]!==1)throw new Error(`broadcastTo(): [${a}] cannot be broadcast to [${t}].`);if(s.map((l,d)=>l>1?d:-1).filter(l=>l>=0).length===0)return Oa(n);let i={x:n},o={reps:s};return D.runKernel(Sr,i,o)}var cl=O({broadcastTo_:TT});function ET(e){let t={x:M(e,"x","ceil")};return D.runKernel(cs,t)}var dA=O({ceil_:ET});function CT(e,t,n){let a=M(e,"x","clipByValue");F(t<=n,()=>`Error in clip: min (${t}) must be less than or equal to max (${n}).`);let r={x:a},s={clipValueMin:t,clipValueMax:n};return D.runKernel(Ir,r,s)}var kn=O({clipByValue_:CT});function RT(e){return ot(e,0)}var Fb=O({concat1d_:RT});function MT(e,t){return ot(e,t)}var hl=O({concat2d_:MT});function FT(e,t){return ot(e,t)}var $b=O({concat3d_:FT});function $T(e,t){return ot(e,t)}var Db=O({concat4d_:$T});function DT(e,t,n,a,r="NHWC",s=[1,1],i){let o=M(e,"x","conv2d"),l=M(t,"filter","conv2d"),d=o,u=!1;o.rank===3&&(u=!0,d=H(o,[1,o.shape[0],o.shape[1],o.shape[2]])),F(d.rank===4,()=>`Error in conv2d: input must be rank 4, but got rank ${d.rank}.`),F(l.rank===4,()=>`Error in conv2d: filter must be rank 4, but got rank ${l.rank}.`),i!=null&&F(Vt(a),()=>`Error in conv2d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`);let p=r==="NHWC"?d.shape[3]:d.shape[1];F(p===l.shape[2],()=>`Error in conv2d: depth of input (${p}) must match input depth for filter ${l.shape[2]}.`),F(za(n,s),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`);let c={x:d,filter:l},h={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i},m=D.runKernel(hs,c,h);return u?H(m,[m.shape[1],m.shape[2],m.shape[3]]):m}var ar=O({conv2d_:DT});function OT(e,t,n,a,r="NWC",s=1,i){let o=M(e,"x","conv1d"),l=M(t,"filter","conv1d"),d=o,u=!1;o.rank===2&&(u=!0,d=H(o,[1,o.shape[0],o.shape[1]])),F(d.rank===3,()=>`Error in conv1d: input must be rank 3, but got rank ${d.rank}.`),F(l.rank===3,()=>`Error in conv1d: filter must be rank 3, but got rank ${l.rank}.`),i!=null&&F(Vt(a),()=>`Error in conv1d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`),F(d.shape[2]===l.shape[1],()=>`Error in conv1d: depth of input (${d.shape[2]}) must match input depth for filter ${l.shape[1]}.`),F(za(n,s),()=>`Error in conv1D: Either stride or dilation must be 1. Got stride ${n} and dilation '${s}'`),F(r==="NWC",()=>`Error in conv1d: got dataFormat of ${r} but only NWC is currently supported.`);let p=H(l,[1,l.shape[0],l.shape[1],l.shape[2]]),c=H(d,[d.shape[0],1,d.shape[1],d.shape[2]]),h=ar(c,p,[1,n],a,"NHWC",[1,s],i);return u?H(h,[h.shape[2],h.shape[3]]):H(h,[h.shape[0],h.shape[2],h.shape[3]])}var vc=O({conv1d_:OT});function zT(e,t,n,a,r,s="NHWC",i){F(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let o=e,l=t,d=!1;t.rank===3&&(d=!0,l=H(t,[1,t.shape[0],t.shape[1],t.shape[2]]),o=[1,e[0],e[1],e[2]]),F(o.length===4,()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${o.length}.`),F(l.rank===4,()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${l.rank}`),F(n.rank===4,()=>`Error in conv2dDerInput: filter must be rank 4, but got rank ${n.rank}`);let u=s==="NHWC"?o[3]:o[1],p=s==="NHWC"?l.shape[3]:l.shape[1];F(u===n.shape[2],()=>`Error in conv2dDerInput: depth of input (${u}) must match input depth for filter ${n.shape[2]}.`),F(p===n.shape[3],()=>`Error in conv2dDerInput: depth of output (${p}) must match output depth for filter ${n.shape[3]}.`),i!=null&&F(Vt(r),()=>`Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode ${i} but got pad ${r}.`);let c={dy:l,filter:n},h={strides:a,pad:r,dataFormat:s,dimRoundingMode:i,inputShape:o},m=D.runKernel(fs,c,h);return d?H(m,[m.shape[1],m.shape[2],m.shape[3]]):m}var pA=O({conv2DBackpropInput_:zT});function _T(e,t,n,a,r,s){let i=M(e,"x","conv2dTranspose"),o=M(t,"filter","conv2dTranspose");return pA(n,i,o,a,r,"NHWC",s)}var wc=O({conv2dTranspose_:_T});function PT(e,t,n,a,r="NDHWC",s=[1,1,1]){let i=M(e,"x","conv3d"),o=M(t,"filter","conv3d"),l=i,d=!1;i.rank===4&&(d=!0,l=H(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),F(l.rank===5,()=>`Error in conv3d: input must be rank 5, but got rank ${l.rank}.`),F(o.rank===5,()=>`Error in conv3d: filter must be rank 5, but got rank ${o.rank}.`),F(l.shape[4]===o.shape[3],()=>`Error in conv3d: depth of input (${l.shape[4]}) must match input depth for filter ${o.shape[3]}.`),F(za(n,s),()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),F(r==="NDHWC",()=>`Error in conv3d: got dataFormat of ${r} but only NDHWC is currently supported.`);let u={x:l,filter:o},p={strides:n,pad:a,dataFormat:r,dilations:s},c=D.runKernel(vu,u,p);return d?H(c,[c.shape[1],c.shape[2],c.shape[3],c.shape[4]]):c}var cA=O({conv3d_:PT});function LT(e,t,n,a,r){F(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let s=e,i=t,o=!1;t.rank===4&&(o=!0,i=H(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]]),s=[1,e[0],e[1],e[2],e[3]]);let l=s[4],d=i.shape[4];F(s.length===5,()=>`Error in conv3dDerInput: inShape must be length 5, but got length ${s.length}.`),F(i.rank===5,()=>`Error in conv3dDerInput: dy must be rank 5, but got rank ${i.rank}`),F(n.rank===5,()=>`Error in conv3dDerInput: filter must be rank 5, but got rank ${n.rank}`),F(l===n.shape[3],()=>`Error in conv3dDerInput: depth of input (${l}) must match input depth for filter ${n.shape[3]}.`),F(d===n.shape[4],()=>`Error in conv3dDerInput: depth of output (${d}) must match output depth for filter ${n.shape[4]}.`);let u={dy:i,filter:n},p={pad:r,strides:a,inputShape:s},c=D.runKernel(Op,u,p);return o?H(c,[c.shape[1],c.shape[2],c.shape[3],c.shape[4]]):c}var Ob=O({conv3DBackpropInput_:LT});function WT(e,t,n,a,r){let s=M(e,"x","conv3dTranspose"),i=M(t,"filter","conv3dTranspose");return Ob(n,s,i,a,r)}var zb=O({conv3dTranspose_:WT});function BT(e){let t={x:M(e,"x","cos")};return D.runKernel(ms,t)}var Ku=O({cos_:BT});function VT(e){let t={x:M(e,"x","cosh")};return D.runKernel(co,t)}var kc=O({cosh_:VT});function jT(e,t=0,n=!1,a=!1){let r={x:M(e,"x","cumsum")},s={axis:t,exclusive:n,reverse:a};return D.runKernel(As,r,s)}var Ic=O({cumsum_:jT});function UT(e,t,n,a=!1){let r=M(e,"x","denseBincount"),s=M(t,"weights","denseBincount");F(r.dtype==="int32",()=>`Error in denseBincount: input dtype must be int32, but got ${r.dtype}`),F(r.rank<=2,()=>`Error in denseBincount: input must be at most rank 2, but got rank ${r.rank}.`),F(n>=0,()=>`size must be non-negative, but got ${n}.`),F(s.size===r.size||s.size===0,()=>`Error in denseBincount: weights must have the same shape as x or 0-length, but got x shape: ${r.shape}, weights shape: ${s.shape}.`);let i={x:r,weights:s},o={size:n,binaryOutput:a};return D.runKernel(zp,i,o)}var _b=O({denseBincount_:UT});function HT(e,t,n="NHWC"){let a=M(e,"x","depthToSpace"),r=n==="NHWC"?a.shape[1]:a.shape[2],s=n==="NHWC"?a.shape[2]:a.shape[3],i=n==="NHWC"?a.shape[3]:a.shape[1];F(r*t>=0,()=>`Negative dimension size caused by overflow when multiplying ${r} and ${t} for depthToSpace with input shape ${a.shape}`),F(s*t>=0,()=>`Negative dimension size caused by overflow when multiplying ${s} and ${t} for depthToSpace with input shape - ${a.shape}`),F(i%(t*t)==0,()=>`Dimension size must be evenly divisible by ${t*t} but is ${i} for depthToSpace with input shape ${a.shape}`);let o={x:a},l={blockSize:t,dataFormat:n};return D.runKernel(ho,o,l)}var cA=O({depthToSpace_:UT});function HT(e,t,n,a,r="NHWC",s=[1,1],i){let o=M(e,"x","depthwiseConv2d"),l=M(t,"filter","depthwiseConv2d"),d=o,u=!1;o.rank===3&&(u=!0,d=H(o,[1,o.shape[0],o.shape[1],o.shape[2]])),F(d.rank===4,()=>`Error in depthwiseConv2d: input must be rank 4, but got rank ${d.rank}.`),F(l.rank===4,()=>`Error in depthwiseConv2d: filter must be rank 4, but got rank ${l.rank}.`),F(d.shape[3]===l.shape[2],()=>`Error in depthwiseConv2d: number of input channels (${d.shape[3]}) must match the inChannels dimension in filter ${l.shape[2]}.`),i!=null&&F(Vt(a),()=>`Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`);let p={x:d,filter:l},c={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i},h=D.runKernel(As,p,c);return u?H(h,[h.shape[1],h.shape[2],h.shape[3]]):h}var hl=O({depthwiseConv2d_:HT});function GT(e){let t={x:M(e,"x","diag")};return D.runKernel(Pp,t)}var qT=O({diag_:GT});function XT(e,t,n,a,r=[1,1],s="NHWC"){let i=M(e,"x","dilation2d"),o=M(t,"filter","dilation2d");F(i.rank===3||i.rank===4,()=>`Error in dilation2d: input must be rank 3 or 4, but got rank ${i.rank}.`),F(o.rank===3,()=>`Error in dilation2d: filter must be rank 3, but got rank ${o.rank}.`),F(s==="NHWC",()=>`Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${s}`);let l=i,d=!1;i.rank===3&&(l=H(i,[1,i.shape[0],i.shape[1],i.shape[2]]),d=!0);let u={x:l,filter:o},p={strides:n,pad:a,dilations:r},c=D.runKernel(vu,u,p);return d?H(c,[c.shape[1],c.shape[2],c.shape[3]]):c}var hA=O({dilation2d_:XT});function KT(e,t){let n=e.length,a=[];for(let r=0;r1&&i===1&&a.unshift(s)}return a}function zt(e,t){let n=[];for(let a=0;a1)&&n.unshift(s)}return n}function pt(e,t){let n=[],a=Math.max(e.length,t.length);for(let r=0;r`Error in dot: inputs must all be rank 1 or 2, but got ranks ${n.rank} and ${a.rank}.`);let r=n.rank===1?n.size:n.shape[1],s=a.rank===1?a.size:a.shape[0];if(F(r===s,()=>`Error in dot: inner dimensions of inputs must match, but got ${r} and ${s}.`),n.rank===1&&a.rank===1){let i=H(n,[1,-1]),o=H(a,[-1,1]),l=Be(i,o);return H(l,[])}else if(n.rank===1&&a.rank===2){let i=H(n,[1,-1]),o=H(a,[a.shape[0],a.shape[1]]),l=Be(i,o);return H(l,[l.size])}else if(n.rank===2&&a.rank===1){let i=H(a,[-1,1]),o=Be(n,i);return H(o,[o.size])}else{let i=H(a,[a.shape[0],a.shape[1]]);return Be(n,i)}}var _b=O({dot_:eE});function tE(e,...t){let n=t.map((r,s)=>M(r,`tensors${s}`,"einsum")),a={equation:e};return D.runKernel(Bp,n,a)}var Pb=O({einsum_:tE});function nE(e){let t={x:M(e,"x","elu")};return D.runKernel(fo,t)}var fl=O({elu_:nE});function aE(e){let t=M(e,"x","erf");F(t.dtype==="int32"||t.dtype==="float32",()=>"Input dtype must be `int32` or `float32`."),t.dtype==="int32"&&(t=fe(t,"float32"));let n={x:t};return D.runKernel(mo,n)}var mA=O({erf_:aE});function rE(e){let t={x:M(e,"x","exp")};return D.runKernel(gs,t)}var qn=O({exp_:rE});function sE(e,t=0){let n=M(e,"x","expandDims","string_or_numeric");F(t<=n.rank,()=>"Axis must be <= rank of the tensor");let a={input:n},r={dim:t};return D.runKernel(yo,a,r)}var ln=O({expandDims_:sE});function iE(e){let t={x:M(e,"x","expm1")};return D.runKernel(go,t)}var AA=O({expm1_:iE});function oE(e,t){let n=M(e,"x","tile","string_or_numeric");F(n.rank===t.length,()=>`Error in transpose: rank of input ${n.rank} must match length of reps ${t}.`);let a={x:n},r={reps:t};return D.runKernel(Ir,a,r)}var Fr=O({tile_:oE});function lE(e,t,n,a="float32"){t==null&&(t=e);let r=We([e,t],a),s=e<=t?e:t;for(let o=0;o`Error in localResponseNormalization: x must be rank 3 or 4 but got - rank ${s.rank}.`),F(Vt(t),()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${t}.`);let i=s,o=!1;s.rank===3&&(o=!0,i=H(s,[1,s.shape[0],s.shape[1],s.shape[2]]));let l={x:i},d={depthRadius:t,bias:n,alpha:a,beta:r},u=D.runKernel(Su,l,d);return o?H(u,[u.shape[1],u.shape[2],u.shape[3]]):u}var xA=O({localResponseNormalization_:bE});function vE(e){let t={x:M(e,"x","log")};return D.runKernel(Ss,t)}var Fn=O({log_:vE});function wE(e){let t={x:M(e,"x","log1p")};return D.runKernel(Eo,t)}var Nc=O({log1p_:wE});function kE(e){return F(vr(e),()=>"The f passed in grad(f) must be a function"),(t,n)=>{let a=M(t,"x","tf.grad","string_or_numeric"),r=n!=null?M(n,"dy","tf.grad"):null;return D.tidy(()=>{let{value:s,grads:i}=D.gradients(()=>e(a),[a],r);return r!=null&&sn(s.shape,r.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),Tc(i),i[0]})}}function IE(e){return F(vr(e),()=>"The f passed in grads(f) must be a function"),(t,n)=>{F(Array.isArray(t),()=>"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s");let a=Bu(t,"args","tf.grads","string_or_numeric"),r=n!=null?M(n,"dy","tf.grads"):null;return D.tidy(()=>{let{value:s,grads:i}=D.gradients(()=>e(...a),a,r);return r!=null&&sn(s.shape,r.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Tc(i),i})}}function SE(e){return F(vr(e),()=>"The f passed in valueAndGrad(f) must be a function"),(t,n)=>{F(t instanceof Le,()=>"The x passed in valueAndGrad(f)(x) must be a tensor"),F(n==null||n instanceof Le,()=>"The dy passed in valueAndGrad(f)(x, dy) must be a tensor");let{grads:a,value:r}=D.gradients(()=>e(t),[t],n);return Tc(a),{grad:a[0],value:r}}}function NE(e){return F(vr(e),()=>"The f passed in valueAndGrads(f) must be a function"),(t,n)=>{F(Array.isArray(t)&&t.every(r=>r instanceof Le),()=>"The args passed in valueAndGrads(f)(args) must be array of tensors"),F(n==null||n instanceof Le,()=>"The dy passed in valueAndGrads(f)(args, dy) must be a tensor");let a=D.gradients(()=>e(...t),t,n);return n!=null&&sn(a.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Tc(a.grads),a}}function Vb(e,t){F(vr(e),()=>"The f passed in variableGrads(f) must be a function"),F(t==null||Array.isArray(t)&&t.every(d=>d instanceof Pu),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");let n=t!=null;if(!n){t=[];for(let d in D.registeredVariables)t.push(D.registeredVariables[d])}let a=n?t.filter(d=>!d.trainable):null,r=t.length;t=t.filter(d=>d.trainable),F(t.length>0,()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${r} variables is trainable.`);let s=!0,{value:i,grads:o}=D.gradients(e,t,null,s);F(o.some(d=>d!=null),()=>"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()."),F(i.rank===0,()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${i.rank} tensor`);let l={};return t.forEach((d,u)=>{o[u]!=null&&(l[d.name]=o[u])}),a!=null&&a.forEach(d=>l[d.name]=null),{value:i,grads:l}}function za(e){return D.customGrad(e)}function Tc(e){if(e.filter(t=>t==null).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.`)}function TE(e){let t={x:M(e,"x","neg")};return D.runKernel(Mo,t)}var vt=O({neg_:TE});function EE(e){let t={x:M(e,"x","softplus")};return D.runKernel(qo,t)}var hi=O({softplus_:EE});function CE(e){let t=M(e,"x","logSigmoid");return za(n=>({value:vt(hi(vt(n))),gradFunc:a=>_(a,wn(vt(n)))}))(t)}var jb=O({logSigmoid_:CE});function RE(e,t=null,n=!1){let a={x:M(e,"x","max")},r={reductionIndices:t,keepDims:n};return D.runKernel(Ns,a,r)}var Xn=O({max_:RE});function ME(e,t){let n=M(e,"a","sub"),a=M(t,"b","sub");[n,a]=bt(n,a);let r={a:n,b:a};return D.runKernel(Zs,r)}var ge=O({sub_:ME});function FE(e,t=null,n=!1){let a=M(e,"x","sum");a.dtype==="bool"&&(a=fe(a,"int32"));let r={x:a},s={axis:t,keepDims:n};return D.runKernel(qs,r,s)}var ke=O({sum_:FE});function $E(e,t=-1){let n=M(e,"logits","logSoftmax");if(t===-1&&(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}`);return za((a,r)=>{let s=!0,i=Xn(a,t,!0),o=ge(a,i),l=ge(fe(o,"float32"),Fn(ke(qn(o),t,s)));return r([l]),{value:l,gradFunc:(d,u)=>{let[p]=u,c=!0,h=qn(p);return ge(d,_(ke(d,t,c),h))}}})(n)}var Ec=O({logSoftmax_:$E});function bA(e,t){for(let n=0;ne[s]);return[n,r]}function fi(e,t){let n=t.map(a=>1);return Ub(e,n,t)}function DE(e,t,n){F(bA(t,n),()=>`${e} supports only inner-most axes for now. Got axes ${t} and rank-${n} input.`)}function Gb(e,t){if(bA(e,t))return null;let n=[];for(let a=0;an.push(a)),n}function vA(e){return e.map((t,n)=>[n,t]).sort((t,n)=>t[1]-n[1]).map(t=>t[0])}function OE(e,t){let n=[];for(let a=t-e;a`Error in maxPool: input must be rank 4 but got rank ${o.rank}.`),F(Oa(n,i),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${i}'`),r!=null&&F(Vt(a),()=>`Error in maxPool: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let d={x:o},u={filterSize:t,strides:n,pad:a,dimRoundingMode:r},p=D.runKernel(Es,d,u);return l?H(p,[p.shape[1],p.shape[2],p.shape[3]]):p}var Yu=O({maxPool_:BE});function VE(e,t=[1,1,1],n,a,r,s="NDHWC"){let i=M(e,"x","maxPool3d"),o=i,l=!1;i.rank===4&&(l=!0,o=H(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),F(o.rank===5,()=>`Error in maxPool3d: x must be rank 5 but got rank ${o.rank}.`),F(s==="NDHWC",()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`),r!=null&&F(Vt(a),()=>`Error in maxPool3d: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let d={x:o},u={filterSize:t,strides:n,pad:a,dimRoundingMode:r,dataFormat:s},p=D.runKernel(Nu,d,u);return l?H(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}var kA=O({maxPool3d_:VE});function jE(e,t,n,a,r=!1){let s={x:M(e,"x","maxPoolWithArgmax")},i={filterSize:t,strides:n,pad:a,includeBatchInIndex:r},o=D.runKernel(Zp,s,i);return{result:o[0],indexes:o[1]}}var Xb=O({maxPoolWithArgmax_:jE});function UE(e,t){let n=M(e,"a","maximum"),a=M(t,"b","maximum");[n,a]=bt(n,a),n.dtype==="bool"&&(n=fe(n,"int32"),a=fe(a,"int32")),pt(n.shape,a.shape);let r={a:n,b:a};return D.runKernel(Ts,r)}var _a=O({maximum_:UE});function HE(e,t=null,n=!1){let a={x:M(e,"x","mean")},r={axis:t,keepDims:n};return D.runKernel(Cs,a,r)}var wt=O({mean_:HE});function Ct(e,t="float32"){if(t==="complex64"){let a=Ct(e,"float32"),r=Ct(e,"float32");return Nr(a,r)}let n=Tp(Nt(e),t);return D.makeTensor(n,e,t)}function $n(e,t="float32"){if(t==="complex64"){let a=$n(e,"float32"),r=Ct(e,"float32");return Nr(a,r)}let n=Am(Nt(e),t);return D.makeTensor(n,e,t)}function GE(e,t,{indexing:n="xy"}={}){if(n!=="xy"&&n!=="ij")throw new TypeError(`${n} is not a valid third argument to meshgrid`);if(e===void 0)return[];let a=M(e,"x","meshgrid",e instanceof Le?e.dtype:"float32");if(t===void 0)return[a];let r=M(t,"y","meshgrid",t instanceof Le?t.dtype:"float32"),s=Nt(a.shape),i=Nt(r.shape);return n==="xy"?(a=H(a,[1,-1]),r=H(r,[-1,1]),[Be($n([i,1],a.dtype),a),Be(r,$n([1,s],r.dtype))]):(a=H(a,[-1,1]),r=H(r,[1,-1]),[Be(a,$n([1,i],a.dtype)),Be($n([s,1],r.dtype),r)])}function qE(e,t=null,n=!1){let a={x:M(e,"x","min")},r={axis:t,keepDims:n};return D.runKernel(Rs,a,r)}var yl=O({min_:qE});function XE(e,t){let n=M(e,"a","minimum"),a=M(t,"b","minimum");[n,a]=bt(n,a),n.dtype==="bool"&&(n=fe(n,"int32"),a=fe(a,"int32")),pt(n.shape,a.shape);let r={a:n,b:a};return D.runKernel(Ms,r)}var gl=O({minimum_:XE});function KE(e,t,n){F(n==="reflect"||n==="symmetric",()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${n}.`);let a=M(e,"x","mirrorPad");if(a.rank===0)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");F(t.length===a.rank,()=>`Padding doesn't match input. Must be ${a.rank}. Got ${t.length}.`);let r=n==="reflect"?1:0;for(let o=0;o"Invalid number of paddings. Must be length of 2 each."),F(t[o][0]>=0&&t[o][0]<=a.shape[o]-r&&t[o][1]>=0&&t[o][1]<=a.shape[o]-r,()=>`Padding in dimension ${o} cannot be greater than or equal to ${a.shape[o]-r} or less than 0 for input of shape ${a.shape}`);let s={paddings:t,mode:n},i={x:a};return D.runKernel(Fs,i,s)}var IA=O({mirrorPad_:KE});function ZE(e,t){let n=M(e,"a","mod"),a=M(t,"b","mod");[n,a]=bt(n,a);let r={a:n,b:a};return D.runKernel(Ro,r)}var SA=O({mod_:ZE});function YE(e){let t=M(e,"x","square"),n={};return D.runKernel("Square",{x:t},n)}var st=O({square_:YE});function JE(e,t=null,n=!1){e=M(e,"x","moments");let a=ra(t,e.shape),r=wt(e,a,n),s=r.shape;n||(s=fi(r.shape,a));let i=st(ge(fe(e,"float32"),H(r,s))),o=wt(i,a,n);return{mean:r,variance:o}}var Rc=O({moments_:JE});function QE(e,t,n,a){let r=M(t,"data","multiRNNCell"),s=Bu(n,"c","multiRNNCell"),i=Bu(a,"h","multiRNNCell"),o=r,l=[];for(let p=0;p2)throw new Error(`Rank of probabilities must be 1 or 2, but is ${i}`);n=n||Math.random();let o={logits:i===1?H(r,[1,-1]):r},l={numSamples:t,seed:n,normalized:a},d=D.runKernel(Yp,o,l);return i===1?H(d,[d.size]):d}var Kb=O({multinomial_:tC});function nC(e,t){let n=M(e,"a","notEqual"),a=M(t,"b","notEqual");[n,a]=bt(n,a),pt(n.shape,a.shape);let r={a:n,b:a};return D.runKernel(Fo,r)}var mi=O({notEqual_:nC});function aC(e){let t={x:M(e,"x","onesLike")};return D.runKernel(zo,t)}var Dn=O({onesLike_:aC});function rC(e,t){let n=M(e,"v1","outerProduct"),a=M(t,"v2","outerProduct");F(n.rank===1&&a.rank===1,()=>`Error in outerProduct: inputs must be rank 1, but got ranks ${n.rank} and ${a.rank}.`);let r=H(n,[-1,1]),s=H(a,[1,-1]);return Be(r,s)}var sC=O({outerProduct_:rC});function iC(e,t,n=0){let a=M(e,"x","pad");if(a.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");let r={paddings:t,constantValue:n},s={x:a};return D.runKernel(Os,s,r)}var ar=O({pad_:iC});function oC(e,t,n=0){return F(t.length===2,()=>"Invalid number of paddings. Must be length of 2."),ar(e,[t],n)}var lC=O({pad1d_:oC});function uC(e,t,n=0){return F(t.length===2&&t[0].length===2&&t[1].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),ar(e,t,n)}var dC=O({pad2d_:uC});function pC(e,t,n=0){return F(t.length===3&&t[0].length===2&&t[1].length===2&&t[2].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),ar(e,t,n)}var cC=O({pad3d_:pC});function hC(e,t,n=0){return F(t.length===4&&t[0].length===2&&t[1].length===2&&t[2].length===2&&t[3].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),ar(e,t,n)}var fC=O({pad4d_:hC});function mC(e,t,n){let a=M(e,"x","spaceToBatchND");F(a.rank>=1+t.length,()=>`input rank ${a.rank} should be > than [blockShape] ${t.length}`),F(n.length===t.length,()=>`paddings.shape[0] ${n.length} must be equal to [blockShape] ${t.length}`),F(a.shape.reduce((i,o,l)=>l>0&&l<=t.length?i&&(o+n[l-1][0]+n[l-1][1])%t[l-1]==0:i,!0),()=>`input spatial dimensions ${a.shape.slice(1)} with paddings ${n.toString()} must be divisible by blockShapes ${t.toString()}`);let r={x:a},s={blockShape:t,paddings:n};return D.runKernel(Cu,r,s)}var Ju=O({spaceToBatchND_:mC});function gC(e,t,n,a,r,s){r==null&&(r=[1,1]),s==null&&(s=1),a===0&&(a="valid");let i=M(e,"x","maxPool"),o=i,l=!1;i.rank===3&&(l=!0,o=H(i,[1,i.shape[0],i.shape[1],i.shape[2]])),F(Oa(s,r),()=>`Error in pool: Either strides or dilations must be 1. Got strides ${s} and dilations '${r}'`);let d=Nb(o.shape,t,s,r,a),u=[d.dilationHeight,d.dilationWidth],p;a==="same"?p=yC([d.filterHeight,d.filterWidth],u):p=[[0,0],[0,0]];let c=u[0]===1&&u[1]===1,[h,m]=AC([d.inHeight,d.inWidth],u,p),f=c?a:"valid",A=c?o:Ju(o,u,h),y=(n==="avg"?()=>Gu(A,t,s,f):()=>Yu(A,t,s,f))(),g=c?y:qu(y,u,m);return l?H(g,[g.shape[1],g.shape[2],g.shape[3]]):g}function AC(e,t,n){let a=n.map(u=>u[0]),r=n.map(u=>u[1]),s=e.concat(a,r),i=t.map((u,p)=>(u-s[p]%u)%u),o=r.map((u,p)=>u+i[p]),l=t.map((u,p)=>[a[p],o[p]]),d=t.map((u,p)=>[0,i[p]]);return[l,d]}function yC(e,t){let n=e.map((s,i)=>s+(s-1)*(t[i]-1)).map(s=>s-1),a=n.map(s=>Math.floor(s/2)),r=n.map((s,i)=>s-a[i]);return n.map((s,i)=>[a[i],r[i]])}var Zb=O({pool_:gC});function xC(e,t){let n=M(e,"base","pow"),a=M(t,"exp","pow");[n,a]=bt(n,a);let r={a:n,b:a};return D.runKernel(zs,r)}var rr=O({pow_:xC});function bC(e,t){let n=M(e,"x","prelu"),a=M(t,"alpha","prelu"),r={x:n,alpha:a};return D.runKernel(_s,r)}var Qu=O({prelu_:bC});function vC(e,t=null,n=!1){let a=M(e,"x","prod");a.dtype==="bool"&&(a=fe(a,"int32"));let r={x:a},s={axis:t,keepDims:n};return D.runKernel(Po,r,s)}var Mc=O({prod_:vC});function wC(e,t,n){let a=Nt(e),r=null;if(n==null||n==="float32")r=new Float32Array(a);else if(n==="int32")r=new Int32Array(a);else if(n==="bool")r=new Uint8Array(a);else throw new Error(`Unknown data type ${n}`);for(let s=0;s=1||s===0);let i=Math.sqrt(-2*Math.log(s)/s);e=this.mean+this.stdDev*a*i,t=this.mean+this.stdDev*r*i,(!this.truncated||this.isValidTruncated(e))&&(n=!0)}return(!this.truncated||this.isValidTruncated(t))&&(this.nextVal=this.convertValue(t)),this.convertValue(e)}convertValue(e){return this.dtype==null||this.dtype==="float32"?e:Math.round(e)}isValidTruncated(e){return e<=this.upper&&e>=this.lower}},IC=class{constructor(e,t,n,a){this.alpha=e,this.beta=1/t,this.dtype=n;let r=a||Math.random();this.randu=NA.alea(r.toString()),this.randn=new TA(0,1,n,!1,this.randu()),e<1?this.d=e+2/3:this.d=e-1/3,this.c=1/Math.sqrt(9*this.d)}nextValue(){let e,t,n,a,r,s;for(;;){do a=this.randn.nextValue(),s=1+this.c*a;while(s<=0);if(s*=s*s,e=a*a,t=1-.331*e*e,n=.5*e+this.d*(1-s+Math.log(s)),r=this.randu(),rthis.dtype==null||this.dtype==="float32",this.min=e,this.range=t-e,this.dtype=n,a==null&&(a=Math.random()),typeof a=="number"&&(a=a.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error(`The difference between ${e} - ${t} <= 1 and dtype is not float`);this.random=NA.alea(a)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}nextValue(){return this.convertValue(this.min+this.range*this.random())}};function NC(e,t,n=1,a="float32",r){if(n==null&&(n=1),a==null&&(a="float32"),a!=="float32"&&a!=="int32")throw new Error(`Unsupported data type ${a}`);let s=new IC(t,n,a,r),i=We(e,a);for(let o=0;o`Error in reverse1D: x must be rank 1 but got rank ${t.rank}.`),On(t,0)}var zC=O({reverse1d_:OC});function _C(e,t){let n=M(e,"x","reverse");return F(n.rank===2,()=>`Error in reverse2D: x must be rank 2 but got rank ${n.rank}.`),On(n,t)}var PC=O({reverse2d_:_C});function LC(e,t){let n=M(e,"x","reverse");return F(n.rank===3,()=>`Error in reverse3D: x must be rank 3 but got rank ${n.rank}.`),On(n,t)}var WC=O({reverse3d_:LC});function BC(e,t){let n=M(e,"x","reverse");return F(n.rank===4,()=>`Error in reverse4D: x must be rank 4 but got rank ${n.rank}.`),On(n,t)}var VC=O({reverse4d_:BC});function jC(e){let t={x:M(e,"x","round")};return D.runKernel(Vs,t)}var $c=O({round_:jC});function UC(e){let t={x:M(e,"x","rsqrt")};return D.runKernel(js,t)}var Dc=O({rsqrt_:UC});function Se(e,t){if((tn(e)&&t!=="string"||Array.isArray(e))&&t!=="complex64")throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if(t==="string"&&tn(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return Tr(e,[],[],t)}function HC(e){let t={x:M(e,"x","selu")};return D.runKernel(jo,t)}var Oc=O({selu_:HC});function GC(e,t,n,a,r,s=[1,1],i="NHWC"){let o=M(e,"x","separableConv2d"),l=M(t,"depthwiseFilter","separableConv2d"),d=M(n,"pointwiseFilter","separableConv2d"),u=o,p=!1;if(o.rank===3&&(p=!0,u=H(o,[1,o.shape[0],o.shape[1],o.shape[2]])),i==="NCHW")throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");F(u.rank===4,()=>`Error in separableConv2d: input must be rank 4, but got rank ${u.rank}.`),F(l.rank===4,()=>`Error in separableConv2d: depthwise filter must be rank 4, but got rank ${l.rank}.`),F(d.rank===4,()=>`Error in separableConv2d: pointwise filter must be rank 4, but got rank ${l.rank}.`),F(d.shape[0]===1,()=>`Error in separableConv2d: the first dimension of pointwise filter must be 1, but got ${d.shape[0]}.`),F(d.shape[1]===1,()=>`Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${d.shape[1]}.`);let c=l.shape[2],h=l.shape[3];F(d.shape[2]===c*h,()=>`Error in separableConv2d: the third dimension of pointwise filter must be ${c*h}, but got ${d.shape[2]}.`);let m=hl(u,l,a,r,i,s),f=nr(m,d,1,"valid",i);return p?H(f,[f.shape[1],f.shape[2],f.shape[3]]):f}var CA=O({separableConv2d_:GC});async function qC(e,t){let n=M(e,"x","setdiff1d"),a=M(t,"y","setdiff1d");F(n.dtype===a.dtype,()=>`x and y should have the same dtype, but got x (${n.dtype}) and y (${a.dtype}).`),F(n.rank===1,()=>`x should be 1D tensor, but got x (${n.shape}).`),F(a.rank===1,()=>`y should be 1D tensor, but got y (${a.shape}).`);let r=await n.data(),s=await a.data(),i=new Set(s),o=0;for(let u=0;u`slice1d expects a rank-1 tensor, but got a rank-${a.rank} tensor`),Re(a,[t],[n])}var Pc=O({slice1d_:YC});function JC(e,t,n){let a=M(e,"x","slice2d");return F(a.rank===2,()=>`slice2d expects a rank-2 tensor, but got a rank-${a.rank} tensor`),Re(a,t,n)}var MA=O({slice2d_:JC});function QC(e,t,n){let a=M(e,"x","slice3d");return F(a.rank===3,()=>`slice3d expects a rank-3 tensor, but got a rank-${a.rank} tensor`),Re(a,t,n)}var Lc=O({slice3d_:QC});function eR(e,t,n){let a=M(e,"x","slice4d");return F(a.rank===4,()=>`slice4d expects a rank-4 tensor, but got a rank-${a.rank} tensor`),Re(a,t,n)}var td=O({slice4d_:eR});function tR(e,t=-1){let n=M(e,"logits","softmax","float32");if(t===-1&&(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}`);let a={logits:n},r={dim:t};return D.runKernel(Xs,a,r)}var nd=O({softmax_:tR});function nR(e){F(e.dtype==="complex64",()=>`The dtype for tf.spectral.fft() must be complex64 but got ${e.dtype}.`);let t={input:e};return D.runKernel(jp,t)}var ad=O({fft_:nR});function aR(e){F(e.dtype==="complex64",()=>`The dtype for tf.spectral.ifft() must be complex64 but got ${e.dtype}.`);let t={input:e};return D.runKernel(Up,t)}var vl=O({ifft_:aR});function rR(e){let t=e.shape[e.shape.length-1],n=e.size/t,a;if(t<=2){let r=H(e,[n,t]);a=vl(r)}else{let r=[n,2*(t-1)],s=H(ed(e),[n,t]),i=H(Ic(e),[n,t]),o=On(Re(s,[0,1],[n,t-2]),1),l=_(On(Re(i,[0,1],[n,t-2]),1),Se(-1)),d=ot([s,o],1),u=ot([i,l],1),p=H(Nr(d,u),[r[0],r[1]]);a=vl(p)}if(a=ed(a),e.rank===3&&e.shape[0]!==0){let r=a,s=e.shape[0];a=H(a,[s,a.shape[0]/s,a.shape[1]]),r.dispose()}return a}var Wc=O({irfft_:rR});function sR(e,t,n=0){let a={x:M(e,"x","split")},r={numOrSizeSplits:t,axis:n};return D.runKernel(Xo,a,r)}var an=O({split_:sR});function iR(e,t){F(e.dtype==="float32",()=>`The dtype for rfft() must be real value but got ${e.dtype}`);let n=e.shape[e.shape.length-1],a=e.size/n,r;if(t!=null&&t0),f=e.shape.map(A=>A);f[e.shape.length-1]=t,r=Re(e,m,f),n=t}else if(t!=null&&t>n){let m=e.shape.map(f=>f);m[e.shape.length-1]=t-n,r=ot([e,Ct(m)],e.shape.length-1),n=t}else r=e;let s=Ue(r),i=H(Nr(r,s),[a,n]),o=ad(i),l=Math.floor(n/2)+1,d=ed(o),u=Ic(o),p=an(d,[l,n-l],d.shape.length-1),c=an(u,[l,n-l],u.shape.length-1),h=r.shape.slice();return h[r.shape.length-1]=l,H(Nr(p[0],c[0]),h)}var rd=O({rfft_:iR});function oR(e){let t={x:M(e,"x","sqrt")};return D.runKernel(Gs,t)}var Jt=O({sqrt_:oR});function lR(e,t){let n=M(e,"a","squaredDifference"),a=M(t,"b","squaredDifference");[n,a]=bt(n,a),pt(n.shape,a.shape);let r={a:n,b:a},s={};return D.runKernel(Ks,r,s)}var Bc=O({squaredDifference_:lR});function uR(e,t){let n=M(e,"x","squeeze");return H(n,xx(n.shape,t).newShape)}var Or=O({squeeze_:uR});function dR(e,t=0){let n=Bu(e,"tensors","stack","string_or_numeric");F(n.length>=1,()=>"Pass at least one tensor to tf.stack"),n.length>0&&F(t<=n[0].rank,()=>"Axis must be <= rank of the tensor");let a=n,r={axis:t};return D.runKernel(_o,a,r)}var zn=O({stack_:dR});function pR(e,t=0){let n={x:M(e,"x","step")},a={alpha:t};return D.runKernel(Sr,n,a)}var wl=O({step_:pR});function cR(e,t,n,a,r=0,s=0,i=0,o=0,l=0){let d={x:M(e,"x","stridedSlice")},u={begin:t,end:n,strides:a,beginMask:r,endMask:s,ellipsisMask:i,newAxisMask:o,shrinkAxisMask:l};return D.runKernel(Ko,d,u)}var FA=O({stridedSlice_:cR});function hR(e){let t={x:M(e,"x","tan")};return D.runKernel(Ys,t)}var $A=O({tan_:hR});function Tt(e,t){rs(e);let n=$a(e,t);if(n.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return Tr(e,null,n,t)}function ya(e,t,n){if(rs(e),t!=null&&t.length!==2)throw new Error("tensor2d() requires shape to have two numbers");let a=$a(e,n);if(a.length!==2&&a.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return Tr(e,t,a,n)}function fR(e,t,n){if(rs(e),t!=null&&t.length!==4)throw new Error("tensor4d() requires shape to have four numbers");let a=$a(e,n);if(a.length!==4&&a.length!==1)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return Tr(e,t,a,n)}function mR(e,t,n){if(rs(e),t!=null&&t.length!==5)throw new Error("tensor5d() requires shape to have five numbers");let a=$a(e,n);if(a.length!==5&&a.length!==1)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return Tr(e,t,a,n)}function AR(e,t,n){if(rs(e),t!=null&&t.length!==6)throw new Error("tensor6d() requires shape to have six numbers");let a=$a(e,n);if(a.length!==6&&a.length!==1)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return t=t||a,Tr(e,t,a,n)}function yR(e,t=1,n=!0){let a=M(e,"x","topk");if(a.rank===0)throw new Error("topk() expects the input to be of rank 1 or higher");let r=a.shape[a.shape.length-1];if(t>r)throw new Error(`'k' passed to topk() must be <= the last dimension (${r}) but got ${t}`);let s={x:a},i={k:t,sorted:n},[o,l]=D.runKernel(Zo,s,i);return{values:o,indices:l}}var DA=O({topk_:yR});function gR(e,t=0,n=1,a,r){if(a!=null&&a==="bool")throw new Error("Unsupported data type $ { dtype }");let s=new TA(t,n,a,!0,r),i=We(e,a);for(let o=0;o0,()=>"The input tensor must be at least 1D");let a={x:n},r={axis:t},[s,i]=D.runKernel(rc,a,r);return{values:s,indices:i}}var jc=O({unique_:xR});function bR(e,t,n){let a=M(e,"x","unsortedSegmentSum"),r=M(t,"segmentIds","unsortedSegmentSum","int32");F(Vt(n),()=>"numSegments must be of dtype int");let s={x:a,segmentIds:r},i={numSegments:n};return D.runKernel(Mu,s,i)}var OA=O({unsortedSegmentSum_:bR});function vR(e,t=0){let n=M(e,"x","unstack","string_or_numeric");F(t>=-n.shape.length&&t`Axis = ${t} is not in [-${n.shape.length}, ${n.shape.length})`);let a={value:n},r={axis:t};return D.runKernel(Jo,a,r)}var la=O({unstack_:vR});function Qb(e,t=!0,n,a){return D.makeVariable(e,t,n,a)}function e3(e,t){let n=[];for(let s=0;s0,()=>"mask cannot be scalar"),sn(o.slice(s,s+i),r.shape,"mask's shape must match the first K dimensions of tensor's shape,");let l=1;for(let f=s;f"Shape mismatch in v and x");let l=Se(1),d=ge(l,o),u=_(ge(i,s),d);if(r){F(a!=null,()=>"When using zeroDebias: true, step is required.");let p=M(a,"step","movingAverage");u=me(u,ge(l,rr(o,p)))}return se(s,u)}var TR=O({movingAverage_:NR});function ER(e,t,n){let a=M(e,"indices","scatterND","int32"),r=M(t,"updates","scatterND");Hm(r,a,n);let s={indices:a,updates:r},i={shape:n};return D.runKernel(Bo,s,i)}var n3=O({scatterND_:ER});function CR(e,t,n,a){if(e.dtype!=="int32")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}.`);let r=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}.`);let i=t.size;if(!(t.rank===0||t.rank===1&&i===r))throw new Error(`sparseValues has incorrect shape ${t.shape}, should be [] or [${r}]`);if(t.dtype!==a.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}function RR(e,t,n,a=0){let r=M(e,"sparseIndices","sparseToDense","int32"),s=M(t,"sparseValues","sparseToDense"),i=M(a,"defaultValue","sparseToDense",s.dtype);CR(r,s,n,i);let o={sparseIndices:r,sparseValues:s,defaultValue:i},l={outputShape:n};return D.runKernel(ac,o,l)}var _A=O({sparseToDense_:RR});function MR(e,t){let n=M(t,"indices","gatherND","int32"),a={params:M(e,"x","gatherND"),indices:n};return D.runKernel(vo,a)}var a3=O({gatherND_:MR});function FR(e,t){if(t==null)return e.shape.slice();if(Qa(e.shape,t))return t;if(e.shape.length===t.length){let n=[];for(let a=0;a`x has to be a floating point tensor since it's going to be scaled, but got a ${r.dtype} tensor instead.`),F(t>=0&&t<1,()=>`rate must be a float in the range [0, 1), but got ${t}.`),t===0)return e instanceof Le?r.clone():r;let s=FR(r,n),i=1-t,o=me(Al(se(xl(s,0,1,"float32",a),i)),i);return _(r,o)}var r3=O({dropout_:$R});function s3(e){return Math.floor(Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))))}function PA(e,t,n){let a=1-e%2,r=new Float32Array(e);for(let s=0;s1,()=>`inTopK() expects the predictions to be of rank 2 or higher, but got ${a.rank}`),F(a.rank-1===r.rank,()=>`predictions rank should be 1 larger than targets rank, but got predictions rank ${a.rank} and targets rank ${r.rank}`),sn(a.shape.slice(0,a.shape.length-1),r.shape,"predictions's shape should be align with the targets' shape, except the last dimension.");let s=a.shape[a.shape.length-1];F(n>0&&n<=s,()=>`'k' passed to inTopK() must be > 0 && <= the predictions last dimension (${s}), but got ${n}`);let i=await a.data(),o=await r.data(),[l,d]=[i.length/s,s],u=bx("bool",l);for(let p=0;pA.value-f.value),u[p]=0;for(let f=0;fzR,depthwiseConv2d:()=>_R,matMul:()=>PR});function LR(e,t,n,a,r,s="NHWC",i){let o=e;e.rank===3&&(o=H(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;l.rank===3&&(l=H(t,[1,t.shape[0],t.shape[1],t.shape[2]])),F(o.rank===4,()=>`Error in conv2dDerFilter: input must be rank 4, but got shape ${o.shape}.`),F(l.rank===4,()=>`Error in conv2dDerFilter: dy must be rank 4, but got shape ${l.shape}.`),F(n.length===4,()=>`Error in conv2dDerFilter: filterShape must be length 4, but got ${n}.`);let d=s==="NHWC"?o.shape[3]:o.shape[1],u=s==="NHWC"?l.shape[3]:l.shape[1];F(d===n[2],()=>`Error in conv2dDerFilter: depth of input ${d}) must match input depth in filter (${n[2]}.`),F(u===n[3],()=>`Error in conv2dDerFilter: depth of dy (${u}) must match output depth for filter (${n[3]}).`),i!=null&&F(Vt(r),()=>`Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode ${i} but got pad ${r}.`);let p={x:o,dy:l},c={strides:a,pad:r,dataFormat:s,dimRoundingMode:i,filterShape:n};return D.runKernel(Fp,p,c)}var LA=O({conv2DBackpropFilter_:LR});function Hc(e,t,n){if(n==null||n==="linear")return e;if(n==="relu")return _(e,wl(t));throw new Error(`Cannot compute gradient for fused activation ${n}.`)}function Gc(e,t){let n=t,a=zt(e.shape,t.shape);return a.length>0&&(n=ke(n,a)),H(n,e.shape)}function qc(e,t,n,a){if(t==="linear")return e;if(t==="relu")return Pa(e);if(t==="elu")return fl(e);if(t==="relu6")return Fc(e);if(t==="prelu")return Qu(e,n);if(t==="leakyrelu")return Ku(e,a);if(t==="sigmoid")return wn(e);throw new Error(`Unknown fused activation ${t}.`)}var Xc=(e,t)=>!(e>0)||t==="linear";function WR({x:e,filter:t,strides:n,pad:a,dataFormat:r="NHWC",dilations:s=[1,1],dimRoundingMode:i,bias:o,activation:l="linear",preluActivationWeights:d,leakyreluAlpha:u}){if(l=l||"linear",Xc(D.state.gradientDepth,l)===!1){let b=nr(e,t,n,a,r,s,i);return o!=null&&(b=se(b,o)),qc(b,l,d,u)}let p=M(e,"x","conv2d"),c=M(t,"filter","conv2d"),h=p,m=!1;p.rank===3&&(m=!0,h=H(p,[1,p.shape[0],p.shape[1],p.shape[2]])),F(h.rank===4,()=>`Error in fused conv2d: input must be rank 4, but got rank ${h.rank}.`),F(c.rank===4,()=>`Error in fused conv2d: filter must be rank 4, but got rank ${c.rank}.`),i!=null&&F(Vt(a),()=>`Error in fused conv2d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`),F(h.shape[3]===c.shape[2],()=>`Error in conv2d: depth of input (${h.shape[3]}) must match input depth for filter ${c.shape[2]}.`),F(Oa(n,s),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),F(r==="NHWC",()=>`Error in conv2d: got dataFormat of ${r} but only NHWC is currently supported.`);let f=Hu(h.shape,c.shape,n,s,a,i),A;o!=null&&(A=M(o,"bias","fused conv2d"),[A]=bt(A,p),pt(f.outShape,A.shape));let y;d!=null&&(y=M(d,"prelu weights","fused conv2d"));let g=(b,v)=>{let[N,T,R,$]=v,z=Hc(b,R,l);F(Rr(s),()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`);let P=dA(T.shape,z,N,n,a),V=LA(T,z,N.shape,n,a),j=[P,V];if($!=null){let U=Gc($,z);j.push(U)}return j},x={x:h,filter:c,bias:A,preluActivationWeights:y},w={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i,activation:l,leakyreluAlpha:u};return o==null?za((b,v,N)=>{let T=D.runKernel(ti,x,w);return N([v,b,T]),m&&(T=H(T,[T.shape[1],T.shape[2],T.shape[3]])),{value:T,gradFunc:g}})(h,c):za((b,v,N,T)=>{let R=D.runKernel(ti,x,w);return T([v,b,R,N]),m&&(R=H(R,[R.shape[1],R.shape[2],R.shape[3]])),{value:R,gradFunc:g}})(h,c,A)}var zR=O({fusedConv2d_:WR});function BR(e,t,n,a,r,s=[1,1],i){let o=e;e.rank===3&&(o=H(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;l.rank===3&&(l=H(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let d={x:o,dy:l},u={strides:a,pad:r,dimRoundingMode:i,dilations:s,filterShape:n};return D.runKernel(zp,d,u)}var i3=O({depthwiseConv2dNativeBackpropFilter_:BR});function VR(e,t,n,a,r,s=[1,1],i){let o=t,l=!1;t.rank===3&&(l=!0,o=H(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let d={dy:o,filter:n},u={strides:a,pad:r,dimRoundingMode:i,dilations:s,inputShape:e},p=D.runKernel(_p,d,u);return l?H(p,[p.shape[1],p.shape[2],p.shape[3]]):p}var o3=O({depthwiseConv2dNativeBackpropInput_:VR});function jR({x:e,filter:t,strides:n,pad:a,dataFormat:r="NHWC",dilations:s=[1,1],dimRoundingMode:i,bias:o,activation:l="linear",preluActivationWeights:d,leakyreluAlpha:u}){if(Xc(D.state.gradientDepth,l)===!1){let b=hl(e,t,n,a,r,s,i);return o!=null&&(b=se(b,o)),qc(b,l,d,u)}let p=M(e,"x","depthwiseConv2d"),c=M(t,"filter","depthwiseConv2d"),h=p,m=!1;p.rank===3&&(m=!0,h=H(p,[1,p.shape[0],p.shape[1],p.shape[2]])),F(h.rank===4,()=>`Error in fused depthwiseConv2d: input must be rank 4, but got rank ${h.rank}.`),F(c.rank===4,()=>`Error in fused depthwiseConv2d: filter must be rank 4, but got rank ${c.rank}.`),F(h.shape[3]===c.shape[2],()=>`Error in fused depthwiseConv2d: number of input channels (${h.shape[3]}) must match the inChannels dimension in filter ${c.shape[2]}.`),s==null&&(s=[1,1]),F(Oa(n,s),()=>`Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),i!=null&&F(Vt(a),()=>`Error in fused depthwiseConv2d: pad must be an integer when using dimRoundingMode ${i} but got pad ${a}.`);let f=Hu(h.shape,c.shape,n,s,a,i,!0),A;o!=null&&(A=M(o,"bias","fused conv2d"),[A]=bt(A,p),pt(f.outShape,A.shape));let y;d!=null&&(y=M(d,"prelu weights","fused depthwiseConv2d"));let g=(b,v)=>{F(Rr(s),()=>`Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '${s}'`);let[N,T,R,$]=v,z=Hc(b,R,l),P=o3(T.shape,z,N,n,a,s,i),V=i3(T,z,N.shape,n,a,s,i);if($!=null){let j=Gc(A,z);return[P,V,j]}return[P,V]},x={x:h,filter:c,bias:A,preluActivationWeights:y},w={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i,activation:l,leakyreluAlpha:u};return o==null?za((b,v,N)=>{let T=D.runKernel(ni,x,w);return N([v,b,T]),m&&(T=H(T,[T.shape[1],T.shape[2],T.shape[3]])),{value:T,gradFunc:g}})(h,c):za((b,v,N,T)=>{let R=D.runKernel(ni,x,w);return T([v,b,R,N]),m&&(R=H(R,[R.shape[1],R.shape[2],R.shape[3]])),{value:R,gradFunc:g}})(h,c,A)}var _R=O({fusedDepthwiseConv2d_:jR});function UR({a:e,b:t,transposeA:n=!1,transposeB:a=!1,bias:r,activation:s="linear",preluActivationWeights:i,leakyreluAlpha:o}){if(Xc(D.state.gradientDepth,s)===!1){let $=Be(e,t,n,a);return r!=null&&($=se($,r)),qc($,s,i,o)}let l=M(e,"a","fused matMul"),d=M(t,"b","fused matMul");[l,d]=bt(l,d);let u=n?l.shape[l.rank-2]:l.shape[l.rank-1],p=a?d.shape[d.rank-1]:d.shape[d.rank-2],c=n?l.shape[l.rank-1]:l.shape[l.rank-2],h=a?d.shape[d.rank-2]:d.shape[d.rank-1],m=l.shape.slice(0,-2),f=d.shape.slice(0,-2),A=Nt(m),y=Nt(f);F(l.rank>=2&&d.rank>=2&&l.rank===d.rank,()=>`Error in fused matMul: inputs must have the same rank of at least 2, got ranks ${l.rank} and ${d.rank}.`),F(Qa(m,f),()=>`Error in fused matMul: outer dimensions (${m}) and (${f}) of Tensors with shapes ${l.shape} and ${d.shape} must match.`),F(u===p,()=>`Error in fused matMul: inner shapes (${u}) and (${p}) of Tensors with shapes ${l.shape} and ${d.shape} and transposeA=${n} and transposeB=${a} must match.`);let g=l.shape.slice(0,-2).concat([c,h]),x=n?H(l,[A,u,c]):H(l,[A,c,u]),w=a?H(d,[y,h,p]):H(d,[y,p,h]),b;r!=null&&(b=M(r,"bias","fused matMul"),[b]=bt(b,l),pt(g,b.shape));let v;i!=null&&(v=M(i,"prelu weights","fused matMul"));let N=($,z)=>{let[P,V,j,U]=z,X=Hc(H($,j.shape),j,s),G,ee;if(!n&&!a?(G=Be(X,V,!1,!0),ee=Be(P,X,!0,!1)):!n&&a?(G=Be(X,V,!1,!1),ee=Be(X,P,!0,!1)):n&&!a?(G=Be(V,X,!1,!0),ee=Be(P,X,!1,!1)):(G=Be(V,X,!0,!0),ee=Be(X,P,!0,!0)),r!=null){let Y=Gc(U,X);return[G,ee,Y]}else return[G,ee]},T={a:x,b:w,bias:b,preluActivationWeights:v},R={transposeA:n,transposeB:a,activation:s,leakyreluAlpha:o};return r==null?za(($,z,P)=>{let V=D.runKernel(ei,T,R);return P([$,z,V]),{value:H(V,g),gradFunc:N}})(x,w):za(($,z,P,V)=>{let j=D.runKernel(ei,T,R);return V([$,z,j,P]),{value:H(j,g),gradFunc:N}})(x,w,b)}var PR=O({fusedMatMul_:UR});function HR(e){return PA(e,.54,.46)}var GR=O({hammingWindow_:HR});function qR(e){return PA(e,.5,.5)}var l3=O({hannWindow_:qR});function XR(e,t,n,a=!1,r=0){let s=0,i=[];for(;s+t<=e.size;)i.push(Re(e,s,t)),s+=n;if(a)for(;s`Error in cropAndResize: image must be rank 4,but got rank ${i.rank}.`),F(o.rank===2&&o.shape[1]===4,()=>`Error in cropAndResize: boxes must be have size [${d},4] but had shape ${o.shape}.`),F(l.rank===1&&l.shape[0]===d,()=>`Error in cropAndResize: boxInd must be have size [${d}] but had shape ${o.shape}.`),F(a.length===2,()=>`Error in cropAndResize: cropSize must be of length 2, but got length ${a.length}.`),F(a[0]>=1&&a[1]>=1,()=>`cropSize must be atleast [1,1], but was ${a}`),F(r==="bilinear"||r==="nearest",()=>`method must be bilinear or nearest, but was ${r}`);let u={image:i,boxes:o,boxInd:l},p={method:r,extrapolationValue:s,cropSize:a};return D.runKernel(co,u,p)}var JR=O({cropAndResize_:YR});function QR(e){let t=M(e,"image","flipLeftRight","float32");F(t.rank===4,()=>`Error in flipLeftRight: image must be rank 4,but got rank ${t.rank}.`);let n={image:t};return D.runKernel(xo,n,{})}var eM=O({flipLeftRight_:QR});function tM(e,t,n=0,a=.5){let r=M(e,"image","rotateWithOffset","float32");F(r.rank===4,()=>`Error in rotateWithOffset: image must be rank 4,but got rank ${r.rank}.`);let s={image:r},i={radians:t,fillValue:n,center:a};return D.runKernel(el,s,i)}var nM=O({rotateWithOffset_:tM});function kl(e,t,n,a,r,s){a==null&&(a=.5),r==null&&(r=Number.NEGATIVE_INFINITY),s==null&&(s=0);let i=e.shape[0];return n=Math.min(n,i),F(0<=a&&a<=1,()=>`iouThreshold must be in [0, 1], but was '${a}'`),F(e.rank===2,()=>`boxes must be a 2D tensor, but was of rank '${e.rank}'`),F(e.shape[1]===4,()=>`boxes must have 4 columns, but 2nd dimension was ${e.shape[1]}`),F(t.rank===1,()=>"scores must be a 1D tensor"),F(t.shape[0]===i,()=>`scores has incompatible shape with boxes. Expected ${i}, but was ${t.shape[0]}`),F(0<=s&&s<=1,()=>`softNmsSigma must be in [0, 1], but was '${s}'`),{maxOutputSize:n,iouThreshold:a,scoreThreshold:r,softNmsSigma:s}}function aM(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY){let s=M(e,"boxes","nonMaxSuppression"),i=M(t,"scores","nonMaxSuppression"),o=kl(s,i,n,a,r);n=o.maxOutputSize,a=o.iouThreshold,r=o.scoreThreshold;let l={maxOutputSize:n,iouThreshold:a,scoreThreshold:r};return D.runKernel($o,{boxes:s,scores:i},l)}var rM=O({nonMaxSuppression_:aM});function iM(e,t,n){let a=sM(e,t,n),r=a<0?-(a+1):a;e.splice(r,0,t)}function sM(e,t,n){return lM(e,t,n||oM)}function oM(e,t){return e>t?1:e>>1);let o=n(t,e[s]);o>0?a=s+1:(r=s,i=!o)}return i?a:-a-1}function d3(e,t,n,a,r){return WA(e,t,n,a,r,0)}function p3(e,t,n,a,r,s){return WA(e,t,n,a,r,0,!1,s,!0)}function c3(e,t,n,a,r,s){return WA(e,t,n,a,r,s,!0)}function WA(e,t,n,a,r,s,i=!1,o=!1,l=!1){let d=[];for(let A=0;Ar&&d.push({score:t[A],boxIndex:A,suppressBeginIndex:0});d.sort(h3);let u=s>0?-.5/s:0,p=[],c=[];for(;p.length0;){let A=d.pop(),{score:y,boxIndex:g,suppressBeginIndex:x}=A;if(y=x;--b){let v=uM(e,g,p[b]);if(v>=a){w=!0;break}if(A.score=A.score*dM(a,u,v),A.score<=r)break}A.suppressBeginIndex=p.length,w||(A.score===y?(p.push(g),c.push(A.score)):A.score>r&&iM(d,A,h3))}let h=p.length,m=n-h;o&&m>0&&(p.push(...new Array(m).fill(0)),c.push(...new Array(m).fill(0)));let f={selectedIndices:p};return i&&(f.selectedScores=c),l&&(f.validOutputs=h),f}function uM(e,t,n){let a=e.subarray(t*4,t*4+4),r=e.subarray(n*4,n*4+4),s=Math.min(a[0],a[2]),i=Math.min(a[1],a[3]),o=Math.max(a[0],a[2]),l=Math.max(a[1],a[3]),d=Math.min(r[0],r[2]),u=Math.min(r[1],r[3]),p=Math.max(r[0],r[2]),c=Math.max(r[1],r[3]),h=(o-s)*(l-i),m=(p-d)*(c-u);if(h<=0||m<=0)return 0;let f=Math.max(s,d),A=Math.max(i,u),y=Math.min(o,p),g=Math.min(l,c),x=Math.max(y-f,0)*Math.max(g-A,0);return x/(h+m-x)}function dM(e,t,n){let a=Math.exp(t*n*n);return n<=e?a:0}function h3(e,t){return e.score-t.score||e.score===t.score&&t.boxIndex-e.boxIndex}async function pM(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY){let s=M(e,"boxes","nonMaxSuppressionAsync"),i=M(t,"scores","nonMaxSuppressionAsync"),o=kl(s,i,n,a,r);n=o.maxOutputSize,a=o.iouThreshold,r=o.scoreThreshold;let l=await Promise.all([s.data(),i.data()]),d=l[0],u=l[1],{selectedIndices:p}=d3(d,u,n,a,r);return s!==e&&s.dispose(),i!==t&&i.dispose(),Tt(p,"int32")}var cM=pM;function hM(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=0){let i=M(e,"boxes","nonMaxSuppression"),o=M(t,"scores","nonMaxSuppression"),l=kl(i,o,n,a,r,s);n=l.maxOutputSize,a=l.iouThreshold,r=l.scoreThreshold,s=l.softNmsSigma;let d={boxes:i,scores:o},u={maxOutputSize:n,iouThreshold:a,scoreThreshold:r,softNmsSigma:s},p=D.runKernel(Oo,d,u);return{selectedIndices:p[0],selectedScores:p[1]}}var fM=O({nonMaxSuppressionWithScore_:hM});async function mM(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=0){let i=M(e,"boxes","nonMaxSuppressionAsync"),o=M(t,"scores","nonMaxSuppressionAsync"),l=kl(i,o,n,a,r,s);n=l.maxOutputSize,a=l.iouThreshold,r=l.scoreThreshold,s=l.softNmsSigma;let d=await Promise.all([i.data(),o.data()]),u=d[0],p=d[1],{selectedIndices:c,selectedScores:h}=c3(u,p,n,a,r,s);return i!==e&&i.dispose(),o!==t&&o.dispose(),{selectedIndices:Tt(c,"int32"),selectedScores:Tt(h)}}var AM=mM;function yM(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=!1){let i=M(e,"boxes","nonMaxSuppression"),o=M(t,"scores","nonMaxSuppression"),l=kl(i,o,n,a,r,null),d=l.maxOutputSize,u=l.iouThreshold,p=l.scoreThreshold,c={boxes:i,scores:o},h={maxOutputSize:d,iouThreshold:u,scoreThreshold:p,padToMaxOutputSize:s},m=D.runKernel(Do,c,h);return{selectedIndices:m[0],validOutputs:m[1]}}var gM=O({nonMaxSuppressionPadded_:yM});async function xM(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=!1){let i=M(e,"boxes","nonMaxSuppressionAsync"),o=M(t,"scores","nonMaxSuppressionAsync"),l=kl(i,o,n,a,r,null),d=l.maxOutputSize,u=l.iouThreshold,p=l.scoreThreshold,[c,h]=await Promise.all([i.data(),o.data()]),{selectedIndices:m,validOutputs:f}=p3(c,h,d,u,p,s);return i!==e&&i.dispose(),o!==t&&o.dispose(),{selectedIndices:Tt(m,"int32"),validOutputs:Se(f,"int32")}}var bM=xM;function vM(e,t,n=!1,a=!1){let r=M(e,"images","resizeBilinear");F(r.rank===3||r.rank===4,()=>`Error in resizeBilinear: x must be rank 3 or 4, but got rank ${r.rank}.`),F(t.length===2,()=>`Error in resizeBilinear: new shape must 2D, but got shape ${t}.`),F(a===!1||n===!1,()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");let s=r,i=!1;r.rank===3&&(i=!0,s=H(r,[1,r.shape[0],r.shape[1],r.shape[2]]));let[]=t,o={images:s},l={alignCorners:n,halfPixelCenters:a,size:t},d=D.runKernel(Ls,o,l);return i?H(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var f3=O({resizeBilinear_:vM});function wM(e,t,n=!1,a=!1){let r=M(e,"images","resizeNearestNeighbor");F(r.rank===3||r.rank===4,()=>`Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${r.rank}.`),F(t.length===2,()=>`Error in resizeNearestNeighbor: new shape must 2D, but got shape ${t}.`),F(r.dtype==="float32"||r.dtype==="int32",()=>"`images` must have `int32` or `float32` as dtype"),F(a===!1||n===!1,()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");let s=r,i=!1;r.rank===3&&(i=!0,s=H(r,[1,r.shape[0],r.shape[1],r.shape[2]]));let[]=t,o={images:s},l={alignCorners:n,halfPixelCenters:a,size:t},d=D.runKernel(Eu,o,l);return i?H(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var m3=O({resizeNearestNeighbor_:wM});function IM(e,t="binary",n=!1,a=.5){let r=M(e,"image","threshold"),s=.2989,i=.587,o=.114,l=r.shape[0]*r.shape[1],d=_(Tt([a]),255),u,p,c,h;if(F(r.rank===3,()=>`Error in threshold: image must be rank 3,but got rank ${r.rank}.`),F(r.shape[2]===3||r.shape[2]===1,()=>`Error in threshold: image color channel must be equal to 3 or 1but got ${r.shape[2]}.`),F(r.dtype==="int32"||r.dtype==="float32",()=>`Error in dtype: image dtype must be int32 or float32,but got dtype ${r.dtype}.`),F(t==="otsu"||t==="binary",()=>`Method must be binary or otsu, but was ${t}`),r.shape[2]===3){[u,p,c]=an(r,[1,1,1],-1);let f=_(u,s),A=_(p,i),y=_(c,o);h=se(se(f,A),y)}else h=e;if(t==="otsu"){let f=lA(fe($c(h),"int32"),ia([]),256);d=kM(f,l)}let m=n?Dr(h,d):Mn(h,d);return fe(_(m,255),"int32")}function kM(e,t){let n=Tt([-1]),a=Tt([0]),r=Tt([0]),s,i,o,l,d,u;for(let p=0;p`Error in transform: image must be rank 4,but got rank ${i.rank}.`),F(o.rank===2&&(o.shape[0]===i.shape[0]||o.shape[0]===1)&&o.shape[1]===8,()=>"Error in transform: Input transform should be batch x 8 or 1 x 8"),F(s==null||s.length===2,()=>`Error in transform: outputShape must be [height, width] or null, but got ${s}.`);let l={image:i,transforms:o},d={interpolation:n,fillMode:a,fillValue:r,outputShape:s};return D.runKernel(Yo,l,d)}var TM=O({transform_:NM});function EM(e,t,n){F(t%1==0,()=>`bandPart(): numLower must be an integer, got ${t}.`),F(n%1==0,()=>`bandPart(): numUpper must be an integer, got ${n}.`);let a=M(e,"a","bandPart");F(a.rank>=2,()=>`bandPart(): Rank must be at least 2, got ${a.rank}.`);let r=a.shape,[s,i]=a.shape.slice(-2);if(!(t<=s))throw new Error(`bandPart(): numLower (${t}) must not be greater than the number of rows (${s}).`);if(!(n<=i))throw new Error(`bandPart(): numUpper (${n}) must not be greater than the number of columns (${i}).`);t<0&&(t=s),n<0&&(n=i);let o=H(bl(0,s,1,"int32"),[-1,1]),l=bl(0,i,1,"int32"),d=ge(o,l),u=oa(Dr(d,Se(+t,"int32")),$r(d,Se(-n,"int32"))),p=Ct([s,i],a.dtype);return H(zn(la(H(a,[-1,s,i])).map(c=>nn(u,c,p))),r)}var CM=O({bandPart_:EM});function RM(e){let t;if(Array.isArray(e)){t=!1,F(e!=null&&e.length>0,()=>"Gram-Schmidt process: input must not be null, undefined, or empty");let r=e[0].shape[0];for(let s=1;s`Gram-Schmidt: Non-unique lengths found in the input vectors: (${e[s].shape[0]} vs. ${r})`)}else t=!0,e=an(e,e.shape[0],0).map(r=>Or(r,[0]));F(e.length<=e[0].shape[0],()=>`Gram-Schmidt: Number of vectors (${e.length}) exceeds number of dimensions (${e[0].shape[0]}).`);let n=[],a=e;for(let r=0;r{let s=a[r];if(r>0)for(let i=0;i=2,()=>`qr() requires input tensor to have a rank >= 2, but got rank ${e.rank}`),e.rank===2)return A3(e,t);{let n=e.shape.slice(0,e.shape.length-2).reduce((l,d)=>l*d),a=la(H(e,[n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0),r=[],s=[];a.forEach(l=>{let[d,u]=A3(l,t);r.push(d),s.push(u)});let i=H(zn(r,0),e.shape),o=H(zn(s,0),e.shape);return[i,o]}}function A3(e,t=!1){return D.tidy(()=>{F(e.shape.length===2,()=>`qr2d() requires a 2D Tensor, but got a ${e.shape.length}D Tensor.`);let n=e.shape[0],a=e.shape[1],r=yA(n),s=Da(e),i=ya([[1]],[1,1]),o=Da(i),l=n>=a?a:n;for(let d=0;d{let h=Re(s,[d,d],[n-d,1]),m=Uc(h),f=Re(s,[d,d],[1,1]),A=nn(Mn(f,0),ya([[-1]]),ya([[1]])),y=ge(f,_(A,m)),g=me(h,y);g.shape[0]===1?o=Da(i):o=ot([i,Re(g,[1,0],[g.shape[0]-1,g.shape[1]])],0);let x=vt(me(Be(A,y),m)),w=Re(s,[d,0],[n-d,a]),b=_(x,o),v=Ze(o);if(d===0)s=ge(w,Be(b,Be(v,w)));else{let R=ge(w,Be(b,Be(v,w)));s=ot([Re(s,[0,0],[d,a]),R],0)}let N=Ze(b),T=Re(r,[0,d],[n,r.shape[1]-d]);if(d===0)r=ge(T,Be(Be(T,o),N));else{let R=ge(T,Be(Be(T,o),N));r=ot([Re(r,[0,0],[n,d]),R],1)}return[o,s,r]}),Ee([u,p,c])}return!t&&n>a&&(r=Re(r,[0,0],[n,a]),s=Re(s,[0,0],[a,a])),[r,s]})}var $M=O({qr_:FM}),un;(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"})(un||(un={}));function DM(e,t,n=un.SUM_BY_NONZERO_WEIGHTS){let a=M(e,"losses","computeWeightedLoss"),r=null;t!=null&&(r=M(t,"weights","computeWeightedLoss"));let s=r==null?a:_(a,r);if(n===un.NONE)return s;if(n===un.SUM)return ke(s);if(n===un.MEAN){if(r==null)return wt(s);{let i=a.size/r.size,o=me(ke(s),ke(r));return i>1?me(o,Se(i)):o}}if(n===un.SUM_BY_NONZERO_WEIGHTS){if(r==null)return me(ke(s),Se(a.size));{let i=_(r,$n(a.shape)),o=fe(ke(mi(i,Se(0))),"float32");return me(ke(s),o)}}throw Error(`Unknown reduction: ${n}`)}var sr=O({computeWeightedLoss_:DM});function OM(e,t,n,a=un.SUM_BY_NONZERO_WEIGHTS){let r=M(e,"labels","absoluteDifference"),s=M(t,"predictions","absoluteDifference"),i=null;n!=null&&(i=M(n,"weights","absoluteDifference")),sn(r.shape,s.shape,"Error in absoluteDifference: ");let o=Ot(ge(r,s));return sr(o,i,a)}var zM=O({absoluteDifference_:OM});function _M(e,t,n,a,r=un.SUM_BY_NONZERO_WEIGHTS){let s=M(e,"labels","cosineDistance"),i=M(t,"predictions","cosineDistance"),o=null;a!=null&&(o=M(a,"weights","cosineDistance")),sn(s.shape,i.shape,"Error in cosineDistance: ");let l=Se(1),d=ge(l,ke(_(s,i),n,!0));return sr(d,o,r)}var PM=O({cosineDistance_:_M});function LM(e,t,n,a=un.SUM_BY_NONZERO_WEIGHTS){let r=M(e,"labels","hingeLoss"),s=M(t,"predictions","hingeLoss"),i=null;n!=null&&(i=M(n,"weights","hingeLoss")),sn(r.shape,s.shape,"Error in hingeLoss: ");let o=Se(1);r=ge(_(Se(2),r),o);let l=Pa(ge(o,_(r,s)));return sr(l,i,a)}var WM=O({hingeLoss_:LM});function BM(e,t,n,a=1,r=un.SUM_BY_NONZERO_WEIGHTS){let s=M(e,"labels","huberLoss"),i=M(t,"predictions","huberLoss"),o=null;n!=null&&(o=M(n,"weights","huberLoss")),sn(s.shape,i.shape,"Error in huberLoss: ");let l=Se(a),d=Ot(ge(i,s)),u=gl(d,l),p=ge(d,u),c=se(_(Se(.5),st(u)),_(l,p));return sr(c,o,r)}var VM=O({huberLoss_:BM});function jM(e,t,n,a=1e-7,r=un.SUM_BY_NONZERO_WEIGHTS){let s=M(e,"labels","logLoss"),i=M(t,"predictions","logLoss"),o=null;n!=null&&(o=M(n,"weights","logLoss")),sn(s.shape,i.shape,"Error in logLoss: ");let l=Se(1),d=Se(a),u=vt(_(s,Fn(se(i,d)))),p=_(ge(l,s),Fn(se(ge(l,i),d))),c=ge(u,p);return sr(c,o,r)}var UM=O({logLoss_:jM});function HM(e,t,n,a=un.SUM_BY_NONZERO_WEIGHTS){let r=M(e,"labels","meanSquaredError"),s=M(t,"predictions","meanSquaredError"),i=null;n!=null&&(i=M(n,"weights","meanSquaredError")),sn(r.shape,s.shape,"Error in meanSquaredError: ");let o=Bc(r,s);return sr(o,i,a)}var GM=O({meanSquaredError_:HM});function qM(e,t){let n=M(e,"labels","sigmoidCrossEntropyWithLogits"),a=M(t,"logits","sigmoidCrossEntropyWithLogits");sn(n.shape,a.shape,"Error in sigmoidCrossEntropyWithLogits: ");let r=Pa(a),s=_(a,n),i=Nc(qn(vt(Ot(a))));return se(ge(r,s),i)}function XM(e,t,n,a=0,r=un.SUM_BY_NONZERO_WEIGHTS){let s=M(e,"multiClassLabels","sigmoidCrossEntropy"),i=M(t,"logits","sigmoidCrossEntropy"),o=null;if(n!=null&&(o=M(n,"weights","sigmoidCrossEntropy")),sn(s.shape,i.shape,"Error in sigmoidCrossEntropy: "),a>0){let d=Se(a),u=Se(1),p=Se(.5);s=se(_(s,ge(u,d)),_(p,d))}let l=qM(s,i);return sr(l,o,r)}var KM=O({sigmoidCrossEntropy_:XM});function ZM(e,t,n=-1){if(n===-1&&(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}`);return za((a,r,s)=>{let i=wA(r,[n],!0),o=ge(fe(r,"float32"),i);s([a,o]);let l=vt(_(o,a));return{value:ke(l,[n]),gradFunc:(d,u)=>{let[p,c]=u,h=fi(d.shape,[n]);return[_(H(d,h),ge(fe(p,"float32"),qn(c))),_(H(d,h),ge(qn(c),fe(p,"float32")))]}}})(e,t)}function YM(e,t,n,a=0,r=un.SUM_BY_NONZERO_WEIGHTS){let s=M(e,"onehotLabels","softmaxCrossEntropy"),i=M(t,"logits","softmaxCrossEntropy"),o=null;if(n!=null&&(o=M(n,"weights","softmaxCrossEntropy")),sn(s.shape,i.shape,"Error in softmaxCrossEntropy: "),a>0){let d=Se(a),u=Se(1),p=Se(s.shape[1]);s=se(_(s,ge(u,d)),me(d,p))}let l=ZM(s,i);return sr(l,o,r)}var JM=O({softmaxCrossEntropy_:YM});function QM(e,t,n,a){let r=M(e,"indices","sparseFillEmptyRows"),s=M(t,"values","sparseFillEmptyRows"),i=M(n,"denseShape","sparseFillEmptyRows"),o=M(a,"defaultValue","sparseFillEmptyRows",s.dtype);if(r.rank!==2)throw new Error(`Indices should be Tensor2D but received shape - ${r.shape}`);if(s.rank!==1)throw new Error(`Values should be Tensor1D but received shape ${s.shape}`);if(i.rank!==1)throw new Error(`Dense shape should be Tensor1D but received shape ${i.shape}`);if(o.rank!==0)throw new Error(`Default value should be a scalar but received shape ${o.shape}`);let l={indices:r,values:s,denseShape:i,defaultValue:o},d=D.runKernel(tc,l);return{outputIndices:d[0],outputValues:d[1],emptyRowIndicator:d[2],reverseIndexMap:d[3]}}var eF=O({sparseFillEmptyRows_:QM});function tF(e,t,n){let a=M(e,"inputIndices","sparseReshape"),r=M(t,"inputShape","sparseReshape"),s=M(n,"newShape","sparseReshape");if(a.rank!==2)throw new Error(`Input indices should be Tensor2D but received shape - ${a.shape}`);if(r.rank!==1)throw new Error(`Input shape should be Tensor1D but received shape ${r.shape}`);if(s.rank!==1)throw new Error(`New shape should be Tensor1D but received shape ${s.shape}`);let i={inputIndices:a,inputShape:r,newShape:s},o=D.runKernel(nc,i);return{outputIndices:o[0],outputShape:o[1]}}var nF=O({sparseReshape_:tF}),aF={fft:ad,ifft:vl,rfft:rd,irfft:Wc},rF={hammingWindow:GR,hannWindow:l3,frame:u3,stft:ZR},Ye={flipLeftRight:eM,resizeNearestNeighbor:m3,resizeBilinear:f3,rotateWithOffset:nM,cropAndResize:JR,nonMaxSuppression:rM,nonMaxSuppressionAsync:cM,nonMaxSuppressionWithScore:fM,nonMaxSuppressionWithScoreAsync:AM,nonMaxSuppressionPadded:gM,nonMaxSuppressionPaddedAsync:bM,threshold:SM,transform:TM},y3={bandPart:CM,gramSchmidt:MM,qr:$M},sF={absoluteDifference:zM,computeWeightedLoss:sr,cosineDistance:PM,hingeLoss:WM,huberLoss:VM,logLoss:UM,meanSquaredError:GM,sigmoidCrossEntropy:KM,softmaxCrossEntropy:JM},g3={sparseFillEmptyRows:eF,sparseReshape:nF},ir=class extends bb{minimize(e,t=!1,n){let{value:a,grads:r}=this.computeGradients(e,n);if(n!=null){let s=n.map(i=>({name:i.name,tensor:r[i.name]}));this.applyGradients(s)}else this.applyGradients(r);return Ee(r),t?a:(a.dispose(),null)}get iterations(){return this.iterations_==null&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return Vb(e,t)}dispose(){this.iterations_!=null&&Ee(this.iterations_)}async saveIterations(){return this.iterations_==null&&(this.iterations_=0),{name:"iter",tensor:Se(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(ir,Symbol.hasInstance,{value:e=>e.minimize!=null&&e.computeGradients!=null&&e.applyGradients!=null});var Kc=class extends ir{constructor(e,t,n=null){super();this.learningRate=e,this.rho=t,this.epsilon=n,this.accumulatedGrads=[],this.accumulatedUpdates=[],n==null&&(this.epsilon=D.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=D.registeredVariables[t],r=!1;this.accumulatedGrads[n]==null&&(this.accumulatedGrads[n]={originalName:`${t}/accum_grad`,variable:W(()=>Ue(a).variable(r))}),this.accumulatedUpdates[n]==null&&(this.accumulatedUpdates[n]={originalName:`${t}/accum_var`,variable:W(()=>Ue(a).variable(r))});let s=Array.isArray(e)?e[n].tensor:e[t];if(s==null)return;let i=this.accumulatedGrads[n].variable,o=this.accumulatedUpdates[n].variable;W(()=>{let l=se(_(i,this.rho),_(st(s),1-this.rho)),d=_(me(Jt(se(o,this.epsilon)),Jt(se(i,this.epsilon))),s),u=se(_(o,this.rho),_(st(d),1-this.rho));i.assign(l),o.assign(u);let p=se(_(d,-this.learningRate),a);a.assign(p)})}),this.incrementIterations()}dispose(){this.accumulatedUpdates!=null&&(Ee(this.accumulatedGrads.map(e=>e.variable)),Ee(this.accumulatedUpdates.map(e=>e.variable)))}async getWeights(){let e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=e.length/2,n=!1;this.accumulatedGrads=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedUpdates=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.rho,t.epsilon)}};Kc.className="Adadelta";Cr(Kc);var Zc=class extends ir{constructor(e,t=.1){super();this.learningRate=e,this.initialAccumulatorValue=t,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=D.registeredVariables[t];if(this.accumulatedGrads[n]==null){let i=!1;this.accumulatedGrads[n]={originalName:`${t}/accumulator`,variable:W(()=>ml(a.shape,this.initialAccumulatorValue).variable(i))}}let r=Array.isArray(e)?e[n].tensor:e[t];if(r==null)return;let s=this.accumulatedGrads[n].variable;W(()=>{let i=se(s,st(r));s.assign(i);let o=se(_(me(r,Jt(se(i,D.backend.epsilon()))),-this.learningRate),a);a.assign(o)})}),this.incrementIterations()}dispose(){this.accumulatedGrads!=null&&Ee(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);let t=!1;this.accumulatedGrads=e.map(n=>({originalName:n.name,variable:n.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(e,t){return new e(t.learningRate,t.initialAccumulatorValue)}};Zc.className="Adagrad";Cr(Zc);var Yc=class extends ir{constructor(e,t,n,a=null){super();this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=a,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],W(()=>{this.accBeta1=Se(t).variable(),this.accBeta2=Se(n).variable()}),a==null&&(this.epsilon=D.backend.epsilon())}applyGradients(e){let t=Array.isArray(e)?e.map(n=>n.name):Object.keys(e);W(()=>{let n=ge(1,this.accBeta1),a=ge(1,this.accBeta2);t.forEach((r,s)=>{let i=D.registeredVariables[r],o=!1;this.accumulatedFirstMoment[s]==null&&(this.accumulatedFirstMoment[s]={originalName:`${r}/m`,variable:W(()=>Ue(i).variable(o))}),this.accumulatedSecondMoment[s]==null&&(this.accumulatedSecondMoment[s]={originalName:`${r}/v`,variable:W(()=>Ue(i).variable(o))});let l=Array.isArray(e)?e[s].tensor:e[r];if(l==null)return;let d=this.accumulatedFirstMoment[s].variable,u=this.accumulatedSecondMoment[s].variable,p=se(_(d,this.beta1),_(l,1-this.beta1)),c=se(_(u,this.beta2),_(st(l),1-this.beta2)),h=me(p,n),m=me(c,a);d.assign(p),u.assign(c);let f=se(_(me(h,se(Jt(m),this.epsilon)),-this.learningRate),i);i.assign(f)}),this.accBeta1.assign(_(this.accBeta1,this.beta1)),this.accBeta2.assign(_(this.accBeta2,this.beta2))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),this.accumulatedFirstMoment!=null&&Ee(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedSecondMoment!=null&&Ee(this.accumulatedSecondMoment.map(e=>e.variable))}async getWeights(){let e=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e),W(()=>{this.accBeta1.assign(rr(this.beta1,this.iterations_+1)),this.accBeta2.assign(rr(this.beta2,this.iterations_+1))});let t=e.length/2,n=!1;this.accumulatedFirstMoment=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedSecondMoment=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)}))}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)}};Yc.className="Adam";Cr(Yc);var Jc=class extends ir{constructor(e,t,n,a=null,r=0){super();this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=a,this.decay=r,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],W(()=>{this.iteration=Se(0).variable(),this.accBeta1=Se(t).variable()}),a==null&&(this.epsilon=D.backend.epsilon())}applyGradients(e){let t=Array.isArray(e)?e.map(n=>n.name):Object.keys(e);W(()=>{let n=ge(1,this.accBeta1),a=me(-this.learningRate,se(_(this.iteration,this.decay),1));t.forEach((r,s)=>{let i=D.registeredVariables[r],o=!1;this.accumulatedFirstMoment[s]==null&&(this.accumulatedFirstMoment[s]={originalName:`${r}/m`,variable:Ue(i).variable(o)}),this.accumulatedWeightedInfNorm[s]==null&&(this.accumulatedWeightedInfNorm[s]={originalName:`${r}/v`,variable:Ue(i).variable(o)});let l=Array.isArray(e)?e[s].tensor:e[r];if(l==null)return;let d=this.accumulatedFirstMoment[s].variable,u=this.accumulatedWeightedInfNorm[s].variable,p=se(_(d,this.beta1),_(l,1-this.beta1)),c=_(u,this.beta2),h=Ot(l),m=_a(c,h);d.assign(p),u.assign(m);let f=se(_(me(a,n),me(p,se(m,this.epsilon))),i);i.assign(f)}),this.iteration.assign(se(this.iteration,1)),this.accBeta1.assign(_(this.accBeta1,this.beta1))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&Ee(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedWeightedInfNorm!=null&&Ee(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)}};Jc.className="Adamax";Cr(Jc);var sd=class extends ir{constructor(e){super();this.learningRate=e,this.setLearningRate(e)}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=Array.isArray(e)?e[n].tensor:e[t];if(a==null)return;let r=D.registeredVariables[t];W(()=>{let s=se(_(this.c,a),r);r.assign(s)})}),this.incrementIterations()}setLearningRate(e){this.learningRate=e,this.c!=null&&this.c.dispose(),this.c=jt(Se(-e))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(e=await this.extractIterations(e),e.length!==0)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,t){return new e(t.learningRate)}};sd.className="SGD";Cr(sd);var Qc=class extends sd{constructor(e,t,n=!1){super(e);this.learningRate=e,this.momentum=t,this.useNesterov=n,this.accumulations=[],this.m=Se(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=D.registeredVariables[t];if(this.accumulations[n]==null){let i=!1;this.accumulations[n]={originalName:`${t}/momentum`,variable:W(()=>Ue(a).variable(i))}}let r=this.accumulations[n].variable,s=Array.isArray(e)?e[n].tensor:e[t];s!=null&&W(()=>{let i,o=se(_(this.m,r),s);this.useNesterov?i=se(_(this.c,se(s,_(o,this.m))),a):i=se(_(this.c,o),a),r.assign(o),a.assign(i)})}),this.incrementIterations()}dispose(){this.m.dispose(),this.accumulations!=null&&Ee(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);let t=!1;this.accumulations=e.map(n=>({originalName:n.name,variable:n.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}};Qc.className="Momentum";Cr(Qc);var eh=class extends ir{constructor(e,t=.9,n=0,a=null,r=!1){super();if(this.learningRate=e,this.decay=t,this.momentum=n,this.epsilon=a,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=r,a==null&&(this.epsilon=D.backend.epsilon()),e==null)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=D.registeredVariables[t],r=!1;this.accumulatedMeanSquares[n]==null&&(this.accumulatedMeanSquares[n]={originalName:`${t}/rms`,variable:W(()=>Ue(a).variable(r))}),this.accumulatedMoments[n]==null&&(this.accumulatedMoments[n]={originalName:`${t}/momentum`,variable:W(()=>Ue(a).variable(r))}),this.accumulatedMeanGrads[n]==null&&this.centered&&(this.accumulatedMeanGrads[n]={originalName:`${t}/mg`,variable:W(()=>Ue(a).variable(r))});let s=Array.isArray(e)?e[n].tensor:e[t];if(s==null)return;let i=this.accumulatedMeanSquares[n].variable,o=this.accumulatedMoments[n].variable;W(()=>{let l=se(_(i,this.decay),_(st(s),1-this.decay));if(this.centered){let d=this.accumulatedMeanGrads[n].variable,u=se(_(d,this.decay),_(s,1-this.decay)),p=me(_(s,this.learningRate),Jt(ge(l,se(st(u),this.epsilon)))),c=se(_(o,this.momentum),p);i.assign(l),d.assign(u),o.assign(c);let h=ge(a,c);a.assign(h)}else{let d=se(_(i,this.decay),_(st(s),1-this.decay)),u=se(_(o,this.momentum),me(_(s,this.learningRate),Jt(se(d,this.epsilon))));i.assign(d),o.assign(u);let p=ge(a,u);a.assign(p)}})}),this.incrementIterations()}dispose(){this.accumulatedMeanSquares!=null&&Ee(this.accumulatedMeanSquares.map(e=>e.variable)),this.accumulatedMeanGrads!=null&&this.centered&&Ee(this.accumulatedMeanGrads.map(e=>e.variable)),this.accumulatedMoments!=null&&Ee(this.accumulatedMoments.map(e=>e.variable))}async getWeights(){let e=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&e.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=this.centered?e.length/3:e.length/2,n=!1;this.accumulatedMeanSquares=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedMoments=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.centered&&(this.accumulatedMeanGrads=e.slice(t*2,t*3).map(a=>({originalName:a.name,variable:a.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)}};eh.className="RMSProp";Cr(eh);var Ai=class{static sgd(e){return new sd(e)}static momentum(e,t,n=!1){return new Qc(e,t,n)}static rmsprop(e,t=.9,n=0,a=null,r=!1){return new eh(e,t,n,a,r)}static adam(e=.001,t=.9,n=.999,a=null){return new Yc(e,t,n,a)}static adadelta(e=.001,t=.95,n=null){return new Kc(e,t,n)}static adamax(e=.002,t=.9,n=.999,a=null,r=0){return new Jc(e,t,n,a,r)}static adagrad(e,t=.1){return new Zc(e,t)}},yi={sgd:Ai.sgd,momentum:Ai.momentum,adadelta:Ai.adadelta,adagrad:Ai.adagrad,rmsprop:Ai.rmsprop,adamax:Ai.adamax,adam:Ai.adam},iF=(()=>typeof requestAnimationFrame!="undefined"?requestAnimationFrame:typeof setImmediate!="undefined"?setImmediate:e=>e())();function th(){return new Promise(e=>iF(()=>e()))}var C={};Fe(C,{ERF_A1:()=>yF,ERF_A2:()=>gF,ERF_A3:()=>xF,ERF_A4:()=>bF,ERF_A5:()=>vF,ERF_P:()=>AF,PARALLELIZE_THRESHOLD:()=>BA,SELU_SCALE:()=>b3,SELU_SCALEALPHA:()=>x3,applyActivation:()=>qc,assertAndGetBroadcastShape:()=>pt,assertAxesAreInnerMostDims:()=>DE,assertParamsConsistent:()=>oF,assignToTypedArray:()=>CF,axesAreInnerMostDims:()=>bA,calculateShapes:()=>lb,checkEinsumDimSizes:()=>DF,combineLocations:()=>Ub,complexWithEvenIndex:()=>NF,complexWithOddIndex:()=>TF,computeConv2DInfo:()=>Hu,computeConv3DInfo:()=>Tb,computeDefaultPad:()=>iA,computeDilation2DInfo:()=>rT,computeOptimalWindowSize:()=>uF,computeOutAndReduceShapes:()=>Hb,computeOutShape:()=>lF,computePool2DInfo:()=>Nb,computePool3DInfo:()=>sT,convertConv2DDataFormat:()=>Sb,decodeEinsumEquation:()=>FF,eitherStridesOrDilationsAreOne:()=>Oa,expandShapeToKeepDim:()=>fi,exponent:()=>MF,exponents:()=>RF,fromStringArrayToUint8:()=>LF,fromUint8ToStringArray:()=>PF,getAxesPermutation:()=>Gb,getBroadcastDims:()=>KT,getComplexWithIndex:()=>EF,getEinsumComputePath:()=>OF,getEinsumPermutation:()=>$F,getFusedBiasGradient:()=>Gc,getFusedDyActivation:()=>Hc,getImageCenter:()=>dF,getInnerMostAxes:()=>OE,getPermuted:()=>cF,getReductionAxes:()=>zt,getReshaped:()=>pF,getReshapedPermuted:()=>hF,getSliceBeginCoords:()=>fF,getSliceSize:()=>mF,getUndoAxesPermutation:()=>vA,isIdentityPermutation:()=>zF,log:()=>kF,mergeRealAndImagArrays:()=>IF,prepareAndValidate:()=>ob,prepareSplitSize:()=>_F,segment_util:()=>v3,shouldFuse:()=>Xc,slice_util:()=>on,splitRealAndImagArrays:()=>SF,tupleValuesAreOne:()=>Rr,upcastType:()=>sa,validateInput:()=>Hm,validateUpdateShape:()=>Um,warn:()=>wF});function oF(e,t){let n=e[0].length;e.forEach((r,s)=>{F(r.length===n,()=>`Error in concat${n}D: rank of tensors[${s}] must be the same as the rank of the rest (${n})`)}),F(t>=0&&t`Error in concat${n}D: axis must be between 0 and ${n-1}.`);let a=e[0];e.forEach((r,s)=>{for(let i=0;i`Error in concat${n}D: Shape of tensors[${s}] (${r}) does not match the shape of the rest (${a}) along the non-concatenated axis ${s}.`)})}function lF(e,t){let n=e[0].slice();for(let a=1;a=t*2+1||i%2==1?s.push(i):r.push(i);a.push(...r),a.push(0),a.push(...s)}return a}function hF(e,t,n,a=!0){let r=[];a?r.push(e[0]/n):r.push(e[0]*n);for(let s=1;s/g,w3=",",k3="...";function FF(e,t){e=e.replace(/\s/g,"");let n=(e.length-e.replace(WF,"").length)/VA.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 ("${VA}").`);let[a,r]=e.split(VA);F(a.indexOf(k3)===-1,()=>`The ellipsis notation ("${k3}") is not supported yet.`);let s=a.split(w3),i=s.length;if(t!==i)throw new Error(`Expected ${i} input tensors, received ${t}`);if(i>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");let o=[];for(let c=0;cm.indexOf(h)!==-1))throw new Error(`Output subscripts contain the label ${h} not present in the input subscripts.`);o.indexOf(h)===-1&&o.push(h)}for(let c=0;cr!==-1),{permutationIndices:n,expandDims:a}}function DF(e,t,n){let a=new Array(e);for(let r=0;r`Expected dimension ${a[t[r][i]]} at axis ${i} of input shaped ${JSON.stringify(s)}, but got dimension ${s[i]}`)}}function OF(e,t){let n=e,a=[],r=0;e.length===0&&n.push(-1),r=e.length+1;for(let i=0;it===n)}function BF(e,t){let n=[];for(let a=0;a"Number of splits must evenly divide the axis."),a=new Array(t).fill(e.shape[n]/t);else{let r=t.reduce((i,o)=>(o===-1&&(i+=1),i),0);F(r<=1,()=>"There should be only one negative value in split array.");let s=t.indexOf(-1);if(s!==-1){let i=t.reduce((o,l)=>l>0?o+l:o);t[s]=e.shape[n]-i}F(e.shape[n]===t.reduce((i,o)=>i+o),()=>"The sum of sizes must match the size of the axis dimension."),a=t}return a}var v3={};Fe(v3,{collectGatherOpShapeInfo:()=>UF,computeOutShape:()=>jF,segOpComputeOptimalWindowSize:()=>VF});function VF(e,t){let n=!1,a;for(e<=BA?(a=e,n=!0):a=Np(e,Math.floor(Math.sqrt(e)));!n;)a>t||a===e?n=!0:a=Np(e,a+1);return a}function jF(e,t,n){let a=[],r=e.length;for(let s=0;sr))throw new Error(`Expect batchDims in the range of [-${r}, ${r}], but got ${a}`);if(a<0&&(a+=r),a>s)throw new Error(`batchDims (${a}) must be less than rank(x) ( - ${s}).`);if(nlc(t))}catch(t){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${t}`)}}function LF(e){return e.map(t=>Du(t))}var La={};Fe(La,{nonMaxSuppressionV3Impl:()=>d3,nonMaxSuppressionV4Impl:()=>p3,nonMaxSuppressionV5Impl:()=>c3,whereImpl:()=>e3});function ve(e,t){Array.isArray(e)||(e=[e]),e.forEach(n=>{n!=null&&k.assert(n.dtype!=="complex64",()=>`${t} does not support complex64 tensors in the CPU backend.`)})}var HF=La.whereImpl,nh=class extends hu{constructor(){super();this.blockSize=48,this.firstUse=!0,this.data=new Ip(this,tr())}nextDataId(){return nh.nextDataId++}write(e,t,n){this.firstUse&&(this.firstUse=!1,J().get("IS_NODE")&&C.warn(` + ${a.shape}`),F(i%(t*t)==0,()=>`Dimension size must be evenly divisible by ${t*t} but is ${i} for depthToSpace with input shape ${a.shape}`);let o={x:a},l={blockSize:t,dataFormat:n};return D.runKernel(fo,o,l)}var hA=O({depthToSpace_:HT});function GT(e,t,n,a,r="NHWC",s=[1,1],i){let o=M(e,"x","depthwiseConv2d"),l=M(t,"filter","depthwiseConv2d"),d=o,u=!1;o.rank===3&&(u=!0,d=H(o,[1,o.shape[0],o.shape[1],o.shape[2]])),F(d.rank===4,()=>`Error in depthwiseConv2d: input must be rank 4, but got rank ${d.rank}.`),F(l.rank===4,()=>`Error in depthwiseConv2d: filter must be rank 4, but got rank ${l.rank}.`),F(d.shape[3]===l.shape[2],()=>`Error in depthwiseConv2d: number of input channels (${d.shape[3]}) must match the inChannels dimension in filter ${l.shape[2]}.`),i!=null&&F(Vt(a),()=>`Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`);let p={x:d,filter:l},c={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i},h=D.runKernel(ys,p,c);return u?H(h,[h.shape[1],h.shape[2],h.shape[3]]):h}var fl=O({depthwiseConv2d_:GT});function qT(e){let t={x:M(e,"x","diag")};return D.runKernel(Lp,t)}var XT=O({diag_:qT});function KT(e,t,n,a,r=[1,1],s="NHWC"){let i=M(e,"x","dilation2d"),o=M(t,"filter","dilation2d");F(i.rank===3||i.rank===4,()=>`Error in dilation2d: input must be rank 3 or 4, but got rank ${i.rank}.`),F(o.rank===3,()=>`Error in dilation2d: filter must be rank 3, but got rank ${o.rank}.`),F(s==="NHWC",()=>`Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${s}`);let l=i,d=!1;i.rank===3&&(l=H(i,[1,i.shape[0],i.shape[1],i.shape[2]]),d=!0);let u={x:l,filter:o},p={strides:n,pad:a,dilations:r},c=D.runKernel(wu,u,p);return d?H(c,[c.shape[1],c.shape[2],c.shape[3]]):c}var fA=O({dilation2d_:KT});function ZT(e,t){let n=e.length,a=[];for(let r=0;r1&&i===1&&a.unshift(s)}return a}function zt(e,t){let n=[];for(let a=0;a1)&&n.unshift(s)}return n}function pt(e,t){let n=[],a=Math.max(e.length,t.length);for(let r=0;r`Error in dot: inputs must all be rank 1 or 2, but got ranks ${n.rank} and ${a.rank}.`);let r=n.rank===1?n.size:n.shape[1],s=a.rank===1?a.size:a.shape[0];if(F(r===s,()=>`Error in dot: inner dimensions of inputs must match, but got ${r} and ${s}.`),n.rank===1&&a.rank===1){let i=H(n,[1,-1]),o=H(a,[-1,1]),l=Be(i,o);return H(l,[])}else if(n.rank===1&&a.rank===2){let i=H(n,[1,-1]),o=H(a,[a.shape[0],a.shape[1]]),l=Be(i,o);return H(l,[l.size])}else if(n.rank===2&&a.rank===1){let i=H(a,[-1,1]),o=Be(n,i);return H(o,[o.size])}else{let i=H(a,[a.shape[0],a.shape[1]]);return Be(n,i)}}var Pb=O({dot_:tE});function nE(e,...t){let n=t.map((r,s)=>M(r,`tensors${s}`,"einsum")),a={equation:e};return D.runKernel(Vp,n,a)}var Lb=O({einsum_:nE});function aE(e){let t={x:M(e,"x","elu")};return D.runKernel(mo,t)}var ml=O({elu_:aE});function rE(e){let t=M(e,"x","erf");F(t.dtype==="int32"||t.dtype==="float32",()=>"Input dtype must be `int32` or `float32`."),t.dtype==="int32"&&(t=fe(t,"float32"));let n={x:t};return D.runKernel(Ao,n)}var AA=O({erf_:rE});function sE(e){let t={x:M(e,"x","exp")};return D.runKernel(xs,t)}var qn=O({exp_:sE});function iE(e,t=0){let n=M(e,"x","expandDims","string_or_numeric");F(t<=n.rank,()=>"Axis must be <= rank of the tensor");let a={input:n},r={dim:t};return D.runKernel(go,a,r)}var ln=O({expandDims_:iE});function oE(e){let t={x:M(e,"x","expm1")};return D.runKernel(xo,t)}var yA=O({expm1_:oE});function lE(e,t){let n=M(e,"x","tile","string_or_numeric");F(n.rank===t.length,()=>`Error in transpose: rank of input ${n.rank} must match length of reps ${t}.`);let a={x:n},r={reps:t};return D.runKernel(Sr,a,r)}var $r=O({tile_:lE});function uE(e,t,n,a="float32"){t==null&&(t=e);let r=We([e,t],a),s=e<=t?e:t;for(let o=0;o`Error in localResponseNormalization: x must be rank 3 or 4 but got + rank ${s.rank}.`),F(Vt(t),()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${t}.`);let i=s,o=!1;s.rank===3&&(o=!0,i=H(s,[1,s.shape[0],s.shape[1],s.shape[2]]));let l={x:i},d={depthRadius:t,bias:n,alpha:a,beta:r},u=D.runKernel(Nu,l,d);return o?H(u,[u.shape[1],u.shape[2],u.shape[3]]):u}var bA=O({localResponseNormalization_:vE});function wE(e){let t={x:M(e,"x","log")};return D.runKernel(Ns,t)}var Fn=O({log_:wE});function kE(e){let t={x:M(e,"x","log1p")};return D.runKernel(Co,t)}var Tc=O({log1p_:kE});function IE(e){return F(wr(e),()=>"The f passed in grad(f) must be a function"),(t,n)=>{let a=M(t,"x","tf.grad","string_or_numeric"),r=n!=null?M(n,"dy","tf.grad"):null;return D.tidy(()=>{let{value:s,grads:i}=D.gradients(()=>e(a),[a],r);return r!=null&&sn(s.shape,r.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),Ec(i),i[0]})}}function SE(e){return F(wr(e),()=>"The f passed in grads(f) must be a function"),(t,n)=>{F(Array.isArray(t),()=>"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s");let a=Vu(t,"args","tf.grads","string_or_numeric"),r=n!=null?M(n,"dy","tf.grads"):null;return D.tidy(()=>{let{value:s,grads:i}=D.gradients(()=>e(...a),a,r);return r!=null&&sn(s.shape,r.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Ec(i),i})}}function NE(e){return F(wr(e),()=>"The f passed in valueAndGrad(f) must be a function"),(t,n)=>{F(t instanceof Le,()=>"The x passed in valueAndGrad(f)(x) must be a tensor"),F(n==null||n instanceof Le,()=>"The dy passed in valueAndGrad(f)(x, dy) must be a tensor");let{grads:a,value:r}=D.gradients(()=>e(t),[t],n);return Ec(a),{grad:a[0],value:r}}}function TE(e){return F(wr(e),()=>"The f passed in valueAndGrads(f) must be a function"),(t,n)=>{F(Array.isArray(t)&&t.every(r=>r instanceof Le),()=>"The args passed in valueAndGrads(f)(args) must be array of tensors"),F(n==null||n instanceof Le,()=>"The dy passed in valueAndGrads(f)(args, dy) must be a tensor");let a=D.gradients(()=>e(...t),t,n);return n!=null&&sn(a.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Ec(a.grads),a}}function jb(e,t){F(wr(e),()=>"The f passed in variableGrads(f) must be a function"),F(t==null||Array.isArray(t)&&t.every(d=>d instanceof Lu),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");let n=t!=null;if(!n){t=[];for(let d in D.registeredVariables)t.push(D.registeredVariables[d])}let a=n?t.filter(d=>!d.trainable):null,r=t.length;t=t.filter(d=>d.trainable),F(t.length>0,()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${r} variables is trainable.`);let s=!0,{value:i,grads:o}=D.gradients(e,t,null,s);F(o.some(d=>d!=null),()=>"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()."),F(i.rank===0,()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${i.rank} tensor`);let l={};return t.forEach((d,u)=>{o[u]!=null&&(l[d.name]=o[u])}),a!=null&&a.forEach(d=>l[d.name]=null),{value:i,grads:l}}function _a(e){return D.customGrad(e)}function Ec(e){if(e.filter(t=>t==null).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.`)}function EE(e){let t={x:M(e,"x","neg")};return D.runKernel(Fo,t)}var vt=O({neg_:EE});function CE(e){let t={x:M(e,"x","softplus")};return D.runKernel(Xo,t)}var fi=O({softplus_:CE});function RE(e){let t=M(e,"x","logSigmoid");return _a(n=>({value:vt(fi(vt(n))),gradFunc:a=>_(a,wn(vt(n)))}))(t)}var Ub=O({logSigmoid_:RE});function ME(e,t=null,n=!1){let a={x:M(e,"x","max")},r={reductionIndices:t,keepDims:n};return D.runKernel(Ts,a,r)}var Xn=O({max_:ME});function FE(e,t){let n=M(e,"a","sub"),a=M(t,"b","sub");[n,a]=bt(n,a);let r={a:n,b:a};return D.runKernel(Ys,r)}var ge=O({sub_:FE});function $E(e,t=null,n=!1){let a=M(e,"x","sum");a.dtype==="bool"&&(a=fe(a,"int32"));let r={x:a},s={axis:t,keepDims:n};return D.runKernel(Xs,r,s)}var ke=O({sum_:$E});function DE(e,t=-1){let n=M(e,"logits","logSoftmax");if(t===-1&&(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}`);return _a((a,r)=>{let s=!0,i=Xn(a,t,!0),o=ge(a,i),l=ge(fe(o,"float32"),Fn(ke(qn(o),t,s)));return r([l]),{value:l,gradFunc:(d,u)=>{let[p]=u,c=!0,h=qn(p);return ge(d,_(ke(d,t,c),h))}}})(n)}var Cc=O({logSoftmax_:DE});function vA(e,t){for(let n=0;ne[s]);return[n,r]}function mi(e,t){let n=t.map(a=>1);return Hb(e,n,t)}function OE(e,t,n){F(vA(t,n),()=>`${e} supports only inner-most axes for now. Got axes ${t} and rank-${n} input.`)}function qb(e,t){if(vA(e,t))return null;let n=[];for(let a=0;an.push(a)),n}function wA(e){return e.map((t,n)=>[n,t]).sort((t,n)=>t[1]-n[1]).map(t=>t[0])}function zE(e,t){let n=[];for(let a=t-e;a`Error in maxPool: input must be rank 4 but got rank ${o.rank}.`),F(za(n,i),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${i}'`),r!=null&&F(Vt(a),()=>`Error in maxPool: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let d={x:o},u={filterSize:t,strides:n,pad:a,dimRoundingMode:r},p=D.runKernel(Cs,d,u);return l?H(p,[p.shape[1],p.shape[2],p.shape[3]]):p}var Ju=O({maxPool_:VE});function jE(e,t=[1,1,1],n,a,r,s="NDHWC"){let i=M(e,"x","maxPool3d"),o=i,l=!1;i.rank===4&&(l=!0,o=H(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),F(o.rank===5,()=>`Error in maxPool3d: x must be rank 5 but got rank ${o.rank}.`),F(s==="NDHWC",()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`),r!=null&&F(Vt(a),()=>`Error in maxPool3d: pad must be an integer when using, dimRoundingMode ${r} but got pad ${a}.`);let d={x:o},u={filterSize:t,strides:n,pad:a,dimRoundingMode:r,dataFormat:s},p=D.runKernel(Tu,d,u);return l?H(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}var IA=O({maxPool3d_:jE});function UE(e,t,n,a,r=!1){let s={x:M(e,"x","maxPoolWithArgmax")},i={filterSize:t,strides:n,pad:a,includeBatchInIndex:r},o=D.runKernel(Yp,s,i);return{result:o[0],indexes:o[1]}}var Kb=O({maxPoolWithArgmax_:UE});function HE(e,t){let n=M(e,"a","maximum"),a=M(t,"b","maximum");[n,a]=bt(n,a),n.dtype==="bool"&&(n=fe(n,"int32"),a=fe(a,"int32")),pt(n.shape,a.shape);let r={a:n,b:a};return D.runKernel(Es,r)}var Pa=O({maximum_:HE});function GE(e,t=null,n=!1){let a={x:M(e,"x","mean")},r={axis:t,keepDims:n};return D.runKernel(Rs,a,r)}var wt=O({mean_:GE});function Ct(e,t="float32"){if(t==="complex64"){let a=Ct(e,"float32"),r=Ct(e,"float32");return Tr(a,r)}let n=Ep(Nt(e),t);return D.makeTensor(n,e,t)}function $n(e,t="float32"){if(t==="complex64"){let a=$n(e,"float32"),r=Ct(e,"float32");return Tr(a,r)}let n=ym(Nt(e),t);return D.makeTensor(n,e,t)}function qE(e,t,{indexing:n="xy"}={}){if(n!=="xy"&&n!=="ij")throw new TypeError(`${n} is not a valid third argument to meshgrid`);if(e===void 0)return[];let a=M(e,"x","meshgrid",e instanceof Le?e.dtype:"float32");if(t===void 0)return[a];let r=M(t,"y","meshgrid",t instanceof Le?t.dtype:"float32"),s=Nt(a.shape),i=Nt(r.shape);return n==="xy"?(a=H(a,[1,-1]),r=H(r,[-1,1]),[Be($n([i,1],a.dtype),a),Be(r,$n([1,s],r.dtype))]):(a=H(a,[-1,1]),r=H(r,[1,-1]),[Be(a,$n([1,i],a.dtype)),Be($n([s,1],r.dtype),r)])}function XE(e,t=null,n=!1){let a={x:M(e,"x","min")},r={axis:t,keepDims:n};return D.runKernel(Ms,a,r)}var gl=O({min_:XE});function KE(e,t){let n=M(e,"a","minimum"),a=M(t,"b","minimum");[n,a]=bt(n,a),n.dtype==="bool"&&(n=fe(n,"int32"),a=fe(a,"int32")),pt(n.shape,a.shape);let r={a:n,b:a};return D.runKernel(Fs,r)}var xl=O({minimum_:KE});function ZE(e,t,n){F(n==="reflect"||n==="symmetric",()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${n}.`);let a=M(e,"x","mirrorPad");if(a.rank===0)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");F(t.length===a.rank,()=>`Padding doesn't match input. Must be ${a.rank}. Got ${t.length}.`);let r=n==="reflect"?1:0;for(let o=0;o"Invalid number of paddings. Must be length of 2 each."),F(t[o][0]>=0&&t[o][0]<=a.shape[o]-r&&t[o][1]>=0&&t[o][1]<=a.shape[o]-r,()=>`Padding in dimension ${o} cannot be greater than or equal to ${a.shape[o]-r} or less than 0 for input of shape ${a.shape}`);let s={paddings:t,mode:n},i={x:a};return D.runKernel($s,i,s)}var SA=O({mirrorPad_:ZE});function YE(e,t){let n=M(e,"a","mod"),a=M(t,"b","mod");[n,a]=bt(n,a);let r={a:n,b:a};return D.runKernel(Mo,r)}var NA=O({mod_:YE});function JE(e){let t=M(e,"x","square"),n={};return D.runKernel("Square",{x:t},n)}var st=O({square_:JE});function QE(e,t=null,n=!1){e=M(e,"x","moments");let a=ra(t,e.shape),r=wt(e,a,n),s=r.shape;n||(s=mi(r.shape,a));let i=st(ge(fe(e,"float32"),H(r,s))),o=wt(i,a,n);return{mean:r,variance:o}}var Mc=O({moments_:QE});function eC(e,t,n,a){let r=M(t,"data","multiRNNCell"),s=Vu(n,"c","multiRNNCell"),i=Vu(a,"h","multiRNNCell"),o=r,l=[];for(let p=0;p2)throw new Error(`Rank of probabilities must be 1 or 2, but is ${i}`);n=n||Math.random();let o={logits:i===1?H(r,[1,-1]):r},l={numSamples:t,seed:n,normalized:a},d=D.runKernel(Jp,o,l);return i===1?H(d,[d.size]):d}var Zb=O({multinomial_:nC});function aC(e,t){let n=M(e,"a","notEqual"),a=M(t,"b","notEqual");[n,a]=bt(n,a),pt(n.shape,a.shape);let r={a:n,b:a};return D.runKernel($o,r)}var Ai=O({notEqual_:aC});function rC(e){let t={x:M(e,"x","onesLike")};return D.runKernel(_o,t)}var Dn=O({onesLike_:rC});function sC(e,t){let n=M(e,"v1","outerProduct"),a=M(t,"v2","outerProduct");F(n.rank===1&&a.rank===1,()=>`Error in outerProduct: inputs must be rank 1, but got ranks ${n.rank} and ${a.rank}.`);let r=H(n,[-1,1]),s=H(a,[1,-1]);return Be(r,s)}var iC=O({outerProduct_:sC});function oC(e,t,n=0){let a=M(e,"x","pad");if(a.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");let r={paddings:t,constantValue:n},s={x:a};return D.runKernel(zs,s,r)}var rr=O({pad_:oC});function lC(e,t,n=0){return F(t.length===2,()=>"Invalid number of paddings. Must be length of 2."),rr(e,[t],n)}var uC=O({pad1d_:lC});function dC(e,t,n=0){return F(t.length===2&&t[0].length===2&&t[1].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),rr(e,t,n)}var pC=O({pad2d_:dC});function cC(e,t,n=0){return F(t.length===3&&t[0].length===2&&t[1].length===2&&t[2].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),rr(e,t,n)}var hC=O({pad3d_:cC});function fC(e,t,n=0){return F(t.length===4&&t[0].length===2&&t[1].length===2&&t[2].length===2&&t[3].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),rr(e,t,n)}var mC=O({pad4d_:fC});function AC(e,t,n){let a=M(e,"x","spaceToBatchND");F(a.rank>=1+t.length,()=>`input rank ${a.rank} should be > than [blockShape] ${t.length}`),F(n.length===t.length,()=>`paddings.shape[0] ${n.length} must be equal to [blockShape] ${t.length}`),F(a.shape.reduce((i,o,l)=>l>0&&l<=t.length?i&&(o+n[l-1][0]+n[l-1][1])%t[l-1]==0:i,!0),()=>`input spatial dimensions ${a.shape.slice(1)} with paddings ${n.toString()} must be divisible by blockShapes ${t.toString()}`);let r={x:a},s={blockShape:t,paddings:n};return D.runKernel(Ru,r,s)}var Qu=O({spaceToBatchND_:AC});function xC(e,t,n,a,r,s){r==null&&(r=[1,1]),s==null&&(s=1),a===0&&(a="valid");let i=M(e,"x","maxPool"),o=i,l=!1;i.rank===3&&(l=!0,o=H(i,[1,i.shape[0],i.shape[1],i.shape[2]])),F(za(s,r),()=>`Error in pool: Either strides or dilations must be 1. Got strides ${s} and dilations '${r}'`);let d=Tb(o.shape,t,s,r,a),u=[d.dilationHeight,d.dilationWidth],p;a==="same"?p=gC([d.filterHeight,d.filterWidth],u):p=[[0,0],[0,0]];let c=u[0]===1&&u[1]===1,[h,m]=yC([d.inHeight,d.inWidth],u,p),f=c?a:"valid",A=c?o:Qu(o,u,h),y=(n==="avg"?()=>qu(A,t,s,f):()=>Ju(A,t,s,f))(),g=c?y:Xu(y,u,m);return l?H(g,[g.shape[1],g.shape[2],g.shape[3]]):g}function yC(e,t,n){let a=n.map(u=>u[0]),r=n.map(u=>u[1]),s=e.concat(a,r),i=t.map((u,p)=>(u-s[p]%u)%u),o=r.map((u,p)=>u+i[p]),l=t.map((u,p)=>[a[p],o[p]]),d=t.map((u,p)=>[0,i[p]]);return[l,d]}function gC(e,t){let n=e.map((s,i)=>s+(s-1)*(t[i]-1)).map(s=>s-1),a=n.map(s=>Math.floor(s/2)),r=n.map((s,i)=>s-a[i]);return n.map((s,i)=>[a[i],r[i]])}var Yb=O({pool_:xC});function bC(e,t){let n=M(e,"base","pow"),a=M(t,"exp","pow");[n,a]=bt(n,a);let r={a:n,b:a};return D.runKernel(_s,r)}var sr=O({pow_:bC});function vC(e,t){let n=M(e,"x","prelu"),a=M(t,"alpha","prelu"),r={x:n,alpha:a};return D.runKernel(Ps,r)}var ed=O({prelu_:vC});function wC(e,t=null,n=!1){let a=M(e,"x","prod");a.dtype==="bool"&&(a=fe(a,"int32"));let r={x:a},s={axis:t,keepDims:n};return D.runKernel(Lo,r,s)}var Fc=O({prod_:wC});function kC(e,t,n){let a=Nt(e),r=null;if(n==null||n==="float32")r=new Float32Array(a);else if(n==="int32")r=new Int32Array(a);else if(n==="bool")r=new Uint8Array(a);else throw new Error(`Unknown data type ${n}`);for(let s=0;s=1||s===0);let i=Math.sqrt(-2*Math.log(s)/s);e=this.mean+this.stdDev*a*i,t=this.mean+this.stdDev*r*i,(!this.truncated||this.isValidTruncated(e))&&(n=!0)}return(!this.truncated||this.isValidTruncated(t))&&(this.nextVal=this.convertValue(t)),this.convertValue(e)}convertValue(e){return this.dtype==null||this.dtype==="float32"?e:Math.round(e)}isValidTruncated(e){return e<=this.upper&&e>=this.lower}},SC=class{constructor(e,t,n,a){this.alpha=e,this.beta=1/t,this.dtype=n;let r=a||Math.random();this.randu=TA.alea(r.toString()),this.randn=new EA(0,1,n,!1,this.randu()),e<1?this.d=e+2/3:this.d=e-1/3,this.c=1/Math.sqrt(9*this.d)}nextValue(){let e,t,n,a,r,s;for(;;){do a=this.randn.nextValue(),s=1+this.c*a;while(s<=0);if(s*=s*s,e=a*a,t=1-.331*e*e,n=.5*e+this.d*(1-s+Math.log(s)),r=this.randu(),rthis.dtype==null||this.dtype==="float32",this.min=e,this.range=t-e,this.dtype=n,a==null&&(a=Math.random()),typeof a=="number"&&(a=a.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error(`The difference between ${e} - ${t} <= 1 and dtype is not float`);this.random=TA.alea(a)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}nextValue(){return this.convertValue(this.min+this.range*this.random())}};function TC(e,t,n=1,a="float32",r){if(n==null&&(n=1),a==null&&(a="float32"),a!=="float32"&&a!=="int32")throw new Error(`Unsupported data type ${a}`);let s=new SC(t,n,a,r),i=We(e,a);for(let o=0;o`Error in reverse1D: x must be rank 1 but got rank ${t.rank}.`),On(t,0)}var _C=O({reverse1d_:zC});function PC(e,t){let n=M(e,"x","reverse");return F(n.rank===2,()=>`Error in reverse2D: x must be rank 2 but got rank ${n.rank}.`),On(n,t)}var LC=O({reverse2d_:PC});function WC(e,t){let n=M(e,"x","reverse");return F(n.rank===3,()=>`Error in reverse3D: x must be rank 3 but got rank ${n.rank}.`),On(n,t)}var BC=O({reverse3d_:WC});function VC(e,t){let n=M(e,"x","reverse");return F(n.rank===4,()=>`Error in reverse4D: x must be rank 4 but got rank ${n.rank}.`),On(n,t)}var jC=O({reverse4d_:VC});function UC(e){let t={x:M(e,"x","round")};return D.runKernel(js,t)}var Dc=O({round_:UC});function HC(e){let t={x:M(e,"x","rsqrt")};return D.runKernel(Us,t)}var Oc=O({rsqrt_:HC});function Se(e,t){if((tn(e)&&t!=="string"||Array.isArray(e))&&t!=="complex64")throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if(t==="string"&&tn(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return Er(e,[],[],t)}function GC(e){let t={x:M(e,"x","selu")};return D.runKernel(Uo,t)}var zc=O({selu_:GC});function qC(e,t,n,a,r,s=[1,1],i="NHWC"){let o=M(e,"x","separableConv2d"),l=M(t,"depthwiseFilter","separableConv2d"),d=M(n,"pointwiseFilter","separableConv2d"),u=o,p=!1;if(o.rank===3&&(p=!0,u=H(o,[1,o.shape[0],o.shape[1],o.shape[2]])),i==="NCHW")throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");F(u.rank===4,()=>`Error in separableConv2d: input must be rank 4, but got rank ${u.rank}.`),F(l.rank===4,()=>`Error in separableConv2d: depthwise filter must be rank 4, but got rank ${l.rank}.`),F(d.rank===4,()=>`Error in separableConv2d: pointwise filter must be rank 4, but got rank ${l.rank}.`),F(d.shape[0]===1,()=>`Error in separableConv2d: the first dimension of pointwise filter must be 1, but got ${d.shape[0]}.`),F(d.shape[1]===1,()=>`Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${d.shape[1]}.`);let c=l.shape[2],h=l.shape[3];F(d.shape[2]===c*h,()=>`Error in separableConv2d: the third dimension of pointwise filter must be ${c*h}, but got ${d.shape[2]}.`);let m=fl(u,l,a,r,i,s),f=ar(m,d,1,"valid",i);return p?H(f,[f.shape[1],f.shape[2],f.shape[3]]):f}var RA=O({separableConv2d_:qC});async function XC(e,t){let n=M(e,"x","setdiff1d"),a=M(t,"y","setdiff1d");F(n.dtype===a.dtype,()=>`x and y should have the same dtype, but got x (${n.dtype}) and y (${a.dtype}).`),F(n.rank===1,()=>`x should be 1D tensor, but got x (${n.shape}).`),F(a.rank===1,()=>`y should be 1D tensor, but got y (${a.shape}).`);let r=await n.data(),s=await a.data(),i=new Set(s),o=0;for(let u=0;u`slice1d expects a rank-1 tensor, but got a rank-${a.rank} tensor`),Re(a,[t],[n])}var Lc=O({slice1d_:JC});function QC(e,t,n){let a=M(e,"x","slice2d");return F(a.rank===2,()=>`slice2d expects a rank-2 tensor, but got a rank-${a.rank} tensor`),Re(a,t,n)}var FA=O({slice2d_:QC});function eR(e,t,n){let a=M(e,"x","slice3d");return F(a.rank===3,()=>`slice3d expects a rank-3 tensor, but got a rank-${a.rank} tensor`),Re(a,t,n)}var Wc=O({slice3d_:eR});function tR(e,t,n){let a=M(e,"x","slice4d");return F(a.rank===4,()=>`slice4d expects a rank-4 tensor, but got a rank-${a.rank} tensor`),Re(a,t,n)}var nd=O({slice4d_:tR});function nR(e,t=-1){let n=M(e,"logits","softmax","float32");if(t===-1&&(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}`);let a={logits:n},r={dim:t};return D.runKernel(Ks,a,r)}var ad=O({softmax_:nR});function aR(e){F(e.dtype==="complex64",()=>`The dtype for tf.spectral.fft() must be complex64 but got ${e.dtype}.`);let t={input:e};return D.runKernel(Up,t)}var rd=O({fft_:aR});function rR(e){F(e.dtype==="complex64",()=>`The dtype for tf.spectral.ifft() must be complex64 but got ${e.dtype}.`);let t={input:e};return D.runKernel(Hp,t)}var wl=O({ifft_:rR});function sR(e){let t=e.shape[e.shape.length-1],n=e.size/t,a;if(t<=2){let r=H(e,[n,t]);a=wl(r)}else{let r=[n,2*(t-1)],s=H(td(e),[n,t]),i=H(Sc(e),[n,t]),o=On(Re(s,[0,1],[n,t-2]),1),l=_(On(Re(i,[0,1],[n,t-2]),1),Se(-1)),d=ot([s,o],1),u=ot([i,l],1),p=H(Tr(d,u),[r[0],r[1]]);a=wl(p)}if(a=td(a),e.rank===3&&e.shape[0]!==0){let r=a,s=e.shape[0];a=H(a,[s,a.shape[0]/s,a.shape[1]]),r.dispose()}return a}var Bc=O({irfft_:sR});function iR(e,t,n=0){let a={x:M(e,"x","split")},r={numOrSizeSplits:t,axis:n};return D.runKernel(Ko,a,r)}var an=O({split_:iR});function oR(e,t){F(e.dtype==="float32",()=>`The dtype for rfft() must be real value but got ${e.dtype}`);let n=e.shape[e.shape.length-1],a=e.size/n,r;if(t!=null&&t0),f=e.shape.map(A=>A);f[e.shape.length-1]=t,r=Re(e,m,f),n=t}else if(t!=null&&t>n){let m=e.shape.map(f=>f);m[e.shape.length-1]=t-n,r=ot([e,Ct(m)],e.shape.length-1),n=t}else r=e;let s=Ue(r),i=H(Tr(r,s),[a,n]),o=rd(i),l=Math.floor(n/2)+1,d=td(o),u=Sc(o),p=an(d,[l,n-l],d.shape.length-1),c=an(u,[l,n-l],u.shape.length-1),h=r.shape.slice();return h[r.shape.length-1]=l,H(Tr(p[0],c[0]),h)}var sd=O({rfft_:oR});function lR(e){let t={x:M(e,"x","sqrt")};return D.runKernel(qs,t)}var Jt=O({sqrt_:lR});function uR(e,t){let n=M(e,"a","squaredDifference"),a=M(t,"b","squaredDifference");[n,a]=bt(n,a),pt(n.shape,a.shape);let r={a:n,b:a},s={};return D.runKernel(Zs,r,s)}var Vc=O({squaredDifference_:uR});function dR(e,t){let n=M(e,"x","squeeze");return H(n,bx(n.shape,t).newShape)}var zr=O({squeeze_:dR});function pR(e,t=0){let n=Vu(e,"tensors","stack","string_or_numeric");F(n.length>=1,()=>"Pass at least one tensor to tf.stack"),n.length>0&&F(t<=n[0].rank,()=>"Axis must be <= rank of the tensor");let a=n,r={axis:t};return D.runKernel(Po,a,r)}var zn=O({stack_:pR});function cR(e,t=0){let n={x:M(e,"x","step")},a={alpha:t};return D.runKernel(Nr,n,a)}var kl=O({step_:cR});function hR(e,t,n,a,r=0,s=0,i=0,o=0,l=0){let d={x:M(e,"x","stridedSlice")},u={begin:t,end:n,strides:a,beginMask:r,endMask:s,ellipsisMask:i,newAxisMask:o,shrinkAxisMask:l};return D.runKernel(Zo,d,u)}var $A=O({stridedSlice_:hR});function fR(e){let t={x:M(e,"x","tan")};return D.runKernel(Js,t)}var DA=O({tan_:fR});function Tt(e,t){ss(e);let n=Da(e,t);if(n.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return Er(e,null,n,t)}function ya(e,t,n){if(ss(e),t!=null&&t.length!==2)throw new Error("tensor2d() requires shape to have two numbers");let a=Da(e,n);if(a.length!==2&&a.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return Er(e,t,a,n)}function mR(e,t,n){if(ss(e),t!=null&&t.length!==4)throw new Error("tensor4d() requires shape to have four numbers");let a=Da(e,n);if(a.length!==4&&a.length!==1)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return Er(e,t,a,n)}function AR(e,t,n){if(ss(e),t!=null&&t.length!==5)throw new Error("tensor5d() requires shape to have five numbers");let a=Da(e,n);if(a.length!==5&&a.length!==1)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return Er(e,t,a,n)}function yR(e,t,n){if(ss(e),t!=null&&t.length!==6)throw new Error("tensor6d() requires shape to have six numbers");let a=Da(e,n);if(a.length!==6&&a.length!==1)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(a.length===1&&t==null)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return t=t||a,Er(e,t,a,n)}function gR(e,t=1,n=!0){let a=M(e,"x","topk");if(a.rank===0)throw new Error("topk() expects the input to be of rank 1 or higher");let r=a.shape[a.shape.length-1];if(t>r)throw new Error(`'k' passed to topk() must be <= the last dimension (${r}) but got ${t}`);let s={x:a},i={k:t,sorted:n},[o,l]=D.runKernel(Yo,s,i);return{values:o,indices:l}}var OA=O({topk_:gR});function xR(e,t=0,n=1,a,r){if(a!=null&&a==="bool")throw new Error("Unsupported data type $ { dtype }");let s=new EA(t,n,a,!0,r),i=We(e,a);for(let o=0;o0,()=>"The input tensor must be at least 1D");let a={x:n},r={axis:t},[s,i]=D.runKernel(sc,a,r);return{values:s,indices:i}}var Uc=O({unique_:bR});function vR(e,t,n){let a=M(e,"x","unsortedSegmentSum"),r=M(t,"segmentIds","unsortedSegmentSum","int32");F(Vt(n),()=>"numSegments must be of dtype int");let s={x:a,segmentIds:r},i={numSegments:n};return D.runKernel(Fu,s,i)}var zA=O({unsortedSegmentSum_:vR});function wR(e,t=0){let n=M(e,"x","unstack","string_or_numeric");F(t>=-n.shape.length&&t`Axis = ${t} is not in [-${n.shape.length}, ${n.shape.length})`);let a={value:n},r={axis:t};return D.runKernel(Qo,a,r)}var la=O({unstack_:wR});function e3(e,t=!0,n,a){return D.makeVariable(e,t,n,a)}function t3(e,t){let n=[];for(let s=0;s0,()=>"mask cannot be scalar"),sn(o.slice(s,s+i),r.shape,"mask's shape must match the first K dimensions of tensor's shape,");let l=1;for(let f=s;f"Shape mismatch in v and x");let l=Se(1),d=ge(l,o),u=_(ge(i,s),d);if(r){F(a!=null,()=>"When using zeroDebias: true, step is required.");let p=M(a,"step","movingAverage");u=me(u,ge(l,sr(o,p)))}return se(s,u)}var ER=O({movingAverage_:TR});function CR(e,t,n){let a=M(e,"indices","scatterND","int32"),r=M(t,"updates","scatterND");Gm(r,a,n);let s={indices:a,updates:r},i={shape:n};return D.runKernel(Vo,s,i)}var a3=O({scatterND_:CR});function RR(e,t,n,a){if(e.dtype!=="int32")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}.`);let r=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}.`);let i=t.size;if(!(t.rank===0||t.rank===1&&i===r))throw new Error(`sparseValues has incorrect shape ${t.shape}, should be [] or [${r}]`);if(t.dtype!==a.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}function MR(e,t,n,a=0){let r=M(e,"sparseIndices","sparseToDense","int32"),s=M(t,"sparseValues","sparseToDense"),i=M(a,"defaultValue","sparseToDense",s.dtype);RR(r,s,n,i);let o={sparseIndices:r,sparseValues:s,defaultValue:i},l={outputShape:n};return D.runKernel(rc,o,l)}var PA=O({sparseToDense_:MR});function FR(e,t){let n=M(t,"indices","gatherND","int32"),a={params:M(e,"x","gatherND"),indices:n};return D.runKernel(wo,a)}var r3=O({gatherND_:FR});function $R(e,t){if(t==null)return e.shape.slice();if(er(e.shape,t))return t;if(e.shape.length===t.length){let n=[];for(let a=0;a`x has to be a floating point tensor since it's going to be scaled, but got a ${r.dtype} tensor instead.`),F(t>=0&&t<1,()=>`rate must be a float in the range [0, 1), but got ${t}.`),t===0)return e instanceof Le?r.clone():r;let s=$R(r,n),i=1-t,o=me(yl(se(bl(s,0,1,"float32",a),i)),i);return _(r,o)}var s3=O({dropout_:DR});function i3(e){return Math.floor(Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))))}function LA(e,t,n){let a=1-e%2,r=new Float32Array(e);for(let s=0;s1,()=>`inTopK() expects the predictions to be of rank 2 or higher, but got ${a.rank}`),F(a.rank-1===r.rank,()=>`predictions rank should be 1 larger than targets rank, but got predictions rank ${a.rank} and targets rank ${r.rank}`),sn(a.shape.slice(0,a.shape.length-1),r.shape,"predictions's shape should be align with the targets' shape, except the last dimension.");let s=a.shape[a.shape.length-1];F(n>0&&n<=s,()=>`'k' passed to inTopK() must be > 0 && <= the predictions last dimension (${s}), but got ${n}`);let i=await a.data(),o=await r.data(),[l,d]=[i.length/s,s],u=vx("bool",l);for(let p=0;pA.value-f.value),u[p]=0;for(let f=0;f_R,depthwiseConv2d:()=>PR,matMul:()=>LR});function WR(e,t,n,a,r,s="NHWC",i){let o=e;e.rank===3&&(o=H(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;l.rank===3&&(l=H(t,[1,t.shape[0],t.shape[1],t.shape[2]])),F(o.rank===4,()=>`Error in conv2dDerFilter: input must be rank 4, but got shape ${o.shape}.`),F(l.rank===4,()=>`Error in conv2dDerFilter: dy must be rank 4, but got shape ${l.shape}.`),F(n.length===4,()=>`Error in conv2dDerFilter: filterShape must be length 4, but got ${n}.`);let d=s==="NHWC"?o.shape[3]:o.shape[1],u=s==="NHWC"?l.shape[3]:l.shape[1];F(d===n[2],()=>`Error in conv2dDerFilter: depth of input ${d}) must match input depth in filter (${n[2]}.`),F(u===n[3],()=>`Error in conv2dDerFilter: depth of dy (${u}) must match output depth for filter (${n[3]}).`),i!=null&&F(Vt(r),()=>`Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode ${i} but got pad ${r}.`);let p={x:o,dy:l},c={strides:a,pad:r,dataFormat:s,dimRoundingMode:i,filterShape:n};return D.runKernel($p,p,c)}var WA=O({conv2DBackpropFilter_:WR});function Gc(e,t,n){if(n==null||n==="linear")return e;if(n==="relu")return _(e,kl(t));throw new Error(`Cannot compute gradient for fused activation ${n}.`)}function qc(e,t){let n=t,a=zt(e.shape,t.shape);return a.length>0&&(n=ke(n,a)),H(n,e.shape)}function Xc(e,t,n,a){if(t==="linear")return e;if(t==="relu")return La(e);if(t==="elu")return ml(e);if(t==="relu6")return $c(e);if(t==="prelu")return ed(e,n);if(t==="leakyrelu")return Zu(e,a);if(t==="sigmoid")return wn(e);throw new Error(`Unknown fused activation ${t}.`)}var Kc=(e,t)=>!(e>0)||t==="linear";function BR({x:e,filter:t,strides:n,pad:a,dataFormat:r="NHWC",dilations:s=[1,1],dimRoundingMode:i,bias:o,activation:l="linear",preluActivationWeights:d,leakyreluAlpha:u}){if(l=l||"linear",Kc(D.state.gradientDepth,l)===!1){let b=ar(e,t,n,a,r,s,i);return o!=null&&(b=se(b,o)),Xc(b,l,d,u)}let p=M(e,"x","conv2d"),c=M(t,"filter","conv2d"),h=p,m=!1;p.rank===3&&(m=!0,h=H(p,[1,p.shape[0],p.shape[1],p.shape[2]])),F(h.rank===4,()=>`Error in fused conv2d: input must be rank 4, but got rank ${h.rank}.`),F(c.rank===4,()=>`Error in fused conv2d: filter must be rank 4, but got rank ${c.rank}.`),i!=null&&F(Vt(a),()=>`Error in fused conv2d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${a}.`),F(h.shape[3]===c.shape[2],()=>`Error in conv2d: depth of input (${h.shape[3]}) must match input depth for filter ${c.shape[2]}.`),F(za(n,s),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),F(r==="NHWC",()=>`Error in conv2d: got dataFormat of ${r} but only NHWC is currently supported.`);let f=Gu(h.shape,c.shape,n,s,a,i),A;o!=null&&(A=M(o,"bias","fused conv2d"),[A]=bt(A,p),pt(f.outShape,A.shape));let y;d!=null&&(y=M(d,"prelu weights","fused conv2d"));let g=(b,v)=>{let[N,T,R,$]=v,z=Gc(b,R,l);F(Mr(s),()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`);let P=pA(T.shape,z,N,n,a),V=WA(T,z,N.shape,n,a),j=[P,V];if($!=null){let U=qc($,z);j.push(U)}return j},x={x:h,filter:c,bias:A,preluActivationWeights:y},w={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i,activation:l,leakyreluAlpha:u};return o==null?_a((b,v,N)=>{let T=D.runKernel(ni,x,w);return N([v,b,T]),m&&(T=H(T,[T.shape[1],T.shape[2],T.shape[3]])),{value:T,gradFunc:g}})(h,c):_a((b,v,N,T)=>{let R=D.runKernel(ni,x,w);return T([v,b,R,N]),m&&(R=H(R,[R.shape[1],R.shape[2],R.shape[3]])),{value:R,gradFunc:g}})(h,c,A)}var _R=O({fusedConv2d_:BR});function VR(e,t,n,a,r,s=[1,1],i){let o=e;e.rank===3&&(o=H(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;l.rank===3&&(l=H(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let d={x:o,dy:l},u={strides:a,pad:r,dimRoundingMode:i,dilations:s,filterShape:n};return D.runKernel(_p,d,u)}var o3=O({depthwiseConv2dNativeBackpropFilter_:VR});function jR(e,t,n,a,r,s=[1,1],i){let o=t,l=!1;t.rank===3&&(l=!0,o=H(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let d={dy:o,filter:n},u={strides:a,pad:r,dimRoundingMode:i,dilations:s,inputShape:e},p=D.runKernel(Pp,d,u);return l?H(p,[p.shape[1],p.shape[2],p.shape[3]]):p}var l3=O({depthwiseConv2dNativeBackpropInput_:jR});function UR({x:e,filter:t,strides:n,pad:a,dataFormat:r="NHWC",dilations:s=[1,1],dimRoundingMode:i,bias:o,activation:l="linear",preluActivationWeights:d,leakyreluAlpha:u}){if(Kc(D.state.gradientDepth,l)===!1){let b=fl(e,t,n,a,r,s,i);return o!=null&&(b=se(b,o)),Xc(b,l,d,u)}let p=M(e,"x","depthwiseConv2d"),c=M(t,"filter","depthwiseConv2d"),h=p,m=!1;p.rank===3&&(m=!0,h=H(p,[1,p.shape[0],p.shape[1],p.shape[2]])),F(h.rank===4,()=>`Error in fused depthwiseConv2d: input must be rank 4, but got rank ${h.rank}.`),F(c.rank===4,()=>`Error in fused depthwiseConv2d: filter must be rank 4, but got rank ${c.rank}.`),F(h.shape[3]===c.shape[2],()=>`Error in fused depthwiseConv2d: number of input channels (${h.shape[3]}) must match the inChannels dimension in filter ${c.shape[2]}.`),s==null&&(s=[1,1]),F(za(n,s),()=>`Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`),i!=null&&F(Vt(a),()=>`Error in fused depthwiseConv2d: pad must be an integer when using dimRoundingMode ${i} but got pad ${a}.`);let f=Gu(h.shape,c.shape,n,s,a,i,!0),A;o!=null&&(A=M(o,"bias","fused conv2d"),[A]=bt(A,p),pt(f.outShape,A.shape));let y;d!=null&&(y=M(d,"prelu weights","fused depthwiseConv2d"));let g=(b,v)=>{F(Mr(s),()=>`Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '${s}'`);let[N,T,R,$]=v,z=Gc(b,R,l),P=l3(T.shape,z,N,n,a,s,i),V=o3(T,z,N.shape,n,a,s,i);if($!=null){let j=qc(A,z);return[P,V,j]}return[P,V]},x={x:h,filter:c,bias:A,preluActivationWeights:y},w={strides:n,pad:a,dataFormat:r,dilations:s,dimRoundingMode:i,activation:l,leakyreluAlpha:u};return o==null?_a((b,v,N)=>{let T=D.runKernel(ai,x,w);return N([v,b,T]),m&&(T=H(T,[T.shape[1],T.shape[2],T.shape[3]])),{value:T,gradFunc:g}})(h,c):_a((b,v,N,T)=>{let R=D.runKernel(ai,x,w);return T([v,b,R,N]),m&&(R=H(R,[R.shape[1],R.shape[2],R.shape[3]])),{value:R,gradFunc:g}})(h,c,A)}var PR=O({fusedDepthwiseConv2d_:UR});function HR({a:e,b:t,transposeA:n=!1,transposeB:a=!1,bias:r,activation:s="linear",preluActivationWeights:i,leakyreluAlpha:o}){if(Kc(D.state.gradientDepth,s)===!1){let $=Be(e,t,n,a);return r!=null&&($=se($,r)),Xc($,s,i,o)}let l=M(e,"a","fused matMul"),d=M(t,"b","fused matMul");[l,d]=bt(l,d);let u=n?l.shape[l.rank-2]:l.shape[l.rank-1],p=a?d.shape[d.rank-1]:d.shape[d.rank-2],c=n?l.shape[l.rank-1]:l.shape[l.rank-2],h=a?d.shape[d.rank-2]:d.shape[d.rank-1],m=l.shape.slice(0,-2),f=d.shape.slice(0,-2),A=Nt(m),y=Nt(f);F(l.rank>=2&&d.rank>=2&&l.rank===d.rank,()=>`Error in fused matMul: inputs must have the same rank of at least 2, got ranks ${l.rank} and ${d.rank}.`),F(er(m,f),()=>`Error in fused matMul: outer dimensions (${m}) and (${f}) of Tensors with shapes ${l.shape} and ${d.shape} must match.`),F(u===p,()=>`Error in fused matMul: inner shapes (${u}) and (${p}) of Tensors with shapes ${l.shape} and ${d.shape} and transposeA=${n} and transposeB=${a} must match.`);let g=l.shape.slice(0,-2).concat([c,h]),x=n?H(l,[A,u,c]):H(l,[A,c,u]),w=a?H(d,[y,h,p]):H(d,[y,p,h]),b;r!=null&&(b=M(r,"bias","fused matMul"),[b]=bt(b,l),pt(g,b.shape));let v;i!=null&&(v=M(i,"prelu weights","fused matMul"));let N=($,z)=>{let[P,V,j,U]=z,X=Gc(H($,j.shape),j,s),G,ee;if(!n&&!a?(G=Be(X,V,!1,!0),ee=Be(P,X,!0,!1)):!n&&a?(G=Be(X,V,!1,!1),ee=Be(X,P,!0,!1)):n&&!a?(G=Be(V,X,!1,!0),ee=Be(P,X,!1,!1)):(G=Be(V,X,!0,!0),ee=Be(X,P,!0,!0)),r!=null){let Y=qc(U,X);return[G,ee,Y]}else return[G,ee]},T={a:x,b:w,bias:b,preluActivationWeights:v},R={transposeA:n,transposeB:a,activation:s,leakyreluAlpha:o};return r==null?_a(($,z,P)=>{let V=D.runKernel(ti,T,R);return P([$,z,V]),{value:H(V,g),gradFunc:N}})(x,w):_a(($,z,P,V)=>{let j=D.runKernel(ti,T,R);return V([$,z,j,P]),{value:H(j,g),gradFunc:N}})(x,w,b)}var LR=O({fusedMatMul_:HR});function GR(e){return LA(e,.54,.46)}var qR=O({hammingWindow_:GR});function XR(e){return LA(e,.5,.5)}var u3=O({hannWindow_:XR});function KR(e,t,n,a=!1,r=0){let s=0,i=[];for(;s+t<=e.size;)i.push(Re(e,s,t)),s+=n;if(a)for(;s`Error in cropAndResize: image must be rank 4,but got rank ${i.rank}.`),F(o.rank===2&&o.shape[1]===4,()=>`Error in cropAndResize: boxes must be have size [${d},4] but had shape ${o.shape}.`),F(l.rank===1&&l.shape[0]===d,()=>`Error in cropAndResize: boxInd must be have size [${d}] but had shape ${o.shape}.`),F(a.length===2,()=>`Error in cropAndResize: cropSize must be of length 2, but got length ${a.length}.`),F(a[0]>=1&&a[1]>=1,()=>`cropSize must be atleast [1,1], but was ${a}`),F(r==="bilinear"||r==="nearest",()=>`method must be bilinear or nearest, but was ${r}`);let u={image:i,boxes:o,boxInd:l},p={method:r,extrapolationValue:s,cropSize:a};return D.runKernel(ho,u,p)}var QR=O({cropAndResize_:JR});function eM(e){let t=M(e,"image","flipLeftRight","float32");F(t.rank===4,()=>`Error in flipLeftRight: image must be rank 4,but got rank ${t.rank}.`);let n={image:t};return D.runKernel(bo,n,{})}var tM=O({flipLeftRight_:eM});function nM(e,t,n=0,a=.5){let r=M(e,"image","rotateWithOffset","float32");F(r.rank===4,()=>`Error in rotateWithOffset: image must be rank 4,but got rank ${r.rank}.`);let s={image:r},i={radians:t,fillValue:n,center:a};return D.runKernel(tl,s,i)}var aM=O({rotateWithOffset_:nM});function Il(e,t,n,a,r,s){a==null&&(a=.5),r==null&&(r=Number.NEGATIVE_INFINITY),s==null&&(s=0);let i=e.shape[0];return n=Math.min(n,i),F(0<=a&&a<=1,()=>`iouThreshold must be in [0, 1], but was '${a}'`),F(e.rank===2,()=>`boxes must be a 2D tensor, but was of rank '${e.rank}'`),F(e.shape[1]===4,()=>`boxes must have 4 columns, but 2nd dimension was ${e.shape[1]}`),F(t.rank===1,()=>"scores must be a 1D tensor"),F(t.shape[0]===i,()=>`scores has incompatible shape with boxes. Expected ${i}, but was ${t.shape[0]}`),F(0<=s&&s<=1,()=>`softNmsSigma must be in [0, 1], but was '${s}'`),{maxOutputSize:n,iouThreshold:a,scoreThreshold:r,softNmsSigma:s}}function rM(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY){let s=M(e,"boxes","nonMaxSuppression"),i=M(t,"scores","nonMaxSuppression"),o=Il(s,i,n,a,r);n=o.maxOutputSize,a=o.iouThreshold,r=o.scoreThreshold;let l={maxOutputSize:n,iouThreshold:a,scoreThreshold:r};return D.runKernel(Do,{boxes:s,scores:i},l)}var sM=O({nonMaxSuppression_:rM});function oM(e,t,n){let a=iM(e,t,n),r=a<0?-(a+1):a;e.splice(r,0,t)}function iM(e,t,n){return uM(e,t,n||lM)}function lM(e,t){return e>t?1:e>>1);let o=n(t,e[s]);o>0?a=s+1:(r=s,i=!o)}return i?a:-a-1}function p3(e,t,n,a,r){return BA(e,t,n,a,r,0)}function c3(e,t,n,a,r,s){return BA(e,t,n,a,r,0,!1,s,!0)}function h3(e,t,n,a,r,s){return BA(e,t,n,a,r,s,!0)}function BA(e,t,n,a,r,s,i=!1,o=!1,l=!1){let d=[];for(let A=0;Ar&&d.push({score:t[A],boxIndex:A,suppressBeginIndex:0});d.sort(f3);let u=s>0?-.5/s:0,p=[],c=[];for(;p.length0;){let A=d.pop(),{score:y,boxIndex:g,suppressBeginIndex:x}=A;if(y=x;--b){let v=dM(e,g,p[b]);if(v>=a){w=!0;break}if(A.score=A.score*pM(a,u,v),A.score<=r)break}A.suppressBeginIndex=p.length,w||(A.score===y?(p.push(g),c.push(A.score)):A.score>r&&oM(d,A,f3))}let h=p.length,m=n-h;o&&m>0&&(p.push(...new Array(m).fill(0)),c.push(...new Array(m).fill(0)));let f={selectedIndices:p};return i&&(f.selectedScores=c),l&&(f.validOutputs=h),f}function dM(e,t,n){let a=e.subarray(t*4,t*4+4),r=e.subarray(n*4,n*4+4),s=Math.min(a[0],a[2]),i=Math.min(a[1],a[3]),o=Math.max(a[0],a[2]),l=Math.max(a[1],a[3]),d=Math.min(r[0],r[2]),u=Math.min(r[1],r[3]),p=Math.max(r[0],r[2]),c=Math.max(r[1],r[3]),h=(o-s)*(l-i),m=(p-d)*(c-u);if(h<=0||m<=0)return 0;let f=Math.max(s,d),A=Math.max(i,u),y=Math.min(o,p),g=Math.min(l,c),x=Math.max(y-f,0)*Math.max(g-A,0);return x/(h+m-x)}function pM(e,t,n){let a=Math.exp(t*n*n);return n<=e?a:0}function f3(e,t){return e.score-t.score||e.score===t.score&&t.boxIndex-e.boxIndex}async function cM(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY){let s=M(e,"boxes","nonMaxSuppressionAsync"),i=M(t,"scores","nonMaxSuppressionAsync"),o=Il(s,i,n,a,r);n=o.maxOutputSize,a=o.iouThreshold,r=o.scoreThreshold;let l=await Promise.all([s.data(),i.data()]),d=l[0],u=l[1],{selectedIndices:p}=p3(d,u,n,a,r);return s!==e&&s.dispose(),i!==t&&i.dispose(),Tt(p,"int32")}var hM=cM;function fM(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=0){let i=M(e,"boxes","nonMaxSuppression"),o=M(t,"scores","nonMaxSuppression"),l=Il(i,o,n,a,r,s);n=l.maxOutputSize,a=l.iouThreshold,r=l.scoreThreshold,s=l.softNmsSigma;let d={boxes:i,scores:o},u={maxOutputSize:n,iouThreshold:a,scoreThreshold:r,softNmsSigma:s},p=D.runKernel(zo,d,u);return{selectedIndices:p[0],selectedScores:p[1]}}var mM=O({nonMaxSuppressionWithScore_:fM});async function AM(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=0){let i=M(e,"boxes","nonMaxSuppressionAsync"),o=M(t,"scores","nonMaxSuppressionAsync"),l=Il(i,o,n,a,r,s);n=l.maxOutputSize,a=l.iouThreshold,r=l.scoreThreshold,s=l.softNmsSigma;let d=await Promise.all([i.data(),o.data()]),u=d[0],p=d[1],{selectedIndices:c,selectedScores:h}=h3(u,p,n,a,r,s);return i!==e&&i.dispose(),o!==t&&o.dispose(),{selectedIndices:Tt(c,"int32"),selectedScores:Tt(h)}}var yM=AM;function gM(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=!1){let i=M(e,"boxes","nonMaxSuppression"),o=M(t,"scores","nonMaxSuppression"),l=Il(i,o,n,a,r,null),d=l.maxOutputSize,u=l.iouThreshold,p=l.scoreThreshold,c={boxes:i,scores:o},h={maxOutputSize:d,iouThreshold:u,scoreThreshold:p,padToMaxOutputSize:s},m=D.runKernel(Oo,c,h);return{selectedIndices:m[0],validOutputs:m[1]}}var xM=O({nonMaxSuppressionPadded_:gM});async function bM(e,t,n,a=.5,r=Number.NEGATIVE_INFINITY,s=!1){let i=M(e,"boxes","nonMaxSuppressionAsync"),o=M(t,"scores","nonMaxSuppressionAsync"),l=Il(i,o,n,a,r,null),d=l.maxOutputSize,u=l.iouThreshold,p=l.scoreThreshold,[c,h]=await Promise.all([i.data(),o.data()]),{selectedIndices:m,validOutputs:f}=c3(c,h,d,u,p,s);return i!==e&&i.dispose(),o!==t&&o.dispose(),{selectedIndices:Tt(m,"int32"),validOutputs:Se(f,"int32")}}var vM=bM;function wM(e,t,n=!1,a=!1){let r=M(e,"images","resizeBilinear");F(r.rank===3||r.rank===4,()=>`Error in resizeBilinear: x must be rank 3 or 4, but got rank ${r.rank}.`),F(t.length===2,()=>`Error in resizeBilinear: new shape must 2D, but got shape ${t}.`),F(a===!1||n===!1,()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");let s=r,i=!1;r.rank===3&&(i=!0,s=H(r,[1,r.shape[0],r.shape[1],r.shape[2]]));let[]=t,o={images:s},l={alignCorners:n,halfPixelCenters:a,size:t},d=D.runKernel(Ws,o,l);return i?H(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var m3=O({resizeBilinear_:wM});function kM(e,t,n=!1,a=!1){let r=M(e,"images","resizeNearestNeighbor");F(r.rank===3||r.rank===4,()=>`Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${r.rank}.`),F(t.length===2,()=>`Error in resizeNearestNeighbor: new shape must 2D, but got shape ${t}.`),F(r.dtype==="float32"||r.dtype==="int32",()=>"`images` must have `int32` or `float32` as dtype"),F(a===!1||n===!1,()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");let s=r,i=!1;r.rank===3&&(i=!0,s=H(r,[1,r.shape[0],r.shape[1],r.shape[2]]));let[]=t,o={images:s},l={alignCorners:n,halfPixelCenters:a,size:t},d=D.runKernel(Cu,o,l);return i?H(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var A3=O({resizeNearestNeighbor_:kM});function SM(e,t="binary",n=!1,a=.5){let r=M(e,"image","threshold"),s=.2989,i=.587,o=.114,l=r.shape[0]*r.shape[1],d=_(Tt([a]),255),u,p,c,h;if(F(r.rank===3,()=>`Error in threshold: image must be rank 3,but got rank ${r.rank}.`),F(r.shape[2]===3||r.shape[2]===1,()=>`Error in threshold: image color channel must be equal to 3 or 1but got ${r.shape[2]}.`),F(r.dtype==="int32"||r.dtype==="float32",()=>`Error in dtype: image dtype must be int32 or float32,but got dtype ${r.dtype}.`),F(t==="otsu"||t==="binary",()=>`Method must be binary or otsu, but was ${t}`),r.shape[2]===3){[u,p,c]=an(r,[1,1,1],-1);let f=_(u,s),A=_(p,i),y=_(c,o);h=se(se(f,A),y)}else h=e;if(t==="otsu"){let f=uA(fe(Dc(h),"int32"),ia([]),256);d=IM(f,l)}let m=n?Or(h,d):Mn(h,d);return fe(_(m,255),"int32")}function IM(e,t){let n=Tt([-1]),a=Tt([0]),r=Tt([0]),s,i,o,l,d,u;for(let p=0;p`Error in transform: image must be rank 4,but got rank ${i.rank}.`),F(o.rank===2&&(o.shape[0]===i.shape[0]||o.shape[0]===1)&&o.shape[1]===8,()=>"Error in transform: Input transform should be batch x 8 or 1 x 8"),F(s==null||s.length===2,()=>`Error in transform: outputShape must be [height, width] or null, but got ${s}.`);let l={image:i,transforms:o},d={interpolation:n,fillMode:a,fillValue:r,outputShape:s};return D.runKernel(Jo,l,d)}var EM=O({transform_:TM});function CM(e,t,n){F(t%1==0,()=>`bandPart(): numLower must be an integer, got ${t}.`),F(n%1==0,()=>`bandPart(): numUpper must be an integer, got ${n}.`);let a=M(e,"a","bandPart");F(a.rank>=2,()=>`bandPart(): Rank must be at least 2, got ${a.rank}.`);let r=a.shape,[s,i]=a.shape.slice(-2);if(!(t<=s))throw new Error(`bandPart(): numLower (${t}) must not be greater than the number of rows (${s}).`);if(!(n<=i))throw new Error(`bandPart(): numUpper (${n}) must not be greater than the number of columns (${i}).`);t<0&&(t=s),n<0&&(n=i);let o=H(vl(0,s,1,"int32"),[-1,1]),l=vl(0,i,1,"int32"),d=ge(o,l),u=oa(Or(d,Se(+t,"int32")),Dr(d,Se(-n,"int32"))),p=Ct([s,i],a.dtype);return H(zn(la(H(a,[-1,s,i])).map(c=>nn(u,c,p))),r)}var RM=O({bandPart_:CM});function MM(e){let t;if(Array.isArray(e)){t=!1,F(e!=null&&e.length>0,()=>"Gram-Schmidt process: input must not be null, undefined, or empty");let r=e[0].shape[0];for(let s=1;s`Gram-Schmidt: Non-unique lengths found in the input vectors: (${e[s].shape[0]} vs. ${r})`)}else t=!0,e=an(e,e.shape[0],0).map(r=>zr(r,[0]));F(e.length<=e[0].shape[0],()=>`Gram-Schmidt: Number of vectors (${e.length}) exceeds number of dimensions (${e[0].shape[0]}).`);let n=[],a=e;for(let r=0;r{let s=a[r];if(r>0)for(let i=0;i=2,()=>`qr() requires input tensor to have a rank >= 2, but got rank ${e.rank}`),e.rank===2)return y3(e,t);{let n=e.shape.slice(0,e.shape.length-2).reduce((l,d)=>l*d),a=la(H(e,[n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0),r=[],s=[];a.forEach(l=>{let[d,u]=y3(l,t);r.push(d),s.push(u)});let i=H(zn(r,0),e.shape),o=H(zn(s,0),e.shape);return[i,o]}}function y3(e,t=!1){return D.tidy(()=>{F(e.shape.length===2,()=>`qr2d() requires a 2D Tensor, but got a ${e.shape.length}D Tensor.`);let n=e.shape[0],a=e.shape[1],r=gA(n),s=Oa(e),i=ya([[1]],[1,1]),o=Oa(i),l=n>=a?a:n;for(let d=0;d{let h=Re(s,[d,d],[n-d,1]),m=Hc(h),f=Re(s,[d,d],[1,1]),A=nn(Mn(f,0),ya([[-1]]),ya([[1]])),y=ge(f,_(A,m)),g=me(h,y);g.shape[0]===1?o=Oa(i):o=ot([i,Re(g,[1,0],[g.shape[0]-1,g.shape[1]])],0);let x=vt(me(Be(A,y),m)),w=Re(s,[d,0],[n-d,a]),b=_(x,o),v=Ze(o);if(d===0)s=ge(w,Be(b,Be(v,w)));else{let R=ge(w,Be(b,Be(v,w)));s=ot([Re(s,[0,0],[d,a]),R],0)}let N=Ze(b),T=Re(r,[0,d],[n,r.shape[1]-d]);if(d===0)r=ge(T,Be(Be(T,o),N));else{let R=ge(T,Be(Be(T,o),N));r=ot([Re(r,[0,0],[n,d]),R],1)}return[o,s,r]}),Ee([u,p,c])}return!t&&n>a&&(r=Re(r,[0,0],[n,a]),s=Re(s,[0,0],[a,a])),[r,s]})}var DM=O({qr_:$M}),un;(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"})(un||(un={}));function OM(e,t,n=un.SUM_BY_NONZERO_WEIGHTS){let a=M(e,"losses","computeWeightedLoss"),r=null;t!=null&&(r=M(t,"weights","computeWeightedLoss"));let s=r==null?a:_(a,r);if(n===un.NONE)return s;if(n===un.SUM)return ke(s);if(n===un.MEAN){if(r==null)return wt(s);{let i=a.size/r.size,o=me(ke(s),ke(r));return i>1?me(o,Se(i)):o}}if(n===un.SUM_BY_NONZERO_WEIGHTS){if(r==null)return me(ke(s),Se(a.size));{let i=_(r,$n(a.shape)),o=fe(ke(Ai(i,Se(0))),"float32");return me(ke(s),o)}}throw Error(`Unknown reduction: ${n}`)}var ir=O({computeWeightedLoss_:OM});function zM(e,t,n,a=un.SUM_BY_NONZERO_WEIGHTS){let r=M(e,"labels","absoluteDifference"),s=M(t,"predictions","absoluteDifference"),i=null;n!=null&&(i=M(n,"weights","absoluteDifference")),sn(r.shape,s.shape,"Error in absoluteDifference: ");let o=Ot(ge(r,s));return ir(o,i,a)}var _M=O({absoluteDifference_:zM});function PM(e,t,n,a,r=un.SUM_BY_NONZERO_WEIGHTS){let s=M(e,"labels","cosineDistance"),i=M(t,"predictions","cosineDistance"),o=null;a!=null&&(o=M(a,"weights","cosineDistance")),sn(s.shape,i.shape,"Error in cosineDistance: ");let l=Se(1),d=ge(l,ke(_(s,i),n,!0));return ir(d,o,r)}var LM=O({cosineDistance_:PM});function WM(e,t,n,a=un.SUM_BY_NONZERO_WEIGHTS){let r=M(e,"labels","hingeLoss"),s=M(t,"predictions","hingeLoss"),i=null;n!=null&&(i=M(n,"weights","hingeLoss")),sn(r.shape,s.shape,"Error in hingeLoss: ");let o=Se(1);r=ge(_(Se(2),r),o);let l=La(ge(o,_(r,s)));return ir(l,i,a)}var BM=O({hingeLoss_:WM});function VM(e,t,n,a=1,r=un.SUM_BY_NONZERO_WEIGHTS){let s=M(e,"labels","huberLoss"),i=M(t,"predictions","huberLoss"),o=null;n!=null&&(o=M(n,"weights","huberLoss")),sn(s.shape,i.shape,"Error in huberLoss: ");let l=Se(a),d=Ot(ge(i,s)),u=xl(d,l),p=ge(d,u),c=se(_(Se(.5),st(u)),_(l,p));return ir(c,o,r)}var jM=O({huberLoss_:VM});function UM(e,t,n,a=1e-7,r=un.SUM_BY_NONZERO_WEIGHTS){let s=M(e,"labels","logLoss"),i=M(t,"predictions","logLoss"),o=null;n!=null&&(o=M(n,"weights","logLoss")),sn(s.shape,i.shape,"Error in logLoss: ");let l=Se(1),d=Se(a),u=vt(_(s,Fn(se(i,d)))),p=_(ge(l,s),Fn(se(ge(l,i),d))),c=ge(u,p);return ir(c,o,r)}var HM=O({logLoss_:UM});function GM(e,t,n,a=un.SUM_BY_NONZERO_WEIGHTS){let r=M(e,"labels","meanSquaredError"),s=M(t,"predictions","meanSquaredError"),i=null;n!=null&&(i=M(n,"weights","meanSquaredError")),sn(r.shape,s.shape,"Error in meanSquaredError: ");let o=Vc(r,s);return ir(o,i,a)}var qM=O({meanSquaredError_:GM});function XM(e,t){let n=M(e,"labels","sigmoidCrossEntropyWithLogits"),a=M(t,"logits","sigmoidCrossEntropyWithLogits");sn(n.shape,a.shape,"Error in sigmoidCrossEntropyWithLogits: ");let r=La(a),s=_(a,n),i=Tc(qn(vt(Ot(a))));return se(ge(r,s),i)}function KM(e,t,n,a=0,r=un.SUM_BY_NONZERO_WEIGHTS){let s=M(e,"multiClassLabels","sigmoidCrossEntropy"),i=M(t,"logits","sigmoidCrossEntropy"),o=null;if(n!=null&&(o=M(n,"weights","sigmoidCrossEntropy")),sn(s.shape,i.shape,"Error in sigmoidCrossEntropy: "),a>0){let d=Se(a),u=Se(1),p=Se(.5);s=se(_(s,ge(u,d)),_(p,d))}let l=XM(s,i);return ir(l,o,r)}var ZM=O({sigmoidCrossEntropy_:KM});function YM(e,t,n=-1){if(n===-1&&(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}`);return _a((a,r,s)=>{let i=kA(r,[n],!0),o=ge(fe(r,"float32"),i);s([a,o]);let l=vt(_(o,a));return{value:ke(l,[n]),gradFunc:(d,u)=>{let[p,c]=u,h=mi(d.shape,[n]);return[_(H(d,h),ge(fe(p,"float32"),qn(c))),_(H(d,h),ge(qn(c),fe(p,"float32")))]}}})(e,t)}function JM(e,t,n,a=0,r=un.SUM_BY_NONZERO_WEIGHTS){let s=M(e,"onehotLabels","softmaxCrossEntropy"),i=M(t,"logits","softmaxCrossEntropy"),o=null;if(n!=null&&(o=M(n,"weights","softmaxCrossEntropy")),sn(s.shape,i.shape,"Error in softmaxCrossEntropy: "),a>0){let d=Se(a),u=Se(1),p=Se(s.shape[1]);s=se(_(s,ge(u,d)),me(d,p))}let l=YM(s,i);return ir(l,o,r)}var QM=O({softmaxCrossEntropy_:JM});function eF(e,t,n,a){let r=M(e,"indices","sparseFillEmptyRows"),s=M(t,"values","sparseFillEmptyRows"),i=M(n,"denseShape","sparseFillEmptyRows"),o=M(a,"defaultValue","sparseFillEmptyRows",s.dtype);if(r.rank!==2)throw new Error(`Indices should be Tensor2D but received shape + ${r.shape}`);if(s.rank!==1)throw new Error(`Values should be Tensor1D but received shape ${s.shape}`);if(i.rank!==1)throw new Error(`Dense shape should be Tensor1D but received shape ${i.shape}`);if(o.rank!==0)throw new Error(`Default value should be a scalar but received shape ${o.shape}`);let l={indices:r,values:s,denseShape:i,defaultValue:o},d=D.runKernel(nc,l);return{outputIndices:d[0],outputValues:d[1],emptyRowIndicator:d[2],reverseIndexMap:d[3]}}var tF=O({sparseFillEmptyRows_:eF});function nF(e,t,n){let a=M(e,"inputIndices","sparseReshape"),r=M(t,"inputShape","sparseReshape"),s=M(n,"newShape","sparseReshape");if(a.rank!==2)throw new Error(`Input indices should be Tensor2D but received shape + ${a.shape}`);if(r.rank!==1)throw new Error(`Input shape should be Tensor1D but received shape ${r.shape}`);if(s.rank!==1)throw new Error(`New shape should be Tensor1D but received shape ${s.shape}`);let i={inputIndices:a,inputShape:r,newShape:s},o=D.runKernel(ac,i);return{outputIndices:o[0],outputShape:o[1]}}var aF=O({sparseReshape_:nF}),rF={fft:rd,ifft:wl,rfft:sd,irfft:Bc},sF={hammingWindow:qR,hannWindow:u3,frame:d3,stft:YR},Ye={flipLeftRight:tM,resizeNearestNeighbor:A3,resizeBilinear:m3,rotateWithOffset:aM,cropAndResize:QR,nonMaxSuppression:sM,nonMaxSuppressionAsync:hM,nonMaxSuppressionWithScore:mM,nonMaxSuppressionWithScoreAsync:yM,nonMaxSuppressionPadded:xM,nonMaxSuppressionPaddedAsync:vM,threshold:NM,transform:EM},g3={bandPart:RM,gramSchmidt:FM,qr:DM},iF={absoluteDifference:_M,computeWeightedLoss:ir,cosineDistance:LM,hingeLoss:BM,huberLoss:jM,logLoss:HM,meanSquaredError:qM,sigmoidCrossEntropy:ZM,softmaxCrossEntropy:QM},x3={sparseFillEmptyRows:tF,sparseReshape:aF},or=class extends vb{minimize(e,t=!1,n){let{value:a,grads:r}=this.computeGradients(e,n);if(n!=null){let s=n.map(i=>({name:i.name,tensor:r[i.name]}));this.applyGradients(s)}else this.applyGradients(r);return Ee(r),t?a:(a.dispose(),null)}get iterations(){return this.iterations_==null&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return jb(e,t)}dispose(){this.iterations_!=null&&Ee(this.iterations_)}async saveIterations(){return this.iterations_==null&&(this.iterations_=0),{name:"iter",tensor:Se(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(or,Symbol.hasInstance,{value:e=>e.minimize!=null&&e.computeGradients!=null&&e.applyGradients!=null});var Zc=class extends or{constructor(e,t,n=null){super();this.learningRate=e,this.rho=t,this.epsilon=n,this.accumulatedGrads=[],this.accumulatedUpdates=[],n==null&&(this.epsilon=D.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=D.registeredVariables[t],r=!1;this.accumulatedGrads[n]==null&&(this.accumulatedGrads[n]={originalName:`${t}/accum_grad`,variable:W(()=>Ue(a).variable(r))}),this.accumulatedUpdates[n]==null&&(this.accumulatedUpdates[n]={originalName:`${t}/accum_var`,variable:W(()=>Ue(a).variable(r))});let s=Array.isArray(e)?e[n].tensor:e[t];if(s==null)return;let i=this.accumulatedGrads[n].variable,o=this.accumulatedUpdates[n].variable;W(()=>{let l=se(_(i,this.rho),_(st(s),1-this.rho)),d=_(me(Jt(se(o,this.epsilon)),Jt(se(i,this.epsilon))),s),u=se(_(o,this.rho),_(st(d),1-this.rho));i.assign(l),o.assign(u);let p=se(_(d,-this.learningRate),a);a.assign(p)})}),this.incrementIterations()}dispose(){this.accumulatedUpdates!=null&&(Ee(this.accumulatedGrads.map(e=>e.variable)),Ee(this.accumulatedUpdates.map(e=>e.variable)))}async getWeights(){let e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=e.length/2,n=!1;this.accumulatedGrads=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedUpdates=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.rho,t.epsilon)}};Zc.className="Adadelta";Rr(Zc);var Yc=class extends or{constructor(e,t=.1){super();this.learningRate=e,this.initialAccumulatorValue=t,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=D.registeredVariables[t];if(this.accumulatedGrads[n]==null){let i=!1;this.accumulatedGrads[n]={originalName:`${t}/accumulator`,variable:W(()=>Al(a.shape,this.initialAccumulatorValue).variable(i))}}let r=Array.isArray(e)?e[n].tensor:e[t];if(r==null)return;let s=this.accumulatedGrads[n].variable;W(()=>{let i=se(s,st(r));s.assign(i);let o=se(_(me(r,Jt(se(i,D.backend.epsilon()))),-this.learningRate),a);a.assign(o)})}),this.incrementIterations()}dispose(){this.accumulatedGrads!=null&&Ee(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);let t=!1;this.accumulatedGrads=e.map(n=>({originalName:n.name,variable:n.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(e,t){return new e(t.learningRate,t.initialAccumulatorValue)}};Yc.className="Adagrad";Rr(Yc);var Jc=class extends or{constructor(e,t,n,a=null){super();this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=a,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],W(()=>{this.accBeta1=Se(t).variable(),this.accBeta2=Se(n).variable()}),a==null&&(this.epsilon=D.backend.epsilon())}applyGradients(e){let t=Array.isArray(e)?e.map(n=>n.name):Object.keys(e);W(()=>{let n=ge(1,this.accBeta1),a=ge(1,this.accBeta2);t.forEach((r,s)=>{let i=D.registeredVariables[r],o=!1;this.accumulatedFirstMoment[s]==null&&(this.accumulatedFirstMoment[s]={originalName:`${r}/m`,variable:W(()=>Ue(i).variable(o))}),this.accumulatedSecondMoment[s]==null&&(this.accumulatedSecondMoment[s]={originalName:`${r}/v`,variable:W(()=>Ue(i).variable(o))});let l=Array.isArray(e)?e[s].tensor:e[r];if(l==null)return;let d=this.accumulatedFirstMoment[s].variable,u=this.accumulatedSecondMoment[s].variable,p=se(_(d,this.beta1),_(l,1-this.beta1)),c=se(_(u,this.beta2),_(st(l),1-this.beta2)),h=me(p,n),m=me(c,a);d.assign(p),u.assign(c);let f=se(_(me(h,se(Jt(m),this.epsilon)),-this.learningRate),i);i.assign(f)}),this.accBeta1.assign(_(this.accBeta1,this.beta1)),this.accBeta2.assign(_(this.accBeta2,this.beta2))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),this.accumulatedFirstMoment!=null&&Ee(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedSecondMoment!=null&&Ee(this.accumulatedSecondMoment.map(e=>e.variable))}async getWeights(){let e=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e),W(()=>{this.accBeta1.assign(sr(this.beta1,this.iterations_+1)),this.accBeta2.assign(sr(this.beta2,this.iterations_+1))});let t=e.length/2,n=!1;this.accumulatedFirstMoment=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedSecondMoment=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)}))}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)}};Jc.className="Adam";Rr(Jc);var Qc=class extends or{constructor(e,t,n,a=null,r=0){super();this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=a,this.decay=r,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],W(()=>{this.iteration=Se(0).variable(),this.accBeta1=Se(t).variable()}),a==null&&(this.epsilon=D.backend.epsilon())}applyGradients(e){let t=Array.isArray(e)?e.map(n=>n.name):Object.keys(e);W(()=>{let n=ge(1,this.accBeta1),a=me(-this.learningRate,se(_(this.iteration,this.decay),1));t.forEach((r,s)=>{let i=D.registeredVariables[r],o=!1;this.accumulatedFirstMoment[s]==null&&(this.accumulatedFirstMoment[s]={originalName:`${r}/m`,variable:Ue(i).variable(o)}),this.accumulatedWeightedInfNorm[s]==null&&(this.accumulatedWeightedInfNorm[s]={originalName:`${r}/v`,variable:Ue(i).variable(o)});let l=Array.isArray(e)?e[s].tensor:e[r];if(l==null)return;let d=this.accumulatedFirstMoment[s].variable,u=this.accumulatedWeightedInfNorm[s].variable,p=se(_(d,this.beta1),_(l,1-this.beta1)),c=_(u,this.beta2),h=Ot(l),m=Pa(c,h);d.assign(p),u.assign(m);let f=se(_(me(a,n),me(p,se(m,this.epsilon))),i);i.assign(f)}),this.iteration.assign(se(this.iteration,1)),this.accBeta1.assign(_(this.accBeta1,this.beta1))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&Ee(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedWeightedInfNorm!=null&&Ee(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)}};Qc.className="Adamax";Rr(Qc);var id=class extends or{constructor(e){super();this.learningRate=e,this.setLearningRate(e)}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=Array.isArray(e)?e[n].tensor:e[t];if(a==null)return;let r=D.registeredVariables[t];W(()=>{let s=se(_(this.c,a),r);r.assign(s)})}),this.incrementIterations()}setLearningRate(e){this.learningRate=e,this.c!=null&&this.c.dispose(),this.c=jt(Se(-e))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(e=await this.extractIterations(e),e.length!==0)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,t){return new e(t.learningRate)}};id.className="SGD";Rr(id);var eh=class extends id{constructor(e,t,n=!1){super(e);this.learningRate=e,this.momentum=t,this.useNesterov=n,this.accumulations=[],this.m=Se(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=D.registeredVariables[t];if(this.accumulations[n]==null){let i=!1;this.accumulations[n]={originalName:`${t}/momentum`,variable:W(()=>Ue(a).variable(i))}}let r=this.accumulations[n].variable,s=Array.isArray(e)?e[n].tensor:e[t];s!=null&&W(()=>{let i,o=se(_(this.m,r),s);this.useNesterov?i=se(_(this.c,se(s,_(o,this.m))),a):i=se(_(this.c,o),a),r.assign(o),a.assign(i)})}),this.incrementIterations()}dispose(){this.m.dispose(),this.accumulations!=null&&Ee(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);let t=!1;this.accumulations=e.map(n=>({originalName:n.name,variable:n.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}};eh.className="Momentum";Rr(eh);var th=class extends or{constructor(e,t=.9,n=0,a=null,r=!1){super();if(this.learningRate=e,this.decay=t,this.momentum=n,this.epsilon=a,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=r,a==null&&(this.epsilon=D.backend.epsilon()),e==null)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(e){(Array.isArray(e)?e.map(t=>t.name):Object.keys(e)).forEach((t,n)=>{let a=D.registeredVariables[t],r=!1;this.accumulatedMeanSquares[n]==null&&(this.accumulatedMeanSquares[n]={originalName:`${t}/rms`,variable:W(()=>Ue(a).variable(r))}),this.accumulatedMoments[n]==null&&(this.accumulatedMoments[n]={originalName:`${t}/momentum`,variable:W(()=>Ue(a).variable(r))}),this.accumulatedMeanGrads[n]==null&&this.centered&&(this.accumulatedMeanGrads[n]={originalName:`${t}/mg`,variable:W(()=>Ue(a).variable(r))});let s=Array.isArray(e)?e[n].tensor:e[t];if(s==null)return;let i=this.accumulatedMeanSquares[n].variable,o=this.accumulatedMoments[n].variable;W(()=>{let l=se(_(i,this.decay),_(st(s),1-this.decay));if(this.centered){let d=this.accumulatedMeanGrads[n].variable,u=se(_(d,this.decay),_(s,1-this.decay)),p=me(_(s,this.learningRate),Jt(ge(l,se(st(u),this.epsilon)))),c=se(_(o,this.momentum),p);i.assign(l),d.assign(u),o.assign(c);let h=ge(a,c);a.assign(h)}else{let d=se(_(i,this.decay),_(st(s),1-this.decay)),u=se(_(o,this.momentum),me(_(s,this.learningRate),Jt(se(d,this.epsilon))));i.assign(d),o.assign(u);let p=ge(a,u);a.assign(p)}})}),this.incrementIterations()}dispose(){this.accumulatedMeanSquares!=null&&Ee(this.accumulatedMeanSquares.map(e=>e.variable)),this.accumulatedMeanGrads!=null&&this.centered&&Ee(this.accumulatedMeanGrads.map(e=>e.variable)),this.accumulatedMoments!=null&&Ee(this.accumulatedMoments.map(e=>e.variable))}async getWeights(){let e=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&e.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(e.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(e){e=await this.extractIterations(e);let t=this.centered?e.length/3:e.length/2,n=!1;this.accumulatedMeanSquares=e.slice(0,t).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.accumulatedMoments=e.slice(t,t*2).map(a=>({originalName:a.name,variable:a.tensor.variable(n)})),this.centered&&(this.accumulatedMeanGrads=e.slice(t*2,t*3).map(a=>({originalName:a.name,variable:a.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)}};th.className="RMSProp";Rr(th);var yi=class{static sgd(e){return new id(e)}static momentum(e,t,n=!1){return new eh(e,t,n)}static rmsprop(e,t=.9,n=0,a=null,r=!1){return new th(e,t,n,a,r)}static adam(e=.001,t=.9,n=.999,a=null){return new Jc(e,t,n,a)}static adadelta(e=.001,t=.95,n=null){return new Zc(e,t,n)}static adamax(e=.002,t=.9,n=.999,a=null,r=0){return new Qc(e,t,n,a,r)}static adagrad(e,t=.1){return new Yc(e,t)}},gi={sgd:yi.sgd,momentum:yi.momentum,adadelta:yi.adadelta,adagrad:yi.adagrad,rmsprop:yi.rmsprop,adamax:yi.adamax,adam:yi.adam},oF=(()=>typeof requestAnimationFrame!="undefined"?requestAnimationFrame:typeof setImmediate!="undefined"?setImmediate:e=>e())();function nh(){return new Promise(e=>oF(()=>e()))}var C={};Fe(C,{ERF_A1:()=>gF,ERF_A2:()=>xF,ERF_A3:()=>bF,ERF_A4:()=>vF,ERF_A5:()=>wF,ERF_P:()=>yF,PARALLELIZE_THRESHOLD:()=>VA,SELU_SCALE:()=>v3,SELU_SCALEALPHA:()=>b3,applyActivation:()=>Xc,assertAndGetBroadcastShape:()=>pt,assertAxesAreInnerMostDims:()=>OE,assertParamsConsistent:()=>lF,assignToTypedArray:()=>RF,axesAreInnerMostDims:()=>vA,calculateShapes:()=>ub,checkEinsumDimSizes:()=>OF,combineLocations:()=>Hb,complexWithEvenIndex:()=>TF,complexWithOddIndex:()=>EF,computeConv2DInfo:()=>Gu,computeConv3DInfo:()=>Eb,computeDefaultPad:()=>oA,computeDilation2DInfo:()=>sT,computeOptimalWindowSize:()=>dF,computeOutAndReduceShapes:()=>Gb,computeOutShape:()=>uF,computePool2DInfo:()=>Tb,computePool3DInfo:()=>iT,convertConv2DDataFormat:()=>Nb,decodeEinsumEquation:()=>$F,eitherStridesOrDilationsAreOne:()=>za,expandShapeToKeepDim:()=>mi,exponent:()=>FF,exponents:()=>MF,fromStringArrayToUint8:()=>WF,fromUint8ToStringArray:()=>LF,getAxesPermutation:()=>qb,getBroadcastDims:()=>ZT,getComplexWithIndex:()=>CF,getEinsumComputePath:()=>zF,getEinsumPermutation:()=>DF,getFusedBiasGradient:()=>qc,getFusedDyActivation:()=>Gc,getImageCenter:()=>pF,getInnerMostAxes:()=>zE,getPermuted:()=>hF,getReductionAxes:()=>zt,getReshaped:()=>cF,getReshapedPermuted:()=>fF,getSliceBeginCoords:()=>mF,getSliceSize:()=>AF,getUndoAxesPermutation:()=>wA,isIdentityPermutation:()=>_F,log:()=>IF,mergeRealAndImagArrays:()=>SF,prepareAndValidate:()=>lb,prepareSplitSize:()=>PF,segment_util:()=>w3,shouldFuse:()=>Kc,slice_util:()=>on,splitRealAndImagArrays:()=>NF,tupleValuesAreOne:()=>Mr,upcastType:()=>sa,validateInput:()=>Gm,validateUpdateShape:()=>Hm,warn:()=>kF});function lF(e,t){let n=e[0].length;e.forEach((r,s)=>{F(r.length===n,()=>`Error in concat${n}D: rank of tensors[${s}] must be the same as the rank of the rest (${n})`)}),F(t>=0&&t`Error in concat${n}D: axis must be between 0 and ${n-1}.`);let a=e[0];e.forEach((r,s)=>{for(let i=0;i`Error in concat${n}D: Shape of tensors[${s}] (${r}) does not match the shape of the rest (${a}) along the non-concatenated axis ${s}.`)})}function uF(e,t){let n=e[0].slice();for(let a=1;a=t*2+1||i%2==1?s.push(i):r.push(i);a.push(...r),a.push(0),a.push(...s)}return a}function fF(e,t,n,a=!0){let r=[];a?r.push(e[0]/n):r.push(e[0]*n);for(let s=1;s/g,k3=",",I3="...";function $F(e,t){e=e.replace(/\s/g,"");let n=(e.length-e.replace(BF,"").length)/jA.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 ("${jA}").`);let[a,r]=e.split(jA);F(a.indexOf(I3)===-1,()=>`The ellipsis notation ("${I3}") is not supported yet.`);let s=a.split(k3),i=s.length;if(t!==i)throw new Error(`Expected ${i} input tensors, received ${t}`);if(i>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");let o=[];for(let c=0;cm.indexOf(h)!==-1))throw new Error(`Output subscripts contain the label ${h} not present in the input subscripts.`);o.indexOf(h)===-1&&o.push(h)}for(let c=0;cr!==-1),{permutationIndices:n,expandDims:a}}function OF(e,t,n){let a=new Array(e);for(let r=0;r`Expected dimension ${a[t[r][i]]} at axis ${i} of input shaped ${JSON.stringify(s)}, but got dimension ${s[i]}`)}}function zF(e,t){let n=e,a=[],r=0;e.length===0&&n.push(-1),r=e.length+1;for(let i=0;it===n)}function VF(e,t){let n=[];for(let a=0;a"Number of splits must evenly divide the axis."),a=new Array(t).fill(e.shape[n]/t);else{let r=t.reduce((i,o)=>(o===-1&&(i+=1),i),0);F(r<=1,()=>"There should be only one negative value in split array.");let s=t.indexOf(-1);if(s!==-1){let i=t.reduce((o,l)=>l>0?o+l:o);t[s]=e.shape[n]-i}F(e.shape[n]===t.reduce((i,o)=>i+o),()=>"The sum of sizes must match the size of the axis dimension."),a=t}return a}var w3={};Fe(w3,{collectGatherOpShapeInfo:()=>HF,computeOutShape:()=>UF,segOpComputeOptimalWindowSize:()=>jF});function jF(e,t){let n=!1,a;for(e<=VA?(a=e,n=!0):a=Tp(e,Math.floor(Math.sqrt(e)));!n;)a>t||a===e?n=!0:a=Tp(e,a+1);return a}function UF(e,t,n){let a=[],r=e.length;for(let s=0;sr))throw new Error(`Expect batchDims in the range of [-${r}, ${r}], but got ${a}`);if(a<0&&(a+=r),a>s)throw new Error(`batchDims (${a}) must be less than rank(x) ( + ${s}).`);if(nuc(t))}catch(t){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${t}`)}}function WF(e){return e.map(t=>Ou(t))}var Wa={};Fe(Wa,{nonMaxSuppressionV3Impl:()=>p3,nonMaxSuppressionV4Impl:()=>c3,nonMaxSuppressionV5Impl:()=>h3,whereImpl:()=>t3});function ve(e,t){Array.isArray(e)||(e=[e]),e.forEach(n=>{n!=null&&k.assert(n.dtype!=="complex64",()=>`${t} does not support complex64 tensors in the CPU backend.`)})}var GF=Wa.whereImpl,ah=class extends fu{constructor(){super();this.blockSize=48,this.firstUse=!0,this.data=new Sp(this,nr())}nextDataId(){return ah.nextDataId++}write(e,t,n){this.firstUse&&(this.firstUse=!1,J().get("IS_NODE")&&C.warn(` ============================ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, which binds to TensorFlow C++, by running npm i @tensorflow/tfjs-node, or npm i @tensorflow/tfjs-node-gpu if you have CUDA. Then call require('@tensorflow/tfjs-node'); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details. -============================`));let a={id:this.nextDataId()};return this.data.set(a,{values:e,dtype:n,refCount:1}),a}makeTensorInfo(e,t,n){let a;if(t==="string"&&n!=null&&n.length>0&&k.isString(n[0])){let r=n.map(s=>k.encodeString(s));a=this.write(r,e,t)}else a=this.write(n,e,t);return{dataId:a,shape:e,dtype:t}}refCount(e){return this.data.has(e)?this.data.get(e).refCount:0}incRef(e){let t=this.data.get(e);t.refCount++}decRef(e){if(this.data.has(e)){let t=this.data.get(e);t.refCount--}}move(e,t,n,a,r){this.data.set(e,{values:t,dtype:a,refCount:r})}numDataIds(){return this.data.numDataIds()}async read(e){return this.readSync(e)}readSync(e){let{dtype:t,complexTensorInfos:n}=this.data.get(e);if(t==="complex64"){let a=this.readSync(n.real.dataId),r=this.readSync(n.imag.dataId);return C.mergeRealAndImagArrays(a,r)}return this.data.get(e).values}bufferSync(e){let t=this.readSync(e.dataId),n=t;if(e.dtype==="string")try{n=t.map(a=>k.decodeString(a))}catch(a){throw new Error("Failed to decode encoded string bytes into utf-8")}return We(e.shape,e.dtype,n)}makeOutput(e,t,n){let a=this.write(e,t,n);return tr().makeTensorFromDataId(a,t,n,this)}disposeData(e,t=!1){if(this.data.has(e)){if(this.data.get(e).refCount--,!t&&this.data.get(e).refCount>0)return!1;let{complexTensorInfos:n}=this.data.get(e);n!=null&&(this.disposeData(n.real.dataId,!0),this.disposeData(n.imag.dataId,!0)),this.data.delete(e)}return!0}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}async time(e){let t=k.now();return e(),{kernelMs:k.now()-t}}memory(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}}where(e){ve([e],"where");let t=this.readSync(e.dataId);return HF(e.shape,t)}dispose(){}floatPrecision(){return 32}epsilon(){return super.epsilon()}};nh.nextDataId=0;var jA={};Fe(jA,{addImpl:()=>S3,bincountImpl:()=>UA,bincountReduceImpl:()=>N3,ceilImpl:()=>T3,concatImpl:()=>HA,expImpl:()=>E3,expm1Impl:()=>C3,floorImpl:()=>R3,gatherV2Impl:()=>M3,greaterImpl:()=>F3,lessImpl:()=>$3,linSpaceImpl:()=>D3,logImpl:()=>O3,maxImpl:()=>z3,maximumImpl:()=>_3,minimumImpl:()=>P3,multiplyImpl:()=>GA,negImpl:()=>L3,notEqualImpl:()=>W3,prodImpl:()=>B3,rangeImpl:()=>XA,rsqrtImpl:()=>V3,simpleAbsImpl:()=>I3,sliceImpl:()=>ah,sparseFillEmptyRowsImpl:()=>j3,sparseReshapeImpl:()=>U3,squaredDifferenceImpl:()=>H3,stridedSliceImpl:()=>G3,subImpl:()=>q3,tileImpl:()=>X3,topKImpl:()=>K3,transposeImpl:()=>qA,uniqueImpl:()=>Z3});function I3(e){let t=new Float32Array(e.length);for(let n=0;n{let{x:t}=e.inputs,n=e.backend;ve(t,"abs");let a=new Float32Array(k.sizeFromShape(t.shape)),r=n.data.get(t.dataId).values;return a=I3(r),n.makeOutput(a,t.shape,"float32")},qF={kernelName:Qi,backendName:"cpu",kernelFunc:GF};function Rt(e){return(t,n,a,r,s)=>{let i=C.assertAndGetBroadcastShape(t,n),o=i.length,l=k.computeStrides(i),d=k.sizeFromShape(i),u=k.getTypedArrayFromDType(s,d),p=t.length,c=n.length,h=k.computeStrides(t),m=k.computeStrides(n),f=C.getBroadcastDims(t,i),A=C.getBroadcastDims(n,i);if(f.length+A.length===0)for(let y=0;yx[N]=0);let w=k.locToIndex(x,p,h),b=g.slice(-c);A.forEach(N=>b[N]=0);let v=k.locToIndex(b,c,m);u[y]=e(a[w],r[v])}return[u,i]}}function _n(e){let{inputs:t,backend:n}=e,{real:a,imag:r}=t,s=n.data.get(a.dataId).values,i=n.data.get(r.dataId).values,o=n.makeTensorInfo(a.shape,"complex64"),l=n.data.get(o.dataId);return l.complexTensorInfos={real:n.makeTensorInfo(a.shape,"float32",s),imag:n.makeTensorInfo(r.shape,"float32",i)},o}var XF={kernelName:Mp,backendName:"cpu",kernelFunc:_n};function rh(e,t,n="float32"){if(n==="complex64"){let r=rh(e,t,"float32"),s=rh(e,t,"float32");return _n({inputs:{real:r,imag:s},backend:e})}let a=k.makeZerosTypedArray(k.sizeFromShape(t),n);return e.makeTensorInfo(t,n,a)}function Wa(e){let{inputs:t,backend:n}=e,{x:a}=t;return n.incRef(a.dataId),{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}var KF={kernelName:ks,backendName:"cpu",kernelFunc:Wa};function gi(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.data.get(a.dataId).complexTensorInfos.real,s=n.data.get(r.dataId).values;return n.makeTensorInfo(r.shape,r.dtype,s)}var ZF={kernelName:Jp,backendName:"cpu",kernelFunc:gi};function _r(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dtype:s}=a;if(s==="complex64"){if(r.dtype==="complex64")return Wa({inputs:{x:r},backend:n});let i=rh(n,r.shape,r.dtype),o=_r({inputs:{x:r},backend:n,attrs:{dtype:"float32"}}),l=_n({inputs:{real:o,imag:i},backend:n});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}if(r.dtype==="complex64"){let i=gi({inputs:{input:r},backend:n}),o=_r({inputs:{x:i},backend:n,attrs:{dtype:s}});return n.disposeIntermediateTensorInfo(i),o}if(!k.hasEncodingLoss(r.dtype,s)){let i=Wa({inputs:{x:r},backend:n});return{dataId:i.dataId,shape:i.shape,dtype:s}}if(s==="int32"){let i=n.data.get(r.dataId).values,o=Int32Array.from(i);return n.makeTensorInfo(r.shape,"int32",o)}if(s==="bool"){let i=n.data.get(r.dataId).values,o=k.toTypedArray([0],r.dtype),[l,d]=Rt((u,p)=>u!==p?1:0)(r.shape,[],i,o,"bool");return n.makeTensorInfo(d,"bool",l)}throw new Error(`Error in Cast: failed to cast ${r.dtype} to ${s}`)}var YF={kernelName:ds,backendName:"cpu",kernelFunc:_r};function Ut(e,t,n,a){return n==null?({inputs:r,backend:s})=>{let{a:i,b:o}=r,l=s;ve([i,o],e);let d=l.data.get(i.dataId).values,u=l.data.get(o.dataId).values,p=a||i.dtype,[c,h]=t(i.shape,o.shape,d,u,p);return l.makeTensorInfo(h,p,c)}:({inputs:r,backend:s})=>{let{a:i,b:o}=r,l=s;if(i.dtype==="complex64"||o.dtype==="complex64"){let d=_r({inputs:{x:i},backend:l,attrs:{dtype:"complex64"}}),u=l.data.get(d.dataId),p=u.complexTensorInfos.real,c=u.complexTensorInfos.imag,h=l.data.get(p.dataId).values,m=l.data.get(c.dataId).values,f=_r({inputs:{x:o},backend:l,attrs:{dtype:"complex64"}}),A=l.data.get(f.dataId),y=A.complexTensorInfos.real,g=A.complexTensorInfos.imag,x=l.data.get(y.dataId).values,w=l.data.get(g.dataId).values,[b,v,N]=n(i.shape,o.shape,h,m,x,w),T=l.makeTensorInfo(N,"float32",b),R=l.makeTensorInfo(N,"float32",v),$=_n({inputs:{real:T,imag:R},backend:l});return l.disposeIntermediateTensorInfo(d),l.disposeIntermediateTensorInfo(f),l.disposeIntermediateTensorInfo(T),l.disposeIntermediateTensorInfo(R),$}else{let d=l.data.get(i.dataId).values,u=l.data.get(o.dataId).values,p=a||i.dtype,[c,h]=t(i.shape,o.shape,d,u,p);return l.makeTensorInfo(h,p,c)}}}function KA(e){return(t,n,a,r,s,i)=>{let o=C.assertAndGetBroadcastShape(t,n),l=k.sizeFromShape(o),d=o.length,u=k.computeStrides(o),p=k.getTypedArrayFromDType("float32",l),c=k.getTypedArrayFromDType("float32",l),h=C.getBroadcastDims(t,o),m=C.getBroadcastDims(n,o),f=C.mergeRealAndImagArrays(a,r),A=C.mergeRealAndImagArrays(s,i),y=t.length,g=k.computeStrides(t),x=n.length,w=k.computeStrides(n);if(h.length+m.length===0)for(let b=0;bN[P]=0);let T=k.locToIndex(N,y,g),R=v.slice(-x);m.forEach(P=>R[P]=0);let $=k.locToIndex(R,x,w),z=e(f[T*2],f[T*2+1],A[$*2],A[$*2+1]);p[b]=z.real,c[b]=z.imag}return[p,c,o]}}var S3=Rt((e,t)=>e+t),JF=KA((e,t,n,a)=>({real:e+n,imag:t+a})),id=Ut(wr,S3,JF),QF={kernelName:wr,backendName:"cpu",kernelFunc:id};function UA(e,t,n,a,r){let s=k.sizeFromShape(a),i=k.makeZerosTypedArray(r,n);for(let o=0;o=r||(s>0?i[l]+=t[o]:i[l]+=1)}return i}function N3(e,t,n,a=!1){let r=e.shape[0],s=e.shape[1],i=We([r,n],t.dtype);for(let o=0;o=n||(a?i.set(1,o,d):t.size>0?i.set(i.get(o,d)+t.get(o,l),o,d):i.set(i.get(o,d)+1,o,d))}return i}function Il(e){return(t,n,a)=>{let r=k.getTypedArrayFromDType(n,t.length);for(let s=0;s{let{x:i}=a;if(ve(i,e),i.dtype==="string"||n==="string")throw new Error("unaryKernelFunc does not support string input/output");let o=s,l=o.data.get(i.dataId).values,d=k.sizeFromShape(i.shape),u=n||i.dtype,p=k.getArrayFromDType(u,d);for(let c=0;c{let{x:i}=a;if(ve(i,e),i.dtype==="string"||n==="string")throw new Error("unaryKernelFunc does not support string input/output");let o=s,l=o.data.get(i.dataId).values,d=n||i.dtype,u=t(l,d,r);return o.makeTensorInfo(i.shape,d,u)}}var T3=Il(e=>Math.ceil(e)),e$=Sl(ps,T3),t$={kernelName:ps,backendName:"cpu",kernelFunc:e$};function HA(e,t,n,a){let r=k.getArrayFromDType(n,k.sizeFromShape(t));if(a&&n!=="string"){let s=0;e.forEach(i=>{let o=k.sizeFromShape(i.shape);r.set(i.vals,s),s+=o})}else{let s=0;e.forEach(i=>{let o=n==="string"?C.fromUint8ToStringArray(i.vals):i.vals,l=0;for(let d=0;dMath.exp(e)),Y3=Sl(gs,E3),n$={kernelName:gs,backendName:"cpu",kernelFunc:Y3},C3=Il(e=>Math.expm1(e)),a$=Sl(go,C3),r$={kernelName:go,backendName:"cpu",kernelFunc:a$},R3=Il(e=>Math.floor(e)),s$=Sl(xs,R3),i$={kernelName:xs,backendName:"cpu",kernelFunc:s$};function M3(e,t,n){let a=We(n,e.dtype);for(let r=0;re>t?1:0),o$=Ut(wo,F3,null,"bool"),l$={kernelName:wo,backendName:"cpu",kernelFunc:o$},$3=Rt((e,t)=>eMath.log(e)),p$=Sl(Ss,O3),c$={kernelName:Ss,backendName:"cpu",kernelFunc:p$};function z3(e,t,n,a){let r=k.getTypedArrayFromDType(a,k.sizeFromShape(n));for(let s=0;so&&(o=d)}r[s]=o}return r}var _3=Rt((e,t)=>Math.max(e,t)),h$=Ut(Ts,_3),f$={kernelName:Ts,backendName:"cpu",kernelFunc:h$},P3=Rt((e,t)=>Math.min(e,t)),m$=Ut(Ms,P3),A$={kernelName:Ms,backendName:"cpu",kernelFunc:m$},GA=Rt((e,t)=>e*t),y$=KA((e,t,n,a)=>({real:e*n-t*a,imag:e*a+t*n})),sh=Ut($s,GA,y$),g$={kernelName:$s,backendName:"cpu",kernelFunc:sh};function L3(e,t,n){let a=k.createScalarValue(-1,n);return GA([],t,a,e,n)}function x$(e){let{inputs:t,backend:n}=e,{x:a}=t;ve(a,"neg");let r=n.data.get(a.dataId).values,[s,i]=L3(r,a.shape,a.dtype);return n.makeTensorInfo(i,a.dtype,s)}var b$={kernelName:Mo,backendName:"cpu",kernelFunc:x$},W3=Rt((e,t)=>e!==t?1:0),v$=Ut(Fo,W3,null,"bool"),w$={kernelName:Fo,backendName:"cpu",kernelFunc:v$};function qA(e,t,n,a,r){let s=t.length,i=k.sizeFromShape(t),o=k.computeStrides(t),l=k.computeStrides(r),d=k.getTypedArrayFromDType(n,k.sizeFromShape(r));for(let u=0;un.disposeIntermediateTensorInfo(g)),n.makeTensorInfo(y,A,m)}var S$={kernelName:Po,backendName:"cpu",kernelFunc:I$};function XA(e,t,n,a){let r=e===t,s=e1;if(r||s||i)return k.makeZerosTypedArray(0,a);let o=Math.abs(Math.ceil((t-e)/n)),l=k.makeZerosTypedArray(o,a);t1/Math.sqrt(e)),N$=Sl(js,V3),T$={kernelName:js,backendName:"cpu",kernelFunc:N$};function ah(e,t,n,a,r){let s=on.isSliceContinous(a,t,n),i=k.sizeFromShape(n),o=k.computeStrides(a);if(s){let p=on.computeFlatOffset(t,o);return r==="string"?e.slice(p,p+i):e.subarray(p,p+i)}let l=r==="string"?C.fromUint8ToStringArray(e):e,d=We(a,r,l),u=We(n,r);for(let p=0;pm+t[f]);u.set(d.get(...h),...c)}return r==="string"?C.fromStringArrayToUint8(u.values):u.values}function xi(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,size:i}=a;ve(r,"slice");let[o,l]=on.parseSliceParams(r,s,i);on.assertParamsValid(r,o,l);let d=n.data.get(r.dataId).values,u=ah(d,o,l,r.shape,r.dtype);return n.makeTensorInfo(l,r.dtype,u)}var E$={kernelName:Uo,backendName:"cpu",kernelFunc:xi};function j3(e,t,n,a,r,s,i){let o=t[0],l=s[0],d=new Array(l),u=new Array(o),p=t[1];if(l===0){if(o!==0)throw new Error(`Received SparseTensor with denseShape[0] = 0 but - indices.shape[0] = ${o}`);let A=k.getArrayFromDType(n,0),y=k.getArrayFromDType(r,0);return[A,[0,p],y,d,u]}let c=!0,h=0,m=new Array(l).fill(0);for(let A=0;A=l)throw new Error(`indices(${A}, 0) is invalid: ${y} >= ${l}`);++m[y],c=c&&y>=h,h=y}let f=!0;for(let A=0;A0&&(m[A]+=m[A-1])}if(f&&c){let A=e,y=a;for(let g=0;g0){h[c-1]=1;for(let A=c-2;A>=0;--A)h[A]=h[A+1]*a[A+1]}let m=[];if(o>0){m[o-1]=1;for(let A=o-2;A>=0;--A)m[A]=m[A+1]*l[A+1]}let f=k.getArrayFromDType(n,i*o);for(let A=0;A{let n=e-t;return n*n}),C$=Ut(Ks,H3),R$={kernelName:Ks,backendName:"cpu",kernelFunc:C$};function G3(e,t,n,a){let r=We(e,t.dtype);for(let s=0;se-t),M$=KA((e,t,n,a)=>({real:e-n,imag:t-a})),ZA=Ut(Zs,q3,M$),F$={kernelName:Zs,backendName:"cpu",kernelFunc:ZA};function X3(e,t){let n=new Array(e.rank);for(let r=0;rx.value-g.value);let f=p*a,A=l.subarray(f,f+a),y=d.subarray(f,f+a);for(let g=0;g{for(let A=0;Anew nh,1);var Q3=nt(fo,e=>e>=0?e:Math.exp(e)-1),$$={kernelName:fo,backendName:"cpu",kernelFunc:Q3};function e7(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{alpha:s}=a;ve([r],"leakyRelu");let i=k.sizeFromShape(r.shape),o=n.data.get(r.dataId).values,l=k.getTypedArrayFromDType("float32",i);for(let d=0;de<0?t*e:e);function t7(e){let{inputs:t,backend:n}=e,{x:a,alpha:r}=t;ve([a,r],"prelu");let s=n.data.get(a.dataId).values,i=n.data.get(r.dataId).values,[o,l]=O$(a.shape,r.shape,s,i,a.dtype);return n.makeTensorInfo(l,a.dtype,o)}var z$={kernelName:_s,backendName:"cpu",kernelFunc:t7},n7=nt(Ps,e=>Math.max(0,e)),_$={kernelName:Ps,backendName:"cpu",kernelFunc:n7},a7=nt(Ws,e=>Math.min(Math.max(0,e),6)),P$={kernelName:Ws,backendName:"cpu",kernelFunc:a7},r7=nt(Hs,e=>1/(1+Math.exp(-e))),L$={kernelName:Hs,backendName:"cpu",kernelFunc:r7};function YA(e,t,n,a,r){if(n==="linear")return Wa({inputs:{x:t},backend:e});if(n==="relu")return n7({inputs:{x:t},backend:e});if(n==="elu")return Q3({inputs:{x:t},backend:e});if(n==="relu6")return a7({inputs:{x:t},backend:e});if(n==="prelu")return t7({inputs:{x:t,alpha:a},backend:e});if(n==="leakyrelu")return e7({inputs:{x:t},backend:e,attrs:{alpha:r}});if(n==="sigmoid")return r7({inputs:{x:t},backend:e});throw new Error(`Activation ${n} has not been implemented for the CPU backend.`)}function ct(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{shape:s}=a,i=k.sizeFromShape(r.shape),o=k.inferFromImplicitShape(s,i),l=k.sizeFromShape(o);k.assert(i===l,()=>`The new shape (${o}) has ${l} elements and the old shape (${r.shape}) has ${i} elements. The new shape and old shape must have the same number of elements.`),n.incRef(r.dataId);let d=n.data.get(r.dataId);if(d.complexTensorInfos!=null){let u=d.complexTensorInfos.real,p=d.complexTensorInfos.imag;u.shape=o,p.shape=o}return{dataId:r.dataId,shape:o,dtype:r.dtype}}var W$={kernelName:Wo,backendName:"cpu",kernelFunc:ct};function s7(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s}=t,{transposeA:i,transposeB:o}=a;ve([r,s],"matMul");let l=r.shape.length,d=s.shape.length,u=i?r.shape[l-2]:r.shape[l-1],p=o?s.shape[d-1]:s.shape[d-2],c=i?r.shape[l-1]:r.shape[l-2],h=o?s.shape[d-2]:s.shape[d-1],m=r.shape.slice(0,-2),f=s.shape.slice(0,-2),A=k.sizeFromShape(m),y=k.sizeFromShape(f),g=A===y||A===1||y===1;k.assert(l>=2&&d>=2&&g,()=>`Error in matMul: the input batch dimensions must either be the same or at least one input batch dimension must be 1. Got input batch dimensions of (${m}) and (${f}).`);let x=(A>y?r.shape.slice(0,-2):s.shape.slice(0,-2)).concat([c,h]);k.assert(u===p,()=>`Error in matMul: inner shapes (${u}) and (${p}) of Tensors with shapes ${r.shape} and ${s.shape} and transposeA=${i} and transposeB=${o} must match.`);let w=i?[A,u,c]:[A,c,u],b=o?[y,h,p]:[y,p,h],v=ct({inputs:{x:r},backend:n,attrs:{shape:w}}),N=ct({inputs:{x:s},backend:n,attrs:{shape:b}}),T=i?v.shape[1]:v.shape[2],R=i?v.shape[2]:v.shape[1],$=o?N.shape[1]:N.shape[2],z=Math.max(A,y),P=n.data.get(v.dataId).values,V=n.data.get(N.dataId).values,j=k.computeStrides(v.shape),U=k.computeStrides(N.shape),[X,G,ee]=i?[j[0],1,j[1]]:[j[0],j[1],1],[Y,re,ne]=o?[1,U[1],U[0]]:[U[1],1,U[0]],ie=R*$,Q=We([z,R,$],v.dtype),de=Q.values,oe=n.blockSize;for(let ye=0;yeMath.acos(e)),H$={kernelName:eo,backendName:"cpu",kernelFunc:U$},G$=nt(to,e=>Math.acosh(e)),q$={kernelName:to,backendName:"cpu",kernelFunc:G$};function X$(e){let{inputs:t,backend:n}=e,a=t;ve(t,"addN");let r=a.map(o=>n.data.get(o.dataId).values),s=We(a[0].shape,a[0].dtype),i=s.values;for(let o=0;og&&(g=b,x=w)}h[A]=x}return d.forEach(A=>n.disposeIntermediateTensorInfo(A)),n.makeTensorInfo(u,"int32",h)}var tD={kernelName:os,backendName:"cpu",kernelFunc:eD};function nD(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s}=a;ve(r,"argMin");let i=k.parseAxisParam(s,r.shape),o=C.getAxesPermutation(i,r.shape.length),l=r,d=[];o!=null&&(l=Kn({inputs:{x:r},backend:n,attrs:{perm:o}}),d.push(l),i=C.getInnerMostAxes(i.length,l.shape.length)),i=[i[0]],C.assertAxesAreInnerMostDims("argMin",i,l.shape.length);let[u,p]=C.computeOutAndReduceShapes(l.shape,i),c=k.sizeFromShape(u),h=k.makeZerosTypedArray(c,"int32"),m=k.sizeFromShape(p),f=n.data.get(l.dataId).values;for(let A=0;An.disposeIntermediateTensorInfo(A)),n.makeTensorInfo(u,"int32",h)}var aD={kernelName:Au,backendName:"cpu",kernelFunc:nD},rD=nt(ro,e=>Math.asin(e)),sD={kernelName:ro,backendName:"cpu",kernelFunc:rD},iD=nt(so,e=>Math.asinh(e)),oD={kernelName:so,backendName:"cpu",kernelFunc:iD},lD=nt(io,e=>Math.atan(e)),uD={kernelName:io,backendName:"cpu",kernelFunc:lD},dD=Rt((e,t)=>Math.atan2(e,t)),pD=Ut(lo,dD),cD={kernelName:lo,backendName:"cpu",kernelFunc:pD},hD=nt(oo,e=>Math.atanh(e)),fD={kernelName:oo,backendName:"cpu",kernelFunc:hD};function JA(e,t,n,a,r,s){let i=r.strideHeight,o=r.strideWidth,l=r.dilationHeight,d=r.dilationWidth,u=r.effectiveFilterHeight,p=r.effectiveFilterWidth,c=r.padInfo.top,h=r.padInfo.left,m=s==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,f=We(r.outShape,n),A=f.values,y=r.outShape[1]*r.outShape[2]*r.outShape[3],g=r.outShape[2]*r.outShape[3],x=r.outShape[3];for(let w=0;wG?G=oe:s==="avg"&&(ee+=oe,Y++)}if(isNaN(G))break}let re=P+V*x+N;A[re]=s==="avg"?ee/Y:G}}}return f}function i7(e,t,n,a,r=!1,s=!1){let i=We(a.outShape,"int32"),o=a.strideHeight,l=a.strideWidth,d=a.dilationHeight,u=a.dilationWidth,p=a.effectiveFilterHeight,c=a.effectiveFilterWidth,h=a.padInfo.top,m=a.padInfo.left,f=We(t,n,e);for(let A=0;A$&&($=X,r?z=s?((A*a.inHeight+P)*a.inWidth+j)*a.inChannels+y:(P*a.inWidth+j)*a.inChannels+y:z=V*c+U)}}i.set(z,A,g,v,y)}}return i}function o7(e,t,n,a,r,s){let i=r.strideDepth,o=r.strideHeight,l=r.strideWidth,d=r.dilationDepth,u=r.dilationHeight,p=r.dilationWidth,c=r.effectiveFilterDepth,h=r.effectiveFilterHeight,m=r.effectiveFilterWidth,f=r.padInfo.front,A=r.padInfo.top,y=r.padInfo.left,g=s==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,x=We(r.outShape,n),w=x.values,b=r.outShape[1]*r.outShape[2]*r.outShape[3]*r.outShape[4],v=r.outShape[2]*r.outShape[3]*r.outShape[4],N=r.outShape[3]*r.outShape[4],T=r.outShape[4];for(let R=0;RIe?Ie=Ve:s==="avg"&&(Ne+=Ve,$e++),isNaN(Ie))break}if(isNaN(Ie))break}if(isNaN(Ie))break}let ze=ce+P;w[ze]=s==="avg"?Ne/$e:Ie}}}}return x}function mD(e,t){let n=We(t.outShape,"int32"),a=t.strideDepth,r=t.strideHeight,s=t.strideWidth,i=t.dilationDepth,o=t.dilationHeight,l=t.dilationWidth,d=t.effectiveFilterDepth,u=t.effectiveFilterHeight,p=t.effectiveFilterWidth,c=t.padInfo.front,h=t.padInfo.top,m=t.padInfo.left;for(let f=0;f=V&&(V=ne,j=X*u*p+ee*u+re)}}}n.set(j,f,y,b,R,A)}}}return n}function AD(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t;ve(r,"avgPool");let{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=a,d=1;k.assert(C.eitherStridesOrDilationsAreOne(i,d),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);let u=C.computePool2DInfo(r.shape,s,i,d,o,l),p;if(u.filterWidth===1&&u.filterHeight===1&&k.arraysEqual(u.inShape,u.outShape))p=Wa({inputs:{x:r},backend:n});else{let c=n.data.get(r.dataId).values,h=k.computeStrides(r.shape),m=JA(c,r.shape,r.dtype,h,u,"avg");p=n.makeTensorInfo(u.outShape,r.dtype,m.values)}return p}var yD={kernelName:ls,backendName:"cpu",kernelFunc:AD};function gD(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:d}=a;ve(r,"avgPool3d");let u=C.computePool3DInfo(r.shape,s,i,1,o,l,d),p=n.data.get(r.dataId).values,c=o7(p,r.shape,r.dtype,k.computeStrides(r.shape),u,"avg");return n.makeTensorInfo(c.shape,"float32",c.values)}var xD={kernelName:yu,backendName:"cpu",kernelFunc:gD};function bD(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,{filterSize:i,strides:o,pad:l,dimRoundingMode:d}=a;ve([r,s],"avgPool3DGrad");let u=C.computePool3DInfo(s.shape,i,o,1,l,d),p=u.strideDepth,c=u.strideHeight,h=u.strideWidth,m=u.filterDepth,f=u.filterHeight,A=u.filterWidth,y=u.dilationDepth,g=u.dilationHeight,x=u.dilationWidth,w=u.effectiveFilterDepth,b=u.effectiveFilterHeight,v=u.effectiveFilterWidth,N=w-1-u.padInfo.front,T=v-1-u.padInfo.left,R=b-1-u.padInfo.top,$=We(s.shape,"float32"),z=1/(m*f*A),P=n.bufferSync(r);for(let V=0;V=u.outDepth||Math.floor(Q)!==Q))for(let de=0;de=u.outHeight||Math.floor(oe)!==oe))for(let ye=0;ye=u.outWidth||Math.floor(ce)!==ce||(ne+=P.get(V,Q,oe,ce,j))}}}$.set(ne*z,V,U,X,G,j)}return n.makeTensorInfo($.shape,$.dtype,$.values)}var vD={kernelName:Cp,backendName:"cpu",kernelFunc:bD};function wD(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s;ve([r,s],"avgPoolGrad");let{filterSize:o,strides:l,pad:d}=a,u=C.computePool2DInfo(i.shape,o,l,1,d),p=u.strideHeight,c=u.strideWidth,h=u.filterHeight,m=u.filterWidth,f=u.dilationHeight,A=u.dilationWidth,y=u.effectiveFilterHeight,g=u.effectiveFilterWidth,x=g-1-u.padInfo.left,w=y-1-u.padInfo.top,b=We(i.shape,"float32"),v=1/(h*m),N=n.data.get(r.dataId).values,T=We(r.shape,"float32",N);for(let R=0;R=u.outHeight||Math.floor(G)!==G))for(let ee=0;ee=u.outWidth||Math.floor(Y)!==Y||(U+=T.get(R,G,Y,$))}}b.set(U*v,R,z,P,$)}return n.makeTensorInfo(b.shape,b.dtype,b.values)}var kD={kernelName:Ep,backendName:"cpu",kernelFunc:wD};function ID(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,scale:s,offset:i,mean:o,variance:l}=t;k.assert(o.shape.length===l.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),k.assert(i==null||o.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),k.assert(s==null||o.shape.length===s.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks."),ve([r,o,l,s,i],"batchNorm");let{varianceEpsilon:d}=a;d==null&&(d=.001);let u=n.data.get(r.dataId).values,p=n.data.get(o.dataId).values,c=n.data.get(l.dataId).values,h=s?n.data.get(s.dataId).values:new Float32Array([1]),m=i?n.data.get(i.dataId).values:new Float32Array([0]),f=new Float32Array(u.length),A=m.length,y=h.length,g=c.length,x=p.length,w=0,b=0,v=0,N=0;for(let T=0;T=A&&(w=0),b>=x&&(b=0),v>=y&&(v=0),N>=g&&(N=0);return n.makeTensorInfo(r.shape,r.dtype,f)}var SD={kernelName:vs,backendName:"cpu",kernelFunc:ID};function ND(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,crops:i}=a;ve([r],"batchToSpaceND");let o=s.reduce((y,g)=>y*g),l=C.getReshaped(r.shape,s,o),d=C.getPermuted(l.length,s.length),u=C.getReshapedPermuted(r.shape,s,o),p=C.getSliceBeginCoords(i,s.length),c=C.getSliceSize(u,i,s.length),h=ct({inputs:{x:r},backend:n,attrs:{shape:l}}),m=Kn({inputs:{x:h},backend:n,attrs:{perm:d}}),f=ct({inputs:{x:m},backend:n,attrs:{shape:u}}),A=xi({inputs:{x:f},backend:n,attrs:{begin:p,size:c}});return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(f),A}var TD={kernelName:gu,backendName:"cpu",kernelFunc:ND};function ED(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,weights:s}=t,{size:i}=a,o=n.data.get(r.dataId).values,l=n.data.get(s.dataId).values,d=UA(o,l,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,d)}var CD={kernelName:Rp,backendName:"cpu",kernelFunc:ED},RD=nt(kr,(e,t)=>{let n=t;return e>n.clipValueMax?n.clipValueMax:e{let{x:t}=e.inputs,n=e.backend,a=new Float32Array(k.sizeFromShape(t.shape)),r=n.data.get(t.dataId),s=r.complexTensorInfos.real,i=r.complexTensorInfos.imag,o=n.data.get(s.dataId).values,l=n.data.get(i.dataId).values;for(let d=0;df.shape),s);if(k.sizeFromShape(i)===0)return n.makeTensorInfo(i,t[0].dtype,[]);let o=t.filter(f=>k.sizeFromShape(f.shape)>0);if(o.length===1)return Wa({inputs:{x:o[0]},backend:n});let l=o.map(f=>f.shape);if(C.assertParamsConsistent(l,s),o[0].dtype==="complex64"){let f=o.map(w=>gi({inputs:{input:w},backend:n})),A=o.map(w=>Nl({inputs:{input:w},backend:n})),y=Tl({inputs:f,backend:n,attrs:{axis:s}}),g=Tl({inputs:A,backend:n,attrs:{axis:s}}),x=_n({inputs:{real:y,imag:g},backend:n});return f.forEach(w=>n.disposeIntermediateTensorInfo(w)),A.forEach(w=>n.disposeIntermediateTensorInfo(w)),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(g),x}let d=o.map(f=>{let A=k.sizeFromShape(f.shape.slice(s));return ct({inputs:{x:f},backend:n,attrs:{shape:[-1,A]}})}),u=d.map(f=>({vals:n.data.get(f.dataId).values,shape:f.shape}));i=C.computeOutShape(d.map(f=>f.shape),1);let p=d[0].shape[0]===1,c=HA(u,i,t[0].dtype,p),h=C.computeOutShape(o.map(f=>f.shape),s),m=n.makeTensorInfo(h,t[0].dtype,c);return d.forEach(f=>n.disposeIntermediateTensorInfo(f)),m}var OD={kernelName:uo,backendName:"cpu",kernelFunc:Tl};function l7(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dataFormat:l,dilations:d,dimRoundingMode:u}=a;ve([r,s],"conv2d");let p=C.convertConv2DDataFormat(l),c=C.computeConv2DInfo(r.shape,s.shape,i,d,o,u,!1,p),h=c.filterHeight,m=c.filterWidth,f=c.dilationHeight,A=c.dilationWidth,y=c.padInfo.left,g=c.padInfo.top,x=c.dataFormat==="channelsLast",w=new Dt(c.outShape,r.dtype),b=k.computeStrides(r.shape),v=k.computeStrides(s.shape),N=b[0],T=x?b[1]:b[2],R=x?b[2]:1,$=x?1:b[1],z=w.strides[0],P=x?w.strides[1]:w.strides[2],V=x?w.strides[2]:1,j=x?1:w.strides[1],U=n.data.get(r.dataId).values,X=n.data.get(s.dataId).values,G=w.values;for(let ee=0;ee=c.inHeight)continue;let ye=de*v[0],ce=Y+oe*T;for(let Ie=0;Ie=c.inWidth)continue;let Qe=ye+ze*v[1],et=ce+De*R,rt=Qe;for(let Xe=0;Xe=d.inDepth)continue;let ee=X*R[0],Y=z+G*T[1];for(let re=0;re=d.inHeight)continue;let oe=ee+Q*R[1],ye=Y+de*T[2];for(let ce=0;ce=d.inWidth)continue;let De=oe+$e*R[2],Qe=ye+ze*d.inChannels,et=De;for(let rt=0;rtMath.cos(e)),XD={kernelName:fs,backendName:"cpu",kernelFunc:qD},KD=nt(po,e=>Math.cosh(e)),ZD={kernelName:po,backendName:"cpu",kernelFunc:KD};function YD(e){let{inputs:t,backend:n,attrs:a}=e,{image:r,boxes:s,boxInd:i}=t,{cropSize:o,method:l,extrapolationValue:d}=a,[u,p,c,h]=r.shape,m=s.shape[0],[f,A]=o,y=We([m,f,A,h],"float32"),g=n.data.get(s.dataId).values,x=n.data.get(i.dataId).values,w=n.data.get(r.dataId).values,b=k.computeStrides(r.shape),v=k.computeStrides(y.shape);for(let N=0;N=u)continue;let j=f>1?(z-R)*(p-1)/(f-1):0,U=A>1?(P-$)*(c-1)/(A-1):0;for(let X=0;X1?R*(p-1)+X*j:.5*(R+z)*(p-1);if(G<0||G>p-1){for(let ee=0;ee1?$*(c-1)+ne*U:.5*($+P)*(c-1);if(ie<0||ie>c-1){for(let ye=0;ye1?$*(c-1)+ee*U:.5*($+P)*(c-1);if(Y<0||Y>c-1){for(let ie=0;iey+m-g-1:(y,g)=>y+g;for(let y=0;y`Only NHWC dataFormat supported on CPU for depthToSpace. Got ${i}`),k.assert(s>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${s}`);let o=r.shape[0],l=r.shape[1],d=r.shape[2],u=r.shape[3],p=l*s,c=d*s,h=u/(s*s),m=n.data.get(r.dataId).values,f=new Float32Array(o*p*c*h),A=0;for(let y=0;y`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${c}'`);let h=C.computeConv2DInfo(r.shape,s.shape,i,c,o,d,!0),{filterHeight:m,filterWidth:f,dilationHeight:A,dilationWidth:y,padInfo:g}=h,x=g.left,w=g.top,b=h.outChannels/h.inChannels,v=new Dt(h.outShape,r.dtype),N=n.data.get(r.dataId).values,T=n.data.get(s.dataId).values,R=v.values;for(let $=0;$=h.inHeight)continue;let ee=X*p[0],Y=z+G*u[1];for(let re=0;re=h.inWidth)continue;let oe=ee+Q*p[1],ye=Y+de*h.inChannels,ce=ne,Ie=oe;for(let Ne=0;Ne{let{x:a,filter:r}=e,{strides:s,pad:i,dilations:o}=n,l=t,d=l.data.get(a.dataId).values,u=a.shape.length,p=l.data.get(r.dataId).values,c=r.shape.length,{batchSize:h,inHeight:m,inWidth:f,inChannels:A,outHeight:y,outWidth:g,padInfo:x,strideHeight:w,strideWidth:b,filterHeight:v,filterWidth:N,dilationHeight:T,dilationWidth:R,outShape:$}=C.computeDilation2DInfo(a.shape,r.shape,s,i,"NHWC",o),z=k.sizeFromShape($),P=$.length,V=k.getArrayFromDType(a.dtype,z);for(let j=0;j=0&&Q=0&&oere&&(re=Ie)}}}let ne=k.locToIndex([j,U,G,Y],P,k.computeStrides($));V[ne]=re}}}return{dataId:l.write(k.toTypedArray(V,a.dtype),$,a.dtype),shape:$,dtype:a.dtype}}},hO={kernelName:Wp,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{let{x:a,filter:r,dy:s}=e,{strides:i,pad:o,dilations:l}=n,d=t,u=k.toNestedArray(a.shape,d.data.get(a.dataId).values),p=k.toNestedArray(r.shape,d.data.get(r.dataId).values),{batchSize:c,inHeight:h,inWidth:m,inChannels:f,outHeight:A,outWidth:y,padInfo:g,strideHeight:x,strideWidth:w,filterHeight:b,filterWidth:v,dilationHeight:N,dilationWidth:T,outShape:R}=C.computeDilation2DInfo(a.shape,r.shape,i,o,"NHWC",l);k.assert(s.rank===R.length,()=>`Error in ${Wp}, dy must have the same rank as output ${R.length}, but got ${s.rank}`);let $=k.toNestedArray(R,d.data.get(s.dataId).values),z=k.makeZerosNestedTypedArray(r.shape,r.dtype);for(let P=0;P=0&&ie=0&&deee&&(ee=oe,Y=ne,re=Q)}}}z[Y][re][G]+=$[P][V][U][G]}}}return{dataId:d.write(k.toTypedArray(z,a.dtype),r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}},fO={kernelName:Lp,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{let{x:a,filter:r,dy:s}=e,{strides:i,pad:o,dilations:l}=n,d=t,u=k.toNestedArray(a.shape,d.data.get(a.dataId).values),p=k.toNestedArray(r.shape,d.data.get(r.dataId).values),{batchSize:c,inHeight:h,inWidth:m,inChannels:f,outHeight:A,outWidth:y,padInfo:g,strideHeight:x,strideWidth:w,filterHeight:b,filterWidth:v,dilationHeight:N,dilationWidth:T,outShape:R}=C.computeDilation2DInfo(a.shape,r.shape,i,o,"NHWC",l);k.assert(s.rank===R.length,()=>`Error in ${Lp}, dy must have the same rank as output ${R.length}, but got ${s.rank}`);let $=k.toNestedArray(R,d.data.get(s.dataId).values),z=k.makeZerosNestedTypedArray(a.shape,a.dtype);for(let P=0;P=0&&ie=0&&deee&&(ee=oe,Y=ie,re=de)}}}z[P][Y][re][G]+=$[P][V][U][G]}}}return{dataId:d.write(k.toTypedArray(z,a.dtype),a.shape,a.dtype),shape:a.shape,dtype:a.dtype}}};function od(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a;ve(r,"sum");let o;r.dtype==="bool"?o=_r({inputs:{x:r},backend:n,attrs:{dtype:"int32"}}):o=Wa({inputs:{x:r},backend:n});let l=o.shape.length,d=k.parseAxisParam(s,o.shape),u=C.getAxesPermutation(d,l),p=d,c=o;u!=null&&(c=Kn({inputs:{x:o},backend:n,attrs:{perm:u}}),p=C.getInnerMostAxes(p.length,l)),C.assertAxesAreInnerMostDims("sum",p,c.shape.length);let[h,m]=C.computeOutAndReduceShapes(c.shape,p),f=C.upcastType(c.dtype,"int32"),A=rh(n,h,f),y=k.sizeFromShape(m),g=n.data.get(A.dataId).values,x=n.data.get(c.dataId).values;for(let w=0;w=0&&(c=od({inputs:{x:c},backend:n,attrs:{axis:d[f]-(i.length-h),keepDims:!1}}),m.push(c)),h--)}for(let f of m)f!==c&&n.disposeIntermediateTensorInfo(f);return c}var yO={kernelName:Bp,backendName:"cpu",kernelFunc:AO};function gO(e){let{inputs:t,backend:n}=e,{dy:a,y:r}=t;ve([a,r],"eluGrad");let s=new Float32Array(k.sizeFromShape(r.shape)),i=n.data.get(r.dataId).values,o=n.data.get(a.dataId).values;for(let l=0;l=1?s[l]=o[l]:s[l]=o[l]*(d+1)}return n.makeTensorInfo(r.shape,"float32",s)}var xO={kernelName:Vp,backendName:"cpu",kernelFunc:gO},bO=Rt((e,t)=>e===t?1:0),d7=Ut(Ao,bO,null,"bool"),vO={kernelName:Ao,backendName:"cpu",kernelFunc:d7},wO=C.ERF_P,kO=C.ERF_A1,IO=C.ERF_A2,SO=C.ERF_A3,NO=C.ERF_A4,TO=C.ERF_A5,EO=nt(mo,e=>{let t=Math.sign(e),n=Math.abs(e),a=1/(1+wO*n);return t*(1-((((TO*a+NO)*a+SO)*a+IO)*a+kO)*a*Math.exp(-n*n))}),CO={kernelName:mo,backendName:"cpu",kernelFunc:EO};function ih(e){let{inputs:t,backend:n,attrs:a}=e,{input:r}=t,{dim:s}=a,i=r.shape.length,o=r.shape.slice(),l=s;return s<0&&(k.assert(-(i+1)<=s,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+s+1),o.splice(l,0,1),ct({inputs:{x:r},backend:n,attrs:{shape:o}})}var RO={kernelName:yo,backendName:"cpu",kernelFunc:ih},MO=Rt((e,t)=>e/t),QA=Ut(ys,MO),e1={kernelName:ys,backendName:"cpu",kernelFunc:QA};function p7(e,t,n){let a=e.shape,r=a[0],s=a[1],i=n.data.get(e.dataId),o=i.complexTensorInfos.real,l=i.complexTensorInfos.imag,d=[r,s],u=k.sizeFromShape(d),p=k.getTypedArrayFromDType("float32",u),c=k.getTypedArrayFromDType("float32",u);for(let A=0;A{let{image:a}=e,r=n,s=k.getTypedArrayFromDType(a.dtype,k.sizeFromShape(a.shape)),[i,o,l,d]=a.shape,u=r.data.get(a.dataId).values;for(let p=0;p=0&&xMath.floor(e/t)),BO=Ut(bs,WO,null,"int32"),VO={kernelName:bs,backendName:"cpu",kernelFunc:BO};function jO(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dataFormat:u,dilations:p,dimRoundingMode:c,activation:h,leakyreluAlpha:m}=a,f=l7({inputs:{x:r,filter:s},backend:n,attrs:{strides:l,pad:d,dataFormat:u,dilations:p,dimRoundingMode:c}});if(i){let A=f;f=id({inputs:{a:f,b:i},backend:n}),n.disposeIntermediateTensorInfo(A)}if(h){let A=f;f=YA(n,f,h,o,m),n.disposeIntermediateTensorInfo(A)}return f}var UO={kernelName:ti,backendName:"cpu",kernelFunc:jO};function HO(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dataFormat:u,dilations:p,dimRoundingMode:c,activation:h,leakyreluAlpha:m}=a,f=u7({inputs:{x:r,filter:s},backend:n,attrs:{strides:l,pad:d,dataFormat:u,dilations:p,dimRoundingMode:c}});if(i){let A=f;f=id({inputs:{a:f,b:i},backend:n}),n.disposeIntermediateTensorInfo(A)}if(h){let A=f;f=YA(n,f,h,o,m),n.disposeIntermediateTensorInfo(A)}return f}var GO={kernelName:ni,backendName:"cpu",kernelFunc:HO};function qO(e){let{inputs:t,backend:n}=e,{params:a,indices:r}=t,s=k.sizeFromShape(a.shape),i=r.shape,o=i[i.length-1],[l,d,u,p]=C.prepareAndValidate(a,r);if(d===0)return n.makeTensorInfo(l,a.dtype,[]);let c=We([d,u],a.dtype),h=n.data.get(r.dataId).values,m=n.data.get(a.dataId).values;for(let f=0;f=s/u)throw new Error(`Invalid indices: ${A} does not index into ${a.shape}`);for(let g=0;ge>=t?1:0),JO=Ut(ws,YO,null,"bool"),QO={kernelName:ws,backendName:"cpu",kernelFunc:JO};function ez(e){let{inputs:t,backend:n}=e,{input:a}=t,r=k.sizeFromShape(a.shape),s=a.shape[a.shape.length-1],i=r/s,o=ct({inputs:{x:a},backend:n,attrs:{shape:[i,s]}}),l=p7(o,!0,n),d=ct({inputs:{x:l},backend:n,attrs:{shape:a.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(l),d}var tz={kernelName:Up,backendName:"cpu",kernelFunc:ez},nz=nt(ko,e=>Number.isFinite(e)?1:0,"bool"),az={kernelName:ko,backendName:"cpu",kernelFunc:nz},rz=nt(Io,e=>Math.abs(e)===Infinity?1:0,"bool"),sz={kernelName:Io,backendName:"cpu",kernelFunc:rz},iz=nt(So,e=>Number.isNaN(e)?1:0,"bool"),oz={kernelName:So,backendName:"cpu",kernelFunc:iz},lz=Rt((e,t)=>e<=t?1:0),uz=Ut(To,lz,null,"bool"),dz={kernelName:To,backendName:"cpu",kernelFunc:uz};function pz(e){let{backend:t,attrs:n}=e,{start:a,stop:r,num:s}=n,i=D3(a,r,s);return t.makeTensorInfo([i.length],"float32",i)}var cz={kernelName:Gp,backendName:"cpu",kernelFunc:pz},hz=nt(Eo,e=>Math.log1p(e)),fz={kernelName:Eo,backendName:"cpu",kernelFunc:hz},mz=Rt((e,t)=>e&&t),Az=Ut(Co,mz,null,"bool"),yz={kernelName:Co,backendName:"cpu",kernelFunc:Az},gz=nt(ku,e=>e?0:1,"bool"),xz={kernelName:ku,backendName:"cpu",kernelFunc:gz},bz=Rt((e,t)=>e||t),vz=Ut(Iu,bz,null,"bool"),wz={kernelName:Iu,backendName:"cpu",kernelFunc:vz};function kz(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{depthRadius:s,bias:i,alpha:o,beta:l}=a;ve(r,"LRN");let d=r.shape[3],u=d-1,p=n.data.get(r.dataId).values,c=k.sizeFromShape(r.shape),h=new Float32Array(c);function m(f){let A=f%d,y=f-A+Math.max(0,A-s),g=f-A+Math.min(A+s,u),x=0;for(;y<=g;y++){let w=p[y];x+=w*w}return x}for(let f=0;f`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);let u=C.computePool2DInfo(r.shape,s,i,d,o,l),p;if(u.filterWidth===1&&u.filterHeight===1&&k.arraysEqual(u.inShape,u.outShape))p=Wa({inputs:{x:r},backend:n});else{let c=n.data.get(r.dataId).values,h=k.computeStrides(r.shape),m=JA(c,r.shape,r.dtype,h,u,"max");p=n.makeTensorInfo(u.outShape,r.dtype,m.values)}return p}var Cz={kernelName:Es,backendName:"cpu",kernelFunc:Ez};function Rz(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:d}=a;ve(r,"maxPool3d");let u=C.computePool3DInfo(r.shape,s,i,1,o,l,d),p=n.data.get(r.dataId).values,c=o7(p,r.shape,r.dtype,k.computeStrides(r.shape),u,"max");return n.makeTensorInfo(c.shape,"float32",c.values)}var Mz={kernelName:Nu,backendName:"cpu",kernelFunc:Rz};function Fz(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,{filterSize:i,strides:o,pad:l,dimRoundingMode:d}=a;ve([r,s],"maxPool3DGrad");let u=C.computePool3DInfo(s.shape,i,o,1,l,d),p=n.bufferSync(s),c=mD(p,u),h=u.strideDepth,m=u.strideHeight,f=u.strideWidth,A=u.dilationDepth,y=u.dilationHeight,g=u.dilationWidth,x=u.effectiveFilterDepth,w=u.effectiveFilterHeight,b=u.effectiveFilterWidth,v=x-1-u.padInfo.front,N=b-1-u.padInfo.left,T=w-1-u.padInfo.top,R=We(s.shape,"float32"),$=n.bufferSync(r);for(let z=0;z=u.outDepth||Math.floor(ne)!==ne))for(let ie=0;ie=u.outHeight||Math.floor(Q)!==Q))for(let de=0;de=u.outWidth||Math.floor(oe)!==oe)continue;let ye=x*w*b-1-c.get(z,ne,Q,oe,P),ce=re*w*b+ie*b+de,Ie=ye===ce?1:0;Ie!==0&&(Y+=$.get(z,ne,Q,oe,P)*Ie)}}}R.set(Y,z,V,j,U,P)}return n.makeTensorInfo(R.shape,R.dtype,R.values)}var $z={kernelName:Kp,backendName:"cpu",kernelFunc:Fz};function Dz(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s,output:i}=t,o=s;ve([s,i],"maxPoolGrad");let{filterSize:l,strides:d,pad:u,dimRoundingMode:p}=a,c=C.computePool2DInfo(o.shape,l,d,1,u,p),h=n.data.get(o.dataId).values,m=We(c.outShape,o.dtype,i7(h,o.shape,o.dtype,c).values),f=c.strideHeight,A=c.strideWidth,y=c.dilationHeight,g=c.dilationWidth,x=c.effectiveFilterHeight,w=c.effectiveFilterWidth,b=w-1-c.padInfo.left,v=x-1-c.padInfo.top,N=We(o.shape,"float32"),T=n.data.get(r.dataId).values,R=We(r.shape,"float32",T);for(let $=0;$=c.outHeight||Math.floor(ee)!==ee))for(let Y=0;Y=c.outWidth||Math.floor(re)!==re)continue;let ne=x*w-1-m.get($,ee,re,z),ie=G*w+Y,Q=ne===ie?1:0;Q!==0&&(X+=R.get($,ee,re,z)*Q)}}N.set(X,$,P,V,z)}return n.makeTensorInfo(N.shape,N.dtype,N.values)}var Oz={kernelName:Xp,backendName:"cpu",kernelFunc:Dz};function zz(e,t,n,a,r){let s=k.computeStrides(t),i=JA(e,t,n,s,r,"max"),o=i7(e,t,n,r,!0,a);return[i.values,o.values]}var _z={kernelName:Zp,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:a}=e,{filterSize:r,strides:s,pad:i,includeBatchInIndex:o}=t,l=n;ve(a,"MaxPoolWithArgmax");let d=l.data.get(a.dataId).values,u=C.computePool2DInfo(a.shape,r,s,[1,1],i),[p,c]=zz(d,a.shape,a.dtype,o,u),h=l.write(p,u.outShape,a.dtype),m=l.write(c,u.outShape,a.dtype);return[{dataId:h,shape:u.outShape,dtype:a.dtype},{dataId:m,shape:u.outShape,dtype:"int32"}]}};function Pz(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=k.parseAxisParam(s,r.shape),l=C.computeOutAndReduceShapes(r.shape,o)[1],d=k.sizeFromShape(l),u=[],p=n.makeTensorInfo([],"float32",new Float32Array([d]));u.push(p);let c=_r({inputs:{x:r},backend:n,attrs:{dtype:"float32"}});u.push(c);let h=QA({inputs:{a:c,b:p},backend:n});u.push(h);let m=od({inputs:{x:h},backend:n,attrs:{axis:s,keepDims:i}});return u.forEach(f=>n.disposeIntermediateTensorInfo(f)),m}var Lz={kernelName:Cs,backendName:"cpu",kernelFunc:Pz};function Wz(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a;ve(r,"min");let o=k.parseAxisParam(s,r.shape),l=o,d=C.getAxesPermutation(l,r.shape.length),u=r;d!=null&&(u=Kn({inputs:{x:r},backend:n,attrs:{perm:d}}),l=C.getInnerMostAxes(l.length,r.shape.length)),C.assertAxesAreInnerMostDims("min",l,u.shape.length);let[p,c]=C.computeOutAndReduceShapes(u.shape,l),h=k.sizeFromShape(c),m=k.makeZerosTypedArray(k.sizeFromShape(p),u.dtype),f=n.data.get(u.dataId).values;for(let y=0;yg[0]+r.shape[x]+g[1]),l=s.map(g=>g[0]),d=s.map((g,x)=>g[0]+r.shape[x]),u=i==="reflect"?0:1,p=n.data.get(r.dataId).values,c=r.shape.length,h=k.computeStrides(r.shape),m=k.sizeFromShape(o),f=o.length,A=k.computeStrides(o),y=k.getTypedArrayFromDType(r.dtype,m);for(let g=0;g=d[b]&&(x[b]=(d[b]-1)*2-x[b]+u);x=x.map((b,v)=>b-l[v]);let w=k.locToIndex(x,c,h);y[g]=p[w]}return{dataId:n.write(y,o,r.dtype),shape:o,dtype:r.dtype}}var jz={kernelName:Fs,backendName:"cpu",kernelFunc:Vz},Uz=Rt((e,t)=>{let n=e%t;return e<0&&t<0||e>=0&&t>=0?n:(n+t)%t}),Hz=Ut(Ro,Uz),Gz={kernelName:Ro,backendName:"cpu",kernelFunc:Hz},qz=Zi(Bg());function h7(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{dim:s}=a,i=r.shape.length,o=s;if(o===-1&&(o=i-1),o!==i-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${i} and dim was ${o}`);let l=k.parseAxisParam([o],r.shape),d=c7({inputs:{x:r},backend:n,attrs:{reductionIndices:l,keepDims:!1}}),u=C.expandShapeToKeepDim(d.shape,l),p=ct({inputs:{x:d},backend:n,attrs:{shape:u}}),c=ZA({inputs:{a:r,b:p},backend:n}),h=Y3({inputs:{x:c},backend:n}),m=od({inputs:{x:h},backend:n,attrs:{axis:l,keepDims:!1}}),f=ct({inputs:{x:m},backend:n,attrs:{shape:u}}),A=QA({inputs:{a:h,b:f},backend:n});return n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(f),A}var Xz={kernelName:Xs,backendName:"cpu",kernelFunc:h7};function Kz(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{numSamples:s,seed:i,normalized:o}=a;ve(r,"multinomial");let l=o?r:h7({inputs:{logits:r},backend:n,attrs:{dim:-1}}),d=l.shape[0],u=l.shape[1],p=n.data.get(l.dataId).values,c=[d,s],h=k.makeZerosTypedArray(k.sizeFromShape(c),"int32");for(let m=0;m=0&&u[p]{k.assertShapesMatch(s,u.shape,"All tensors passed to stack must have matching shapes"),k.assert(i===u.dtype,()=>"All tensors passed to stack must have matching dtypes")});let o=[],l=t.map(u=>{let p=ih({inputs:{input:u},backend:n,attrs:{dim:r}});return o.push(p),p}),d=Tl({inputs:l,backend:n,attrs:{axis:r}});return o.forEach(u=>n.disposeIntermediateTensorInfo(u)),d}var d_={kernelName:_o,backendName:"cpu",kernelFunc:m7};function p_(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{paddings:s,constantValue:i}=a;ve(r,"pad");let o=s.map((y,g)=>y[0]+r.shape[g]+y[1]),l=s.map(y=>y[0]),d=n.data.get(r.dataId).values,u=k.sizeFromShape(r.shape),p=r.shape.length,c=k.computeStrides(r.shape),h=k.sizeFromShape(o),m=o.length,f=k.computeStrides(o),A=k.getTypedArrayFromDType(r.dtype,h);i!==0&&A.fill(i);for(let y=0;yw+l[b]),x=k.locToIndex(g,m,f);A[x]=d[y]}return{dataId:n.write(A,o,r.dtype),shape:o,dtype:r.dtype}}var A7={kernelName:Os,backendName:"cpu",kernelFunc:p_},c_=Rt((e,t)=>Math.pow(e,t)),h_=Ut(zs,c_),f_={kernelName:zs,backendName:"cpu",kernelFunc:h_};function m_(e){let{backend:t,attrs:n}=e,{start:a,stop:r,dtype:s,step:i}=n,o=XA(a,r,i,s);return t.makeTensorInfo([o.length],s,o)}var A_={kernelName:Tu,backendName:"cpu",kernelFunc:m_},y_=nt(Lo,e=>1/e),g_={kernelName:Lo,backendName:"cpu",kernelFunc:y_};function x_(e){let{inputs:t,backend:n,attrs:a}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:i,size:o}=a;ve(r,"resizeBilinear");let l=k.computeStrides(r.shape),[d,u]=o,[p,c,h,m]=r.shape,f=n.data.get(r.dataId).values,A=new Float32Array(k.sizeFromShape([p,d,u,m])),y=[s&&d>1?c-1:c,s&&u>1?h-1:h],g=[s&&d>1?d-1:d,s&&u>1?u-1:u],x=0,w=y[0]/g[0],b=y[1]/g[1];for(let v=0;v1?d-1:d,i&&h>1?u-1:u],A=[i&&c>1?c-1:c,i&&h>1?h-1:h],y=f[0]/A[0],g=f[1]/A[1],x=n.data.get(s.dataId).values,w=0;for(let b=0;b1?c-1:c,s&&u>1?h-1:h],g=[s&&d>1?d-1:d,s&&u>1?u-1:u],x=y[0]/g[0],w=y[1]/g[1],b=0;for(let v=0;v1?u-1:u,i&&m>1?p-1:p],g=[i&&h>1?h-1:h,i&&m>1?m-1:m],x=y[0]/g[0],w=y[1]/g[1],b=1/x,v=1/w,N=Math.ceil(b)*2+2,T=Math.ceil(v)*2+2;for(let R=0;R=h)continue;let Q=$+ie*l[1],de=ie*x,oe=Math.min(u-1,i?Math.round(de):Math.floor(de));if(z===oe)for(let ye=0;ye=m)continue;let Ie=Q+ce*l[2],Ne=ce*w,$e=Math.min(p-1,i?Math.round(Ne):Math.floor(Ne));U===$e&&(re+=A[Ie+Y])}}f[X+Y]=re}}}}return n.makeTensorInfo(r.shape,r.dtype,f)}var N_={kernelName:Qp,backendName:"cpu",kernelFunc:S_};function T_(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dims:s}=a;ve(r,"reverse");let i=r.shape.length,o=k.parseAxisParam(s,r.shape);if(i===0)return Wa({inputs:{x:r},backend:n});let l=new Dt(r.shape,r.dtype),d=n.bufferSync(r);for(let u=0;uc[h]=r.shape[h]-1-c[h]),l.set(d.get(...c),...p)}return n.makeTensorInfo(l.shape,l.dtype,l.values)}var E_={kernelName:Bs,backendName:"cpu",kernelFunc:T_},C_={kernelName:el,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{image:a}=e,{radians:r,fillValue:s,center:i}=t,o=n,l=k.getTypedArrayFromDType(a.dtype,k.sizeFromShape(a.shape)),[d,u,p,c]=a.shape,[h,m]=C.getImageCenter(i,u,p),f=255,A=Math.sin(r),y=Math.cos(r),g=o.data.get(a.dataId).values;for(let x=0;x=0&&V=0&&j{let t=Math.floor(e);return e-t<.5?Math.floor(e):e-t>.5?Math.ceil(e):t%2==0?t:t+1}),M_={kernelName:Vs,backendName:"cpu",kernelFunc:R_};function y7(e,t,n,a,r,s,i,o,l,d){let u=[a/r,r],p=e.values,c=t.values;if(a===0)return We(n,t.dtype);let h=We(u,t.dtype);h.values.fill(l);for(let m=0;m=a/r)throw new Error(`Invalid indices: ${f} does not index into ${n}`);for(let y=0;y1||r.shape.length===1?1:k.sizeFromShape(r.shape.slice(1));for(let m=0;me>=0?__*e:z_*(Math.exp(e)-1)),L_={kernelName:jo,backendName:"cpu",kernelFunc:P_},W_=nt(Go,e=>e<0?-1:e>0?1:0),B_={kernelName:Go,backendName:"cpu",kernelFunc:W_},V_=nt(Us,e=>Math.sin(e)),j_={kernelName:Us,backendName:"cpu",kernelFunc:V_},U_=nt(Ho,e=>Math.sinh(e)),H_={kernelName:Ho,backendName:"cpu",kernelFunc:U_},G_=11920928955078125e-23,g7=Math.log(G_)+2,q_=nt(qo,e=>{let t=e>-g7,n=e0&&k.isString(n[0])){let r=n.map(s=>k.encodeString(s));a=this.write(r,e,t)}else a=this.write(n,e,t);return{dataId:a,shape:e,dtype:t}}refCount(e){return this.data.has(e)?this.data.get(e).refCount:0}incRef(e){let t=this.data.get(e);t.refCount++}decRef(e){if(this.data.has(e)){let t=this.data.get(e);t.refCount--}}move(e,t,n,a,r){this.data.set(e,{values:t,dtype:a,refCount:r})}numDataIds(){return this.data.numDataIds()}async read(e){return this.readSync(e)}readSync(e){let{dtype:t,complexTensorInfos:n}=this.data.get(e);if(t==="complex64"){let a=this.readSync(n.real.dataId),r=this.readSync(n.imag.dataId);return C.mergeRealAndImagArrays(a,r)}return this.data.get(e).values}bufferSync(e){let t=this.readSync(e.dataId),n=t;if(e.dtype==="string")try{n=t.map(a=>k.decodeString(a))}catch(a){throw new Error("Failed to decode encoded string bytes into utf-8")}return We(e.shape,e.dtype,n)}makeOutput(e,t,n){let a=this.write(e,t,n);return nr().makeTensorFromDataId(a,t,n,this)}disposeData(e,t=!1){if(this.data.has(e)){if(this.data.get(e).refCount--,!t&&this.data.get(e).refCount>0)return!1;let{complexTensorInfos:n}=this.data.get(e);n!=null&&(this.disposeData(n.real.dataId,!0),this.disposeData(n.imag.dataId,!0)),this.data.delete(e)}return!0}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}async time(e){let t=k.now();return e(),{kernelMs:k.now()-t}}memory(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}}where(e){ve([e],"where");let t=this.readSync(e.dataId);return GF(e.shape,t)}dispose(){}floatPrecision(){return 32}epsilon(){return super.epsilon()}};ah.nextDataId=0;var UA={};Fe(UA,{addImpl:()=>N3,bincountImpl:()=>HA,bincountReduceImpl:()=>T3,ceilImpl:()=>E3,concatImpl:()=>GA,expImpl:()=>C3,expm1Impl:()=>R3,floorImpl:()=>M3,gatherV2Impl:()=>F3,greaterImpl:()=>$3,lessImpl:()=>D3,linSpaceImpl:()=>O3,logImpl:()=>z3,maxImpl:()=>_3,maximumImpl:()=>P3,minimumImpl:()=>L3,multiplyImpl:()=>qA,negImpl:()=>W3,notEqualImpl:()=>B3,prodImpl:()=>V3,rangeImpl:()=>KA,rsqrtImpl:()=>j3,simpleAbsImpl:()=>S3,sliceImpl:()=>rh,sparseFillEmptyRowsImpl:()=>U3,sparseReshapeImpl:()=>H3,squaredDifferenceImpl:()=>G3,stridedSliceImpl:()=>q3,subImpl:()=>X3,tileImpl:()=>K3,topKImpl:()=>Z3,transposeImpl:()=>XA,uniqueImpl:()=>Y3});function S3(e){let t=new Float32Array(e.length);for(let n=0;n{let{x:t}=e.inputs,n=e.backend;ve(t,"abs");let a=new Float32Array(k.sizeFromShape(t.shape)),r=n.data.get(t.dataId).values;return a=S3(r),n.makeOutput(a,t.shape,"float32")},XF={kernelName:eo,backendName:"cpu",kernelFunc:qF};function Rt(e){return(t,n,a,r,s)=>{let i=C.assertAndGetBroadcastShape(t,n),o=i.length,l=k.computeStrides(i),d=k.sizeFromShape(i),u=k.getTypedArrayFromDType(s,d),p=t.length,c=n.length,h=k.computeStrides(t),m=k.computeStrides(n),f=C.getBroadcastDims(t,i),A=C.getBroadcastDims(n,i);if(f.length+A.length===0)for(let y=0;yx[N]=0);let w=k.locToIndex(x,p,h),b=g.slice(-c);A.forEach(N=>b[N]=0);let v=k.locToIndex(b,c,m);u[y]=e(a[w],r[v])}return[u,i]}}function _n(e){let{inputs:t,backend:n}=e,{real:a,imag:r}=t,s=n.data.get(a.dataId).values,i=n.data.get(r.dataId).values,o=n.makeTensorInfo(a.shape,"complex64"),l=n.data.get(o.dataId);return l.complexTensorInfos={real:n.makeTensorInfo(a.shape,"float32",s),imag:n.makeTensorInfo(r.shape,"float32",i)},o}var KF={kernelName:Fp,backendName:"cpu",kernelFunc:_n};function sh(e,t,n="float32"){if(n==="complex64"){let r=sh(e,t,"float32"),s=sh(e,t,"float32");return _n({inputs:{real:r,imag:s},backend:e})}let a=k.makeZerosTypedArray(k.sizeFromShape(t),n);return e.makeTensorInfo(t,n,a)}function Ba(e){let{inputs:t,backend:n}=e,{x:a}=t;return n.incRef(a.dataId),{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}var ZF={kernelName:Is,backendName:"cpu",kernelFunc:Ba};function xi(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.data.get(a.dataId).complexTensorInfos.real,s=n.data.get(r.dataId).values;return n.makeTensorInfo(r.shape,r.dtype,s)}var YF={kernelName:Qp,backendName:"cpu",kernelFunc:xi};function Pr(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dtype:s}=a;if(s==="complex64"){if(r.dtype==="complex64")return Ba({inputs:{x:r},backend:n});let i=sh(n,r.shape,r.dtype),o=Pr({inputs:{x:r},backend:n,attrs:{dtype:"float32"}}),l=_n({inputs:{real:o,imag:i},backend:n});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}if(r.dtype==="complex64"){let i=xi({inputs:{input:r},backend:n}),o=Pr({inputs:{x:i},backend:n,attrs:{dtype:s}});return n.disposeIntermediateTensorInfo(i),o}if(!k.hasEncodingLoss(r.dtype,s)){let i=Ba({inputs:{x:r},backend:n});return{dataId:i.dataId,shape:i.shape,dtype:s}}if(s==="int32"){let i=n.data.get(r.dataId).values,o=Int32Array.from(i);return n.makeTensorInfo(r.shape,"int32",o)}if(s==="bool"){let i=n.data.get(r.dataId).values,o=k.toTypedArray([0],r.dtype),[l,d]=Rt((u,p)=>u!==p?1:0)(r.shape,[],i,o,"bool");return n.makeTensorInfo(d,"bool",l)}throw new Error(`Error in Cast: failed to cast ${r.dtype} to ${s}`)}var JF={kernelName:ps,backendName:"cpu",kernelFunc:Pr};function Ut(e,t,n,a){return n==null?({inputs:r,backend:s})=>{let{a:i,b:o}=r,l=s;ve([i,o],e);let d=l.data.get(i.dataId).values,u=l.data.get(o.dataId).values,p=a||i.dtype,[c,h]=t(i.shape,o.shape,d,u,p);return l.makeTensorInfo(h,p,c)}:({inputs:r,backend:s})=>{let{a:i,b:o}=r,l=s;if(i.dtype==="complex64"||o.dtype==="complex64"){let d=Pr({inputs:{x:i},backend:l,attrs:{dtype:"complex64"}}),u=l.data.get(d.dataId),p=u.complexTensorInfos.real,c=u.complexTensorInfos.imag,h=l.data.get(p.dataId).values,m=l.data.get(c.dataId).values,f=Pr({inputs:{x:o},backend:l,attrs:{dtype:"complex64"}}),A=l.data.get(f.dataId),y=A.complexTensorInfos.real,g=A.complexTensorInfos.imag,x=l.data.get(y.dataId).values,w=l.data.get(g.dataId).values,[b,v,N]=n(i.shape,o.shape,h,m,x,w),T=l.makeTensorInfo(N,"float32",b),R=l.makeTensorInfo(N,"float32",v),$=_n({inputs:{real:T,imag:R},backend:l});return l.disposeIntermediateTensorInfo(d),l.disposeIntermediateTensorInfo(f),l.disposeIntermediateTensorInfo(T),l.disposeIntermediateTensorInfo(R),$}else{let d=l.data.get(i.dataId).values,u=l.data.get(o.dataId).values,p=a||i.dtype,[c,h]=t(i.shape,o.shape,d,u,p);return l.makeTensorInfo(h,p,c)}}}function ZA(e){return(t,n,a,r,s,i)=>{let o=C.assertAndGetBroadcastShape(t,n),l=k.sizeFromShape(o),d=o.length,u=k.computeStrides(o),p=k.getTypedArrayFromDType("float32",l),c=k.getTypedArrayFromDType("float32",l),h=C.getBroadcastDims(t,o),m=C.getBroadcastDims(n,o),f=C.mergeRealAndImagArrays(a,r),A=C.mergeRealAndImagArrays(s,i),y=t.length,g=k.computeStrides(t),x=n.length,w=k.computeStrides(n);if(h.length+m.length===0)for(let b=0;bN[P]=0);let T=k.locToIndex(N,y,g),R=v.slice(-x);m.forEach(P=>R[P]=0);let $=k.locToIndex(R,x,w),z=e(f[T*2],f[T*2+1],A[$*2],A[$*2+1]);p[b]=z.real,c[b]=z.imag}return[p,c,o]}}var N3=Rt((e,t)=>e+t),QF=ZA((e,t,n,a)=>({real:e+n,imag:t+a})),od=Ut(kr,N3,QF),e$={kernelName:kr,backendName:"cpu",kernelFunc:od};function HA(e,t,n,a,r){let s=k.sizeFromShape(a),i=k.makeZerosTypedArray(r,n);for(let o=0;o=r||(s>0?i[l]+=t[o]:i[l]+=1)}return i}function T3(e,t,n,a=!1){let r=e.shape[0],s=e.shape[1],i=We([r,n],t.dtype);for(let o=0;o=n||(a?i.set(1,o,d):t.size>0?i.set(i.get(o,d)+t.get(o,l),o,d):i.set(i.get(o,d)+1,o,d))}return i}function Sl(e){return(t,n,a)=>{let r=k.getTypedArrayFromDType(n,t.length);for(let s=0;s{let{x:i}=a;if(ve(i,e),i.dtype==="string"||n==="string")throw new Error("unaryKernelFunc does not support string input/output");let o=s,l=o.data.get(i.dataId).values,d=k.sizeFromShape(i.shape),u=n||i.dtype,p=k.getArrayFromDType(u,d);for(let c=0;c{let{x:i}=a;if(ve(i,e),i.dtype==="string"||n==="string")throw new Error("unaryKernelFunc does not support string input/output");let o=s,l=o.data.get(i.dataId).values,d=n||i.dtype,u=t(l,d,r);return o.makeTensorInfo(i.shape,d,u)}}var E3=Sl(e=>Math.ceil(e)),t$=Nl(cs,E3),n$={kernelName:cs,backendName:"cpu",kernelFunc:t$};function GA(e,t,n,a){let r=k.getArrayFromDType(n,k.sizeFromShape(t));if(a&&n!=="string"){let s=0;e.forEach(i=>{let o=k.sizeFromShape(i.shape);r.set(i.vals,s),s+=o})}else{let s=0;e.forEach(i=>{let o=n==="string"?C.fromUint8ToStringArray(i.vals):i.vals,l=0;for(let d=0;dMath.exp(e)),J3=Nl(xs,C3),a$={kernelName:xs,backendName:"cpu",kernelFunc:J3},R3=Sl(e=>Math.expm1(e)),r$=Nl(xo,R3),s$={kernelName:xo,backendName:"cpu",kernelFunc:r$},M3=Sl(e=>Math.floor(e)),i$=Nl(bs,M3),o$={kernelName:bs,backendName:"cpu",kernelFunc:i$};function F3(e,t,n){let a=We(n,e.dtype);for(let r=0;re>t?1:0),l$=Ut(ko,$3,null,"bool"),u$={kernelName:ko,backendName:"cpu",kernelFunc:l$},D3=Rt((e,t)=>eMath.log(e)),c$=Nl(Ns,z3),h$={kernelName:Ns,backendName:"cpu",kernelFunc:c$};function _3(e,t,n,a){let r=k.getTypedArrayFromDType(a,k.sizeFromShape(n));for(let s=0;so&&(o=d)}r[s]=o}return r}var P3=Rt((e,t)=>Math.max(e,t)),f$=Ut(Es,P3),m$={kernelName:Es,backendName:"cpu",kernelFunc:f$},L3=Rt((e,t)=>Math.min(e,t)),A$=Ut(Fs,L3),y$={kernelName:Fs,backendName:"cpu",kernelFunc:A$},qA=Rt((e,t)=>e*t),g$=ZA((e,t,n,a)=>({real:e*n-t*a,imag:e*a+t*n})),ih=Ut(Ds,qA,g$),x$={kernelName:Ds,backendName:"cpu",kernelFunc:ih};function W3(e,t,n){let a=k.createScalarValue(-1,n);return qA([],t,a,e,n)}function b$(e){let{inputs:t,backend:n}=e,{x:a}=t;ve(a,"neg");let r=n.data.get(a.dataId).values,[s,i]=W3(r,a.shape,a.dtype);return n.makeTensorInfo(i,a.dtype,s)}var v$={kernelName:Fo,backendName:"cpu",kernelFunc:b$},B3=Rt((e,t)=>e!==t?1:0),w$=Ut($o,B3,null,"bool"),k$={kernelName:$o,backendName:"cpu",kernelFunc:w$};function XA(e,t,n,a,r){let s=t.length,i=k.sizeFromShape(t),o=k.computeStrides(t),l=k.computeStrides(r),d=k.getTypedArrayFromDType(n,k.sizeFromShape(r));for(let u=0;un.disposeIntermediateTensorInfo(g)),n.makeTensorInfo(y,A,m)}var N$={kernelName:Lo,backendName:"cpu",kernelFunc:S$};function KA(e,t,n,a){let r=e===t,s=e1;if(r||s||i)return k.makeZerosTypedArray(0,a);let o=Math.abs(Math.ceil((t-e)/n)),l=k.makeZerosTypedArray(o,a);t1/Math.sqrt(e)),T$=Nl(Us,j3),E$={kernelName:Us,backendName:"cpu",kernelFunc:T$};function rh(e,t,n,a,r){let s=on.isSliceContinous(a,t,n),i=k.sizeFromShape(n),o=k.computeStrides(a);if(s){let p=on.computeFlatOffset(t,o);return r==="string"?e.slice(p,p+i):e.subarray(p,p+i)}let l=r==="string"?C.fromUint8ToStringArray(e):e,d=We(a,r,l),u=We(n,r);for(let p=0;pm+t[f]);u.set(d.get(...h),...c)}return r==="string"?C.fromStringArrayToUint8(u.values):u.values}function bi(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,size:i}=a;ve(r,"slice");let[o,l]=on.parseSliceParams(r,s,i);on.assertParamsValid(r,o,l);let d=n.data.get(r.dataId).values,u=rh(d,o,l,r.shape,r.dtype);return n.makeTensorInfo(l,r.dtype,u)}var C$={kernelName:Ho,backendName:"cpu",kernelFunc:bi};function U3(e,t,n,a,r,s,i){let o=t[0],l=s[0],d=new Array(l),u=new Array(o),p=t[1];if(l===0){if(o!==0)throw new Error(`Received SparseTensor with denseShape[0] = 0 but + indices.shape[0] = ${o}`);let A=k.getArrayFromDType(n,0),y=k.getArrayFromDType(r,0);return[A,[0,p],y,d,u]}let c=!0,h=0,m=new Array(l).fill(0);for(let A=0;A=l)throw new Error(`indices(${A}, 0) is invalid: ${y} >= ${l}`);++m[y],c=c&&y>=h,h=y}let f=!0;for(let A=0;A0&&(m[A]+=m[A-1])}if(f&&c){let A=e,y=a;for(let g=0;g0){h[c-1]=1;for(let A=c-2;A>=0;--A)h[A]=h[A+1]*a[A+1]}let m=[];if(o>0){m[o-1]=1;for(let A=o-2;A>=0;--A)m[A]=m[A+1]*l[A+1]}let f=k.getArrayFromDType(n,i*o);for(let A=0;A{let n=e-t;return n*n}),R$=Ut(Zs,G3),M$={kernelName:Zs,backendName:"cpu",kernelFunc:R$};function q3(e,t,n,a){let r=We(e,t.dtype);for(let s=0;se-t),F$=ZA((e,t,n,a)=>({real:e-n,imag:t-a})),YA=Ut(Ys,X3,F$),$$={kernelName:Ys,backendName:"cpu",kernelFunc:YA};function K3(e,t){let n=new Array(e.rank);for(let r=0;rx.value-g.value);let f=p*a,A=l.subarray(f,f+a),y=d.subarray(f,f+a);for(let g=0;g{for(let A=0;Anew ah,1);var e7=nt(mo,e=>e>=0?e:Math.exp(e)-1),D$={kernelName:mo,backendName:"cpu",kernelFunc:e7};function t7(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{alpha:s}=a;ve([r],"leakyRelu");let i=k.sizeFromShape(r.shape),o=n.data.get(r.dataId).values,l=k.getTypedArrayFromDType("float32",i);for(let d=0;de<0?t*e:e);function n7(e){let{inputs:t,backend:n}=e,{x:a,alpha:r}=t;ve([a,r],"prelu");let s=n.data.get(a.dataId).values,i=n.data.get(r.dataId).values,[o,l]=z$(a.shape,r.shape,s,i,a.dtype);return n.makeTensorInfo(l,a.dtype,o)}var _$={kernelName:Ps,backendName:"cpu",kernelFunc:n7},a7=nt(Ls,e=>Math.max(0,e)),P$={kernelName:Ls,backendName:"cpu",kernelFunc:a7},r7=nt(Bs,e=>Math.min(Math.max(0,e),6)),L$={kernelName:Bs,backendName:"cpu",kernelFunc:r7},s7=nt(Gs,e=>1/(1+Math.exp(-e))),W$={kernelName:Gs,backendName:"cpu",kernelFunc:s7};function JA(e,t,n,a,r){if(n==="linear")return Ba({inputs:{x:t},backend:e});if(n==="relu")return a7({inputs:{x:t},backend:e});if(n==="elu")return e7({inputs:{x:t},backend:e});if(n==="relu6")return r7({inputs:{x:t},backend:e});if(n==="prelu")return n7({inputs:{x:t,alpha:a},backend:e});if(n==="leakyrelu")return t7({inputs:{x:t},backend:e,attrs:{alpha:r}});if(n==="sigmoid")return s7({inputs:{x:t},backend:e});throw new Error(`Activation ${n} has not been implemented for the CPU backend.`)}function ct(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{shape:s}=a,i=k.sizeFromShape(r.shape),o=k.inferFromImplicitShape(s,i),l=k.sizeFromShape(o);k.assert(i===l,()=>`The new shape (${o}) has ${l} elements and the old shape (${r.shape}) has ${i} elements. The new shape and old shape must have the same number of elements.`),n.incRef(r.dataId);let d=n.data.get(r.dataId);if(d.complexTensorInfos!=null){let u=d.complexTensorInfos.real,p=d.complexTensorInfos.imag;u.shape=o,p.shape=o}return{dataId:r.dataId,shape:o,dtype:r.dtype}}var B$={kernelName:Bo,backendName:"cpu",kernelFunc:ct};function i7(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s}=t,{transposeA:i,transposeB:o}=a;ve([r,s],"matMul");let l=r.shape.length,d=s.shape.length,u=i?r.shape[l-2]:r.shape[l-1],p=o?s.shape[d-1]:s.shape[d-2],c=i?r.shape[l-1]:r.shape[l-2],h=o?s.shape[d-2]:s.shape[d-1],m=r.shape.slice(0,-2),f=s.shape.slice(0,-2),A=k.sizeFromShape(m),y=k.sizeFromShape(f),g=A===y||A===1||y===1;k.assert(l>=2&&d>=2&&g,()=>`Error in matMul: the input batch dimensions must either be the same or at least one input batch dimension must be 1. Got input batch dimensions of (${m}) and (${f}).`);let x=(A>y?r.shape.slice(0,-2):s.shape.slice(0,-2)).concat([c,h]);k.assert(u===p,()=>`Error in matMul: inner shapes (${u}) and (${p}) of Tensors with shapes ${r.shape} and ${s.shape} and transposeA=${i} and transposeB=${o} must match.`);let w=i?[A,u,c]:[A,c,u],b=o?[y,h,p]:[y,p,h],v=ct({inputs:{x:r},backend:n,attrs:{shape:w}}),N=ct({inputs:{x:s},backend:n,attrs:{shape:b}}),T=i?v.shape[1]:v.shape[2],R=i?v.shape[2]:v.shape[1],$=o?N.shape[1]:N.shape[2],z=Math.max(A,y),P=n.data.get(v.dataId).values,V=n.data.get(N.dataId).values,j=k.computeStrides(v.shape),U=k.computeStrides(N.shape),[X,G,ee]=i?[j[0],1,j[1]]:[j[0],j[1],1],[Y,re,ne]=o?[1,U[1],U[0]]:[U[1],1,U[0]],ie=R*$,Q=We([z,R,$],v.dtype),de=Q.values,oe=n.blockSize;for(let ye=0;yeMath.acos(e)),G$={kernelName:to,backendName:"cpu",kernelFunc:H$},q$=nt(no,e=>Math.acosh(e)),X$={kernelName:no,backendName:"cpu",kernelFunc:q$};function K$(e){let{inputs:t,backend:n}=e,a=t;ve(t,"addN");let r=a.map(o=>n.data.get(o.dataId).values),s=We(a[0].shape,a[0].dtype),i=s.values;for(let o=0;og&&(g=b,x=w)}h[A]=x}return d.forEach(A=>n.disposeIntermediateTensorInfo(A)),n.makeTensorInfo(u,"int32",h)}var nD={kernelName:ls,backendName:"cpu",kernelFunc:tD};function aD(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s}=a;ve(r,"argMin");let i=k.parseAxisParam(s,r.shape),o=C.getAxesPermutation(i,r.shape.length),l=r,d=[];o!=null&&(l=Kn({inputs:{x:r},backend:n,attrs:{perm:o}}),d.push(l),i=C.getInnerMostAxes(i.length,l.shape.length)),i=[i[0]],C.assertAxesAreInnerMostDims("argMin",i,l.shape.length);let[u,p]=C.computeOutAndReduceShapes(l.shape,i),c=k.sizeFromShape(u),h=k.makeZerosTypedArray(c,"int32"),m=k.sizeFromShape(p),f=n.data.get(l.dataId).values;for(let A=0;An.disposeIntermediateTensorInfo(A)),n.makeTensorInfo(u,"int32",h)}var rD={kernelName:yu,backendName:"cpu",kernelFunc:aD},sD=nt(so,e=>Math.asin(e)),iD={kernelName:so,backendName:"cpu",kernelFunc:sD},oD=nt(io,e=>Math.asinh(e)),lD={kernelName:io,backendName:"cpu",kernelFunc:oD},uD=nt(oo,e=>Math.atan(e)),dD={kernelName:oo,backendName:"cpu",kernelFunc:uD},pD=Rt((e,t)=>Math.atan2(e,t)),cD=Ut(uo,pD),hD={kernelName:uo,backendName:"cpu",kernelFunc:cD},fD=nt(lo,e=>Math.atanh(e)),mD={kernelName:lo,backendName:"cpu",kernelFunc:fD};function QA(e,t,n,a,r,s){let i=r.strideHeight,o=r.strideWidth,l=r.dilationHeight,d=r.dilationWidth,u=r.effectiveFilterHeight,p=r.effectiveFilterWidth,c=r.padInfo.top,h=r.padInfo.left,m=s==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,f=We(r.outShape,n),A=f.values,y=r.outShape[1]*r.outShape[2]*r.outShape[3],g=r.outShape[2]*r.outShape[3],x=r.outShape[3];for(let w=0;wG?G=oe:s==="avg"&&(ee+=oe,Y++)}if(isNaN(G))break}let re=P+V*x+N;A[re]=s==="avg"?ee/Y:G}}}return f}function o7(e,t,n,a,r=!1,s=!1){let i=We(a.outShape,"int32"),o=a.strideHeight,l=a.strideWidth,d=a.dilationHeight,u=a.dilationWidth,p=a.effectiveFilterHeight,c=a.effectiveFilterWidth,h=a.padInfo.top,m=a.padInfo.left,f=We(t,n,e);for(let A=0;A$&&($=X,r?z=s?((A*a.inHeight+P)*a.inWidth+j)*a.inChannels+y:(P*a.inWidth+j)*a.inChannels+y:z=V*c+U)}}i.set(z,A,g,v,y)}}return i}function l7(e,t,n,a,r,s){let i=r.strideDepth,o=r.strideHeight,l=r.strideWidth,d=r.dilationDepth,u=r.dilationHeight,p=r.dilationWidth,c=r.effectiveFilterDepth,h=r.effectiveFilterHeight,m=r.effectiveFilterWidth,f=r.padInfo.front,A=r.padInfo.top,y=r.padInfo.left,g=s==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,x=We(r.outShape,n),w=x.values,b=r.outShape[1]*r.outShape[2]*r.outShape[3]*r.outShape[4],v=r.outShape[2]*r.outShape[3]*r.outShape[4],N=r.outShape[3]*r.outShape[4],T=r.outShape[4];for(let R=0;RIe?Ie=Ve:s==="avg"&&(Ne+=Ve,$e++),isNaN(Ie))break}if(isNaN(Ie))break}if(isNaN(Ie))break}let ze=ce+P;w[ze]=s==="avg"?Ne/$e:Ie}}}}return x}function AD(e,t){let n=We(t.outShape,"int32"),a=t.strideDepth,r=t.strideHeight,s=t.strideWidth,i=t.dilationDepth,o=t.dilationHeight,l=t.dilationWidth,d=t.effectiveFilterDepth,u=t.effectiveFilterHeight,p=t.effectiveFilterWidth,c=t.padInfo.front,h=t.padInfo.top,m=t.padInfo.left;for(let f=0;f=V&&(V=ne,j=X*u*p+ee*u+re)}}}n.set(j,f,y,b,R,A)}}}return n}function yD(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t;ve(r,"avgPool");let{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=a,d=1;k.assert(C.eitherStridesOrDilationsAreOne(i,d),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);let u=C.computePool2DInfo(r.shape,s,i,d,o,l),p;if(u.filterWidth===1&&u.filterHeight===1&&k.arraysEqual(u.inShape,u.outShape))p=Ba({inputs:{x:r},backend:n});else{let c=n.data.get(r.dataId).values,h=k.computeStrides(r.shape),m=QA(c,r.shape,r.dtype,h,u,"avg");p=n.makeTensorInfo(u.outShape,r.dtype,m.values)}return p}var gD={kernelName:us,backendName:"cpu",kernelFunc:yD};function xD(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:d}=a;ve(r,"avgPool3d");let u=C.computePool3DInfo(r.shape,s,i,1,o,l,d),p=n.data.get(r.dataId).values,c=l7(p,r.shape,r.dtype,k.computeStrides(r.shape),u,"avg");return n.makeTensorInfo(c.shape,"float32",c.values)}var bD={kernelName:gu,backendName:"cpu",kernelFunc:xD};function vD(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,{filterSize:i,strides:o,pad:l,dimRoundingMode:d}=a;ve([r,s],"avgPool3DGrad");let u=C.computePool3DInfo(s.shape,i,o,1,l,d),p=u.strideDepth,c=u.strideHeight,h=u.strideWidth,m=u.filterDepth,f=u.filterHeight,A=u.filterWidth,y=u.dilationDepth,g=u.dilationHeight,x=u.dilationWidth,w=u.effectiveFilterDepth,b=u.effectiveFilterHeight,v=u.effectiveFilterWidth,N=w-1-u.padInfo.front,T=v-1-u.padInfo.left,R=b-1-u.padInfo.top,$=We(s.shape,"float32"),z=1/(m*f*A),P=n.bufferSync(r);for(let V=0;V=u.outDepth||Math.floor(Q)!==Q))for(let de=0;de=u.outHeight||Math.floor(oe)!==oe))for(let ye=0;ye=u.outWidth||Math.floor(ce)!==ce||(ne+=P.get(V,Q,oe,ce,j))}}}$.set(ne*z,V,U,X,G,j)}return n.makeTensorInfo($.shape,$.dtype,$.values)}var wD={kernelName:Rp,backendName:"cpu",kernelFunc:vD};function kD(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s;ve([r,s],"avgPoolGrad");let{filterSize:o,strides:l,pad:d}=a,u=C.computePool2DInfo(i.shape,o,l,1,d),p=u.strideHeight,c=u.strideWidth,h=u.filterHeight,m=u.filterWidth,f=u.dilationHeight,A=u.dilationWidth,y=u.effectiveFilterHeight,g=u.effectiveFilterWidth,x=g-1-u.padInfo.left,w=y-1-u.padInfo.top,b=We(i.shape,"float32"),v=1/(h*m),N=n.data.get(r.dataId).values,T=We(r.shape,"float32",N);for(let R=0;R=u.outHeight||Math.floor(G)!==G))for(let ee=0;ee=u.outWidth||Math.floor(Y)!==Y||(U+=T.get(R,G,Y,$))}}b.set(U*v,R,z,P,$)}return n.makeTensorInfo(b.shape,b.dtype,b.values)}var ID={kernelName:Cp,backendName:"cpu",kernelFunc:kD};function SD(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,scale:s,offset:i,mean:o,variance:l}=t;k.assert(o.shape.length===l.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),k.assert(i==null||o.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),k.assert(s==null||o.shape.length===s.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks."),ve([r,o,l,s,i],"batchNorm");let{varianceEpsilon:d}=a;d==null&&(d=.001);let u=n.data.get(r.dataId).values,p=n.data.get(o.dataId).values,c=n.data.get(l.dataId).values,h=s?n.data.get(s.dataId).values:new Float32Array([1]),m=i?n.data.get(i.dataId).values:new Float32Array([0]),f=new Float32Array(u.length),A=m.length,y=h.length,g=c.length,x=p.length,w=0,b=0,v=0,N=0;for(let T=0;T=A&&(w=0),b>=x&&(b=0),v>=y&&(v=0),N>=g&&(N=0);return n.makeTensorInfo(r.shape,r.dtype,f)}var ND={kernelName:ws,backendName:"cpu",kernelFunc:SD};function TD(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,crops:i}=a;ve([r],"batchToSpaceND");let o=s.reduce((y,g)=>y*g),l=C.getReshaped(r.shape,s,o),d=C.getPermuted(l.length,s.length),u=C.getReshapedPermuted(r.shape,s,o),p=C.getSliceBeginCoords(i,s.length),c=C.getSliceSize(u,i,s.length),h=ct({inputs:{x:r},backend:n,attrs:{shape:l}}),m=Kn({inputs:{x:h},backend:n,attrs:{perm:d}}),f=ct({inputs:{x:m},backend:n,attrs:{shape:u}}),A=bi({inputs:{x:f},backend:n,attrs:{begin:p,size:c}});return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(f),A}var ED={kernelName:xu,backendName:"cpu",kernelFunc:TD};function CD(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,weights:s}=t,{size:i}=a,o=n.data.get(r.dataId).values,l=n.data.get(s.dataId).values,d=HA(o,l,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,d)}var RD={kernelName:Mp,backendName:"cpu",kernelFunc:CD},MD=nt(Ir,(e,t)=>{let n=t;return e>n.clipValueMax?n.clipValueMax:e{let{x:t}=e.inputs,n=e.backend,a=new Float32Array(k.sizeFromShape(t.shape)),r=n.data.get(t.dataId),s=r.complexTensorInfos.real,i=r.complexTensorInfos.imag,o=n.data.get(s.dataId).values,l=n.data.get(i.dataId).values;for(let d=0;df.shape),s);if(k.sizeFromShape(i)===0)return n.makeTensorInfo(i,t[0].dtype,[]);let o=t.filter(f=>k.sizeFromShape(f.shape)>0);if(o.length===1)return Ba({inputs:{x:o[0]},backend:n});let l=o.map(f=>f.shape);if(C.assertParamsConsistent(l,s),o[0].dtype==="complex64"){let f=o.map(w=>xi({inputs:{input:w},backend:n})),A=o.map(w=>Tl({inputs:{input:w},backend:n})),y=El({inputs:f,backend:n,attrs:{axis:s}}),g=El({inputs:A,backend:n,attrs:{axis:s}}),x=_n({inputs:{real:y,imag:g},backend:n});return f.forEach(w=>n.disposeIntermediateTensorInfo(w)),A.forEach(w=>n.disposeIntermediateTensorInfo(w)),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(g),x}let d=o.map(f=>{let A=k.sizeFromShape(f.shape.slice(s));return ct({inputs:{x:f},backend:n,attrs:{shape:[-1,A]}})}),u=d.map(f=>({vals:n.data.get(f.dataId).values,shape:f.shape}));i=C.computeOutShape(d.map(f=>f.shape),1);let p=d[0].shape[0]===1,c=GA(u,i,t[0].dtype,p),h=C.computeOutShape(o.map(f=>f.shape),s),m=n.makeTensorInfo(h,t[0].dtype,c);return d.forEach(f=>n.disposeIntermediateTensorInfo(f)),m}var zD={kernelName:po,backendName:"cpu",kernelFunc:El};function u7(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dataFormat:l,dilations:d,dimRoundingMode:u}=a;ve([r,s],"conv2d");let p=C.convertConv2DDataFormat(l),c=C.computeConv2DInfo(r.shape,s.shape,i,d,o,u,!1,p),h=c.filterHeight,m=c.filterWidth,f=c.dilationHeight,A=c.dilationWidth,y=c.padInfo.left,g=c.padInfo.top,x=c.dataFormat==="channelsLast",w=new Dt(c.outShape,r.dtype),b=k.computeStrides(r.shape),v=k.computeStrides(s.shape),N=b[0],T=x?b[1]:b[2],R=x?b[2]:1,$=x?1:b[1],z=w.strides[0],P=x?w.strides[1]:w.strides[2],V=x?w.strides[2]:1,j=x?1:w.strides[1],U=n.data.get(r.dataId).values,X=n.data.get(s.dataId).values,G=w.values;for(let ee=0;ee=c.inHeight)continue;let ye=de*v[0],ce=Y+oe*T;for(let Ie=0;Ie=c.inWidth)continue;let Qe=ye+ze*v[1],et=ce+De*R,rt=Qe;for(let Xe=0;Xe=d.inDepth)continue;let ee=X*R[0],Y=z+G*T[1];for(let re=0;re=d.inHeight)continue;let oe=ee+Q*R[1],ye=Y+de*T[2];for(let ce=0;ce=d.inWidth)continue;let De=oe+$e*R[2],Qe=ye+ze*d.inChannels,et=De;for(let rt=0;rtMath.cos(e)),KD={kernelName:ms,backendName:"cpu",kernelFunc:XD},ZD=nt(co,e=>Math.cosh(e)),YD={kernelName:co,backendName:"cpu",kernelFunc:ZD};function JD(e){let{inputs:t,backend:n,attrs:a}=e,{image:r,boxes:s,boxInd:i}=t,{cropSize:o,method:l,extrapolationValue:d}=a,[u,p,c,h]=r.shape,m=s.shape[0],[f,A]=o,y=We([m,f,A,h],"float32"),g=n.data.get(s.dataId).values,x=n.data.get(i.dataId).values,w=n.data.get(r.dataId).values,b=k.computeStrides(r.shape),v=k.computeStrides(y.shape);for(let N=0;N=u)continue;let j=f>1?(z-R)*(p-1)/(f-1):0,U=A>1?(P-$)*(c-1)/(A-1):0;for(let X=0;X1?R*(p-1)+X*j:.5*(R+z)*(p-1);if(G<0||G>p-1){for(let ee=0;ee1?$*(c-1)+ne*U:.5*($+P)*(c-1);if(ie<0||ie>c-1){for(let ye=0;ye1?$*(c-1)+ee*U:.5*($+P)*(c-1);if(Y<0||Y>c-1){for(let ie=0;iey+m-g-1:(y,g)=>y+g;for(let y=0;y`Only NHWC dataFormat supported on CPU for depthToSpace. Got ${i}`),k.assert(s>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${s}`);let o=r.shape[0],l=r.shape[1],d=r.shape[2],u=r.shape[3],p=l*s,c=d*s,h=u/(s*s),m=n.data.get(r.dataId).values,f=new Float32Array(o*p*c*h),A=0;for(let y=0;y`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${c}'`);let h=C.computeConv2DInfo(r.shape,s.shape,i,c,o,d,!0),{filterHeight:m,filterWidth:f,dilationHeight:A,dilationWidth:y,padInfo:g}=h,x=g.left,w=g.top,b=h.outChannels/h.inChannels,v=new Dt(h.outShape,r.dtype),N=n.data.get(r.dataId).values,T=n.data.get(s.dataId).values,R=v.values;for(let $=0;$=h.inHeight)continue;let ee=X*p[0],Y=z+G*u[1];for(let re=0;re=h.inWidth)continue;let oe=ee+Q*p[1],ye=Y+de*h.inChannels,ce=ne,Ie=oe;for(let Ne=0;Ne{let{x:a,filter:r}=e,{strides:s,pad:i,dilations:o}=n,l=t,d=l.data.get(a.dataId).values,u=a.shape.length,p=l.data.get(r.dataId).values,c=r.shape.length,{batchSize:h,inHeight:m,inWidth:f,inChannels:A,outHeight:y,outWidth:g,padInfo:x,strideHeight:w,strideWidth:b,filterHeight:v,filterWidth:N,dilationHeight:T,dilationWidth:R,outShape:$}=C.computeDilation2DInfo(a.shape,r.shape,s,i,"NHWC",o),z=k.sizeFromShape($),P=$.length,V=k.getArrayFromDType(a.dtype,z);for(let j=0;j=0&&Q=0&&oere&&(re=Ie)}}}let ne=k.locToIndex([j,U,G,Y],P,k.computeStrides($));V[ne]=re}}}return{dataId:l.write(k.toTypedArray(V,a.dtype),$,a.dtype),shape:$,dtype:a.dtype}}},fO={kernelName:Bp,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{let{x:a,filter:r,dy:s}=e,{strides:i,pad:o,dilations:l}=n,d=t,u=k.toNestedArray(a.shape,d.data.get(a.dataId).values),p=k.toNestedArray(r.shape,d.data.get(r.dataId).values),{batchSize:c,inHeight:h,inWidth:m,inChannels:f,outHeight:A,outWidth:y,padInfo:g,strideHeight:x,strideWidth:w,filterHeight:b,filterWidth:v,dilationHeight:N,dilationWidth:T,outShape:R}=C.computeDilation2DInfo(a.shape,r.shape,i,o,"NHWC",l);k.assert(s.rank===R.length,()=>`Error in ${Bp}, dy must have the same rank as output ${R.length}, but got ${s.rank}`);let $=k.toNestedArray(R,d.data.get(s.dataId).values),z=k.makeZerosNestedTypedArray(r.shape,r.dtype);for(let P=0;P=0&&ie=0&&deee&&(ee=oe,Y=ne,re=Q)}}}z[Y][re][G]+=$[P][V][U][G]}}}return{dataId:d.write(k.toTypedArray(z,a.dtype),r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}},mO={kernelName:Wp,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{let{x:a,filter:r,dy:s}=e,{strides:i,pad:o,dilations:l}=n,d=t,u=k.toNestedArray(a.shape,d.data.get(a.dataId).values),p=k.toNestedArray(r.shape,d.data.get(r.dataId).values),{batchSize:c,inHeight:h,inWidth:m,inChannels:f,outHeight:A,outWidth:y,padInfo:g,strideHeight:x,strideWidth:w,filterHeight:b,filterWidth:v,dilationHeight:N,dilationWidth:T,outShape:R}=C.computeDilation2DInfo(a.shape,r.shape,i,o,"NHWC",l);k.assert(s.rank===R.length,()=>`Error in ${Wp}, dy must have the same rank as output ${R.length}, but got ${s.rank}`);let $=k.toNestedArray(R,d.data.get(s.dataId).values),z=k.makeZerosNestedTypedArray(a.shape,a.dtype);for(let P=0;P=0&&ie=0&&deee&&(ee=oe,Y=ie,re=de)}}}z[P][Y][re][G]+=$[P][V][U][G]}}}return{dataId:d.write(k.toTypedArray(z,a.dtype),a.shape,a.dtype),shape:a.shape,dtype:a.dtype}}};function ld(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a;ve(r,"sum");let o;r.dtype==="bool"?o=Pr({inputs:{x:r},backend:n,attrs:{dtype:"int32"}}):o=Ba({inputs:{x:r},backend:n});let l=o.shape.length,d=k.parseAxisParam(s,o.shape),u=C.getAxesPermutation(d,l),p=d,c=o;u!=null&&(c=Kn({inputs:{x:o},backend:n,attrs:{perm:u}}),p=C.getInnerMostAxes(p.length,l)),C.assertAxesAreInnerMostDims("sum",p,c.shape.length);let[h,m]=C.computeOutAndReduceShapes(c.shape,p),f=C.upcastType(c.dtype,"int32"),A=sh(n,h,f),y=k.sizeFromShape(m),g=n.data.get(A.dataId).values,x=n.data.get(c.dataId).values;for(let w=0;w=0&&(c=ld({inputs:{x:c},backend:n,attrs:{axis:d[f]-(i.length-h),keepDims:!1}}),m.push(c)),h--)}for(let f of m)f!==c&&n.disposeIntermediateTensorInfo(f);return c}var gO={kernelName:Vp,backendName:"cpu",kernelFunc:yO};function xO(e){let{inputs:t,backend:n}=e,{dy:a,y:r}=t;ve([a,r],"eluGrad");let s=new Float32Array(k.sizeFromShape(r.shape)),i=n.data.get(r.dataId).values,o=n.data.get(a.dataId).values;for(let l=0;l=1?s[l]=o[l]:s[l]=o[l]*(d+1)}return n.makeTensorInfo(r.shape,"float32",s)}var bO={kernelName:jp,backendName:"cpu",kernelFunc:xO},vO=Rt((e,t)=>e===t?1:0),p7=Ut(yo,vO,null,"bool"),wO={kernelName:yo,backendName:"cpu",kernelFunc:p7},kO=C.ERF_P,IO=C.ERF_A1,SO=C.ERF_A2,NO=C.ERF_A3,TO=C.ERF_A4,EO=C.ERF_A5,CO=nt(Ao,e=>{let t=Math.sign(e),n=Math.abs(e),a=1/(1+kO*n);return t*(1-((((EO*a+TO)*a+NO)*a+SO)*a+IO)*a*Math.exp(-n*n))}),RO={kernelName:Ao,backendName:"cpu",kernelFunc:CO};function oh(e){let{inputs:t,backend:n,attrs:a}=e,{input:r}=t,{dim:s}=a,i=r.shape.length,o=r.shape.slice(),l=s;return s<0&&(k.assert(-(i+1)<=s,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+s+1),o.splice(l,0,1),ct({inputs:{x:r},backend:n,attrs:{shape:o}})}var MO={kernelName:go,backendName:"cpu",kernelFunc:oh},FO=Rt((e,t)=>e/t),e1=Ut(gs,FO),t1={kernelName:gs,backendName:"cpu",kernelFunc:e1};function c7(e,t,n){let a=e.shape,r=a[0],s=a[1],i=n.data.get(e.dataId),o=i.complexTensorInfos.real,l=i.complexTensorInfos.imag,d=[r,s],u=k.sizeFromShape(d),p=k.getTypedArrayFromDType("float32",u),c=k.getTypedArrayFromDType("float32",u);for(let A=0;A{let{image:a}=e,r=n,s=k.getTypedArrayFromDType(a.dtype,k.sizeFromShape(a.shape)),[i,o,l,d]=a.shape,u=r.data.get(a.dataId).values;for(let p=0;p=0&&xMath.floor(e/t)),VO=Ut(vs,BO,null,"int32"),jO={kernelName:vs,backendName:"cpu",kernelFunc:VO};function UO(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dataFormat:u,dilations:p,dimRoundingMode:c,activation:h,leakyreluAlpha:m}=a,f=u7({inputs:{x:r,filter:s},backend:n,attrs:{strides:l,pad:d,dataFormat:u,dilations:p,dimRoundingMode:c}});if(i){let A=f;f=od({inputs:{a:f,b:i},backend:n}),n.disposeIntermediateTensorInfo(A)}if(h){let A=f;f=JA(n,f,h,o,m),n.disposeIntermediateTensorInfo(A)}return f}var HO={kernelName:ni,backendName:"cpu",kernelFunc:UO};function GO(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dataFormat:u,dilations:p,dimRoundingMode:c,activation:h,leakyreluAlpha:m}=a,f=d7({inputs:{x:r,filter:s},backend:n,attrs:{strides:l,pad:d,dataFormat:u,dilations:p,dimRoundingMode:c}});if(i){let A=f;f=od({inputs:{a:f,b:i},backend:n}),n.disposeIntermediateTensorInfo(A)}if(h){let A=f;f=JA(n,f,h,o,m),n.disposeIntermediateTensorInfo(A)}return f}var qO={kernelName:ai,backendName:"cpu",kernelFunc:GO};function XO(e){let{inputs:t,backend:n}=e,{params:a,indices:r}=t,s=k.sizeFromShape(a.shape),i=r.shape,o=i[i.length-1],[l,d,u,p]=C.prepareAndValidate(a,r);if(d===0)return n.makeTensorInfo(l,a.dtype,[]);let c=We([d,u],a.dtype),h=n.data.get(r.dataId).values,m=n.data.get(a.dataId).values;for(let f=0;f=s/u)throw new Error(`Invalid indices: ${A} does not index into ${a.shape}`);for(let g=0;ge>=t?1:0),QO=Ut(ks,JO,null,"bool"),ez={kernelName:ks,backendName:"cpu",kernelFunc:QO};function tz(e){let{inputs:t,backend:n}=e,{input:a}=t,r=k.sizeFromShape(a.shape),s=a.shape[a.shape.length-1],i=r/s,o=ct({inputs:{x:a},backend:n,attrs:{shape:[i,s]}}),l=c7(o,!0,n),d=ct({inputs:{x:l},backend:n,attrs:{shape:a.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(l),d}var nz={kernelName:Hp,backendName:"cpu",kernelFunc:tz},az=nt(Io,e=>Number.isFinite(e)?1:0,"bool"),rz={kernelName:Io,backendName:"cpu",kernelFunc:az},sz=nt(So,e=>Math.abs(e)===Infinity?1:0,"bool"),iz={kernelName:So,backendName:"cpu",kernelFunc:sz},oz=nt(No,e=>Number.isNaN(e)?1:0,"bool"),lz={kernelName:No,backendName:"cpu",kernelFunc:oz},uz=Rt((e,t)=>e<=t?1:0),dz=Ut(Eo,uz,null,"bool"),pz={kernelName:Eo,backendName:"cpu",kernelFunc:dz};function cz(e){let{backend:t,attrs:n}=e,{start:a,stop:r,num:s}=n,i=O3(a,r,s);return t.makeTensorInfo([i.length],"float32",i)}var hz={kernelName:qp,backendName:"cpu",kernelFunc:cz},fz=nt(Co,e=>Math.log1p(e)),mz={kernelName:Co,backendName:"cpu",kernelFunc:fz},Az=Rt((e,t)=>e&&t),yz=Ut(Ro,Az,null,"bool"),gz={kernelName:Ro,backendName:"cpu",kernelFunc:yz},xz=nt(Iu,e=>e?0:1,"bool"),bz={kernelName:Iu,backendName:"cpu",kernelFunc:xz},vz=Rt((e,t)=>e||t),wz=Ut(Su,vz,null,"bool"),kz={kernelName:Su,backendName:"cpu",kernelFunc:wz};function Iz(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{depthRadius:s,bias:i,alpha:o,beta:l}=a;ve(r,"LRN");let d=r.shape[3],u=d-1,p=n.data.get(r.dataId).values,c=k.sizeFromShape(r.shape),h=new Float32Array(c);function m(f){let A=f%d,y=f-A+Math.max(0,A-s),g=f-A+Math.min(A+s,u),x=0;for(;y<=g;y++){let w=p[y];x+=w*w}return x}for(let f=0;f`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);let u=C.computePool2DInfo(r.shape,s,i,d,o,l),p;if(u.filterWidth===1&&u.filterHeight===1&&k.arraysEqual(u.inShape,u.outShape))p=Ba({inputs:{x:r},backend:n});else{let c=n.data.get(r.dataId).values,h=k.computeStrides(r.shape),m=QA(c,r.shape,r.dtype,h,u,"max");p=n.makeTensorInfo(u.outShape,r.dtype,m.values)}return p}var Rz={kernelName:Cs,backendName:"cpu",kernelFunc:Cz};function Mz(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:d}=a;ve(r,"maxPool3d");let u=C.computePool3DInfo(r.shape,s,i,1,o,l,d),p=n.data.get(r.dataId).values,c=l7(p,r.shape,r.dtype,k.computeStrides(r.shape),u,"max");return n.makeTensorInfo(c.shape,"float32",c.values)}var Fz={kernelName:Tu,backendName:"cpu",kernelFunc:Mz};function $z(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,{filterSize:i,strides:o,pad:l,dimRoundingMode:d}=a;ve([r,s],"maxPool3DGrad");let u=C.computePool3DInfo(s.shape,i,o,1,l,d),p=n.bufferSync(s),c=AD(p,u),h=u.strideDepth,m=u.strideHeight,f=u.strideWidth,A=u.dilationDepth,y=u.dilationHeight,g=u.dilationWidth,x=u.effectiveFilterDepth,w=u.effectiveFilterHeight,b=u.effectiveFilterWidth,v=x-1-u.padInfo.front,N=b-1-u.padInfo.left,T=w-1-u.padInfo.top,R=We(s.shape,"float32"),$=n.bufferSync(r);for(let z=0;z=u.outDepth||Math.floor(ne)!==ne))for(let ie=0;ie=u.outHeight||Math.floor(Q)!==Q))for(let de=0;de=u.outWidth||Math.floor(oe)!==oe)continue;let ye=x*w*b-1-c.get(z,ne,Q,oe,P),ce=re*w*b+ie*b+de,Ie=ye===ce?1:0;Ie!==0&&(Y+=$.get(z,ne,Q,oe,P)*Ie)}}}R.set(Y,z,V,j,U,P)}return n.makeTensorInfo(R.shape,R.dtype,R.values)}var Dz={kernelName:Zp,backendName:"cpu",kernelFunc:$z};function Oz(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s,output:i}=t,o=s;ve([s,i],"maxPoolGrad");let{filterSize:l,strides:d,pad:u,dimRoundingMode:p}=a,c=C.computePool2DInfo(o.shape,l,d,1,u,p),h=n.data.get(o.dataId).values,m=We(c.outShape,o.dtype,o7(h,o.shape,o.dtype,c).values),f=c.strideHeight,A=c.strideWidth,y=c.dilationHeight,g=c.dilationWidth,x=c.effectiveFilterHeight,w=c.effectiveFilterWidth,b=w-1-c.padInfo.left,v=x-1-c.padInfo.top,N=We(o.shape,"float32"),T=n.data.get(r.dataId).values,R=We(r.shape,"float32",T);for(let $=0;$=c.outHeight||Math.floor(ee)!==ee))for(let Y=0;Y=c.outWidth||Math.floor(re)!==re)continue;let ne=x*w-1-m.get($,ee,re,z),ie=G*w+Y,Q=ne===ie?1:0;Q!==0&&(X+=R.get($,ee,re,z)*Q)}}N.set(X,$,P,V,z)}return n.makeTensorInfo(N.shape,N.dtype,N.values)}var zz={kernelName:Kp,backendName:"cpu",kernelFunc:Oz};function _z(e,t,n,a,r){let s=k.computeStrides(t),i=QA(e,t,n,s,r,"max"),o=o7(e,t,n,r,!0,a);return[i.values,o.values]}var Pz={kernelName:Yp,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:a}=e,{filterSize:r,strides:s,pad:i,includeBatchInIndex:o}=t,l=n;ve(a,"MaxPoolWithArgmax");let d=l.data.get(a.dataId).values,u=C.computePool2DInfo(a.shape,r,s,[1,1],i),[p,c]=_z(d,a.shape,a.dtype,o,u),h=l.write(p,u.outShape,a.dtype),m=l.write(c,u.outShape,a.dtype);return[{dataId:h,shape:u.outShape,dtype:a.dtype},{dataId:m,shape:u.outShape,dtype:"int32"}]}};function Lz(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=k.parseAxisParam(s,r.shape),l=C.computeOutAndReduceShapes(r.shape,o)[1],d=k.sizeFromShape(l),u=[],p=n.makeTensorInfo([],"float32",new Float32Array([d]));u.push(p);let c=Pr({inputs:{x:r},backend:n,attrs:{dtype:"float32"}});u.push(c);let h=e1({inputs:{a:c,b:p},backend:n});u.push(h);let m=ld({inputs:{x:h},backend:n,attrs:{axis:s,keepDims:i}});return u.forEach(f=>n.disposeIntermediateTensorInfo(f)),m}var Wz={kernelName:Rs,backendName:"cpu",kernelFunc:Lz};function Bz(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a;ve(r,"min");let o=k.parseAxisParam(s,r.shape),l=o,d=C.getAxesPermutation(l,r.shape.length),u=r;d!=null&&(u=Kn({inputs:{x:r},backend:n,attrs:{perm:d}}),l=C.getInnerMostAxes(l.length,r.shape.length)),C.assertAxesAreInnerMostDims("min",l,u.shape.length);let[p,c]=C.computeOutAndReduceShapes(u.shape,l),h=k.sizeFromShape(c),m=k.makeZerosTypedArray(k.sizeFromShape(p),u.dtype),f=n.data.get(u.dataId).values;for(let y=0;yg[0]+r.shape[x]+g[1]),l=s.map(g=>g[0]),d=s.map((g,x)=>g[0]+r.shape[x]),u=i==="reflect"?0:1,p=n.data.get(r.dataId).values,c=r.shape.length,h=k.computeStrides(r.shape),m=k.sizeFromShape(o),f=o.length,A=k.computeStrides(o),y=k.getTypedArrayFromDType(r.dtype,m);for(let g=0;g=d[b]&&(x[b]=(d[b]-1)*2-x[b]+u);x=x.map((b,v)=>b-l[v]);let w=k.locToIndex(x,c,h);y[g]=p[w]}return{dataId:n.write(y,o,r.dtype),shape:o,dtype:r.dtype}}var Uz={kernelName:$s,backendName:"cpu",kernelFunc:jz},Hz=Rt((e,t)=>{let n=e%t;return e<0&&t<0||e>=0&&t>=0?n:(n+t)%t}),Gz=Ut(Mo,Hz),qz={kernelName:Mo,backendName:"cpu",kernelFunc:Gz},Xz=Yi(Vg());function f7(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{dim:s}=a,i=r.shape.length,o=s;if(o===-1&&(o=i-1),o!==i-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${i} and dim was ${o}`);let l=k.parseAxisParam([o],r.shape),d=h7({inputs:{x:r},backend:n,attrs:{reductionIndices:l,keepDims:!1}}),u=C.expandShapeToKeepDim(d.shape,l),p=ct({inputs:{x:d},backend:n,attrs:{shape:u}}),c=YA({inputs:{a:r,b:p},backend:n}),h=J3({inputs:{x:c},backend:n}),m=ld({inputs:{x:h},backend:n,attrs:{axis:l,keepDims:!1}}),f=ct({inputs:{x:m},backend:n,attrs:{shape:u}}),A=e1({inputs:{a:h,b:f},backend:n});return n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(f),A}var Kz={kernelName:Ks,backendName:"cpu",kernelFunc:f7};function Zz(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{numSamples:s,seed:i,normalized:o}=a;ve(r,"multinomial");let l=o?r:f7({inputs:{logits:r},backend:n,attrs:{dim:-1}}),d=l.shape[0],u=l.shape[1],p=n.data.get(l.dataId).values,c=[d,s],h=k.makeZerosTypedArray(k.sizeFromShape(c),"int32");for(let m=0;m=0&&u[p]{k.assertShapesMatch(s,u.shape,"All tensors passed to stack must have matching shapes"),k.assert(i===u.dtype,()=>"All tensors passed to stack must have matching dtypes")});let o=[],l=t.map(u=>{let p=oh({inputs:{input:u},backend:n,attrs:{dim:r}});return o.push(p),p}),d=El({inputs:l,backend:n,attrs:{axis:r}});return o.forEach(u=>n.disposeIntermediateTensorInfo(u)),d}var p_={kernelName:Po,backendName:"cpu",kernelFunc:A7};function c_(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{paddings:s,constantValue:i}=a;ve(r,"pad");let o=s.map((y,g)=>y[0]+r.shape[g]+y[1]),l=s.map(y=>y[0]),d=n.data.get(r.dataId).values,u=k.sizeFromShape(r.shape),p=r.shape.length,c=k.computeStrides(r.shape),h=k.sizeFromShape(o),m=o.length,f=k.computeStrides(o),A=k.getTypedArrayFromDType(r.dtype,h);i!==0&&A.fill(i);for(let y=0;yw+l[b]),x=k.locToIndex(g,m,f);A[x]=d[y]}return{dataId:n.write(A,o,r.dtype),shape:o,dtype:r.dtype}}var y7={kernelName:zs,backendName:"cpu",kernelFunc:c_},h_=Rt((e,t)=>Math.pow(e,t)),f_=Ut(_s,h_),m_={kernelName:_s,backendName:"cpu",kernelFunc:f_};function A_(e){let{backend:t,attrs:n}=e,{start:a,stop:r,dtype:s,step:i}=n,o=KA(a,r,i,s);return t.makeTensorInfo([o.length],s,o)}var y_={kernelName:Eu,backendName:"cpu",kernelFunc:A_},g_=nt(Wo,e=>1/e),x_={kernelName:Wo,backendName:"cpu",kernelFunc:g_};function b_(e){let{inputs:t,backend:n,attrs:a}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:i,size:o}=a;ve(r,"resizeBilinear");let l=k.computeStrides(r.shape),[d,u]=o,[p,c,h,m]=r.shape,f=n.data.get(r.dataId).values,A=new Float32Array(k.sizeFromShape([p,d,u,m])),y=[s&&d>1?c-1:c,s&&u>1?h-1:h],g=[s&&d>1?d-1:d,s&&u>1?u-1:u],x=0,w=y[0]/g[0],b=y[1]/g[1];for(let v=0;v1?d-1:d,i&&h>1?u-1:u],A=[i&&c>1?c-1:c,i&&h>1?h-1:h],y=f[0]/A[0],g=f[1]/A[1],x=n.data.get(s.dataId).values,w=0;for(let b=0;b1?c-1:c,s&&u>1?h-1:h],g=[s&&d>1?d-1:d,s&&u>1?u-1:u],x=y[0]/g[0],w=y[1]/g[1],b=0;for(let v=0;v1?u-1:u,i&&m>1?p-1:p],g=[i&&h>1?h-1:h,i&&m>1?m-1:m],x=y[0]/g[0],w=y[1]/g[1],b=1/x,v=1/w,N=Math.ceil(b)*2+2,T=Math.ceil(v)*2+2;for(let R=0;R=h)continue;let Q=$+ie*l[1],de=ie*x,oe=Math.min(u-1,i?Math.round(de):Math.floor(de));if(z===oe)for(let ye=0;ye=m)continue;let Ie=Q+ce*l[2],Ne=ce*w,$e=Math.min(p-1,i?Math.round(Ne):Math.floor(Ne));U===$e&&(re+=A[Ie+Y])}}f[X+Y]=re}}}}return n.makeTensorInfo(r.shape,r.dtype,f)}var T_={kernelName:ec,backendName:"cpu",kernelFunc:N_};function E_(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dims:s}=a;ve(r,"reverse");let i=r.shape.length,o=k.parseAxisParam(s,r.shape);if(i===0)return Ba({inputs:{x:r},backend:n});let l=new Dt(r.shape,r.dtype),d=n.bufferSync(r);for(let u=0;uc[h]=r.shape[h]-1-c[h]),l.set(d.get(...c),...p)}return n.makeTensorInfo(l.shape,l.dtype,l.values)}var C_={kernelName:Vs,backendName:"cpu",kernelFunc:E_},R_={kernelName:tl,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{image:a}=e,{radians:r,fillValue:s,center:i}=t,o=n,l=k.getTypedArrayFromDType(a.dtype,k.sizeFromShape(a.shape)),[d,u,p,c]=a.shape,[h,m]=C.getImageCenter(i,u,p),f=255,A=Math.sin(r),y=Math.cos(r),g=o.data.get(a.dataId).values;for(let x=0;x=0&&V=0&&j{let t=Math.floor(e);return e-t<.5?Math.floor(e):e-t>.5?Math.ceil(e):t%2==0?t:t+1}),F_={kernelName:js,backendName:"cpu",kernelFunc:M_};function g7(e,t,n,a,r,s,i,o,l,d){let u=[a/r,r],p=e.values,c=t.values;if(a===0)return We(n,t.dtype);let h=We(u,t.dtype);h.values.fill(l);for(let m=0;m=a/r)throw new Error(`Invalid indices: ${f} does not index into ${n}`);for(let y=0;y1||r.shape.length===1?1:k.sizeFromShape(r.shape.slice(1));for(let m=0;me>=0?P_*e:__*(Math.exp(e)-1)),W_={kernelName:Uo,backendName:"cpu",kernelFunc:L_},B_=nt(qo,e=>e<0?-1:e>0?1:0),V_={kernelName:qo,backendName:"cpu",kernelFunc:B_},j_=nt(Hs,e=>Math.sin(e)),U_={kernelName:Hs,backendName:"cpu",kernelFunc:j_},H_=nt(Go,e=>Math.sinh(e)),G_={kernelName:Go,backendName:"cpu",kernelFunc:H_},q_=11920928955078125e-23,x7=Math.log(q_)+2,X_=nt(Xo,e=>{let t=e>-x7,n=eNumber(A)))),n.makeTensorInfo([f.length],a.dtype,new Int32Array(f))]}var J_={kernelName:tc,backendName:"cpu",kernelFunc:Y_};function Q_(e){let{inputs:t,backend:n}=e,{inputIndices:a,inputShape:r,newShape:s}=t;if(a.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape + ${i.shape}`);let o=n.data.get(a.dataId).values,l=n.data.get(r.dataId).values,d=n.data.get(s.dataId).values,u=n.data.get(i.dataId).values[0],[p,c,h,m,f]=U3(o,a.shape,a.dtype,l,r.dtype,d,u);return[n.makeTensorInfo(c,a.dtype,p),n.makeTensorInfo([c[0]],r.dtype,h),n.makeTensorInfo([m.length],"bool",new Uint8Array(m.map(A=>Number(A)))),n.makeTensorInfo([f.length],a.dtype,new Int32Array(f))]}var Q_={kernelName:nc,backendName:"cpu",kernelFunc:J_};function eP(e){let{inputs:t,backend:n}=e,{inputIndices:a,inputShape:r,newShape:s}=t;if(a.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape ${a.shape}`);if(r.shape.length!==1)throw new Error(`Input shape should be a vector but received shape - ${r.shape}`);if(s.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${s.shape}`);let i=Array.from(n.data.get(r.dataId).values),o=n.data.get(a.dataId).values,l=Array.from(n.data.get(s.dataId).values),[d,u,p]=U3(o,a.shape,a.dtype,i,l);return[n.makeTensorInfo(u,a.dtype,d),n.makeTensorInfo([p.length],s.dtype,new Int32Array(p))]}var eP={kernelName:nc,backendName:"cpu",kernelFunc:Q_};function tP(e){let{inputs:t,backend:n,attrs:a}=e,{sparseIndices:r,sparseValues:s,defaultValue:i}=t,{outputShape:o}=a,{sliceRank:l,numUpdates:d,sliceSize:u,strides:p,outputSize:c}=C.calculateShapes(s,r,o),h=!1,m=n.bufferSync(r),f=n.bufferSync(s),A=n.data.get(i.dataId).values[0],y=y7(m,f,o,c,u,d,l,p,A,h);return n.makeTensorInfo(o,y.dtype,y.values)}var nP={kernelName:ac,backendName:"cpu",kernelFunc:tP};function aP(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{numOrSizeSplits:s,axis:i}=a,o=k.parseAxisParam(i,r.shape)[0],l=C.prepareSplitSize(r,s,o),d=new Array(r.shape.length).fill(0),u=r.shape.slice();return l.map(p=>{let c=[...u];c[o]=p;let h=xi({inputs:{x:r},backend:n,attrs:{begin:d,size:c}});return d[o]+=p,h})}var rP={kernelName:Xo,backendName:"cpu",kernelFunc:aP},sP=nt(Gs,e=>Math.sqrt(e)),iP={kernelName:Gs,backendName:"cpu",kernelFunc:sP},oP={kernelName:Ru,backendName:"cpu",kernelFunc:({inputs:e,backend:t})=>{let{x:n}=e,a=t;ve(n,"square");let r=a.data.get(n.dataId).values,s=new Float32Array(r.length);for(let i=0;i{let n=t;return isNaN(e)?NaN:e>0?1:n.alpha}),uP={kernelName:Sr,backendName:"cpu",kernelFunc:lP};function dP(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,end:i,strides:o,beginMask:l,endMask:d,ellipsisMask:u,newAxisMask:p,shrinkAxisMask:c}=a;ve(r,"stridedSlice");let{nonStrided:h,$begin:m,$strides:f,size:A,newShape:y,outShape:g}=on.sliceInfo(r.shape,s,i,o,l,d,u,p,c),x=ct({inputs:{x:r},backend:n,attrs:{shape:y}}),w;if(h){let v=xi({inputs:{x},backend:n,attrs:{begin:m,size:A}});w=ct({inputs:{x:v},backend:n,attrs:{shape:g}}),n.disposeIntermediateTensorInfo(v)}else if(g.some(v=>v===0))w=n.makeTensorInfo(g,r.dtype,[]);else{let v=n.bufferSync(x),N=G3(g,v,f,m);w=n.makeTensorInfo(N.shape,N.dtype,N.values)}let b=ct({inputs:{x:w},backend:n,attrs:{shape:g}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(w),b}var pP={kernelName:Ko,backendName:"cpu",kernelFunc:dP},cP=nt(Ys,e=>Math.tan(e)),hP={kernelName:Ys,backendName:"cpu",kernelFunc:cP},fP=nt(Js,e=>Math.tanh(e)),mP={kernelName:Js,backendName:"cpu",kernelFunc:fP};function AP(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{reps:s}=a;ve(r,"tile");let i=X3(n.bufferSync(r),s);return n.makeTensorInfo(i.shape,i.dtype,i.values)}var yP={kernelName:Ir,backendName:"cpu",kernelFunc:AP};function gP(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{k:s,sorted:i}=a;ve(r,"topk");let o=n.data.get(r.dataId).values,[l,d]=K3(o,r.shape,r.dtype,s,i);return[n.makeTensorInfo(l.shape,l.dtype,l.values),n.makeTensorInfo(d.shape,d.dtype,d.values)]}var xP={kernelName:Zo,backendName:"cpu",kernelFunc:gP};function wP(e){let{inputs:t,attrs:n,backend:a}=e,{image:r,transforms:s}=t,{interpolation:i,fillMode:o,fillValue:l,outputShape:d}=n,[u,p,c,h]=r.shape,[m,f]=d!=null?d:[p,c],A=[u,m,f,h],y=k.computeStrides(r.shape),g=y[0],x=y[1],w=y[2],b=k.getTypedArrayFromDType(r.dtype,k.sizeFromShape(A));b.fill(l);let v=a.data.get(r.dataId).values,N=a.data.get(s.dataId).values;for(let T=0;Tt-1)if(t<=1)n=0;else{let a=2*t;n-=a*Math.trunc(n/a),n>=t&&(n=a-n-1)}return k.clamp(0,n,t-1)}function SP(e,t){let n=e;if(n<0)if(t<=1)n=0;else{let a=t-1;n+=t*(Math.trunc(-n/a)+1)}else if(n>t-1)if(t<=1)n=0;else{let a=t-1;n-=t*Math.trunc(n/a)}return k.clamp(0,n,t-1)}function NP(e,t){return e}function TP(e,t){return k.clamp(0,e,t-1)}function ld(e,t,n,a,r,s,i,o,l,d,u){let p=i*a+o*r+l*s+d;return 0<=o&&on.disposeIntermediateTensorInfo(m)),h}var $P={kernelName:Mu,backendName:"cpu",kernelFunc:FP},DP=[j$,qF,H$,q$,QF,K$,Y$,Q$,tD,aD,sD,oD,uD,cD,fD,yD,xD,vD,kD,B$,SD,TD,CD,YF,t$,MD,XF,$D,OD,PD,WD,zD,UD,GD,VD,XD,ZD,JD,eO,nO,rO,sO,oO,uO,pO,cO,fO,hO,e1,yO,$$,xO,vO,CO,n$,RO,r$,zO,PO,LO,i$,VO,UO,GO,XO,ZO,l$,QO,KF,tz,DD,az,sz,oz,D$,d$,dz,cz,c$,fz,yz,xz,wz,Iz,Nz,f$,Cz,Mz,$z,Oz,_z,Tz,Lz,Bz,A$,jz,Gz,Zz,g$,b$,Qz,n_,s_,w$,o_,u_,d_,A7,f_,z$,S$,A_,ZF,g_,_$,P$,W$,b_,w_,I_,N_,E_,C_,M_,T$,$_,O_,L_,L$,B_,j_,H_,E$,Xz,X_,Z_,J_,eP,nP,rP,iP,oP,R$,uP,pP,F$,mO,hP,mP,yP,xP,k$,kP,CP,MP,$P,l_];for(let e of DP)ai(e);var b7={};Fe(b7,{assertNotComplex:()=>El,bindCanvasToFramebuffer:()=>_P,bindColorTextureToFramebuffer:()=>uh,bindTextureToProgramUniformSampler:()=>O7,bindTextureUnit:()=>F7,bindVertexBufferToProgramAttribute:()=>a1,callAndCheck:()=>xe,canBeRepresented:()=>v7,createFragmentShader:()=>I7,createFramebuffer:()=>M7,createProgram:()=>S7,createStaticIndexBuffer:()=>E7,createStaticVertexBuffer:()=>T7,createTexture:()=>C7,createVertexShader:()=>k7,getBatchDim:()=>bi,getExtensionOrThrow:()=>ud,getFramebufferErrorMessage:()=>z7,getMaxTexturesInShader:()=>L7,getNumChannels:()=>OP,getProgramUniformLocation:()=>D7,getProgramUniformLocationOrThrow:()=>$7,getRowsCols:()=>vi,getShapeAs3D:()=>dh,getTextureShapeFromLogicalShape:()=>_7,getWebGLDisjointQueryTimerVersion:()=>W7,getWebGLErrorMessage:()=>w7,getWebGLMaxTextureSize:()=>P7,hasExtension:()=>Zn,isCapableOfRenderingToFloatTexture:()=>B7,isDownloadFloatTextureEnabled:()=>V7,isReshapeFree:()=>pd,isWebGLFenceEnabled:()=>j7,isWebGLVersionEnabled:()=>s1,linkProgram:()=>N7,resetMaxTextureSize:()=>PP,resetMaxTexturesInShader:()=>LP,unbindColorTextureFromFramebuffer:()=>r1,unbindTextureUnit:()=>zP,validateFramebuffer:()=>dd,validateProgram:()=>lh,validateTextureSize:()=>R7});var wi={},i1={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function ph(e,t){wi[e]=t}function Ba(e){if(!(e in wi)){let n=WP(e);if(n!==null)wi[e]=n;else return console.log("Could not get context for WebGL version",e),null}let t=wi[e];return t.isContextLost()?(delete wi[e],Ba(e)):(t.disable(t.DEPTH_TEST),t.disable(t.STENCIL_TEST),t.disable(t.BLEND),t.disable(t.DITHER),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SAMPLE_COVERAGE),t.enable(t.SCISSOR_TEST),t.enable(t.CULL_FACE),t.cullFace(t.BACK),wi[e])}function BP(e){if(typeof OffscreenCanvas!="undefined"&&e===2)return new OffscreenCanvas(300,150);if(typeof document!="undefined")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}function WP(e){if(e!==1&&e!==2)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");let t=BP(e);return t.addEventListener("webglcontextlost",n=>{n.preventDefault(),delete wi[e]},!1),e===1?t.getContext("webgl",i1)||t.getContext("experimental-webgl",i1):t.getContext("webgl2",i1)}var cd;(function(e){e[e.DENSE=0]="DENSE",e[e.SHARED_BATCH=1]="SHARED_BATCH"})(cd||(cd={}));var Yn;(function(e){e[e.RENDER=0]="RENDER",e[e.UPLOAD=1]="UPLOAD",e[e.PIXELS=2]="PIXELS",e[e.DOWNLOAD=3]="DOWNLOAD"})(Yn||(Yn={}));var Qt;(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"})(Qt||(Qt={}));function hd(e,t){return[t,e]}function VP(e,t){return e*t}function fd(e){let t=k.sizeFromShape(e),n=Math.ceil(t/4);return k.sizeToSquarishShape(n)}function Cl(e,t){return[Math.max(1,Math.ceil(t/2)),Math.max(1,Math.ceil(e/2))]}function jP(e,t){let[n,a]=Cl(e,t);return n*a*4}function o1(e,t){let n=e,a,r,s,i,o,l,d,u,p,c;return J().getNumber("WEBGL_VERSION")===2?(a=n.R32F,r=n.R16F,s=n.RGBA16F,i=n.RGBA32F,o=n.RED,d=4,u=1,p=n.HALF_FLOAT,c=n.FLOAT):(a=e.RGBA,r=e.RGBA,s=e.RGBA,i=n.RGBA,o=e.RGBA,d=4,u=4,p=t!=null?t.HALF_FLOAT_OES:null,c=e.FLOAT),l=e.RGBA,{internalFormatFloat:a,internalFormatHalfFloat:r,internalFormatPackedHalfFloat:s,internalFormatPackedFloat:i,textureFormatFloat:o,downloadTextureFormat:l,downloadUnpackNumChannels:d,defaultNumChannels:u,textureTypeHalfFloat:p,textureTypeFloat:c}}function xe(e,t){let n=t();return J().getBool("DEBUG")&&UP(e),n}function UP(e){let t=e.getError();if(t!==e.NO_ERROR)throw new Error("WebGL Error: "+w7(e,t))}var HP=596e-10,GP=65504;function v7(e){return!!(J().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||e===0||HPe.getExtension(t),'Extension "'+t+'" not supported on this browser.')}function k7(e,t){let n=or(e,()=>e.createShader(e.VERTEX_SHADER),"Unable to create vertex WebGLShader.");if(xe(e,()=>e.shaderSource(n,t)),xe(e,()=>e.compileShader(n)),e.getShaderParameter(n,e.COMPILE_STATUS)===!1)throw console.log(e.getShaderInfoLog(n)),new Error("Failed to compile vertex shader.");return n}function I7(e,t){let n=or(e,()=>e.createShader(e.FRAGMENT_SHADER),"Unable to create fragment WebGLShader.");if(xe(e,()=>e.shaderSource(n,t)),xe(e,()=>e.compileShader(n)),e.getShaderParameter(n,e.COMPILE_STATUS)===!1)throw qP(t,e.getShaderInfoLog(n)),new Error("Failed to compile fragment shader.");return n}var XP=/ERROR: [0-9]+:([0-9]+):/g;function qP(e,t){let n=XP.exec(t);if(n==null){console.log(`Couldn't parse line number in error: ${t}`),console.log(e);return}let a=+n[1],r=e.split(` + ${r.shape}`);if(s.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${s.shape}`);let i=Array.from(n.data.get(r.dataId).values),o=n.data.get(a.dataId).values,l=Array.from(n.data.get(s.dataId).values),[d,u,p]=H3(o,a.shape,a.dtype,i,l);return[n.makeTensorInfo(u,a.dtype,d),n.makeTensorInfo([p.length],s.dtype,new Int32Array(p))]}var tP={kernelName:ac,backendName:"cpu",kernelFunc:eP};function nP(e){let{inputs:t,backend:n,attrs:a}=e,{sparseIndices:r,sparseValues:s,defaultValue:i}=t,{outputShape:o}=a,{sliceRank:l,numUpdates:d,sliceSize:u,strides:p,outputSize:c}=C.calculateShapes(s,r,o),h=!1,m=n.bufferSync(r),f=n.bufferSync(s),A=n.data.get(i.dataId).values[0],y=g7(m,f,o,c,u,d,l,p,A,h);return n.makeTensorInfo(o,y.dtype,y.values)}var aP={kernelName:rc,backendName:"cpu",kernelFunc:nP};function rP(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{numOrSizeSplits:s,axis:i}=a,o=k.parseAxisParam(i,r.shape)[0],l=C.prepareSplitSize(r,s,o),d=new Array(r.shape.length).fill(0),u=r.shape.slice();return l.map(p=>{let c=[...u];c[o]=p;let h=bi({inputs:{x:r},backend:n,attrs:{begin:d,size:c}});return d[o]+=p,h})}var sP={kernelName:Ko,backendName:"cpu",kernelFunc:rP},iP=nt(qs,e=>Math.sqrt(e)),oP={kernelName:qs,backendName:"cpu",kernelFunc:iP},lP={kernelName:Mu,backendName:"cpu",kernelFunc:({inputs:e,backend:t})=>{let{x:n}=e,a=t;ve(n,"square");let r=a.data.get(n.dataId).values,s=new Float32Array(r.length);for(let i=0;i{let n=t;return isNaN(e)?NaN:e>0?1:n.alpha}),dP={kernelName:Nr,backendName:"cpu",kernelFunc:uP};function pP(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,end:i,strides:o,beginMask:l,endMask:d,ellipsisMask:u,newAxisMask:p,shrinkAxisMask:c}=a;ve(r,"stridedSlice");let{nonStrided:h,$begin:m,$strides:f,size:A,newShape:y,outShape:g}=on.sliceInfo(r.shape,s,i,o,l,d,u,p,c),x=ct({inputs:{x:r},backend:n,attrs:{shape:y}}),w;if(h){let v=bi({inputs:{x},backend:n,attrs:{begin:m,size:A}});w=ct({inputs:{x:v},backend:n,attrs:{shape:g}}),n.disposeIntermediateTensorInfo(v)}else if(g.some(v=>v===0))w=n.makeTensorInfo(g,r.dtype,[]);else{let v=n.bufferSync(x),N=q3(g,v,f,m);w=n.makeTensorInfo(N.shape,N.dtype,N.values)}let b=ct({inputs:{x:w},backend:n,attrs:{shape:g}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(w),b}var cP={kernelName:Zo,backendName:"cpu",kernelFunc:pP},hP=nt(Js,e=>Math.tan(e)),fP={kernelName:Js,backendName:"cpu",kernelFunc:hP},mP=nt(Qs,e=>Math.tanh(e)),AP={kernelName:Qs,backendName:"cpu",kernelFunc:mP};function yP(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{reps:s}=a;ve(r,"tile");let i=K3(n.bufferSync(r),s);return n.makeTensorInfo(i.shape,i.dtype,i.values)}var gP={kernelName:Sr,backendName:"cpu",kernelFunc:yP};function xP(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{k:s,sorted:i}=a;ve(r,"topk");let o=n.data.get(r.dataId).values,[l,d]=Z3(o,r.shape,r.dtype,s,i);return[n.makeTensorInfo(l.shape,l.dtype,l.values),n.makeTensorInfo(d.shape,d.dtype,d.values)]}var bP={kernelName:Yo,backendName:"cpu",kernelFunc:xP};function kP(e){let{inputs:t,attrs:n,backend:a}=e,{image:r,transforms:s}=t,{interpolation:i,fillMode:o,fillValue:l,outputShape:d}=n,[u,p,c,h]=r.shape,[m,f]=d!=null?d:[p,c],A=[u,m,f,h],y=k.computeStrides(r.shape),g=y[0],x=y[1],w=y[2],b=k.getTypedArrayFromDType(r.dtype,k.sizeFromShape(A));b.fill(l);let v=a.data.get(r.dataId).values,N=a.data.get(s.dataId).values;for(let T=0;Tt-1)if(t<=1)n=0;else{let a=2*t;n-=a*Math.trunc(n/a),n>=t&&(n=a-n-1)}return k.clamp(0,n,t-1)}function NP(e,t){let n=e;if(n<0)if(t<=1)n=0;else{let a=t-1;n+=t*(Math.trunc(-n/a)+1)}else if(n>t-1)if(t<=1)n=0;else{let a=t-1;n-=t*Math.trunc(n/a)}return k.clamp(0,n,t-1)}function TP(e,t){return e}function EP(e,t){return k.clamp(0,e,t-1)}function ud(e,t,n,a,r,s,i,o,l,d,u){let p=i*a+o*r+l*s+d;return 0<=o&&on.disposeIntermediateTensorInfo(m)),h}var DP={kernelName:Fu,backendName:"cpu",kernelFunc:$P},OP=[U$,XF,G$,X$,e$,Z$,J$,eD,nD,rD,iD,lD,dD,hD,mD,gD,bD,wD,ID,V$,ND,ED,RD,JF,n$,FD,KF,DD,zD,LD,BD,_D,HD,qD,jD,KD,YD,QD,tO,aO,sO,iO,lO,dO,cO,hO,mO,fO,t1,gO,D$,bO,wO,RO,a$,MO,s$,_O,LO,WO,o$,jO,HO,qO,KO,YO,u$,ez,ZF,nz,OD,rz,iz,lz,O$,p$,pz,hz,h$,mz,gz,bz,kz,Sz,Tz,m$,Rz,Fz,Dz,zz,Pz,Ez,Wz,Vz,y$,Uz,qz,Yz,x$,v$,e_,a_,i_,k$,l_,d_,p_,y7,m_,_$,N$,y_,YF,x_,P$,L$,B$,v_,k_,S_,T_,C_,R_,F_,E$,D_,z_,W_,W$,V_,U_,G_,C$,Kz,K_,Y_,Q_,tP,aP,sP,oP,lP,M$,dP,cP,$$,AO,fP,AP,gP,bP,I$,IP,RP,FP,DP,u_];for(let e of OP)ri(e);var v7={};Fe(v7,{assertNotComplex:()=>Cl,bindCanvasToFramebuffer:()=>PP,bindColorTextureToFramebuffer:()=>dh,bindTextureToProgramUniformSampler:()=>z7,bindTextureUnit:()=>$7,bindVertexBufferToProgramAttribute:()=>r1,callAndCheck:()=>xe,canBeRepresented:()=>w7,createFragmentShader:()=>S7,createFramebuffer:()=>F7,createProgram:()=>N7,createStaticIndexBuffer:()=>C7,createStaticVertexBuffer:()=>E7,createTexture:()=>R7,createVertexShader:()=>I7,getBatchDim:()=>vi,getExtensionOrThrow:()=>dd,getFramebufferErrorMessage:()=>_7,getMaxTexturesInShader:()=>W7,getNumChannels:()=>zP,getProgramUniformLocation:()=>O7,getProgramUniformLocationOrThrow:()=>D7,getRowsCols:()=>wi,getShapeAs3D:()=>ph,getTextureShapeFromLogicalShape:()=>P7,getWebGLDisjointQueryTimerVersion:()=>B7,getWebGLErrorMessage:()=>k7,getWebGLMaxTextureSize:()=>L7,hasExtension:()=>Zn,isCapableOfRenderingToFloatTexture:()=>V7,isDownloadFloatTextureEnabled:()=>j7,isReshapeFree:()=>cd,isWebGLFenceEnabled:()=>U7,isWebGLVersionEnabled:()=>i1,linkProgram:()=>T7,resetMaxTextureSize:()=>LP,resetMaxTexturesInShader:()=>WP,unbindColorTextureFromFramebuffer:()=>s1,unbindTextureUnit:()=>_P,validateFramebuffer:()=>pd,validateProgram:()=>uh,validateTextureSize:()=>M7});var ki={},o1={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function ch(e,t){ki[e]=t}function Va(e){if(!(e in ki)){let n=BP(e);if(n!==null)ki[e]=n;else return console.log("Could not get context for WebGL version",e),null}let t=ki[e];return t.isContextLost()?(delete ki[e],Va(e)):(t.disable(t.DEPTH_TEST),t.disable(t.STENCIL_TEST),t.disable(t.BLEND),t.disable(t.DITHER),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SAMPLE_COVERAGE),t.enable(t.SCISSOR_TEST),t.enable(t.CULL_FACE),t.cullFace(t.BACK),ki[e])}function VP(e){if(typeof OffscreenCanvas!="undefined"&&e===2)return new OffscreenCanvas(300,150);if(typeof document!="undefined")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}function BP(e){if(e!==1&&e!==2)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");let t=VP(e);return t.addEventListener("webglcontextlost",n=>{n.preventDefault(),delete ki[e]},!1),e===1?t.getContext("webgl",o1)||t.getContext("experimental-webgl",o1):t.getContext("webgl2",o1)}var hd;(function(e){e[e.DENSE=0]="DENSE",e[e.SHARED_BATCH=1]="SHARED_BATCH"})(hd||(hd={}));var Yn;(function(e){e[e.RENDER=0]="RENDER",e[e.UPLOAD=1]="UPLOAD",e[e.PIXELS=2]="PIXELS",e[e.DOWNLOAD=3]="DOWNLOAD"})(Yn||(Yn={}));var Qt;(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"})(Qt||(Qt={}));function fd(e,t){return[t,e]}function jP(e,t){return e*t}function md(e){let t=k.sizeFromShape(e),n=Math.ceil(t/4);return k.sizeToSquarishShape(n)}function Rl(e,t){return[Math.max(1,Math.ceil(t/2)),Math.max(1,Math.ceil(e/2))]}function UP(e,t){let[n,a]=Rl(e,t);return n*a*4}function l1(e,t){let n=e,a,r,s,i,o,l,d,u,p,c;return J().getNumber("WEBGL_VERSION")===2?(a=n.R32F,r=n.R16F,s=n.RGBA16F,i=n.RGBA32F,o=n.RED,d=4,u=1,p=n.HALF_FLOAT,c=n.FLOAT):(a=e.RGBA,r=e.RGBA,s=e.RGBA,i=n.RGBA,o=e.RGBA,d=4,u=4,p=t!=null?t.HALF_FLOAT_OES:null,c=e.FLOAT),l=e.RGBA,{internalFormatFloat:a,internalFormatHalfFloat:r,internalFormatPackedHalfFloat:s,internalFormatPackedFloat:i,textureFormatFloat:o,downloadTextureFormat:l,downloadUnpackNumChannels:d,defaultNumChannels:u,textureTypeHalfFloat:p,textureTypeFloat:c}}function xe(e,t){let n=t();return J().getBool("DEBUG")&&HP(e),n}function HP(e){let t=e.getError();if(t!==e.NO_ERROR)throw new Error("WebGL Error: "+k7(e,t))}var GP=596e-10,qP=65504;function w7(e){return!!(J().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||e===0||GPe.getExtension(t),'Extension "'+t+'" not supported on this browser.')}function I7(e,t){let n=lr(e,()=>e.createShader(e.VERTEX_SHADER),"Unable to create vertex WebGLShader.");if(xe(e,()=>e.shaderSource(n,t)),xe(e,()=>e.compileShader(n)),e.getShaderParameter(n,e.COMPILE_STATUS)===!1)throw console.log(e.getShaderInfoLog(n)),new Error("Failed to compile vertex shader.");return n}function S7(e,t){let n=lr(e,()=>e.createShader(e.FRAGMENT_SHADER),"Unable to create fragment WebGLShader.");if(xe(e,()=>e.shaderSource(n,t)),xe(e,()=>e.compileShader(n)),e.getShaderParameter(n,e.COMPILE_STATUS)===!1)throw XP(t,e.getShaderInfoLog(n)),new Error("Failed to compile fragment shader.");return n}var KP=/ERROR: [0-9]+:([0-9]+):/g;function XP(e,t){let n=KP.exec(t);if(n==null){console.log(`Couldn't parse line number in error: ${t}`),console.log(e);return}let a=+n[1],r=e.split(` `),s=r.length.toString().length+2,i=r.map((p,c)=>k.rightPad((c+1).toString(),s)+p),o=0;for(let p=0;pe.createProgram(),"Unable to create WebGLProgram.")}function N7(e,t){if(xe(e,()=>e.linkProgram(t)),e.getProgramParameter(t,e.LINK_STATUS)===!1)throw console.log(e.getProgramInfoLog(t)),new Error("Failed to link vertex and fragment shaders.")}function lh(e,t){if(xe(e,()=>e.validateProgram(t)),e.getProgramParameter(t,e.VALIDATE_STATUS)===!1)throw console.log(e.getProgramInfoLog(t)),new Error("Shader program validation failed.")}function T7(e,t){let n=or(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return xe(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n)),xe(e,()=>e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function E7(e,t){let n=or(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return xe(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n)),xe(e,()=>e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function OP(){return J().getNumber("WEBGL_VERSION")===2?1:4}function C7(e){return or(e,()=>e.createTexture(),"Unable to create WebGLTexture.")}function R7(e,t){let n=J().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e<=0||t<=0){let a=`[${e}x${t}]`;throw new Error("Requested texture size "+a+" is invalid.")}if(e>n||t>n){let a=`[${e}x${t}]`,r=`[${n}x${n}]`;throw new Error("Requested texture size "+a+" greater than WebGL maximum on this browser / GPU "+r+".")}}function M7(e){return or(e,()=>e.createFramebuffer(),"Unable to create WebGLFramebuffer.")}function a1(e,t,n,a,r,s,i){let o=e.getAttribLocation(t,n);return o===-1?!1:(xe(e,()=>e.bindBuffer(e.ARRAY_BUFFER,a)),xe(e,()=>e.vertexAttribPointer(o,r,e.FLOAT,!1,s,i)),xe(e,()=>e.enableVertexAttribArray(o)),!0)}function F7(e,t,n){U7(e,n),xe(e,()=>e.activeTexture(e.TEXTURE0+n)),xe(e,()=>e.bindTexture(e.TEXTURE_2D,t))}function zP(e,t){U7(e,t),xe(e,()=>e.activeTexture(e.TEXTURE0+t)),xe(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function $7(e,t,n){return or(e,()=>e.getUniformLocation(t,n),'uniform "'+n+'" not present in program.')}function D7(e,t,n){return e.getUniformLocation(t,n)}function O7(e,t,n,a){xe(e,()=>F7(e,t,a)),xe(e,()=>e.uniform1i(n,a))}function _P(e){xe(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),xe(e,()=>e.viewport(0,0,e.canvas.width,e.canvas.height)),xe(e,()=>e.scissor(0,0,e.canvas.width,e.canvas.height))}function uh(e,t,n){xe(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,n)),xe(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0))}function r1(e,t){xe(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,t)),xe(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0))}function dd(e){let t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+z7(e,t))}function z7(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 or(e,t,n){let a=xe(e,()=>t());if(a==null)throw new Error(n);return a}function U7(e,t){let n=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,a=t+e.TEXTURE0;if(an){let r=`[gl.TEXTURE0, gl.TEXTURE${n}]`;throw new Error(`textureUnit must be in ${r}.`)}}function bi(e,t=2){return k.sizeFromShape(e.slice(0,e.length-t))}function vi(e){if(e.length===0)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 dh(e){let t=[1,1,1];return e.length===0||e.length===1&&e[0]===1||(t=[bi(e),...vi(e)]),t}function _7(e,t=!1){let n=J().getNumber("WEBGL_MAX_TEXTURE_SIZE");t&&(n=n*2,e=e.map((r,s)=>s>=e.length-2?k.nearestLargerEven(e[s]):e[s]),e.length===1&&(e=[2,e[0]])),e.length!==2&&(e=k.squeezeShape(e).newShape);let a=k.sizeFromShape(e);if(e.length<=1&&a<=n)return[1,a];if(e.length===2&&e[0]<=n&&e[1]<=n)return e;if(e.length===3&&e[0]*e[1]<=n&&e[2]<=n)return[e[0]*e[1],e[2]];if(e.length===3&&e[0]<=n&&e[1]*e[2]<=n)return[e[0],e[1]*e[2]];if(e.length===4&&e[0]*e[1]*e[2]<=n&&e[3]<=n)return[e[0]*e[1]*e[2],e[3]];if(e.length===4&&e[0]<=n&&e[1]*e[2]*e[3]<=n)return[e[0],e[1]*e[2]*e[3]];if(t){let r=bi(e),s=2,i=2;return e.length&&([s,i]=vi(e)),a=r*(s/2)*(i/2),k.sizeToSquarishShape(a).map(o=>o*2)}return k.sizeToSquarishShape(a)}function ch(e){return e%2==0}function pd(e,t){if(e=e.slice(-2),t=t.slice(-2),k.arraysEqual(e,t)||!e.length||!t.length||e[0]===0||e[1]===0||t[0]===0||t[1]===0)return!0;if(e.length!==t.length){let n=e.slice(-1)[0],a=t.slice(-1)[0];if(n===a||ch(n)&&ch(a)&&(e[0]===1||t[0]===1))return!0}return e[1]===t[1]&&ch(e[0])&&ch(t[0])}var hh,fh;function P7(e){if(hh==null){let t=Ba(e);hh=t.getParameter(t.MAX_TEXTURE_SIZE)}return hh}function PP(){hh=null}function LP(){fh=null}function L7(e){if(fh==null){let t=Ba(e);fh=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,fh)}function W7(e){if(e===0)return 0;let t,n=Ba(e);return Zn(n,"EXT_disjoint_timer_query_webgl2")&&e===2?t=2:Zn(n,"EXT_disjoint_timer_query")?t=1:t=0,t}function Zn(e,t){return e.getExtension(t)!=null}function s1(e){try{if(Ba(e)!=null)return!0}catch(t){return console.log("Error when getting WebGL context: ",t),!1}return!1}function B7(e){if(e===0)return!1;let t=Ba(e);if(e===1){if(!Zn(t,"OES_texture_float"))return!1}else if(!Zn(t,"EXT_color_buffer_float"))return!1;return l1(t)}function V7(e){if(e===0)return!1;let t=Ba(e);if(e===1){if(!Zn(t,"OES_texture_float")||!Zn(t,"WEBGL_color_buffer_float"))return!1}else{if(Zn(t,"EXT_color_buffer_float"))return l1(t);let n="EXT_color_buffer_half_float";if(Zn(t,n)){let a=t.getExtension(n);return KP(t,a)}return!1}return l1(t)}function l1(e){let t=o1(e),n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n);let a=1,r=1;e.texImage2D(e.TEXTURE_2D,0,t.internalFormatFloat,a,r,0,t.textureFormatFloat,t.textureTypeFloat,null);let s=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,s),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0);let i=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(n),e.deleteFramebuffer(s),i}function KP(e,t){let n=o1(e,t),a=e.createTexture();e.bindTexture(e.TEXTURE_2D,a);let r=1,s=1;e.texImage2D(e.TEXTURE_2D,0,n.internalFormatHalfFloat,r,s,0,n.textureFormatFloat,n.textureTypeHalfFloat,null);let i=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,a,0);let o=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(a),e.deleteFramebuffer(i),o}function j7(e){return e!==2?!1:Ba(e).fenceSync!=null}function El(e,t){Array.isArray(e)||(e=[e]),e.forEach(n=>{n!=null&&k.assert(n.dtype!=="complex64",()=>`${t} does not support complex64 tensors in the WebGL backend.`)})}var Me=J();Me.registerFlag("HAS_WEBGL",()=>Me.getNumber("WEBGL_VERSION")>0);Me.registerFlag("WEBGL_VERSION",()=>s1(2)?2:s1(1)?1:0);Me.registerFlag("WEBGL_CHECK_NUMERICAL_PROBLEMS",()=>!1);Me.registerFlag("WEBGL_BUFFER_SUPPORTED",()=>Me.get("WEBGL_VERSION")===2);Me.registerFlag("WEBGL_CPU_FORWARD",()=>!0);Me.registerFlag("WEBGL_FORCE_F16_TEXTURES",()=>!1);Me.registerFlag("WEBGL_PACK",()=>Me.getBool("HAS_WEBGL"));Me.registerFlag("WEBGL_PACK_NORMALIZATION",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_PACK_CLIP",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_PACK_DEPTHWISECONV",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_PACK_REDUCE",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_LAZILY_UNPACK",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_CONV_IM2COL",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_MAX_TEXTURE_SIZE",()=>P7(Me.getNumber("WEBGL_VERSION")));Me.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",()=>L7(Me.getNumber("WEBGL_VERSION")));Me.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",()=>{let e=Me.getNumber("WEBGL_VERSION");return e===0?0:W7(e)});Me.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",()=>Me.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!Wu.isMobile());Me.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",()=>B7(Me.getNumber("WEBGL_VERSION")));Me.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",()=>Me.getBool("WEBGL_FORCE_F16_TEXTURES")?!1:Me.getBool("WEBGL_RENDER_FLOAT32_CAPABLE"));Me.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",()=>V7(Me.getNumber("WEBGL_VERSION")));Me.registerFlag("WEBGL_FENCE_API_ENABLED",()=>j7(Me.getNumber("WEBGL_VERSION")));Me.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",()=>Me.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0);Me.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD",()=>-1,e=>{if(e<0&&e!==-1)throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never delete) or at least 0, but got ${e}.`)});Me.registerFlag("WEBGL_FLUSH_THRESHOLD",()=>Wu.isMobile()&&Me.getBool("IS_CHROME")?1:-1,e=>{if(e<0&&e!==-1)throw new Error(`WEBGL_FLUSH_THRESHOLD must be -1 (indicating never manual flush) or at least 0, but got ${e}.`)});function dn(){let e,t,n,a,r,s,i,o,l,d;return J().getNumber("WEBGL_VERSION")===2?(e="#version 300 es",t="in",n="out",a="in",r="texture",s="outputColor",i="out vec4 outputColor;",o=` +`))}function N7(e){return lr(e,()=>e.createProgram(),"Unable to create WebGLProgram.")}function T7(e,t){if(xe(e,()=>e.linkProgram(t)),e.getProgramParameter(t,e.LINK_STATUS)===!1)throw console.log(e.getProgramInfoLog(t)),new Error("Failed to link vertex and fragment shaders.")}function uh(e,t){if(xe(e,()=>e.validateProgram(t)),e.getProgramParameter(t,e.VALIDATE_STATUS)===!1)throw console.log(e.getProgramInfoLog(t)),new Error("Shader program validation failed.")}function E7(e,t){let n=lr(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return xe(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n)),xe(e,()=>e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function C7(e,t){let n=lr(e,()=>e.createBuffer(),"Unable to create WebGLBuffer");return xe(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n)),xe(e,()=>e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW)),n}function zP(){return J().getNumber("WEBGL_VERSION")===2?1:4}function R7(e){return lr(e,()=>e.createTexture(),"Unable to create WebGLTexture.")}function M7(e,t){let n=J().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e<=0||t<=0){let a=`[${e}x${t}]`;throw new Error("Requested texture size "+a+" is invalid.")}if(e>n||t>n){let a=`[${e}x${t}]`,r=`[${n}x${n}]`;throw new Error("Requested texture size "+a+" greater than WebGL maximum on this browser / GPU "+r+".")}}function F7(e){return lr(e,()=>e.createFramebuffer(),"Unable to create WebGLFramebuffer.")}function r1(e,t,n,a,r,s,i){let o=e.getAttribLocation(t,n);return o===-1?!1:(xe(e,()=>e.bindBuffer(e.ARRAY_BUFFER,a)),xe(e,()=>e.vertexAttribPointer(o,r,e.FLOAT,!1,s,i)),xe(e,()=>e.enableVertexAttribArray(o)),!0)}function $7(e,t,n){H7(e,n),xe(e,()=>e.activeTexture(e.TEXTURE0+n)),xe(e,()=>e.bindTexture(e.TEXTURE_2D,t))}function _P(e,t){H7(e,t),xe(e,()=>e.activeTexture(e.TEXTURE0+t)),xe(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function D7(e,t,n){return lr(e,()=>e.getUniformLocation(t,n),'uniform "'+n+'" not present in program.')}function O7(e,t,n){return e.getUniformLocation(t,n)}function z7(e,t,n,a){xe(e,()=>$7(e,t,a)),xe(e,()=>e.uniform1i(n,a))}function PP(e){xe(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),xe(e,()=>e.viewport(0,0,e.canvas.width,e.canvas.height)),xe(e,()=>e.scissor(0,0,e.canvas.width,e.canvas.height))}function dh(e,t,n){xe(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,n)),xe(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0))}function s1(e,t){xe(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,t)),xe(e,()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0))}function pd(e){let t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+_7(e,t))}function _7(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 lr(e,t,n){let a=xe(e,()=>t());if(a==null)throw new Error(n);return a}function H7(e,t){let n=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,a=t+e.TEXTURE0;if(an){let r=`[gl.TEXTURE0, gl.TEXTURE${n}]`;throw new Error(`textureUnit must be in ${r}.`)}}function vi(e,t=2){return k.sizeFromShape(e.slice(0,e.length-t))}function wi(e){if(e.length===0)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 ph(e){let t=[1,1,1];return e.length===0||e.length===1&&e[0]===1||(t=[vi(e),...wi(e)]),t}function P7(e,t=!1){let n=J().getNumber("WEBGL_MAX_TEXTURE_SIZE");t&&(n=n*2,e=e.map((r,s)=>s>=e.length-2?k.nearestLargerEven(e[s]):e[s]),e.length===1&&(e=[2,e[0]])),e.length!==2&&(e=k.squeezeShape(e).newShape);let a=k.sizeFromShape(e);if(e.length<=1&&a<=n)return[1,a];if(e.length===2&&e[0]<=n&&e[1]<=n)return e;if(e.length===3&&e[0]*e[1]<=n&&e[2]<=n)return[e[0]*e[1],e[2]];if(e.length===3&&e[0]<=n&&e[1]*e[2]<=n)return[e[0],e[1]*e[2]];if(e.length===4&&e[0]*e[1]*e[2]<=n&&e[3]<=n)return[e[0]*e[1]*e[2],e[3]];if(e.length===4&&e[0]<=n&&e[1]*e[2]*e[3]<=n)return[e[0],e[1]*e[2]*e[3]];if(t){let r=vi(e),s=2,i=2;return e.length&&([s,i]=wi(e)),a=r*(s/2)*(i/2),k.sizeToSquarishShape(a).map(o=>o*2)}return k.sizeToSquarishShape(a)}function hh(e){return e%2==0}function cd(e,t){if(e=e.slice(-2),t=t.slice(-2),k.arraysEqual(e,t)||!e.length||!t.length||e[0]===0||e[1]===0||t[0]===0||t[1]===0)return!0;if(e.length!==t.length){let n=e.slice(-1)[0],a=t.slice(-1)[0];if(n===a||hh(n)&&hh(a)&&(e[0]===1||t[0]===1))return!0}return e[1]===t[1]&&hh(e[0])&&hh(t[0])}var fh,mh;function L7(e){if(fh==null){let t=Va(e);fh=t.getParameter(t.MAX_TEXTURE_SIZE)}return fh}function LP(){fh=null}function WP(){mh=null}function W7(e){if(mh==null){let t=Va(e);mh=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,mh)}function B7(e){if(e===0)return 0;let t,n=Va(e);return Zn(n,"EXT_disjoint_timer_query_webgl2")&&e===2?t=2:Zn(n,"EXT_disjoint_timer_query")?t=1:t=0,t}function Zn(e,t){return e.getExtension(t)!=null}function i1(e){try{if(Va(e)!=null)return!0}catch(t){return console.log("Error when getting WebGL context: ",t),!1}return!1}function V7(e){if(e===0)return!1;let t=Va(e);if(e===1){if(!Zn(t,"OES_texture_float"))return!1}else if(!Zn(t,"EXT_color_buffer_float"))return!1;return u1(t)}function j7(e){if(e===0)return!1;let t=Va(e);if(e===1){if(!Zn(t,"OES_texture_float")||!Zn(t,"WEBGL_color_buffer_float"))return!1}else{if(Zn(t,"EXT_color_buffer_float"))return u1(t);let n="EXT_color_buffer_half_float";if(Zn(t,n)){let a=t.getExtension(n);return ZP(t,a)}return!1}return u1(t)}function u1(e){let t=l1(e),n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n);let a=1,r=1;e.texImage2D(e.TEXTURE_2D,0,t.internalFormatFloat,a,r,0,t.textureFormatFloat,t.textureTypeFloat,null);let s=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,s),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0);let i=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(n),e.deleteFramebuffer(s),i}function ZP(e,t){let n=l1(e,t),a=e.createTexture();e.bindTexture(e.TEXTURE_2D,a);let r=1,s=1;e.texImage2D(e.TEXTURE_2D,0,n.internalFormatHalfFloat,r,s,0,n.textureFormatFloat,n.textureTypeHalfFloat,null);let i=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,a,0);let o=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(a),e.deleteFramebuffer(i),o}function U7(e){return e!==2?!1:Va(e).fenceSync!=null}function Cl(e,t){Array.isArray(e)||(e=[e]),e.forEach(n=>{n!=null&&k.assert(n.dtype!=="complex64",()=>`${t} does not support complex64 tensors in the WebGL backend.`)})}var Me=J();Me.registerFlag("HAS_WEBGL",()=>Me.getNumber("WEBGL_VERSION")>0);Me.registerFlag("WEBGL_VERSION",()=>i1(2)?2:i1(1)?1:0);Me.registerFlag("WEBGL_CHECK_NUMERICAL_PROBLEMS",()=>!1);Me.registerFlag("WEBGL_BUFFER_SUPPORTED",()=>Me.get("WEBGL_VERSION")===2);Me.registerFlag("WEBGL_CPU_FORWARD",()=>!0);Me.registerFlag("WEBGL_FORCE_F16_TEXTURES",()=>!1);Me.registerFlag("WEBGL_PACK",()=>Me.getBool("HAS_WEBGL"));Me.registerFlag("WEBGL_PACK_NORMALIZATION",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_PACK_CLIP",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_PACK_DEPTHWISECONV",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_PACK_REDUCE",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_LAZILY_UNPACK",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_CONV_IM2COL",()=>Me.getBool("WEBGL_PACK"));Me.registerFlag("WEBGL_MAX_TEXTURE_SIZE",()=>L7(Me.getNumber("WEBGL_VERSION")));Me.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",()=>W7(Me.getNumber("WEBGL_VERSION")));Me.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",()=>{let e=Me.getNumber("WEBGL_VERSION");return e===0?0:B7(e)});Me.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",()=>Me.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!Bu.isMobile());Me.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",()=>V7(Me.getNumber("WEBGL_VERSION")));Me.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",()=>Me.getBool("WEBGL_FORCE_F16_TEXTURES")?!1:Me.getBool("WEBGL_RENDER_FLOAT32_CAPABLE"));Me.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",()=>j7(Me.getNumber("WEBGL_VERSION")));Me.registerFlag("WEBGL_FENCE_API_ENABLED",()=>U7(Me.getNumber("WEBGL_VERSION")));Me.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",()=>Me.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0);Me.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD",()=>-1,e=>{if(e<0&&e!==-1)throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never delete) or at least 0, but got ${e}.`)});Me.registerFlag("WEBGL_FLUSH_THRESHOLD",()=>Bu.isMobile()&&Me.getBool("IS_CHROME")?1:-1,e=>{if(e<0&&e!==-1)throw new Error(`WEBGL_FLUSH_THRESHOLD must be -1 (indicating never manual flush) or at least 0, but got ${e}.`)});function dn(){let e,t,n,a,r,s,i,o,l,d;return J().getNumber("WEBGL_VERSION")===2?(e="#version 300 es",t="in",n="out",a="in",r="texture",s="outputColor",i="out vec4 outputColor;",o=` bool isnan_custom(float val) { return (val > 0.0 || val < 0.0) ? false : val != 0.0; } @@ -84,11 +84,11 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee ivec4 round(vec4 value) { return ivec4(floor(value + vec4(0.5))); } - `),{version:e,attribute:t,varyingVs:n,varyingFs:a,texture2D:r,output:s,defineOutput:i,defineSpecialNaN:o,defineSpecialInf:l,defineRound:d}}function ki(e,t,n="index"){let a=k.computeStrides(t);return a.map((r,s)=>{let i=`int ${e[s]} = ${n} / ${r}`,o=s===a.length-1?`int ${e[s+1]} = ${n} - ${e[s]} * ${r}`:`index -= ${e[s]} * ${r}`;return`${i}; ${o};`}).join("")}function u1(e){let t=k.computeStrides(e).map(n=>n.toString());return` + `),{version:e,attribute:t,varyingVs:n,varyingFs:a,texture2D:r,output:s,defineOutput:i,defineSpecialNaN:o,defineSpecialInf:l,defineRound:d}}function Ii(e,t,n="index"){let a=k.computeStrides(t);return a.map((r,s)=>{let i=`int ${e[s]} = ${n} / ${r}`,o=s===a.length-1?`int ${e[s+1]} = ${n} - ${e[s]} * ${r}`:`index -= ${e[s]} * ${r}`;return`${i}; ${o};`}).join("")}function d1(e){let t=k.computeStrides(e).map(n=>n.toString());return` int getFlatIndex(ivec3 coords) { return coords.x * ${t[0]} + coords.y * ${t[1]} + coords.z; } -`}var H7=` +`}var G7=` const float FLOAT_MAX = 1.70141184e38; const float FLOAT_MIN = 1.17549435e-38; @@ -127,9 +127,9 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee return c / 255.0; } -`,ZP=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=cd.DENSE;let t=fd(e),n=dn();this.outputShape=e,this.userCode=` +`,YP=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=hd.DENSE;let t=md(e),n=dn();this.outputShape=e,this.userCode=` ivec3 outCoordsFromFlatIndex(int index) { - ${ki(["r","c","d"],e)} + ${Ii(["r","c","d"],e)} return ivec3(r, c, d); } @@ -148,9 +148,9 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee ${n.output} = result; } - `}},YP=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=cd.DENSE;let t=fd(e),n=dn();this.outputShape=e,this.userCode=` + `}},JP=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=hd.DENSE;let t=md(e),n=dn();this.outputShape=e,this.userCode=` ivec3 outCoordsFromFlatIndex(int index) { - ${ki(["r","c","d"],e)} + ${Ii(["r","c","d"],e)} return ivec3(r, c, d); } @@ -169,23 +169,23 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee ${n.output} = result; } - `}},JP=class{constructor(e){this.variableNames=["A"],this.outTexUsage=Yn.DOWNLOAD;let t=dn();this.outputShape=e,this.userCode=` - ${H7} + `}},QP=class{constructor(e){this.variableNames=["A"],this.outTexUsage=Yn.DOWNLOAD;let t=dn();this.outputShape=e,this.userCode=` + ${G7} void main() { float x = getAAtOutCoords(); ${t.output} = encode_float(x); } - `}},QP=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=Yn.DOWNLOAD;let t=dn();this.outputShape=e,this.userCode=` - ${H7} + `}},eL=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=Yn.DOWNLOAD;let t=dn();this.outputShape=e,this.userCode=` + ${G7} void main() { ivec3 coords = getOutputCoords(); float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z)); ${t.output} = encode_float(x); } - `}},eL=class{constructor(e,t,n=!1){this.variableNames=["A"];let a=dn(),[r,s]=t;this.outputShape=e;let i="result";n&&(i="floor(result * 255. + 0.5)"),this.userCode=` - ${u1(e)} + `}},tL=class{constructor(e,t,n=!1){this.variableNames=["A"];let a=dn(),[r,s]=t;this.outputShape=e;let i="result";n&&(i="floor(result * 255. + 0.5)"),this.userCode=` + ${d1(e)} void main() { ivec3 coords = getOutputCoords(); @@ -214,7 +214,7 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee ${a.output} = vec4(${i}, 0., 0., 0.); } - `}},tL=class{constructor(e,t,n=!1){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;let a=dn(),[r,s]=t;this.outputShape=e;let i="",o="result";n&&(o="floor(result * 255. + 0.5)");for(let l=0;l<=1;l++)for(let d=0;d<=1;d++){let u=l*2+d;i+=` + `}},nL=class{constructor(e,t,n=!1){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;let a=dn(),[r,s]=t;this.outputShape=e;let i="",o="result";n&&(o="floor(result * 255. + 0.5)");for(let l=0;l<=1;l++)for(let d=0;d<=1;d++){let u=l*2+d;i+=` localCoords = coords; if(localCoords[2] + ${d} < ${e[2]}) { localCoords[2] += ${d}; @@ -243,7 +243,7 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee } } `}this.userCode=` - ${u1(e)} + ${d1(e)} void main() { ivec3 coords = getOutputCoords(); @@ -258,7 +258,7 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee ${a.output} = ${o}; } - `}},G7={};Fe(G7,{bindVertexProgramAttributeStreams:()=>tv,createBufferFromOutputTexture:()=>rv,createFloat16MatrixTexture:()=>Y7,createFloat16PackedMatrixTexture:()=>ev,createFloat32MatrixTexture:()=>Z7,createIndexBuffer:()=>K7,createPackedMatrixTexture:()=>Q7,createUnsignedBytesMatrixTexture:()=>J7,createVertexBuffer:()=>X7,createVertexShader:()=>q7,downloadByteEncodedFloatMatrixFromOutputTexture:()=>iv,downloadFloat32MatrixFromBuffer:()=>sv,downloadMatrixFromPackedOutputTexture:()=>lv,downloadPackedMatrixFromBuffer:()=>ov,getInternalFormatForFloat16MatrixTexture:()=>p1,getInternalFormatForFloat16PackedMatrixTexture:()=>f1,getInternalFormatForFloat32MatrixTexture:()=>d1,getInternalFormatForPackedMatrixTexture:()=>h1,getInternalFormatForUnsignedBytesMatrixTexture:()=>c1,uploadDenseMatrixToTexture:()=>nv,uploadPixelDataToTexture:()=>av});function q7(e){let t=dn(),n=`${t.version} + `}},q7={};Fe(q7,{bindVertexProgramAttributeStreams:()=>nv,createBufferFromOutputTexture:()=>sv,createFloat16MatrixTexture:()=>J7,createFloat16PackedMatrixTexture:()=>tv,createFloat32MatrixTexture:()=>Y7,createIndexBuffer:()=>Z7,createPackedMatrixTexture:()=>ev,createUnsignedBytesMatrixTexture:()=>Q7,createVertexBuffer:()=>K7,createVertexShader:()=>X7,downloadByteEncodedFloatMatrixFromOutputTexture:()=>ov,downloadFloat32MatrixFromBuffer:()=>iv,downloadMatrixFromPackedOutputTexture:()=>uv,downloadPackedMatrixFromBuffer:()=>lv,getInternalFormatForFloat16MatrixTexture:()=>c1,getInternalFormatForFloat16PackedMatrixTexture:()=>m1,getInternalFormatForFloat32MatrixTexture:()=>p1,getInternalFormatForPackedMatrixTexture:()=>f1,getInternalFormatForUnsignedBytesMatrixTexture:()=>h1,uploadDenseMatrixToTexture:()=>av,uploadPixelDataToTexture:()=>rv});function X7(e){let t=dn(),n=`${t.version} precision highp float; ${t.attribute} vec3 clipSpacePos; ${t.attribute} vec2 uv; @@ -267,22 +267,22 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee void main() { gl_Position = vec4(clipSpacePos, 1); resultUV = uv; - }`;return k7(e,n)}function X7(e){let t=new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]);return T7(e,t)}function K7(e){let t=new Uint16Array([0,1,2,2,1,3]);return E7(e,t)}function md(e,t,n,a,r,s){R7(t,n);let i=C7(e),o=e.TEXTURE_2D;return xe(e,()=>e.bindTexture(o,i)),xe(e,()=>e.texParameteri(o,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE)),xe(e,()=>e.texParameteri(o,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)),xe(e,()=>e.texParameteri(o,e.TEXTURE_MIN_FILTER,e.NEAREST)),xe(e,()=>e.texParameteri(o,e.TEXTURE_MAG_FILTER,e.NEAREST)),xe(e,()=>e.texImage2D(o,0,a,t,n,0,r,s,null)),xe(e,()=>e.bindTexture(e.TEXTURE_2D,null)),i}function d1(e){return e.internalFormatFloat}function Z7(e,t,n,a){let[r,s]=hd(t,n);return md(e,r,s,d1(a),a.textureFormatFloat,e.FLOAT)}function p1(e){return e.internalFormatHalfFloat}function Y7(e,t,n,a){let[r,s]=hd(t,n);return md(e,r,s,p1(a),a.textureFormatFloat,a.textureTypeHalfFloat)}function c1(e){return e.downloadTextureFormat}function J7(e,t,n,a){let[r,s]=hd(t,n);return md(e,r,s,c1(a),e.RGBA,e.UNSIGNED_BYTE)}function h1(e){return e.internalFormatPackedFloat}function Q7(e,t,n,a){let[r,s]=Cl(t,n);return md(e,r,s,h1(a),e.RGBA,e.FLOAT)}function f1(e){return e.internalFormatPackedHalfFloat}function ev(e,t,n,a){let[r,s]=Cl(t,n);return md(e,r,s,f1(a),e.RGBA,a.textureTypeHalfFloat)}function tv(e,t,n){let a=0,r=3*4,s=3*4+2*4;return xe(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n)),a1(e,t,"clipSpacePos",n,3,s,a)&&a1(e,t,"uv",n,2,s,r)}function nv(e,t,n,a,r,s){xe(e,()=>e.bindTexture(e.TEXTURE_2D,t));let i,o,l;r instanceof Uint8Array?(i=new Uint8Array(n*a*4),o=e.UNSIGNED_BYTE,l=e.RGBA):(i=new Float32Array(n*a*4),o=e.FLOAT,l=s.internalFormatPackedFloat),i.set(r),xe(e,()=>e.texImage2D(e.TEXTURE_2D,0,l,n,a,0,e.RGBA,o,i)),xe(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function av(e,t,n){xe(e,()=>e.bindTexture(e.TEXTURE_2D,t)),n.data instanceof Uint8Array?xe(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data)):xe(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)),xe(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function rv(e,t,n,a){let r=e.createBuffer();xe(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,r));let s=4*4*t*n;return xe(e,()=>e.bufferData(e.PIXEL_PACK_BUFFER,s,e.STREAM_READ)),xe(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,0)),xe(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,null)),r}function sv(e,t,n){let a=e,r=new Float32Array(n);return a.bindBuffer(a.PIXEL_PACK_BUFFER,t),a.getBufferSubData(a.PIXEL_PACK_BUFFER,0,r),a.bindBuffer(a.PIXEL_PACK_BUFFER,null),r}function iv(e,t,n,a){let[r,s]=hd(t,n),i=4,o=new Uint8Array(VP(t*n,i));return xe(e,()=>e.readPixels(0,0,r,s,a.downloadTextureFormat,e.UNSIGNED_BYTE,o)),new Float32Array(o.buffer)}function ov(e,t,n,a,r,s,i,o){let l=e,d=new Float32Array(jP(s,i));return l.bindBuffer(l.PIXEL_PACK_BUFFER,t),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,d),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),d}function lv(e,t,n){let a=new Float32Array(t*n*4);return xe(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,a)),a}var mh=class{constructor(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];let t=J().getNumber("WEBGL_VERSION");e!=null?(this.gl=e,ph(t,e)):this.gl=Ba(t);let n="WEBGL_color_buffer_float",a="EXT_color_buffer_half_float";if(J().getNumber("WEBGL_VERSION")===1){let r="OES_texture_float",s="OES_texture_half_float";if(this.textureFloatExtension=ud(this.gl,r),Zn(this.gl,s))this.textureHalfFloatExtension=ud(this.gl,s);else if(J().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),Zn(this.gl,a))this.colorBufferHalfFloatExtension=ud(this.gl,a);else if(J().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",Zn(this.gl,n))this.colorBufferFloatExtension=this.gl.getExtension(n);else if(Zn(this.gl,a))this.colorBufferHalfFloatExtension=this.gl.getExtension(a);else throw new Error("GL context does not support color renderable floats");this.vertexBuffer=X7(this.gl),this.indexBuffer=K7(this.gl),this.framebuffer=M7(this.gl),this.textureConfig=o1(this.gl,this.textureHalfFloatExtension)}get debug(){return J().getBool("DEBUG")}dispose(){if(this.disposed)return;this.program!=null&&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."),this.outputTexture!=null&&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.");let e=this.gl;xe(e,()=>e.finish()),xe(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),xe(e,()=>e.deleteFramebuffer(this.framebuffer)),xe(e,()=>e.bindBuffer(e.ARRAY_BUFFER,null)),xe(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)),xe(e,()=>e.deleteBuffer(this.indexBuffer)),this.disposed=!0}createFloat32MatrixTexture(e,t){return this.throwIfDisposed(),Z7(this.gl,e,t,this.textureConfig)}createFloat16MatrixTexture(e,t){return this.throwIfDisposed(),Y7(this.gl,e,t,this.textureConfig)}createUnsignedBytesMatrixTexture(e,t){return this.throwIfDisposed(),J7(this.gl,e,t,this.textureConfig)}uploadPixelDataToTexture(e,t){this.throwIfDisposed(),av(this.gl,e,t)}uploadDenseMatrixToTexture(e,t,n,a){this.throwIfDisposed(),nv(this.gl,e,t,n,a,this.textureConfig)}createFloat16PackedMatrixTexture(e,t){return this.throwIfDisposed(),ev(this.gl,e,t,this.textureConfig)}createPackedMatrixTexture(e,t){return this.throwIfDisposed(),Q7(this.gl,e,t,this.textureConfig)}deleteMatrixTexture(e){this.throwIfDisposed(),this.outputTexture===e&&(r1(this.gl,this.framebuffer),this.outputTexture=null),xe(this.gl,()=>this.gl.deleteTexture(e))}downloadByteEncodedFloatMatrixFromOutputTexture(e,t,n){return this.downloadMatrixDriver(e,()=>iv(this.gl,t,n,this.textureConfig))}downloadPackedMatrixFromBuffer(e,t,n,a,r,s){return ov(this.gl,e,t,n,a,r,s,this.textureConfig)}downloadFloat32MatrixFromBuffer(e,t){return sv(this.gl,e,t)}createBufferFromTexture(e,t,n){this.bindTextureToFrameBuffer(e);let a=rv(this.gl,t,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),a}createAndWaitForFence(){let e=this.createFence(this.gl);return this.pollFence(e)}createFence(e){let t,n;if(J().getBool("WEBGL_FENCE_API_ENABLED")){let a=e,r=a.fenceSync(a.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),n=()=>{let s=a.clientWaitSync(r,0,0);return s===a.ALREADY_SIGNALED||s===a.CONDITION_SATISFIED},t=r}else J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(t=this.beginQuery(),this.endQuery(),n=()=>this.isQueryAvailable(t,J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))):n=()=>!0;return{query:t,isFencePassed:n}}downloadMatrixFromPackedTexture(e,t,n){return this.downloadMatrixDriver(e,()=>lv(this.gl,t,n))}createProgram(e){this.throwIfDisposed();let t=this.gl,n=I7(t,e);this.vertexShader==null&&(this.vertexShader=q7(t));let a=S7(t);return xe(t,()=>t.attachShader(a,this.vertexShader)),xe(t,()=>t.attachShader(a,n)),N7(t,a),this.debug&&lh(t,a),this.vertexAttrsAreBound||(this.setProgram(a),this.vertexAttrsAreBound=tv(t,this.program,this.vertexBuffer)),a}deleteProgram(e){this.throwIfDisposed(),e===this.program&&(this.program=null),e!=null&&xe(this.gl,()=>this.gl.deleteProgram(e))}setProgram(e){this.throwIfDisposed(),this.program=e,this.program!=null&&this.debug&&lh(this.gl,this.program),xe(this.gl,()=>this.gl.useProgram(e))}getUniformLocation(e,t,n=!0){return this.throwIfDisposed(),n?$7(this.gl,e,t):D7(this.gl,e,t)}getAttributeLocation(e,t){return this.throwIfDisposed(),xe(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(),O7(this.gl,e,t,n)}setOutputMatrixTexture(e,t,n){this.setOutputMatrixTextureDriver(e,n,t)}setOutputPackedMatrixTexture(e,t,n){this.throwIfDisposed();let[a,r]=Cl(t,n);this.setOutputMatrixTextureDriver(e,a,r)}setOutputMatrixWriteRegion(e,t,n,a){this.setOutputMatrixWriteRegionDriver(n,e,a,t)}setOutputPackedMatrixWriteRegion(e,t,n,a){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")}debugValidate(){this.program!=null&&lh(this.gl,this.program),dd(this.gl)}executeProgram(){this.throwIfDisposed(),this.throwIfNoProgram();let e=this.gl;this.debug&&this.debugValidate(),xe(e,()=>e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0))}blockUntilAllProgramsCompleted(){this.throwIfDisposed(),xe(this.gl,()=>this.gl.finish())}getQueryTimerExtension(){return this.disjointQueryTimerExtension==null&&(this.disjointQueryTimerExtension=ud(this.gl,J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension}getQueryTimerExtensionWebGL2(){return this.getQueryTimerExtension()}getQueryTimerExtensionWebGL1(){return this.getQueryTimerExtension()}beginQuery(){if(J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){let n=this.gl,a=this.getQueryTimerExtensionWebGL2(),r=n.createQuery();return n.beginQuery(a.TIME_ELAPSED_EXT,r),r}let e=this.getQueryTimerExtensionWebGL1(),t=e.createQueryEXT();return e.beginQueryEXT(e.TIME_ELAPSED_EXT,t),t}endQuery(){if(J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){let t=this.gl,n=this.getQueryTimerExtensionWebGL2();t.endQuery(n.TIME_ELAPSED_EXT);return}let e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT)}async waitForQueryAndGetTime(e){return await k.repeatedTry(()=>this.disposed||this.isQueryAvailable(e,J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))),this.getQueryTime(e,J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}getQueryTime(e,t){if(t===0)return null;if(t===2){let n=this.gl;return n.getQueryParameter(e,n.QUERY_RESULT)/1e6}else{let n=this.getQueryTimerExtensionWebGL1();return n.getQueryObjectEXT(e,n.QUERY_RESULT_EXT)/1e6}}isQueryAvailable(e,t){if(t===0)return!0;if(t===2){let n=this.gl,a=this.getQueryTimerExtensionWebGL2(),r=n.getQueryParameter(e,n.QUERY_RESULT_AVAILABLE);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(a.GPU_DISJOINT_EXT)),r&&!this.disjoint}else{let n=this.getQueryTimerExtensionWebGL1(),a=n.getQueryObjectEXT(e,n.QUERY_RESULT_AVAILABLE_EXT);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(n.GPU_DISJOINT_EXT)),a&&!this.disjoint}}pollFence(e){return new Promise(t=>{this.addItemToPoll(()=>e.isFencePassed(),()=>t())})}pollItems(){let e=nL(this.itemsToPoll.map(t=>t.isDoneFn));for(let t=0;t<=e;++t){let{resolveFn:n}=this.itemsToPoll[t];n()}this.itemsToPoll=this.itemsToPoll.slice(e+1)}addItemToPoll(e,t){this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),!(this.itemsToPoll.length>1)&&k.repeatedTry(()=>(this.pollItems(),this.itemsToPoll.length===0))}bindTextureToFrameBuffer(e){this.throwIfDisposed(),uh(this.gl,e,this.framebuffer),this.debug&&dd(this.gl)}unbindTextureToFrameBuffer(){this.outputTexture!=null?(uh(this.gl,this.outputTexture,this.framebuffer),this.debug&&dd(this.gl)):r1(this.gl,this.framebuffer)}downloadMatrixDriver(e,t){this.bindTextureToFrameBuffer(e);let n=t();return this.unbindTextureToFrameBuffer(),n}setOutputMatrixTextureDriver(e,t,n){this.throwIfDisposed();let a=this.gl;uh(a,e,this.framebuffer),this.debug&&dd(a),this.outputTexture=e,xe(a,()=>a.viewport(0,0,t,n)),xe(a,()=>a.scissor(0,0,t,n))}setOutputMatrixWriteRegionDriver(e,t,n,a){this.throwIfDisposed(),xe(this.gl,()=>this.gl.scissor(e,t,n,a))}throwIfDisposed(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")}throwIfNoProgram(){if(this.program==null)throw new Error("No GPU program is currently set.")}};function nL(e){let t=0;for(;t{let m=k.sizeFromShape(h.shapeInfo.logicalShape);h.shapeInfo.isUniform?r.push(`uniform float ${h.name}${m>1?`[${m}]`:""};`):(r.push(`uniform sampler2D ${h.name};`),r.push(`uniform int offset${h.name};`))});let s=r.join(` -`),i=e.map(h=>aL(h,t,a)).join(` -`),o=t.texShape,l=dn(),d=iL(l),u,p,c=uL(l);return t.isPacked?(u=rL(t.logicalShape,o),p=lL(l)):(u=sL(t.logicalShape,o),p=oL(l)),a&&(c+=dL),[c,d,p,s,u,i,n].join(` -`)}function Rl(e){let t=e.shapeInfo.logicalShape;switch(t.length){case 0:return cL(e);case 1:return hL(e);case 2:return fL(e);case 3:return mL(e);case 4:return AL(e);case 5:return yL(e);case 6:return gL(e);default:throw new Error(`${t.length}-D input sampling is not yet supported`)}}function dv(e){switch(e.shapeInfo.logicalShape.length){case 0:return xL(e);case 1:return bL(e);case 2:return vL(e);case 3:return wL(e);default:return kL(e)}}function aL(e,t,n=!1){let a="";n?a+=dv(e):a+=Rl(e);let r=e.shapeInfo.logicalShape,s=t.logicalShape;return r.length<=s.length&&(n?a+=IL(e,t):a+=SL(e,t)),a}function rL(e,t){switch(e.length){case 0:return pv();case 1:return NL(e,t);case 2:return CL(e,t);case 3:return TL(e,t);default:return EL(e,t)}}function sL(e,t){switch(e.length){case 0:return pv();case 1:return RL(e,t);case 2:return OL(e,t);case 3:return ML(e,t);case 4:return FL(e,t);case 5:return $L(e,t);case 6:return DL(e,t);default:throw new Error(`${e.length}-D output sampling is not yet supported`)}}function iL(e){return` + }`;return I7(e,n)}function K7(e){let t=new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]);return E7(e,t)}function Z7(e){let t=new Uint16Array([0,1,2,2,1,3]);return C7(e,t)}function Ad(e,t,n,a,r,s){M7(t,n);let i=R7(e),o=e.TEXTURE_2D;return xe(e,()=>e.bindTexture(o,i)),xe(e,()=>e.texParameteri(o,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE)),xe(e,()=>e.texParameteri(o,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)),xe(e,()=>e.texParameteri(o,e.TEXTURE_MIN_FILTER,e.NEAREST)),xe(e,()=>e.texParameteri(o,e.TEXTURE_MAG_FILTER,e.NEAREST)),xe(e,()=>e.texImage2D(o,0,a,t,n,0,r,s,null)),xe(e,()=>e.bindTexture(e.TEXTURE_2D,null)),i}function p1(e){return e.internalFormatFloat}function Y7(e,t,n,a){let[r,s]=fd(t,n);return Ad(e,r,s,p1(a),a.textureFormatFloat,e.FLOAT)}function c1(e){return e.internalFormatHalfFloat}function J7(e,t,n,a){let[r,s]=fd(t,n);return Ad(e,r,s,c1(a),a.textureFormatFloat,a.textureTypeHalfFloat)}function h1(e){return e.downloadTextureFormat}function Q7(e,t,n,a){let[r,s]=fd(t,n);return Ad(e,r,s,h1(a),e.RGBA,e.UNSIGNED_BYTE)}function f1(e){return e.internalFormatPackedFloat}function ev(e,t,n,a){let[r,s]=Rl(t,n);return Ad(e,r,s,f1(a),e.RGBA,e.FLOAT)}function m1(e){return e.internalFormatPackedHalfFloat}function tv(e,t,n,a){let[r,s]=Rl(t,n);return Ad(e,r,s,m1(a),e.RGBA,a.textureTypeHalfFloat)}function nv(e,t,n){let a=0,r=3*4,s=3*4+2*4;return xe(e,()=>e.bindBuffer(e.ARRAY_BUFFER,n)),r1(e,t,"clipSpacePos",n,3,s,a)&&r1(e,t,"uv",n,2,s,r)}function av(e,t,n,a,r,s){xe(e,()=>e.bindTexture(e.TEXTURE_2D,t));let i,o,l;r instanceof Uint8Array?(i=new Uint8Array(n*a*4),o=e.UNSIGNED_BYTE,l=e.RGBA):(i=new Float32Array(n*a*4),o=e.FLOAT,l=s.internalFormatPackedFloat),i.set(r),xe(e,()=>e.texImage2D(e.TEXTURE_2D,0,l,n,a,0,e.RGBA,o,i)),xe(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function rv(e,t,n){xe(e,()=>e.bindTexture(e.TEXTURE_2D,t)),n.data instanceof Uint8Array?xe(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data)):xe(e,()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)),xe(e,()=>e.bindTexture(e.TEXTURE_2D,null))}function sv(e,t,n,a){let r=e.createBuffer();xe(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,r));let s=4*4*t*n;return xe(e,()=>e.bufferData(e.PIXEL_PACK_BUFFER,s,e.STREAM_READ)),xe(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,0)),xe(e,()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,null)),r}function iv(e,t,n){let a=e,r=new Float32Array(n);return a.bindBuffer(a.PIXEL_PACK_BUFFER,t),a.getBufferSubData(a.PIXEL_PACK_BUFFER,0,r),a.bindBuffer(a.PIXEL_PACK_BUFFER,null),r}function ov(e,t,n,a){let[r,s]=fd(t,n),i=4,o=new Uint8Array(jP(t*n,i));return xe(e,()=>e.readPixels(0,0,r,s,a.downloadTextureFormat,e.UNSIGNED_BYTE,o)),new Float32Array(o.buffer)}function lv(e,t,n,a,r,s,i,o){let l=e,d=new Float32Array(UP(s,i));return l.bindBuffer(l.PIXEL_PACK_BUFFER,t),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,d),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),d}function uv(e,t,n){let a=new Float32Array(t*n*4);return xe(e,()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,a)),a}var Ah=class{constructor(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];let t=J().getNumber("WEBGL_VERSION");e!=null?(this.gl=e,ch(t,e)):this.gl=Va(t);let n="WEBGL_color_buffer_float",a="EXT_color_buffer_half_float";if(J().getNumber("WEBGL_VERSION")===1){let r="OES_texture_float",s="OES_texture_half_float";if(this.textureFloatExtension=dd(this.gl,r),Zn(this.gl,s))this.textureHalfFloatExtension=dd(this.gl,s);else if(J().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),Zn(this.gl,a))this.colorBufferHalfFloatExtension=dd(this.gl,a);else if(J().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",Zn(this.gl,n))this.colorBufferFloatExtension=this.gl.getExtension(n);else if(Zn(this.gl,a))this.colorBufferHalfFloatExtension=this.gl.getExtension(a);else throw new Error("GL context does not support color renderable floats");this.vertexBuffer=K7(this.gl),this.indexBuffer=Z7(this.gl),this.framebuffer=F7(this.gl),this.textureConfig=l1(this.gl,this.textureHalfFloatExtension)}get debug(){return J().getBool("DEBUG")}dispose(){if(this.disposed)return;this.program!=null&&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."),this.outputTexture!=null&&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.");let e=this.gl;xe(e,()=>e.finish()),xe(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),xe(e,()=>e.deleteFramebuffer(this.framebuffer)),xe(e,()=>e.bindBuffer(e.ARRAY_BUFFER,null)),xe(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)),xe(e,()=>e.deleteBuffer(this.indexBuffer)),this.disposed=!0}createFloat32MatrixTexture(e,t){return this.throwIfDisposed(),Y7(this.gl,e,t,this.textureConfig)}createFloat16MatrixTexture(e,t){return this.throwIfDisposed(),J7(this.gl,e,t,this.textureConfig)}createUnsignedBytesMatrixTexture(e,t){return this.throwIfDisposed(),Q7(this.gl,e,t,this.textureConfig)}uploadPixelDataToTexture(e,t){this.throwIfDisposed(),rv(this.gl,e,t)}uploadDenseMatrixToTexture(e,t,n,a){this.throwIfDisposed(),av(this.gl,e,t,n,a,this.textureConfig)}createFloat16PackedMatrixTexture(e,t){return this.throwIfDisposed(),tv(this.gl,e,t,this.textureConfig)}createPackedMatrixTexture(e,t){return this.throwIfDisposed(),ev(this.gl,e,t,this.textureConfig)}deleteMatrixTexture(e){this.throwIfDisposed(),this.outputTexture===e&&(s1(this.gl,this.framebuffer),this.outputTexture=null),xe(this.gl,()=>this.gl.deleteTexture(e))}downloadByteEncodedFloatMatrixFromOutputTexture(e,t,n){return this.downloadMatrixDriver(e,()=>ov(this.gl,t,n,this.textureConfig))}downloadPackedMatrixFromBuffer(e,t,n,a,r,s){return lv(this.gl,e,t,n,a,r,s,this.textureConfig)}downloadFloat32MatrixFromBuffer(e,t){return iv(this.gl,e,t)}createBufferFromTexture(e,t,n){this.bindTextureToFrameBuffer(e);let a=sv(this.gl,t,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),a}createAndWaitForFence(){let e=this.createFence(this.gl);return this.pollFence(e)}createFence(e){let t,n;if(J().getBool("WEBGL_FENCE_API_ENABLED")){let a=e,r=a.fenceSync(a.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),n=()=>{let s=a.clientWaitSync(r,0,0);return s===a.ALREADY_SIGNALED||s===a.CONDITION_SATISFIED},t=r}else J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(t=this.beginQuery(),this.endQuery(),n=()=>this.isQueryAvailable(t,J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))):n=()=>!0;return{query:t,isFencePassed:n}}downloadMatrixFromPackedTexture(e,t,n){return this.downloadMatrixDriver(e,()=>uv(this.gl,t,n))}createProgram(e){this.throwIfDisposed();let t=this.gl,n=S7(t,e);this.vertexShader==null&&(this.vertexShader=X7(t));let a=N7(t);return xe(t,()=>t.attachShader(a,this.vertexShader)),xe(t,()=>t.attachShader(a,n)),T7(t,a),this.debug&&uh(t,a),this.vertexAttrsAreBound||(this.setProgram(a),this.vertexAttrsAreBound=nv(t,this.program,this.vertexBuffer)),a}deleteProgram(e){this.throwIfDisposed(),e===this.program&&(this.program=null),e!=null&&xe(this.gl,()=>this.gl.deleteProgram(e))}setProgram(e){this.throwIfDisposed(),this.program=e,this.program!=null&&this.debug&&uh(this.gl,this.program),xe(this.gl,()=>this.gl.useProgram(e))}getUniformLocation(e,t,n=!0){return this.throwIfDisposed(),n?D7(this.gl,e,t):O7(this.gl,e,t)}getAttributeLocation(e,t){return this.throwIfDisposed(),xe(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(),z7(this.gl,e,t,n)}setOutputMatrixTexture(e,t,n){this.setOutputMatrixTextureDriver(e,n,t)}setOutputPackedMatrixTexture(e,t,n){this.throwIfDisposed();let[a,r]=Rl(t,n);this.setOutputMatrixTextureDriver(e,a,r)}setOutputMatrixWriteRegion(e,t,n,a){this.setOutputMatrixWriteRegionDriver(n,e,a,t)}setOutputPackedMatrixWriteRegion(e,t,n,a){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")}debugValidate(){this.program!=null&&uh(this.gl,this.program),pd(this.gl)}executeProgram(){this.throwIfDisposed(),this.throwIfNoProgram();let e=this.gl;this.debug&&this.debugValidate(),xe(e,()=>e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0))}blockUntilAllProgramsCompleted(){this.throwIfDisposed(),xe(this.gl,()=>this.gl.finish())}getQueryTimerExtension(){return this.disjointQueryTimerExtension==null&&(this.disjointQueryTimerExtension=dd(this.gl,J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension}getQueryTimerExtensionWebGL2(){return this.getQueryTimerExtension()}getQueryTimerExtensionWebGL1(){return this.getQueryTimerExtension()}beginQuery(){if(J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){let n=this.gl,a=this.getQueryTimerExtensionWebGL2(),r=n.createQuery();return n.beginQuery(a.TIME_ELAPSED_EXT,r),r}let e=this.getQueryTimerExtensionWebGL1(),t=e.createQueryEXT();return e.beginQueryEXT(e.TIME_ELAPSED_EXT,t),t}endQuery(){if(J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){let t=this.gl,n=this.getQueryTimerExtensionWebGL2();t.endQuery(n.TIME_ELAPSED_EXT);return}let e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT)}async waitForQueryAndGetTime(e){return await k.repeatedTry(()=>this.disposed||this.isQueryAvailable(e,J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))),this.getQueryTime(e,J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}getQueryTime(e,t){if(t===0)return null;if(t===2){let n=this.gl;return n.getQueryParameter(e,n.QUERY_RESULT)/1e6}else{let n=this.getQueryTimerExtensionWebGL1();return n.getQueryObjectEXT(e,n.QUERY_RESULT_EXT)/1e6}}isQueryAvailable(e,t){if(t===0)return!0;if(t===2){let n=this.gl,a=this.getQueryTimerExtensionWebGL2(),r=n.getQueryParameter(e,n.QUERY_RESULT_AVAILABLE);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(a.GPU_DISJOINT_EXT)),r&&!this.disjoint}else{let n=this.getQueryTimerExtensionWebGL1(),a=n.getQueryObjectEXT(e,n.QUERY_RESULT_AVAILABLE_EXT);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(n.GPU_DISJOINT_EXT)),a&&!this.disjoint}}pollFence(e){return new Promise(t=>{this.addItemToPoll(()=>e.isFencePassed(),()=>t())})}pollItems(){let e=aL(this.itemsToPoll.map(t=>t.isDoneFn));for(let t=0;t<=e;++t){let{resolveFn:n}=this.itemsToPoll[t];n()}this.itemsToPoll=this.itemsToPoll.slice(e+1)}addItemToPoll(e,t){this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),!(this.itemsToPoll.length>1)&&k.repeatedTry(()=>(this.pollItems(),this.itemsToPoll.length===0))}bindTextureToFrameBuffer(e){this.throwIfDisposed(),dh(this.gl,e,this.framebuffer),this.debug&&pd(this.gl)}unbindTextureToFrameBuffer(){this.outputTexture!=null?(dh(this.gl,this.outputTexture,this.framebuffer),this.debug&&pd(this.gl)):s1(this.gl,this.framebuffer)}downloadMatrixDriver(e,t){this.bindTextureToFrameBuffer(e);let n=t();return this.unbindTextureToFrameBuffer(),n}setOutputMatrixTextureDriver(e,t,n){this.throwIfDisposed();let a=this.gl;dh(a,e,this.framebuffer),this.debug&&pd(a),this.outputTexture=e,xe(a,()=>a.viewport(0,0,t,n)),xe(a,()=>a.scissor(0,0,t,n))}setOutputMatrixWriteRegionDriver(e,t,n,a){this.throwIfDisposed(),xe(this.gl,()=>this.gl.scissor(e,t,n,a))}throwIfDisposed(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")}throwIfNoProgram(){if(this.program==null)throw new Error("No GPU program is currently set.")}};function aL(e){let t=0;for(;t{let m=k.sizeFromShape(h.shapeInfo.logicalShape);h.shapeInfo.isUniform?r.push(`uniform float ${h.name}${m>1?`[${m}]`:""};`):(r.push(`uniform sampler2D ${h.name};`),r.push(`uniform int offset${h.name};`))});let s=r.join(` +`),i=e.map(h=>rL(h,t,a)).join(` +`),o=t.texShape,l=dn(),d=oL(l),u,p,c=dL(l);return t.isPacked?(u=sL(t.logicalShape,o),p=uL(l)):(u=iL(t.logicalShape,o),p=lL(l)),a&&(c+=pL),[c,d,p,s,u,i,n].join(` +`)}function Ml(e){let t=e.shapeInfo.logicalShape;switch(t.length){case 0:return hL(e);case 1:return fL(e);case 2:return mL(e);case 3:return AL(e);case 4:return yL(e);case 5:return gL(e);case 6:return xL(e);default:throw new Error(`${t.length}-D input sampling is not yet supported`)}}function pv(e){switch(e.shapeInfo.logicalShape.length){case 0:return bL(e);case 1:return vL(e);case 2:return wL(e);case 3:return kL(e);default:return IL(e)}}function rL(e,t,n=!1){let a="";n?a+=pv(e):a+=Ml(e);let r=e.shapeInfo.logicalShape,s=t.logicalShape;return r.length<=s.length&&(n?a+=SL(e,t):a+=NL(e,t)),a}function sL(e,t){switch(e.length){case 0:return cv();case 1:return TL(e,t);case 2:return RL(e,t);case 3:return EL(e,t);default:return CL(e,t)}}function iL(e,t){switch(e.length){case 0:return cv();case 1:return ML(e,t);case 2:return zL(e,t);case 3:return FL(e,t);case 4:return $L(e,t);case 5:return DL(e,t);case 6:return OL(e,t);default:throw new Error(`${e.length}-D output sampling is not yet supported`)}}function oL(e){return` float sampleTexture(sampler2D textureSampler, vec2 uv) { return ${e.texture2D}(textureSampler, uv).r; } - `}function oL(e){return` + `}function lL(e){return` void setOutput(float val) { ${e.output} = vec4(val, 0, 0, 0); } - `}function lL(e){return` + `}function uL(e){return` void setOutput(vec4 val) { ${e.output} = val; } - `}function uL(e){return`${e.version} + `}function dL(e){return`${e.version} precision highp float; precision highp int; precision highp sampler2D; @@ -337,10 +337,10 @@ Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To spee return fract((p3.x + p3.y) * p3.z); } - ${zL} ${_L} ${PL} - `}var zL=` + ${LL} + `}var _L=` vec2 uvFromFlat(int texNumR, int texNumC, int index) { int texR = index / texNumC; int texC = index - texR * texNumC; @@ -352,7 +352,7 @@ vec2 packedUVfrom1D(int texNumR, int texNumC, int index) { int texC = texelIndex - texR * texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); } -`,_L=` +`,PL=` vec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR, int texNumC, int row, int col) { int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2); @@ -360,7 +360,7 @@ vec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR, int texC = texelIndex - texR * texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); } -`,PL=` +`,LL=` vec2 packedUVfrom3D(int texNumR, int texNumC, int texelsInBatch, int texelsInLogicalRow, int b, int row, int col) { @@ -369,7 +369,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, int texC = index - texR * texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); } -`,dL=` +`,pL=` float getChannel(vec4 frag, vec2 innerDims) { vec2 modCoord = mod(innerDims, 2.); return modCoord.x == 0. ? @@ -380,11 +380,11 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, float modCoord = mod(float(dim), 2.); return modCoord == 0. ? frag.r : frag.g; } -`;function pv(){return` +`;function cv(){return` int getOutputCoords() { return 0; } - `}function NL(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];return n[0]===1?` + `}function TL(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];return n[0]===1?` int getOutputCoords() { return 2 * int(resultUV.x * ${n[1]}.0); } @@ -398,7 +398,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, vec2(${n[0]}, ${n[1]})); return 2 * (resTexRC.x * ${n[1]} + resTexRC.y); } - `}function RL(e,t){return t[0]===1?` + `}function ML(e,t){return t[0]===1?` int getOutputCoords() { return int(resultUV.x * ${t[1]}.0); } @@ -412,7 +412,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, vec2(${t[0]}, ${t[1]})); return resTexRC.x * ${t[1]} + resTexRC.y; } - `}function TL(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],a=Math.ceil(e[2]/2),r=a*Math.ceil(e[1]/2);return` + `}function EL(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],a=Math.ceil(e[2]/2),r=a*Math.ceil(e[1]/2);return` ivec3 getOutputCoords() { ivec2 resTexRC = ivec2(resultUV.yx * vec2(${n[0]}, ${n[1]})); @@ -426,7 +426,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, return ivec3(b, r, c); } - `}function ML(e,t){let n=ki(["r","c","d"],e);return` + `}function FL(e,t){let n=Ii(["r","c","d"],e);return` ivec3 getOutputCoords() { ivec2 resTexRC = ivec2(resultUV.yx * vec2(${t[0]}, ${t[1]})); @@ -434,7 +434,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, ${n} return ivec3(r, c, d); } - `}function EL(e,t){let n=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],a=Math.ceil(e[e.length-1]/2),r=a*Math.ceil(e[e.length-2]/2),s=r,i="",o="b, r, c";for(let l=2;l=1?u="coords = 0;":u=o.map(A=>`coords.${p[A+d]} = 0;`).join(` + `}function SL(e,t){let n=e.name,a=n.charAt(0).toUpperCase()+n.slice(1),r="get"+a+"AtOutCoords",s=e.shapeInfo.logicalShape.length,i=t.logicalShape.length,o=dv(e.shapeInfo.logicalShape,t.logicalShape),l=lt(i),d=i-s,u,p=["x","y","z","w","u","v"];s===0?u="":i<2&&o.length>=1?u="coords = 0;":u=o.map(A=>`coords.${p[A+d]} = 0;`).join(` `);let c="";i<2&&s>0?c="coords":c=e.shapeInfo.logicalShape.map((A,y)=>`coords.${p[y+d]}`).join(", ");let h="return outputValue;",m=k.sizeFromShape(e.shapeInfo.logicalShape)===1,f=k.sizeFromShape(t.logicalShape)===1;if(s===1&&!m&&!f)h=` return vec4(outputValue.xy, outputValue.xy); `;else if(m&&!f)i===1?h=` @@ -814,22 +814,22 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, vec4 outputValue = get${a}(${c}); ${h} } - `}function SL(e,t){let n=e.name,a=n.charAt(0).toUpperCase()+n.slice(1),r="get"+a+"AtOutCoords",s=t.texShape,i=e.shapeInfo.texShape,o=e.shapeInfo.logicalShape.length,l=t.logicalShape.length;if(!e.shapeInfo.isUniform&&o===l&&e.shapeInfo.flatOffset==null&&k.arraysEqual(i,s))return` + `}function NL(e,t){let n=e.name,a=n.charAt(0).toUpperCase()+n.slice(1),r="get"+a+"AtOutCoords",s=t.texShape,i=e.shapeInfo.texShape,o=e.shapeInfo.logicalShape.length,l=t.logicalShape.length;if(!e.shapeInfo.isUniform&&o===l&&e.shapeInfo.flatOffset==null&&k.arraysEqual(i,s))return` float ${r}() { return sampleTexture(${n}, resultUV); } - `;let d=lt(l),u=uv(e.shapeInfo.logicalShape,t.logicalShape),p=l-o,c,h=["x","y","z","w","u","v"];o===0?c="":l<2&&u.length>=1?c="coords = 0;":c=u.map(f=>`coords.${h[f+p]} = 0;`).join(` + `;let d=lt(l),u=dv(e.shapeInfo.logicalShape,t.logicalShape),p=l-o,c,h=["x","y","z","w","u","v"];o===0?c="":l<2&&u.length>=1?c="coords = 0;":c=u.map(f=>`coords.${h[f+p]} = 0;`).join(` `);let m="";return l<2&&o>0?m="coords":m=e.shapeInfo.logicalShape.map((f,A)=>`coords.${h[A+p]}`).join(", "),` float ${r}() { ${d} coords = getOutputCoords(); ${c} return get${a}(${m}); } - `}function lt(e){if(e<=1)return"int";if(e===2)return"ivec2";if(e===3)return"ivec3";if(e===4)return"ivec4";if(e===5)return"ivec5";if(e===6)return"ivec6";throw Error(`GPU for rank ${e} is not yet supported`)}function Fl(e,t){let n=JSON.parse(JSON.stringify(e));return n.shapeInfo.logicalShape=t,n}function $l(e,t){return t.map(n=>e[n]).join(", ")}function LL(e,t,n,a){let r=t.userCode,s=n.map((h,m)=>{let f={logicalShape:h.shape,texShape:h.isUniform?null:h.texData.texShape,isUniform:h.isUniform,isPacked:h.isUniform?!1:h.texData.isPacked,flatOffset:null};return h.texData!=null&&h.texData.slice!=null&&h.texData.slice.flatOffset>0&&(f.flatOffset=h.texData.slice.flatOffset),{name:t.variableNames[m],shapeInfo:f}}),i=s.map(h=>h.shapeInfo),o={logicalShape:a.shape,texShape:a.texData.texShape,isUniform:!1,isPacked:a.texData.isPacked,flatOffset:null},l=pL(s,o,r,t.packedInputs),d=e.createProgram(l),u=null,p=e.getUniformLocation(d,"NAN",!1);J().getNumber("WEBGL_VERSION")===1&&(u=e.getUniformLocation(d,"INFINITY",!1));let c={};for(let h=0;h{let r=n.logicalShape,s=t[a],i=s.shape;if(!k.arraysEqual(r,i))throw Error(`Binary was compiled with different shapes than the current args. Shapes ${r} and ${i} must match`);if(n.isUniform&&s.isUniform)return;let o=n.texShape,l=s.isUniform?null:s.texData.texShape;if(!k.arraysEqual(o,l))throw Error(`Binary was compiled with different texture shapes than the current args. Shape ${o} and ${l} must match`)})}function WL(e,t,n,a,r){cv(t.inShapeInfos,n),cv([t.outShapeInfo],[a]);let s=a.texData.texture,i=a.texData.texShape;a.texData.isPacked?e.setOutputPackedMatrixTexture(s,i[0],i[1]):e.setOutputMatrixTexture(s,i[0],i[1]),e.setProgram(t.webGLProgram),J().getNumber("WEBGL_VERSION")===1&&t.infLoc!==null&&e.gl.uniform1f(t.infLoc,Infinity),t.nanLoc!==null&&e.gl.uniform1f(t.nanLoc,NaN),n.forEach((o,l)=>{let d=t.program.variableNames[l],u=t.uniformLocations[d],p=t.uniformLocations[`offset${d}`];if(u!=null){if(o.isUniform){if(k.sizeFromShape(o.shape)<2)e.gl.uniform1f(u,o.uniformValues[0]);else{let c=o.uniformValues;c instanceof Float32Array||(c=new Float32Array(c)),e.gl.uniform1fv(u,c)}return}o.texData.slice!=null&&p!=null&&e.gl.uniform1i(p,o.texData.slice.flatOffset),e.setInputMatrixTexture(o.texData.texture,u,l)}}),r!=null&&r(e,t.webGLProgram),e.executeProgram()}function BL(e,t,n){let a="";t.concat(n).forEach(i=>{let o=i.texData!=null&&i.texData.slice!=null&&i.texData.slice.flatOffset>0,l=i.isUniform?"uniform":i.texData.texShape;a+=`${i.shape}_${l}_${o}`});let r=e.userCode,s=e.constructor.name;return s+="_"+a+"_"+r,s}var{addImpl:VL,bincountImpl:hv,bincountReduceImpl:jL,ceilImpl:UL,concatImpl:HL,expImpl:GL,expm1Impl:qL,floorImpl:XL,gatherV2Impl:KL,greaterImpl:ZL,lessImpl:YL,linSpaceImpl:JL,logImpl:QL,maxImpl:eW,maximumImpl:tW,minimumImpl:nW,multiplyImpl:aW,negImpl:rW,prodImpl:sW,rangeImpl:iW,rsqrtImpl:oW,simpleAbsImpl:fv,sliceImpl:lW,sparseFillEmptyRowsImpl:uW,sparseReshapeImpl:dW,stridedSliceImpl:pW,subImpl:cW,tileImpl:hW,topKImpl:fW,transposeImpl:m1,uniqueImpl:mW}=jA;function mv(e,t){return["x","y","z","w","u","v"].slice(0,t).map(n=>`${e}.${n}`)}function pn(e,t){return t===1?[e]:mv(e,t)}function AW(e,t){if(e===1)return"rc";let n="";for(let a=0;ae[n]).join(", ")}function WL(e,t,n,a){let r=t.userCode,s=n.map((h,m)=>{let f={logicalShape:h.shape,texShape:h.isUniform?null:h.texData.texShape,isUniform:h.isUniform,isPacked:h.isUniform?!1:h.texData.isPacked,flatOffset:null};return h.texData!=null&&h.texData.slice!=null&&h.texData.slice.flatOffset>0&&(f.flatOffset=h.texData.slice.flatOffset),{name:t.variableNames[m],shapeInfo:f}}),i=s.map(h=>h.shapeInfo),o={logicalShape:a.shape,texShape:a.texData.texShape,isUniform:!1,isPacked:a.texData.isPacked,flatOffset:null},l=cL(s,o,r,t.packedInputs),d=e.createProgram(l),u=null,p=e.getUniformLocation(d,"NAN",!1);J().getNumber("WEBGL_VERSION")===1&&(u=e.getUniformLocation(d,"INFINITY",!1));let c={};for(let h=0;h{let r=n.logicalShape,s=t[a],i=s.shape;if(!k.arraysEqual(r,i))throw Error(`Binary was compiled with different shapes than the current args. Shapes ${r} and ${i} must match`);if(n.isUniform&&s.isUniform)return;let o=n.texShape,l=s.isUniform?null:s.texData.texShape;if(!k.arraysEqual(o,l))throw Error(`Binary was compiled with different texture shapes than the current args. Shape ${o} and ${l} must match`)})}function BL(e,t,n,a,r){hv(t.inShapeInfos,n),hv([t.outShapeInfo],[a]);let s=a.texData.texture,i=a.texData.texShape;a.texData.isPacked?e.setOutputPackedMatrixTexture(s,i[0],i[1]):e.setOutputMatrixTexture(s,i[0],i[1]),e.setProgram(t.webGLProgram),J().getNumber("WEBGL_VERSION")===1&&t.infLoc!==null&&e.gl.uniform1f(t.infLoc,Infinity),t.nanLoc!==null&&e.gl.uniform1f(t.nanLoc,NaN),n.forEach((o,l)=>{let d=t.program.variableNames[l],u=t.uniformLocations[d],p=t.uniformLocations[`offset${d}`];if(u!=null){if(o.isUniform){if(k.sizeFromShape(o.shape)<2)e.gl.uniform1f(u,o.uniformValues[0]);else{let c=o.uniformValues;c instanceof Float32Array||(c=new Float32Array(c)),e.gl.uniform1fv(u,c)}return}o.texData.slice!=null&&p!=null&&e.gl.uniform1i(p,o.texData.slice.flatOffset),e.setInputMatrixTexture(o.texData.texture,u,l)}}),r!=null&&r(e,t.webGLProgram),e.executeProgram()}function VL(e,t,n){let a="";t.concat(n).forEach(i=>{let o=i.texData!=null&&i.texData.slice!=null&&i.texData.slice.flatOffset>0,l=i.isUniform?"uniform":i.texData.texShape;a+=`${i.shape}_${l}_${o}`});let r=e.userCode,s=e.constructor.name;return s+="_"+a+"_"+r,s}var{addImpl:jL,bincountImpl:fv,bincountReduceImpl:UL,ceilImpl:HL,concatImpl:GL,expImpl:qL,expm1Impl:XL,floorImpl:KL,gatherV2Impl:ZL,greaterImpl:YL,lessImpl:JL,linSpaceImpl:QL,logImpl:eW,maxImpl:tW,maximumImpl:nW,minimumImpl:aW,multiplyImpl:rW,negImpl:sW,prodImpl:iW,rangeImpl:oW,rsqrtImpl:lW,simpleAbsImpl:mv,sliceImpl:uW,sparseFillEmptyRowsImpl:dW,sparseReshapeImpl:pW,stridedSliceImpl:cW,subImpl:hW,tileImpl:fW,topKImpl:mW,transposeImpl:A1,uniqueImpl:AW}=UA;function Av(e,t){return["x","y","z","w","u","v"].slice(0,t).map(n=>`${e}.${n}`)}function pn(e,t){return t===1?[e]:Av(e,t)}function yW(e,t){if(e===1)return"rc";let n="";for(let a=0;a ${t[0]}`;let a="";for(let r=e-2;r= ${t[r]}`,r ${t[0]}`;let a="";for(let r=e-2;r= ${t[r]}`,r= ${t}; bool rEdge = rp1 >= ${n}; - `}function xW(e,t){let n=e.length,a=vW(n,t);return n===1?`getA(rc), + `}function bW(e,t){let n=e.length,a=wW(n,t);return n===1?`getA(rc), rc + 1 >= ${e[0]} ? 0. : getA(rc + 1), 0, 0`:`getA(${a[0]}), cEdge ? 0. : getA(${a[1]}), rEdge ? 0. : getA(${a[2]}), - rEdge || cEdge ? 0. : getA(${a[3]})`}var Av=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e;let n="";for(let a=0;a<4;a++){let r="thisRC = rc;";a%2==1&&(r+="thisRC.z += 1;"),a>1&&(r+="thisRC.y += 1;"),n+=` + rEdge || cEdge ? 0. : getA(${a[3]})`}var yv=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e;let n="";for(let a=0;a<4;a++){let r="thisRC = rc;";a%2==1&&(r+="thisRC.z += 1;"),a>1&&(r+="thisRC.y += 1;"),n+=` ${r} ${a>0?"if(thisRC.y < rows && thisRC.z < cols){":""} int flatIndex = getFlatIndex(thisRC); @@ -866,8 +866,8 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims); ${a>0?"}":""} `}this.userCode=` - ${wW(t)} - ${u1(e)} + ${kW(t)} + ${d1(e)} void main() { ivec3 rc = getOutputCoords(); @@ -882,12 +882,12 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, setOutput(result); } - `}};function wW(e){return` + `}};function kW(e){return` ivec3 inputCoordsFromReshapedOutCoords(int index) { - ${ki(["r","c","d"],e)} + ${Ii(["r","c","d"],e)} return ivec3(r, c, d); } - `}var kW=class{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){let a=gv(t,n),r=xv(e,a,n);r in this.freeTextures||(this.freeTextures[r]=[]),r in this.usedTextures||(this.usedTextures[r]=[]);let s=yv(e,a,this.gpgpu.gl,this.gpgpu.textureConfig,n);if(this.freeTextures[r].length>0){this.numFreeTextures--,this.numUsedTextures++,this._numBytesFree-=s,this.log();let o=this.freeTextures[r].shift();return this.usedTextures[r].push(o),o}let i;return a===Qt.PACKED_2X2_FLOAT32?i=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):a===Qt.PACKED_2X2_FLOAT16?i=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):a===Qt.UNPACKED_FLOAT32?i=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):a===Qt.UNPACKED_FLOAT16?i=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):a===Qt.PACKED_4X1_UNSIGNED_BYTE&&(i=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[r].push(i),this.numUsedTextures++,this._numBytesAllocated+=s,this.log(),i}releaseTexture(e,t,n,a){if(this.freeTextures==null)return;let r=gv(n,a),s=xv(t,r,a);s in this.freeTextures||(this.freeTextures[s]=[]);let i=yv(t,r,this.gpgpu.gl,this.gpgpu.textureConfig,a),o=J().get("WEBGL_DELETE_TEXTURE_THRESHOLD");o!==-1&&this._numBytesAllocated>o?(this.gpgpu.deleteMatrixTexture(e),this._numBytesAllocated-=i):(this.freeTextures[s].push(e),this.numFreeTextures++,this._numBytesFree+=i),this.numUsedTextures--;let l=this.usedTextures[s],d=l.indexOf(e);if(d<0)throw new Error("Cannot release a texture that was never provided by this texture manager");l.splice(d,1),this.log()}log(){if(!this.logEnabled)return;let e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",`${this.numFreeTextures} / ${this.numUsedTextures}`,`(${e})`);let 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(this.freeTextures!=null){for(let e in this.freeTextures)this.freeTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t)});for(let e in this.usedTextures)this.usedTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0}}};function IW(e,t){let n=e;if(t===n.R32F)return 4;if(t===n.R16F)return 2;if(t===n.RGBA32F||t===e.RGBA)return 16;if(t===n.RGBA16F)return 8;throw new Error(`Unknown internal format ${t}`)}function yv(e,t,n,a,r){let s=SW(t,a),i;if(r){let[l,d]=Cl(e[0],e[1]);i=l*d}else{let[l,d]=hd(e[0],e[1]);i=l*d}let o=IW(n,s);return i*o}function SW(e,t){switch(e){case Qt.PACKED_2X2_FLOAT32:return h1(t);case Qt.PACKED_2X2_FLOAT16:return f1(t);case Qt.UNPACKED_FLOAT32:return d1(t);case Qt.UNPACKED_FLOAT16:return p1(t);case Qt.PACKED_4X1_UNSIGNED_BYTE:return c1(t);default:throw new Error(`Unknown physical texture type ${e}`)}}function NW(e){return J().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?e?Qt.PACKED_2X2_FLOAT32:Qt.UNPACKED_FLOAT32:e?Qt.PACKED_2X2_FLOAT16:Qt.UNPACKED_FLOAT16}function gv(e,t){if(e===Yn.UPLOAD)return Qt.PACKED_2X2_FLOAT32;if(e===Yn.RENDER||e==null)return NW(t);if(e===Yn.DOWNLOAD||e===Yn.PIXELS)return Qt.PACKED_4X1_UNSIGNED_BYTE;throw new Error(`Unknown logical texture type ${e}`)}function xv(e,t,n){return`${e[0]}_${e[1]}_${t}_${n}`}var Pr=class{constructor(e,t){this.variableNames=["A"],this.outputShape=e,this.userCode=` + `}var IW=class{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){let a=xv(t,n),r=bv(e,a,n);r in this.freeTextures||(this.freeTextures[r]=[]),r in this.usedTextures||(this.usedTextures[r]=[]);let s=gv(e,a,this.gpgpu.gl,this.gpgpu.textureConfig,n);if(this.freeTextures[r].length>0){this.numFreeTextures--,this.numUsedTextures++,this._numBytesFree-=s,this.log();let o=this.freeTextures[r].shift();return this.usedTextures[r].push(o),o}let i;return a===Qt.PACKED_2X2_FLOAT32?i=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):a===Qt.PACKED_2X2_FLOAT16?i=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):a===Qt.UNPACKED_FLOAT32?i=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):a===Qt.UNPACKED_FLOAT16?i=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):a===Qt.PACKED_4X1_UNSIGNED_BYTE&&(i=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[r].push(i),this.numUsedTextures++,this._numBytesAllocated+=s,this.log(),i}releaseTexture(e,t,n,a){if(this.freeTextures==null)return;let r=xv(n,a),s=bv(t,r,a);s in this.freeTextures||(this.freeTextures[s]=[]);let i=gv(t,r,this.gpgpu.gl,this.gpgpu.textureConfig,a),o=J().get("WEBGL_DELETE_TEXTURE_THRESHOLD");o!==-1&&this._numBytesAllocated>o?(this.gpgpu.deleteMatrixTexture(e),this._numBytesAllocated-=i):(this.freeTextures[s].push(e),this.numFreeTextures++,this._numBytesFree+=i),this.numUsedTextures--;let l=this.usedTextures[s],d=l.indexOf(e);if(d<0)throw new Error("Cannot release a texture that was never provided by this texture manager");l.splice(d,1),this.log()}log(){if(!this.logEnabled)return;let e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",`${this.numFreeTextures} / ${this.numUsedTextures}`,`(${e})`);let 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(this.freeTextures!=null){for(let e in this.freeTextures)this.freeTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t)});for(let e in this.usedTextures)this.usedTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0}}};function SW(e,t){let n=e;if(t===n.R32F)return 4;if(t===n.R16F)return 2;if(t===n.RGBA32F||t===e.RGBA)return 16;if(t===n.RGBA16F)return 8;throw new Error(`Unknown internal format ${t}`)}function gv(e,t,n,a,r){let s=NW(t,a),i;if(r){let[l,d]=Rl(e[0],e[1]);i=l*d}else{let[l,d]=fd(e[0],e[1]);i=l*d}let o=SW(n,s);return i*o}function NW(e,t){switch(e){case Qt.PACKED_2X2_FLOAT32:return f1(t);case Qt.PACKED_2X2_FLOAT16:return m1(t);case Qt.UNPACKED_FLOAT32:return p1(t);case Qt.UNPACKED_FLOAT16:return c1(t);case Qt.PACKED_4X1_UNSIGNED_BYTE:return h1(t);default:throw new Error(`Unknown physical texture type ${e}`)}}function TW(e){return J().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?e?Qt.PACKED_2X2_FLOAT32:Qt.UNPACKED_FLOAT32:e?Qt.PACKED_2X2_FLOAT16:Qt.UNPACKED_FLOAT16}function xv(e,t){if(e===Yn.UPLOAD)return Qt.PACKED_2X2_FLOAT32;if(e===Yn.RENDER||e==null)return TW(t);if(e===Yn.DOWNLOAD||e===Yn.PIXELS)return Qt.PACKED_4X1_UNSIGNED_BYTE;throw new Error(`Unknown logical texture type ${e}`)}function bv(e,t,n){return`${e[0]}_${e[1]}_${t}_${n}`}var Lr=class{constructor(e,t){this.variableNames=["A"],this.outputShape=e,this.userCode=` float unaryOperation(float x) { ${t} } @@ -898,11 +898,11 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, setOutput(y); } - `}},ga="if (isnan(x)) return x;",TW="return x;",bv="return abs(x);",EW="return (x >= 0.0) ? x : (exp(x) - 1.0);",CW=ga+` + `}},ga="if (isnan(x)) return x;",EW="return x;",vv="return abs(x);",CW="return (x >= 0.0) ? x : (exp(x) - 1.0);",RW=ga+` return (x < 0.0) ? 0.0 : x; -`,RW=ga+` +`,MW=ga+` return (x < 0.0) ? 0.0 : min(6.0, x); -`,Ah="return x;",MW="return 1.0 / (1.0 + exp(-1.0 * x));",FW="return x;",$W=` +`,yh="return x;",FW="return 1.0 / (1.0 + exp(-1.0 * x));",$W="return x;",DW=` vec4 result; result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0); @@ -911,7 +911,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0); return result; -`,DW=` +`,OW=` vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0))); bvec4 isNaN = isnan(x); @@ -921,7 +921,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, result.a = isNaN.a ? x.a : result.a; return result; -`,OW=` +`,zW=` vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0))); bvec4 isNaN = isnan(x); @@ -931,7 +931,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, result.a = isNaN.a ? x.a : result.a; return result; -`,zW="return 1.0 / (1.0 + exp(-1.0 * x));",Dl=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.userCode=` +`,_W="return 1.0 / (1.0 + exp(-1.0 * x));",Ol=class{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.userCode=` vec4 unaryOperation(vec4 x) { ${t} } @@ -942,17 +942,17 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, setOutput(y); } - `}},_W=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=e;let t=e.length,n=pn("rc",t),a=lt(t),r=AW(t,n),s=n.slice(-2),i=t<=1?"rc":`vec2(${s.join(",")})`;this.userCode=` + `}},PW=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=e;let t=e.length,n=pn("rc",t),a=lt(t),r=yW(t,n),s=n.slice(-2),i=t<=1?"rc":`vec2(${s.join(",")})`;this.userCode=` void main() { ${a} rc = getOutputCoords(); vec4 packedInput = getA(${r}); setOutput(getChannel(packedInput, ${i})); } - `}},PW=La.whereImpl,LW=1e-7,WW=1e-4,A1={};function BW(e){return e in A1||(A1[e]={}),A1[e]}var VW=128,jW=600;function UW(){return J().global.screen==null?1024:J().global.screen.height*J().global.screen.width*window.devicePixelRatio*jW/1024/1024}var Ol=class extends hu{constructor(e){super();if(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,!J().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");if(e==null){let t=Ba(J().getNumber("WEBGL_VERSION"));this.binaryCache=BW(J().getNumber("WEBGL_VERSION")),this.gpgpu=new mh(t),this.canvas=t.canvas,this.gpgpuCreatedLocally=!0}else this.gpgpu=e,this.binaryCache={},this.gpgpuCreatedLocally=!1,this.canvas=e.gl.canvas;this.textureManager=new kW(this.gpgpu),this.numMBBeforeWarning=UW(),this.texData=new Ip(this,tr())}nextDataId(){return Ol.nextDataId++}numDataIds(){return this.texData.numDataIds()-this.pendingDeletes}write(e,t,n){if((J().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS")||J().getBool("DEBUG"))&&this.checkNumericalProblems(e),n==="complex64"&&e!=null)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");let a={id:this.nextDataId()};return this.texData.set(a,{shape:t,dtype:n,values:e,usage:Yn.UPLOAD,refCount:1}),a}refCount(e){return this.texData.has(e)?this.texData.get(e).refCount:0}incRef(e){let t=this.texData.get(e);t.refCount++}decRef(e){if(this.texData.has(e)){let t=this.texData.get(e);t.refCount--}}move(e,t,n,a,r){if(J().getBool("DEBUG")&&this.checkNumericalProblems(t),a==="complex64")throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:n,dtype:a,values:t,usage:Yn.UPLOAD,refCount:r})}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}readSync(e){let t=this.texData.get(e),{values:n,dtype:a,complexTensorInfos:r,slice:s,shape:i,isPacked:o}=t;if(s!=null){let p;o?p=new Dl(i,Ah):p=new Pr(i,Ah);let c=this.runWebGLProgram(p,[{dataId:e,shape:i,dtype:a}],a),h=this.readSync(c.dataId);return this.disposeIntermediateTensorInfo(c),h}if(n!=null)return this.convertAndCacheOnCPU(e);if(a==="string")return n;let l=this.activeTimers!=null,d;l&&(d=k.now());let u;if(a==="complex64"){let p=this.readSync(r.real.dataId),c=this.readSync(r.imag.dataId);u=C.mergeRealAndImagArrays(p,c)}else u=this.getValuesFromTexture(e);return l&&(this.downloadWaitMs+=k.now()-d),this.convertAndCacheOnCPU(e,u)}async read(e){if(this.pendingRead.has(e)){let h=this.pendingRead.get(e);return new Promise(m=>h.push(m))}let t=this.texData.get(e),{values:n,shape:a,slice:r,dtype:s,complexTensorInfos:i,isPacked:o}=t;if(r!=null){let h;o?h=new Dl(a,Ah):h=new Pr(a,Ah);let m=this.runWebGLProgram(h,[{dataId:e,shape:a,dtype:s}],s),f=this.read(m.dataId);return this.disposeIntermediateTensorInfo(m),f}if(n!=null)return this.convertAndCacheOnCPU(e);if(!J().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&J().getNumber("WEBGL_VERSION")===2)throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");let l=null,d;if(s!=="complex64"&&J().get("WEBGL_BUFFER_SUPPORTED")){d=this.decode(e);let h=this.texData.get(d.dataId);l=this.gpgpu.createBufferFromTexture(h.texture,...fd(a))}this.pendingRead.set(e,[]),s!=="complex64"&&await this.gpgpu.createAndWaitForFence();let u;if(s==="complex64"){let h=await Promise.all([this.read(i.real.dataId),this.read(i.imag.dataId)]),m=h[0],f=h[1];u=C.mergeRealAndImagArrays(m,f)}else if(l==null)u=this.getValuesFromTexture(e);else{let h=k.sizeFromShape(a);u=this.gpgpu.downloadFloat32MatrixFromBuffer(l,h)}d!=null&&this.disposeIntermediateTensorInfo(d);let p=this.convertAndCacheOnCPU(e,u),c=this.pendingRead.get(e);return this.pendingRead.delete(e),c.forEach(h=>h(p)),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e)&&tr().removeDataId(e,this),this.pendingDeletes--),p}bufferSync(e){let t=this.readSync(e.dataId),n=t;if(e.dtype==="string")try{n=t.map(a=>k.decodeString(a))}catch(a){throw new Error("Failed to decode encoded string bytes into utf-8")}return We(e.shape,e.dtype,n)}checkNumericalProblems(e){if(e!=null)for(let t=0;t0}async time(e){let t=this.activeTimers,n=[],a=!1;this.programTimersStack==null?(this.programTimersStack=n,a=!0):this.activeTimers.push(n),this.activeTimers=n,e();let r=k.flatten(this.activeTimers.map(o=>o.query)).filter(o=>o!=null),s=k.flatten(this.activeTimers.map(o=>o.name)).filter(o=>o!=null);this.activeTimers=t,a&&(this.programTimersStack=null);let i={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null};if(J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0){let o=await Promise.all(r);i.kernelMs=k.sum(o),i.getExtraProfileInfo=()=>o.map((l,d)=>({name:s[d],ms:l})).map(l=>`${l.name}: ${l.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 J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:k.now(),endMs:null}}endTimer(e){return J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=k.now(),e)}async getQueryTime(e){if(J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0)return this.gpgpu.waitForQueryAndGetTime(e);let 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);let{complexTensorInfos:n}=this.texData.get(e);return n!=null&&(this.disposeData(n.real.dataId,t),this.disposeData(n.imag.dataId,t)),this.texData.delete(e),!0}releaseGPUData(e){let{texture:t,dtype:n,texShape:a,usage:r,isPacked:s,slice:i}=this.texData.get(e),o=i&&i.origDataId||e,l=this.dataRefCount.get(o);l>1?this.dataRefCount.set(o,l-1):(this.dataRefCount.delete(o),t!=null&&(this.numBytesInGPU-=this.computeBytes(a,n),this.textureManager.releaseTexture(t,a,r,s)));let d=this.texData.get(e);d.texture=null,d.texShape=null,d.isPacked=!1,d.slice=null}getTexture(e){return this.uploadToGPU(e),this.texData.get(e).texture}getDataInfo(e){return this.texData.get(e)}shouldExecuteOnCPU(e,t=VW){return J().getBool("WEBGL_CPU_FORWARD")&&e.every(n=>this.texData.get(n.dataId).texture==null&&k.sizeFromShape(n.shape)0&&k.isString(n[0])){let r=n.map(s=>k.encodeString(s));a=this.write(r,e,t)}else a=this.write(n,e,t);return this.texData.get(a).usage=null,{dataId:a,shape:e,dtype:t}}makeOutput(e,t,n){let{dataId:a}=this.makeTensorInfo(e,t,n);return tr().makeTensorFromDataId(a,e,t,this)}unpackTensor(e){let t=new _W(e.shape);return this.runWebGLProgram(t,[e],e.dtype)}packTensor(e){let t=new bW(e.shape),n=!0;return this.runWebGLProgram(t,[e],e.dtype,null,n)}packedReshape(e,t){let n=[bi(e.shape),...vi(e.shape)],a={dtype:e.dtype,shape:n,dataId:e.dataId},r=[bi(t),...vi(t)],s=new Av(r,n),i=!0,o=this.runWebGLProgram(s,[a],e.dtype,null,i);return{dataId:o.dataId,shape:t,dtype:o.dtype}}decode(e){let t=this.texData.get(e),{isPacked:n,shape:a,dtype:r}=t,s=dh(a),i;n?i=new YP(s):i=new ZP(s);let o=!0,l=this.runWebGLProgram(i,[{shape:s,dtype:r,dataId:e}],r,null,o);return{dtype:r,shape:a,dataId:l.dataId}}runWebGLProgram(e,t,n,a,r=!1){let s=this.makeTensorInfo(e.outputShape,n),i=this.texData.get(s.dataId);if(e.packedOutput&&(i.isPacked=!0),e.outPackingScheme===cd.DENSE){let f=fd(e.outputShape);i.texShape=f.map(A=>A*2)}if(e.outTexUsage!=null&&(i.usage=e.outTexUsage),k.sizeFromShape(s.shape)===0)return i.values=k.getTypedArrayFromDType(s.dtype,0),s;let o=[],l=t.map(f=>{if(f.dtype==="complex64")throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");let A=this.texData.get(f.dataId);if(A.texture==null){if(!e.packedInputs&&k.sizeFromShape(f.shape)<=J().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:f.shape,texData:null,isUniform:!0,uniformValues:A.values};e.packedInputs&&(A.isPacked=!0,A.shape=f.shape)}else if(!!A.isPacked!=!!e.packedInputs)f=A.isPacked?this.unpackTensor(f):this.packTensor(f),o.push(f),A=this.texData.get(f.dataId);else if(A.isPacked&&!pd(A.shape,f.shape)){let y=f,g=f.shape;f.shape=A.shape,f=this.packedReshape(f,g),o.push(f),A=this.texData.get(f.dataId),y.shape=g}return this.uploadToGPU(f.dataId),{shape:f.shape,texData:A,isUniform:!1}});this.uploadToGPU(s.dataId);let d={shape:s.shape,texData:i,isUniform:!1},u=BL(e,l,d),p=this.getAndSaveBinary(u,()=>LL(this.gpgpu,e,l,d)),c=this.activeTimers!=null,h;c&&(h=this.startTimer()),WL(this.gpgpu,p,l,d,a),o.forEach(f=>this.disposeIntermediateTensorInfo(f)),c&&(h=this.endTimer(h),this.activeTimers.push({name:e.constructor.name,query:this.getQueryTime(h)}));let m=J().get("WEBGL_FLUSH_THRESHOLD");if(m>0){let f=k.now();f-this.lastGlFlushTime>m&&(this.gpgpu.gl.flush(),this.lastGlFlushTime=f)}if(!J().getBool("WEBGL_LAZILY_UNPACK")&&i.isPacked&&r===!1){let f=this.unpackTensor(s);return this.disposeIntermediateTensorInfo(s),f}return s}compileAndRun(e,t,n,a,r=!1){return n=n||t[0].dtype,this.runWebGLProgram(e,t,n,a,r)}getAndSaveBinary(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]}getTextureManager(){return this.textureManager}dispose(){this.disposed||(J().getBool("IS_TEST")||Object.keys(this.binaryCache).forEach(e=>{this.gpgpu.deleteProgram(this.binaryCache[e].webGLProgram),delete this.binaryCache[e]}),this.textureManager.dispose(),this.canvas!=null&&typeof HTMLCanvasElement!="undefined"&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0)}floatPrecision(){return this.floatPrecisionValue==null&&(this.floatPrecisionValue=W(()=>{if(!J().get("WEBGL_RENDER_FLOAT32_ENABLED")){let e=J().getBool("DEBUG");J().set("DEBUG",!1);let t=this.abs(Se(1e-8)).dataSync()[0];if(J().set("DEBUG",e),t>0)return 32}return 16})),this.floatPrecisionValue}epsilon(){return this.floatPrecision()===32?LW:WW}uploadToGPU(e){let t=this.texData.get(e),{shape:n,dtype:a,values:r,texture:s,usage:i,isPacked:o}=t;if(s!=null)return;let l=this.activeTimers!=null,d;l&&(d=k.now());let u=t.texShape;if(u==null&&(u=_7(n,o),t.texShape=u),r!=null){let p=dh(n),c,h=u[1],m=u[0],f=r instanceof Uint8Array;o?([h,m]=Cl(u[0],u[1]),c=new tL(p,[m,h],f)):c=new eL(p,[m,h],f);let A=this.makeTensorInfo([m,h],a);f?this.texData.get(A.dataId).usage=Yn.PIXELS:this.texData.get(A.dataId).usage=Yn.UPLOAD,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(A.dataId),h,m,r);let y=!0,g=this.runWebGLProgram(c,[A],a,null,y),x=this.texData.get(g.dataId);t.texture=x.texture,t.texShape=x.texShape,t.isPacked=x.isPacked,t.usage=x.usage,this.disposeIntermediateTensorInfo(A),this.texData.delete(g.dataId),t.values=null,l&&(this.uploadWaitMs+=k.now()-d)}else{let p=this.acquireTexture(u,i,a,o);t.texture=p}}convertAndCacheOnCPU(e,t){let n=this.texData.get(e),{dtype:a}=n;return this.releaseGPUData(e),t!=null&&(n.values=HW(t,a)),n.values}acquireTexture(e,t,n,a){if(this.numBytesInGPU+=this.computeBytes(e,n),!this.warnedAboutMemory&&this.numBytesInGPU>this.numMBBeforeWarning*1024*1024){let r=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn(`High memory usage in GPU: ${r} MB, most likely due to a memory leak`)}return this.textureManager.acquireTexture(e,t,a)}computeBytes(e,t){return e[0]*e[1]*k.bytesPerElement(t)}};Ol.nextDataId=0;function HW(e,t){if(t==="float32"||t==="complex64")return e;if(t==="int32"||t==="bool"){let n=t==="int32"?new Int32Array(e.length):new Uint8Array(e.length);for(let a=0;anew Ol,2);var GW={forceHalfFloat:wv},kv=` + `}},LW=Wa.whereImpl,WW=1e-7,BW=1e-4,y1={};function VW(e){return e in y1||(y1[e]={}),y1[e]}var jW=128,UW=600;function HW(){return J().global.screen==null?1024:J().global.screen.height*J().global.screen.width*window.devicePixelRatio*UW/1024/1024}var zl=class extends fu{constructor(e){super();if(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,!J().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");if(e==null){let t=Va(J().getNumber("WEBGL_VERSION"));this.binaryCache=VW(J().getNumber("WEBGL_VERSION")),this.gpgpu=new Ah(t),this.canvas=t.canvas,this.gpgpuCreatedLocally=!0}else this.gpgpu=e,this.binaryCache={},this.gpgpuCreatedLocally=!1,this.canvas=e.gl.canvas;this.textureManager=new IW(this.gpgpu),this.numMBBeforeWarning=HW(),this.texData=new Sp(this,nr())}nextDataId(){return zl.nextDataId++}numDataIds(){return this.texData.numDataIds()-this.pendingDeletes}write(e,t,n){if((J().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS")||J().getBool("DEBUG"))&&this.checkNumericalProblems(e),n==="complex64"&&e!=null)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");let a={id:this.nextDataId()};return this.texData.set(a,{shape:t,dtype:n,values:e,usage:Yn.UPLOAD,refCount:1}),a}refCount(e){return this.texData.has(e)?this.texData.get(e).refCount:0}incRef(e){let t=this.texData.get(e);t.refCount++}decRef(e){if(this.texData.has(e)){let t=this.texData.get(e);t.refCount--}}move(e,t,n,a,r){if(J().getBool("DEBUG")&&this.checkNumericalProblems(t),a==="complex64")throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:n,dtype:a,values:t,usage:Yn.UPLOAD,refCount:r})}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}readSync(e){let t=this.texData.get(e),{values:n,dtype:a,complexTensorInfos:r,slice:s,shape:i,isPacked:o}=t;if(s!=null){let p;o?p=new Ol(i,yh):p=new Lr(i,yh);let c=this.runWebGLProgram(p,[{dataId:e,shape:i,dtype:a}],a),h=this.readSync(c.dataId);return this.disposeIntermediateTensorInfo(c),h}if(n!=null)return this.convertAndCacheOnCPU(e);if(a==="string")return n;let l=this.activeTimers!=null,d;l&&(d=k.now());let u;if(a==="complex64"){let p=this.readSync(r.real.dataId),c=this.readSync(r.imag.dataId);u=C.mergeRealAndImagArrays(p,c)}else u=this.getValuesFromTexture(e);return l&&(this.downloadWaitMs+=k.now()-d),this.convertAndCacheOnCPU(e,u)}async read(e){if(this.pendingRead.has(e)){let h=this.pendingRead.get(e);return new Promise(m=>h.push(m))}let t=this.texData.get(e),{values:n,shape:a,slice:r,dtype:s,complexTensorInfos:i,isPacked:o}=t;if(r!=null){let h;o?h=new Ol(a,yh):h=new Lr(a,yh);let m=this.runWebGLProgram(h,[{dataId:e,shape:a,dtype:s}],s),f=this.read(m.dataId);return this.disposeIntermediateTensorInfo(m),f}if(n!=null)return this.convertAndCacheOnCPU(e);if(!J().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&J().getNumber("WEBGL_VERSION")===2)throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");let l=null,d;if(s!=="complex64"&&J().get("WEBGL_BUFFER_SUPPORTED")){d=this.decode(e);let h=this.texData.get(d.dataId);l=this.gpgpu.createBufferFromTexture(h.texture,...md(a))}this.pendingRead.set(e,[]),s!=="complex64"&&await this.gpgpu.createAndWaitForFence();let u;if(s==="complex64"){let h=await Promise.all([this.read(i.real.dataId),this.read(i.imag.dataId)]),m=h[0],f=h[1];u=C.mergeRealAndImagArrays(m,f)}else if(l==null)u=this.getValuesFromTexture(e);else{let h=k.sizeFromShape(a);u=this.gpgpu.downloadFloat32MatrixFromBuffer(l,h)}d!=null&&this.disposeIntermediateTensorInfo(d);let p=this.convertAndCacheOnCPU(e,u),c=this.pendingRead.get(e);return this.pendingRead.delete(e),c.forEach(h=>h(p)),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e)&&nr().removeDataId(e,this),this.pendingDeletes--),p}bufferSync(e){let t=this.readSync(e.dataId),n=t;if(e.dtype==="string")try{n=t.map(a=>k.decodeString(a))}catch(a){throw new Error("Failed to decode encoded string bytes into utf-8")}return We(e.shape,e.dtype,n)}checkNumericalProblems(e){if(e!=null)for(let t=0;t0}async time(e){let t=this.activeTimers,n=[],a=!1;this.programTimersStack==null?(this.programTimersStack=n,a=!0):this.activeTimers.push(n),this.activeTimers=n,e();let r=k.flatten(this.activeTimers.map(o=>o.query)).filter(o=>o!=null),s=k.flatten(this.activeTimers.map(o=>o.name)).filter(o=>o!=null);this.activeTimers=t,a&&(this.programTimersStack=null);let i={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null};if(J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0){let o=await Promise.all(r);i.kernelMs=k.sum(o),i.getExtraProfileInfo=()=>o.map((l,d)=>({name:s[d],ms:l})).map(l=>`${l.name}: ${l.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 J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:k.now(),endMs:null}}endTimer(e){return J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=k.now(),e)}async getQueryTime(e){if(J().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0)return this.gpgpu.waitForQueryAndGetTime(e);let 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);let{complexTensorInfos:n}=this.texData.get(e);return n!=null&&(this.disposeData(n.real.dataId,t),this.disposeData(n.imag.dataId,t)),this.texData.delete(e),!0}releaseGPUData(e){let{texture:t,dtype:n,texShape:a,usage:r,isPacked:s,slice:i}=this.texData.get(e),o=i&&i.origDataId||e,l=this.dataRefCount.get(o);l>1?this.dataRefCount.set(o,l-1):(this.dataRefCount.delete(o),t!=null&&(this.numBytesInGPU-=this.computeBytes(a,n),this.textureManager.releaseTexture(t,a,r,s)));let d=this.texData.get(e);d.texture=null,d.texShape=null,d.isPacked=!1,d.slice=null}getTexture(e){return this.uploadToGPU(e),this.texData.get(e).texture}getDataInfo(e){return this.texData.get(e)}shouldExecuteOnCPU(e,t=jW){return J().getBool("WEBGL_CPU_FORWARD")&&e.every(n=>this.texData.get(n.dataId).texture==null&&k.sizeFromShape(n.shape)0&&k.isString(n[0])){let r=n.map(s=>k.encodeString(s));a=this.write(r,e,t)}else a=this.write(n,e,t);return this.texData.get(a).usage=null,{dataId:a,shape:e,dtype:t}}makeOutput(e,t,n){let{dataId:a}=this.makeTensorInfo(e,t,n);return nr().makeTensorFromDataId(a,e,t,this)}unpackTensor(e){let t=new PW(e.shape);return this.runWebGLProgram(t,[e],e.dtype)}packTensor(e){let t=new vW(e.shape),n=!0;return this.runWebGLProgram(t,[e],e.dtype,null,n)}packedReshape(e,t){let n=[vi(e.shape),...wi(e.shape)],a={dtype:e.dtype,shape:n,dataId:e.dataId},r=[vi(t),...wi(t)],s=new yv(r,n),i=!0,o=this.runWebGLProgram(s,[a],e.dtype,null,i);return{dataId:o.dataId,shape:t,dtype:o.dtype}}decode(e){let t=this.texData.get(e),{isPacked:n,shape:a,dtype:r}=t,s=ph(a),i;n?i=new JP(s):i=new YP(s);let o=!0,l=this.runWebGLProgram(i,[{shape:s,dtype:r,dataId:e}],r,null,o);return{dtype:r,shape:a,dataId:l.dataId}}runWebGLProgram(e,t,n,a,r=!1){let s=this.makeTensorInfo(e.outputShape,n),i=this.texData.get(s.dataId);if(e.packedOutput&&(i.isPacked=!0),e.outPackingScheme===hd.DENSE){let f=md(e.outputShape);i.texShape=f.map(A=>A*2)}if(e.outTexUsage!=null&&(i.usage=e.outTexUsage),k.sizeFromShape(s.shape)===0)return i.values=k.getTypedArrayFromDType(s.dtype,0),s;let o=[],l=t.map(f=>{if(f.dtype==="complex64")throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");let A=this.texData.get(f.dataId);if(A.texture==null){if(!e.packedInputs&&k.sizeFromShape(f.shape)<=J().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:f.shape,texData:null,isUniform:!0,uniformValues:A.values};e.packedInputs&&(A.isPacked=!0,A.shape=f.shape)}else if(!!A.isPacked!=!!e.packedInputs)f=A.isPacked?this.unpackTensor(f):this.packTensor(f),o.push(f),A=this.texData.get(f.dataId);else if(A.isPacked&&!cd(A.shape,f.shape)){let y=f,g=f.shape;f.shape=A.shape,f=this.packedReshape(f,g),o.push(f),A=this.texData.get(f.dataId),y.shape=g}return this.uploadToGPU(f.dataId),{shape:f.shape,texData:A,isUniform:!1}});this.uploadToGPU(s.dataId);let d={shape:s.shape,texData:i,isUniform:!1},u=VL(e,l,d),p=this.getAndSaveBinary(u,()=>WL(this.gpgpu,e,l,d)),c=this.activeTimers!=null,h;c&&(h=this.startTimer()),BL(this.gpgpu,p,l,d,a),o.forEach(f=>this.disposeIntermediateTensorInfo(f)),c&&(h=this.endTimer(h),this.activeTimers.push({name:e.constructor.name,query:this.getQueryTime(h)}));let m=J().get("WEBGL_FLUSH_THRESHOLD");if(m>0){let f=k.now();f-this.lastGlFlushTime>m&&(this.gpgpu.gl.flush(),this.lastGlFlushTime=f)}if(!J().getBool("WEBGL_LAZILY_UNPACK")&&i.isPacked&&r===!1){let f=this.unpackTensor(s);return this.disposeIntermediateTensorInfo(s),f}return s}compileAndRun(e,t,n,a,r=!1){return n=n||t[0].dtype,this.runWebGLProgram(e,t,n,a,r)}getAndSaveBinary(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]}getTextureManager(){return this.textureManager}dispose(){this.disposed||(J().getBool("IS_TEST")||Object.keys(this.binaryCache).forEach(e=>{this.gpgpu.deleteProgram(this.binaryCache[e].webGLProgram),delete this.binaryCache[e]}),this.textureManager.dispose(),this.canvas!=null&&typeof HTMLCanvasElement!="undefined"&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0)}floatPrecision(){return this.floatPrecisionValue==null&&(this.floatPrecisionValue=W(()=>{if(!J().get("WEBGL_RENDER_FLOAT32_ENABLED")){let e=J().getBool("DEBUG");J().set("DEBUG",!1);let t=this.abs(Se(1e-8)).dataSync()[0];if(J().set("DEBUG",e),t>0)return 32}return 16})),this.floatPrecisionValue}epsilon(){return this.floatPrecision()===32?WW:BW}uploadToGPU(e){let t=this.texData.get(e),{shape:n,dtype:a,values:r,texture:s,usage:i,isPacked:o}=t;if(s!=null)return;let l=this.activeTimers!=null,d;l&&(d=k.now());let u=t.texShape;if(u==null&&(u=P7(n,o),t.texShape=u),r!=null){let p=ph(n),c,h=u[1],m=u[0],f=r instanceof Uint8Array;o?([h,m]=Rl(u[0],u[1]),c=new nL(p,[m,h],f)):c=new tL(p,[m,h],f);let A=this.makeTensorInfo([m,h],a);f?this.texData.get(A.dataId).usage=Yn.PIXELS:this.texData.get(A.dataId).usage=Yn.UPLOAD,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(A.dataId),h,m,r);let y=!0,g=this.runWebGLProgram(c,[A],a,null,y),x=this.texData.get(g.dataId);t.texture=x.texture,t.texShape=x.texShape,t.isPacked=x.isPacked,t.usage=x.usage,this.disposeIntermediateTensorInfo(A),this.texData.delete(g.dataId),t.values=null,l&&(this.uploadWaitMs+=k.now()-d)}else{let p=this.acquireTexture(u,i,a,o);t.texture=p}}convertAndCacheOnCPU(e,t){let n=this.texData.get(e),{dtype:a}=n;return this.releaseGPUData(e),t!=null&&(n.values=GW(t,a)),n.values}acquireTexture(e,t,n,a){if(this.numBytesInGPU+=this.computeBytes(e,n),!this.warnedAboutMemory&&this.numBytesInGPU>this.numMBBeforeWarning*1024*1024){let r=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn(`High memory usage in GPU: ${r} MB, most likely due to a memory leak`)}return this.textureManager.acquireTexture(e,t,a)}computeBytes(e,t){return e[0]*e[1]*k.bytesPerElement(t)}};zl.nextDataId=0;function GW(e,t){if(t==="float32"||t==="complex64")return e;if(t==="int32"||t==="bool"){let n=t==="int32"?new Int32Array(e.length):new Uint8Array(e.length);for(let a=0;anew zl,2);var qW={forceHalfFloat:kv},Iv=` if (isnan(a)) return a; if (isnan(b)) return b; -`,zl=class{constructor(e,t,n){this.variableNames=["A","B"],this.outputShape=C.assertAndGetBroadcastShape(t,n),this.userCode=` +`,_l=class{constructor(e,t,n){this.variableNames=["A","B"],this.outputShape=C.assertAndGetBroadcastShape(t,n),this.userCode=` float binaryOperation(float a, float b) { ${e} } @@ -962,12 +962,12 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, float b = getBAtOutCoords(); setOutput(binaryOperation(a, b)); } - `}},yh=` + `}},gh=` result.r = isNaN.r > 0. ? NAN : result.r; result.g = isNaN.g > 0. ? NAN : result.g; result.b = isNaN.b > 0. ? NAN : result.b; result.a = isNaN.a > 0. ? NAN : result.a; -`,Ad=class{constructor(e,t,n,a=!1){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=C.assertAndGetBroadcastShape(t,n);let r=this.outputShape.length,s="";if(a)if(r===0||k.sizeFromShape(this.outputShape)===1)s=` +`,yd=class{constructor(e,t,n,a=!1){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=C.assertAndGetBroadcastShape(t,n);let r=this.outputShape.length,s="";if(a)if(r===0||k.sizeFromShape(this.outputShape)===1)s=` result.y = 0.; result.z = 0.; result.w = 0.; @@ -999,21 +999,21 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, setOutput(result); } - `}};function Pn(e){let{inputs:t,backend:n}=e,{x:a}=t;return n.incRef(a.dataId),{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}var qW={kernelName:ks,backendName:"webgl",kernelFunc:Pn};function Lr(e){let{inputs:t,backend:n}=e,{real:a,imag:r}=t,s=n.makeTensorInfo(a.shape,"complex64"),i=n.texData.get(s.dataId),o=Pn({inputs:{x:a},backend:n}),l=Pn({inputs:{x:r},backend:n});return i.complexTensorInfos={real:o,imag:l},s}var XW={kernelName:Mp,backendName:"webgl",kernelFunc:Lr},Iv="return (a < 0.) ? b * a : a;",Sv=` + `}};function Pn(e){let{inputs:t,backend:n}=e,{x:a}=t;return n.incRef(a.dataId),{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}var XW={kernelName:Is,backendName:"webgl",kernelFunc:Pn};function Wr(e){let{inputs:t,backend:n}=e,{real:a,imag:r}=t,s=n.makeTensorInfo(a.shape,"complex64"),i=n.texData.get(s.dataId),o=Pn({inputs:{x:a},backend:n}),l=Pn({inputs:{x:r},backend:n});return i.complexTensorInfos={real:o,imag:l},s}var KW={kernelName:Fp,backendName:"webgl",kernelFunc:Wr},Sv="return (a < 0.) ? b * a : a;",Nv=` vec4 aLessThanZero = vec4(lessThan(a, vec4(0.))); return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a); -`;function KW(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{alpha:s}=a,i=n.makeTensorInfo([],"float32",k.createScalarValue(s,"float32")),o=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Ad(Sv,r.shape,i.shape):new zl(Iv,r.shape,i.shape),l=n.runWebGLProgram(o,[r,i],r.dtype);return n.disposeIntermediateTensorInfo(i),l}var ZW={kernelName:Is,backendName:"webgl",kernelFunc:KW},Nv="return (a < 0.) ? b * a : a;",Tv=` +`;function ZW(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{alpha:s}=a,i=n.makeTensorInfo([],"float32",k.createScalarValue(s,"float32")),o=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new yd(Nv,r.shape,i.shape):new _l(Sv,r.shape,i.shape),l=n.runWebGLProgram(o,[r,i],r.dtype);return n.disposeIntermediateTensorInfo(i),l}var YW={kernelName:Ss,backendName:"webgl",kernelFunc:ZW},Tv="return (a < 0.) ? b * a : a;",Ev=` vec4 aLessThanZero = vec4(lessThan(a, vec4(0.))); return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a); -`;function YW(e){let{inputs:t,backend:n}=e,{x:a,alpha:r}=t,s=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Ad(Tv,a.shape,r.shape):new zl(Nv,a.shape,r.shape);return n.runWebGLProgram(s,[a,r],a.dtype)}var JW={kernelName:_s,backendName:"webgl",kernelFunc:YW},Ev="if (isnan(x)) return x;",QW=` +`;function JW(e){let{inputs:t,backend:n}=e,{x:a,alpha:r}=t,s=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new yd(Ev,a.shape,r.shape):new _l(Tv,a.shape,r.shape);return n.runWebGLProgram(s,[a,r],a.dtype)}var QW={kernelName:Ps,backendName:"webgl",kernelFunc:JW},Cv="if (isnan(x)) return x;",eB=` if (isnan(a)) return a; if (isnan(b)) return b; -`,eB=` +`,tB=` result.r = isNaN.r > 0. ? NAN : result.r; result.g = isNaN.g > 0. ? NAN : result.g; result.b = isNaN.b > 0. ? NAN : result.b; result.a = isNaN.a > 0. ? NAN : result.a; -`;function qe({opSnippet:e,packedOpSnippet:t,cpuKernelImpl:n,dtype:a}){return({inputs:r,backend:s})=>{let{x:i}=r,o=s,l=a||i.dtype;if(o.shouldExecuteOnCPU([i])&&n!=null){let p=o.texData.get(i.dataId),c=n(p.values,l);return o.makeTensorInfo(i.shape,l,c)}let d=J().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&t!=null,u;return d?u=new Dl(i.shape,t):u=new Pr(i.shape,e),o.runWebGLProgram(u,[i],l)}}function en({opSnippet:e,packedOpSnippet:t,checkOutOfBounds:n=!1,supportsComplex:a=!1,cpuKernelImpl:r,dtype:s}){return({inputs:i,backend:o})=>{let{a:l,b:d}=i,u=o;if(a&&l.dtype==="complex64"){let m=u.texData.get(l.dataId),f=u.texData.get(d.dataId),[A,y]=[[m.complexTensorInfos.real,f.complexTensorInfos.real],[m.complexTensorInfos.imag,f.complexTensorInfos.imag]].map(x=>{let[w,b]=x,v={dataId:w.dataId,dtype:w.dtype,shape:l.shape},N={dataId:b.dataId,dtype:b.dtype,shape:d.shape},T=new zl(e,l.shape,d.shape);return u.runWebGLProgram(T,[v,N],sa(w.dtype,b.dtype))}),g=Lr({inputs:{real:A,imag:y},backend:u});return u.disposeIntermediateTensorInfo(A),u.disposeIntermediateTensorInfo(y),g}let p=s||sa(l.dtype,d.dtype);if(u.shouldExecuteOnCPU([l,d])&&r!=null){let m=u.texData.get(l.dataId),f=u.texData.get(d.dataId),[A,y]=r(l.shape,d.shape,m.values,f.values,p),g=u.makeTensorInfo(y,p),x=u.texData.get(g.dataId);return x.values=A,g}let c=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&t!=null,h;return c?h=new Ad(t,l.shape,d.shape,n):h=new zl(e,l.shape,d.shape),u.runWebGLProgram(h,[l,d],p)}}function gh(e,t=!1){if(e==="linear")return t?FW:TW;if(e==="relu")return t?DW:CW;if(e==="elu")return t?$W:EW;if(e==="relu6")return t?OW:RW;if(e==="prelu")return t?Tv:Nv;if(e==="leakyrelu")return t?Sv:Iv;if(e==="sigmoid")return t?zW:MW;throw new Error(`Activation ${e} has not been implemented for the WebGL backend.`)}var Cv=class{constructor(e,t,n,a=!1,r=!1,s=!1,i=null,o=!1,l=!1){this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n;let d=a?e[1]:e[2],u=Math.ceil(d/2),p=a?"i * 2, rc.y":"rc.y, i * 2",c=r?"rc.z, i * 2":"i * 2, rc.z",h=a?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],m=r?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],f="",A="";i&&(o?f=`vec4 activation(vec4 a) { +`;function qe({opSnippet:e,packedOpSnippet:t,cpuKernelImpl:n,dtype:a}){return({inputs:r,backend:s})=>{let{x:i}=r,o=s,l=a||i.dtype;if(o.shouldExecuteOnCPU([i])&&n!=null){let p=o.texData.get(i.dataId),c=n(p.values,l);return o.makeTensorInfo(i.shape,l,c)}let d=J().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&t!=null,u;return d?u=new Ol(i.shape,t):u=new Lr(i.shape,e),o.runWebGLProgram(u,[i],l)}}function en({opSnippet:e,packedOpSnippet:t,checkOutOfBounds:n=!1,supportsComplex:a=!1,cpuKernelImpl:r,dtype:s}){return({inputs:i,backend:o})=>{let{a:l,b:d}=i,u=o;if(a&&l.dtype==="complex64"){let m=u.texData.get(l.dataId),f=u.texData.get(d.dataId),[A,y]=[[m.complexTensorInfos.real,f.complexTensorInfos.real],[m.complexTensorInfos.imag,f.complexTensorInfos.imag]].map(x=>{let[w,b]=x,v={dataId:w.dataId,dtype:w.dtype,shape:l.shape},N={dataId:b.dataId,dtype:b.dtype,shape:d.shape},T=new _l(e,l.shape,d.shape);return u.runWebGLProgram(T,[v,N],sa(w.dtype,b.dtype))}),g=Wr({inputs:{real:A,imag:y},backend:u});return u.disposeIntermediateTensorInfo(A),u.disposeIntermediateTensorInfo(y),g}let p=s||sa(l.dtype,d.dtype);if(u.shouldExecuteOnCPU([l,d])&&r!=null){let m=u.texData.get(l.dataId),f=u.texData.get(d.dataId),[A,y]=r(l.shape,d.shape,m.values,f.values,p),g=u.makeTensorInfo(y,p),x=u.texData.get(g.dataId);return x.values=A,g}let c=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&t!=null,h;return c?h=new yd(t,l.shape,d.shape,n):h=new _l(e,l.shape,d.shape),u.runWebGLProgram(h,[l,d],p)}}function xh(e,t=!1){if(e==="linear")return t?$W:EW;if(e==="relu")return t?OW:RW;if(e==="elu")return t?DW:CW;if(e==="relu6")return t?zW:MW;if(e==="prelu")return t?Ev:Tv;if(e==="leakyrelu")return t?Nv:Sv;if(e==="sigmoid")return t?_W:FW;throw new Error(`Activation ${e} has not been implemented for the WebGL backend.`)}var Rv=class{constructor(e,t,n,a=!1,r=!1,s=!1,i=null,o=!1,l=!1){this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n;let d=a?e[1]:e[2],u=Math.ceil(d/2),p=a?"i * 2, rc.y":"rc.y, i * 2",c=r?"rc.z, i * 2":"i * 2, rc.z",h=a?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],m=r?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],f="",A="";i&&(o?f=`vec4 activation(vec4 a) { vec4 b = getPreluActivationWeightsAtOutCoords(); ${i} }`:l?f=`vec4 activation(vec4 a) { @@ -1052,7 +1052,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, setOutput(result); } - `}},Rv={REAL:"return areal * breal - aimag * bimag;",IMAG:"return areal * bimag + aimag * breal;"},Mv=class{constructor(e,t,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=C.assertAndGetBroadcastShape(t,n),this.userCode=` + `}},Mv={REAL:"return areal * breal - aimag * bimag;",IMAG:"return areal * bimag + aimag * breal;"},Fv=class{constructor(e,t,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=C.assertAndGetBroadcastShape(t,n),this.userCode=` float binaryOpComplex( float areal, float aimag, float breal, float bimag) { ${e} @@ -1065,7 +1065,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, float bimag = getBImagAtOutCoords(); setOutput(binaryOpComplex(areal, aimag, breal, bimag)); } - `}},Fv="return a * b;";function y1(e){let{inputs:t,backend:n}=e,{a,b:r}=t,s=C.upcastType(a.dtype,r.dtype);if(a.dtype==="complex64"){let o=n.texData.get(a.dataId),l=n.texData.get(r.dataId),d=new Mv(Rv.REAL,a.shape,r.shape),u=new Mv(Rv.IMAG,a.shape,r.shape),p=[{dataId:o.complexTensorInfos.real.dataId,dtype:o.complexTensorInfos.real.dtype,shape:a.shape},{dataId:o.complexTensorInfos.imag.dataId,dtype:o.complexTensorInfos.imag.dtype,shape:a.shape},{dataId:l.complexTensorInfos.real.dataId,dtype:l.complexTensorInfos.real.dtype,shape:r.shape},{dataId:l.complexTensorInfos.imag.dataId,dtype:l.complexTensorInfos.imag.dtype,shape:r.shape}],c=n.runWebGLProgram(d,p,"float32"),h=n.runWebGLProgram(u,p,"float32"),m=Lr({inputs:{real:c,imag:h},backend:n});return n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h),m}if(n.shouldExecuteOnCPU([a,r])){let o=n.texData.get(a.dataId),l=n.texData.get(r.dataId),[d,u]=aW(a.shape,r.shape,o.values,l.values,s),p=n.makeTensorInfo(u,s),c=n.texData.get(p.dataId);return c.values=d,p}let i;return J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?i=new Ad(Fv,a.shape,r.shape):i=new zl(Fv,a.shape,r.shape),n.runWebGLProgram(i,[a,r],s)}var tB={kernelName:$s,backendName:"webgl",kernelFunc:y1};function nB(e,t,n){let a=[bi(e.shape),...vi(e.shape)],r={dtype:e.dtype,shape:a,dataId:e.dataId},s=[bi(t),...vi(t)],i=new Av(s,a),o=!0,l=n.runWebGLProgram(i,[r],e.dtype,null,o);return{dataId:l.dataId,shape:t,dtype:l.dtype}}function Ae(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{shape:s}=a,i=n,o=k.sizeFromShape(r.shape),l=k.inferFromImplicitShape(s,o),d=k.sizeFromShape(l);k.assert(o===d,()=>`The new shape (${l}) has ${d} elements and the old shape (${r.shape}) has ${o} elements. The new shape and old shape must have the same number of elements.`);let u=i.texData.get(r.dataId);return u.isPacked&&!pd(r.shape,l)&&!(u.texture!==null&&pd(u.shape,l))?nB(r,l,i):(i.incRef(r.dataId),{dataId:r.dataId,shape:l,dtype:r.dtype})}var aB={kernelName:Wo,backendName:"webgl",kernelFunc:Ae},$v=class{constructor(e,t){this.variableNames=["x"];let{windowSize:n,batchSize:a,inSize:r,outSize:s}=e;this.outputShape=[a,s];let i=Math.floor(n/4)*4,o=n%4,l="sumValue += dot(values, ones);";if(t!=null){let u=1/t;l=`sumValue += dot(values * ${k.isInt(u)?u.toPrecision(2):u}, ones);`}let d="";r%n>0&&(d=` + `}},$v="return a * b;";function g1(e){let{inputs:t,backend:n}=e,{a,b:r}=t,s=C.upcastType(a.dtype,r.dtype);if(a.dtype==="complex64"){let o=n.texData.get(a.dataId),l=n.texData.get(r.dataId),d=new Fv(Mv.REAL,a.shape,r.shape),u=new Fv(Mv.IMAG,a.shape,r.shape),p=[{dataId:o.complexTensorInfos.real.dataId,dtype:o.complexTensorInfos.real.dtype,shape:a.shape},{dataId:o.complexTensorInfos.imag.dataId,dtype:o.complexTensorInfos.imag.dtype,shape:a.shape},{dataId:l.complexTensorInfos.real.dataId,dtype:l.complexTensorInfos.real.dtype,shape:r.shape},{dataId:l.complexTensorInfos.imag.dataId,dtype:l.complexTensorInfos.imag.dtype,shape:r.shape}],c=n.runWebGLProgram(d,p,"float32"),h=n.runWebGLProgram(u,p,"float32"),m=Wr({inputs:{real:c,imag:h},backend:n});return n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h),m}if(n.shouldExecuteOnCPU([a,r])){let o=n.texData.get(a.dataId),l=n.texData.get(r.dataId),[d,u]=rW(a.shape,r.shape,o.values,l.values,s),p=n.makeTensorInfo(u,s),c=n.texData.get(p.dataId);return c.values=d,p}let i;return J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?i=new yd($v,a.shape,r.shape):i=new _l($v,a.shape,r.shape),n.runWebGLProgram(i,[a,r],s)}var nB={kernelName:Ds,backendName:"webgl",kernelFunc:g1};function aB(e,t,n){let a=[vi(e.shape),...wi(e.shape)],r={dtype:e.dtype,shape:a,dataId:e.dataId},s=[vi(t),...wi(t)],i=new yv(s,a),o=!0,l=n.runWebGLProgram(i,[r],e.dtype,null,o);return{dataId:l.dataId,shape:t,dtype:l.dtype}}function Ae(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{shape:s}=a,i=n,o=k.sizeFromShape(r.shape),l=k.inferFromImplicitShape(s,o),d=k.sizeFromShape(l);k.assert(o===d,()=>`The new shape (${l}) has ${d} elements and the old shape (${r.shape}) has ${o} elements. The new shape and old shape must have the same number of elements.`);let u=i.texData.get(r.dataId);return u.isPacked&&!cd(r.shape,l)&&!(u.texture!==null&&cd(u.shape,l))?aB(r,l,i):(i.incRef(r.dataId),{dataId:r.dataId,shape:l,dtype:r.dtype})}var rB={kernelName:Bo,backendName:"webgl",kernelFunc:Ae},Dv=class{constructor(e,t){this.variableNames=["x"];let{windowSize:n,batchSize:a,inSize:r,outSize:s}=e;this.outputShape=[a,s];let i=Math.floor(n/4)*4,o=n%4,l="sumValue += dot(values, ones);";if(t!=null){let u=1/t;l=`sumValue += dot(values * ${k.isInt(u)?u.toPrecision(2):u}, ones);`}let d="";r%n>0&&(d=` if (inIdx < 0 || inIdx >= ${r}) { return 0.0; } @@ -1118,7 +1118,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, } setOutput(sumValue); } - `}},rB=class{constructor(e,t){this.variableNames=["x"];let{windowSize:n,batchSize:a,inSize:r,outSize:s}=e;this.outputShape=[a,s];let i="0.0",o="";t==="prod"?i="1.0":t==="min"?(i="1.0 / 1e-20",o="min"):t==="max"&&(i="-1.0 / 1e-20",o="max");let l=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="sum"?l="sumValue":t==="prod"?l="prodValue":t==="all"?l="allValue":t==="any"&&(l="anyValue");let d=Math.floor(n/4)*4,u=n%4,p=` + `}},sB=class{constructor(e,t){this.variableNames=["x"];let{windowSize:n,batchSize:a,inSize:r,outSize:s}=e;this.outputShape=[a,s];let i="0.0",o="";t==="prod"?i="1.0":t==="min"?(i="1.0 / 1e-20",o="min"):t==="max"&&(i="-1.0 / 1e-20",o="max");let l=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="sum"?l="sumValue":t==="prod"?l="prodValue":t==="all"?l="allValue":t==="any"&&(l="anyValue");let d=Math.floor(n/4)*4,u=n%4,p=` if (${t==="sum"}) { sumValue += dot(values, ones); } else if (${t==="prod"}) { @@ -1203,12 +1203,12 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, } setOutput(${l}); } - `}};function sB(e){let t=[];for(;t.length===0||t[t.length-1].outSize!==1;){let n=t.length?t[t.length-1].outSize:e[1],a=C.computeOptimalWindowSize(n);t.push({inSize:n,windowSize:a,outSize:Math.ceil(n/a)})}return t}function Si(e,t,n,a){let r=sB(e.shape),s=e;for(let i=0;i6)throw Error(`Transpose for rank ${t} is not yet supported`);let n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],a=new Array(t);for(let r=0;r6)throw Error(`Packed transpose for rank ${this.rank} is not yet supported.`);let a=lt(this.rank),r=mv("rc",this.rank),s=new Array(this.rank);for(let d=0;d6)throw Error(`Transpose for rank ${t} is not yet supported`);let n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],a=new Array(t);for(let r=0;r6)throw Error(`Packed transpose for rank ${this.rank} is not yet supported.`);let a=lt(this.rank),r=Av("rc",this.rank),s=new Array(this.rank);for(let d=0;d=2&&u>=2&&x,()=>`Error in matMul: the input batch dimensions must either be the same or at least one input batch dimension must be 1. Got input batch dimensions of (${f}) and (${A}).`);let w=(y>g?e.shape.slice(0,-2):t.shape.slice(0,-2)).concat([h,m]);k.assert(p===c,()=>`Error in matMul: inner shapes (${p}) and (${c}) of Tensors with shapes ${e.shape} and ${t.shape} and transposeA=${n} and transposeB=${a} must match.`);let b=n?[y,p,h]:[y,h,p],v=a?[g,m,c]:[g,c,m],N=Ae({inputs:{x:e},backend:r,attrs:{shape:b}}),T=Ae({inputs:{x:t},backend:r,attrs:{shape:v}}),R=[N,T],$=Math.max(y,g),z=n?N.shape[1]:N.shape[2],P=s!=null,V=i!=null,j=l==="leakyrelu",U=l!=null?gh(l,!0):null,X=P||V||j||U!=null,G;if((h===1||m===1)&&z>Dv&&X===!1){let Y=N,re=T;n&&(Y=cn({inputs:{x:N},backend:r,attrs:{perm:[0,2,1]}}),R.push(Y)),a&&(re=cn({inputs:{x:T},backend:r,attrs:{perm:[0,2,1]}}),R.push(re));let ne=m!==1,ie=m===1,Q=Y;ne&&(Q=Ae({inputs:{x:Y},backend:r,attrs:{shape:[$,z,1]}}),R.push(Q));let de=m===1?2:1,oe=re;ie&&(oe=Ae({inputs:{x:re},backend:r,attrs:{shape:[$,1,z]}}),R.push(oe));let ye=y1({inputs:{a:Q,b:oe},backend:r});G=bh({inputs:{x:ye},backend:r,attrs:{axis:de,keepDims:!0}}),R.push(ye)}else{let Y=sa(e.dtype,t.dtype),re=new Cv(b,v,[$,h,m],n,a,P,U,V,j),ne=[N,T];if(s!=null&&ne.push(s),V&&ne.push(i),j){let ie=r.makeTensorInfo([],"float32",k.createScalarValue(o,"float32"));ne.push(ie),R.push(ie)}G=r.runWebGLProgram(re,ne,Y)}let ee=Ae({inputs:{x:G},backend:r,attrs:{shape:w}});R.push(G);for(let Y of R)r.disposeIntermediateTensorInfo(Y);return ee}function cB(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s,bias:i,preluActivationWeights:o}=t,{transposeA:l,transposeB:d,activation:u,leakyreluAlpha:p}=a;return vh({a:r,b:s,transposeA:l,transposeB:d,backend:n,bias:i,preluActivationWeights:o,leakyreluAlpha:p,activation:u})}var hB={kernelName:ei,backendName:"webgl",kernelFunc:cB},Ov="return abs(x);";function fB(e){let{inputs:t,backend:n}=e,{x:a}=t;if(n.shouldExecuteOnCPU([a])&&a.dtype!=="complex64"){let s=n.texData.get(a.dataId),i=fv(s.values);return n.makeTensorInfo(a.shape,a.dtype,i)}let r;return J().getBool("WEBGL_PACK_UNARY_OPERATIONS")?r=new Dl(a.shape,Ov):r=new Pr(a.shape,Ov),n.runWebGLProgram(r,[a],a.dtype)}var mB={kernelName:Qi,backendName:"webgl",kernelFunc:fB},AB=ga+` + `}};function bh(e,t,n){let a=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new uB(e.shape,t):new lB(e.shape,t);return n.runWebGLProgram(a,[e],e.dtype)}function dB(e,t,n,a){let r=t,s=e.shape.length,i=k.parseAxisParam(r,e.shape),o=i,l=C.getAxesPermutation(o,s),d=l!=null,u=e;d&&(u=bh(e,l,a),o=C.getInnerMostAxes(o.length,s)),C.assertAxesAreInnerMostDims("sum",o,s);let[p,c]=C.computeOutAndReduceShapes(u.shape,o),h=p;n&&(h=C.expandShapeToKeepDim(p,i));let m=k.sizeFromShape(c),f=k.sizeFromShape(e.shape)/m,A=Ae({inputs:{x:u},attrs:{shape:[f,m]},backend:a}),y=pc(e.dtype),g=Ni(A,y,"sum",a),x=Ae({inputs:{x:g},attrs:{shape:h},backend:a});return a.disposeIntermediateTensorInfo(A),a.disposeIntermediateTensorInfo(g),d&&a.disposeIntermediateTensorInfo(u),x}function vh(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a;return dB(r,s,i,n)}var pB={kernelName:Xs,backendName:"webgl",kernelFunc:vh};function cn(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{perm:s}=a,i=n,o=r.shape.length,l=new Array(o);for(let u=0;u=2&&u>=2&&x,()=>`Error in matMul: the input batch dimensions must either be the same or at least one input batch dimension must be 1. Got input batch dimensions of (${f}) and (${A}).`);let w=(y>g?e.shape.slice(0,-2):t.shape.slice(0,-2)).concat([h,m]);k.assert(p===c,()=>`Error in matMul: inner shapes (${p}) and (${c}) of Tensors with shapes ${e.shape} and ${t.shape} and transposeA=${n} and transposeB=${a} must match.`);let b=n?[y,p,h]:[y,h,p],v=a?[g,m,c]:[g,c,m],N=Ae({inputs:{x:e},backend:r,attrs:{shape:b}}),T=Ae({inputs:{x:t},backend:r,attrs:{shape:v}}),R=[N,T],$=Math.max(y,g),z=n?N.shape[1]:N.shape[2],P=s!=null,V=i!=null,j=l==="leakyrelu",U=l!=null?xh(l,!0):null,X=P||V||j||U!=null,G;if((h===1||m===1)&&z>Ov&&X===!1){let Y=N,re=T;n&&(Y=cn({inputs:{x:N},backend:r,attrs:{perm:[0,2,1]}}),R.push(Y)),a&&(re=cn({inputs:{x:T},backend:r,attrs:{perm:[0,2,1]}}),R.push(re));let ne=m!==1,ie=m===1,Q=Y;ne&&(Q=Ae({inputs:{x:Y},backend:r,attrs:{shape:[$,z,1]}}),R.push(Q));let de=m===1?2:1,oe=re;ie&&(oe=Ae({inputs:{x:re},backend:r,attrs:{shape:[$,1,z]}}),R.push(oe));let ye=g1({inputs:{a:Q,b:oe},backend:r});G=vh({inputs:{x:ye},backend:r,attrs:{axis:de,keepDims:!0}}),R.push(ye)}else{let Y=sa(e.dtype,t.dtype),re=new Rv(b,v,[$,h,m],n,a,P,U,V,j),ne=[N,T];if(s!=null&&ne.push(s),V&&ne.push(i),j){let ie=r.makeTensorInfo([],"float32",k.createScalarValue(o,"float32"));ne.push(ie),R.push(ie)}G=r.runWebGLProgram(re,ne,Y)}let ee=Ae({inputs:{x:G},backend:r,attrs:{shape:w}});R.push(G);for(let Y of R)r.disposeIntermediateTensorInfo(Y);return ee}function hB(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s,bias:i,preluActivationWeights:o}=t,{transposeA:l,transposeB:d,activation:u,leakyreluAlpha:p}=a;return wh({a:r,b:s,transposeA:l,transposeB:d,backend:n,bias:i,preluActivationWeights:o,leakyreluAlpha:p,activation:u})}var fB={kernelName:ti,backendName:"webgl",kernelFunc:hB},zv="return abs(x);";function mB(e){let{inputs:t,backend:n}=e,{x:a}=t;if(n.shouldExecuteOnCPU([a])&&a.dtype!=="complex64"){let s=n.texData.get(a.dataId),i=mv(s.values);return n.makeTensorInfo(a.shape,a.dtype,i)}let r;return J().getBool("WEBGL_PACK_UNARY_OPERATIONS")?r=new Ol(a.shape,zv):r=new Lr(a.shape,zv),n.runWebGLProgram(r,[a],a.dtype)}var AB={kernelName:eo,backendName:"webgl",kernelFunc:mB},yB=ga+` if (abs(x) > 1.) { return NAN; } return acos(x); -`,yB=qe({opSnippet:AB}),gB={kernelName:eo,backendName:"webgl",kernelFunc:yB},xB=ga+` +`,gB=qe({opSnippet:yB}),xB={kernelName:to,backendName:"webgl",kernelFunc:gB},bB=ga+` if (x < 1.0) return NAN; -return log(x + sqrt(x * x - 1.0));`,bB=qe({opSnippet:xB}),vB={kernelName:to,backendName:"webgl",kernelFunc:bB},zv="return a + b;",wB=en({opSnippet:zv,packedOpSnippet:zv,supportsComplex:!0,cpuKernelImpl:VL}),kB={kernelName:wr,backendName:"webgl",kernelFunc:wB},IB=class{constructor(e,t){this.outputShape=[],this.outputShape=e,this.variableNames=t.map((r,s)=>`T${s}`);let n=[];this.variableNames.forEach(r=>{n.push(`float v${r} = get${r}AtOutCoords();`)});let a=this.variableNames.map(r=>`v${r}`).join(" + ");this.userCode=` +return log(x + sqrt(x * x - 1.0));`,vB=qe({opSnippet:bB}),wB={kernelName:no,backendName:"webgl",kernelFunc:vB},_v="return a + b;",kB=en({opSnippet:_v,packedOpSnippet:_v,supportsComplex:!0,cpuKernelImpl:jL}),IB={kernelName:kr,backendName:"webgl",kernelFunc:kB},SB=class{constructor(e,t){this.outputShape=[],this.outputShape=e,this.variableNames=t.map((r,s)=>`T${s}`);let n=[];this.variableNames.forEach(r=>{n.push(`float v${r} = get${r}AtOutCoords();`)});let a=this.variableNames.map(r=>`v${r}`).join(" + ");this.userCode=` void main() { ${n.join(` `)} @@ -1240,7 +1240,7 @@ return log(x + sqrt(x * x - 1.0));`,bB=qe({opSnippet:xB}),vB={kernelName:to,back float result = ${a}; setOutput(result); } - `}},SB=class{constructor(e,t){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.variableNames=t.map((r,s)=>`T${s}`);let n=[];this.variableNames.forEach(r=>{n.push(`vec4 v${r} = get${r}AtOutCoords();`)});let a=this.variableNames.map(r=>`v${r}`).join(" + ");this.userCode=` + `}},NB=class{constructor(e,t){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.variableNames=t.map((r,s)=>`T${s}`);let n=[];this.variableNames.forEach(r=>{n.push(`vec4 v${r} = get${r}AtOutCoords();`)});let a=this.variableNames.map(r=>`v${r}`).join(" + ");this.userCode=` void main() { ${n.join(` `)} @@ -1248,7 +1248,7 @@ return log(x + sqrt(x * x - 1.0));`,bB=qe({opSnippet:xB}),vB={kernelName:to,back vec4 result = ${a}; setOutput(result); } - `}};function wh(e){let{inputs:t,backend:n}=e,a=t;if(a.length===1)return Pn({inputs:{x:a[0]},backend:n});if(a.length>J().get("WEBGL_MAX_TEXTURES_IN_SHADER")){let o=Math.floor(a.length/2),l=wh({inputs:a.slice(0,o),backend:n}),d=wh({inputs:a.slice(o),backend:n});return wh({inputs:[l,d],backend:n})}let r=a.map(o=>o.dtype).reduce((o,l)=>sa(o,l)),s=a.map(o=>o.shape),i=J().getBool("WEBGL_PACK")?new SB(a[0].shape,s):new IB(a[0].shape,s);return n.runWebGLProgram(i,a,r)}var NB={kernelName:is,backendName:"webgl",kernelFunc:wh};function TB(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=k.parseAxisParam(s,r.shape),d=l,u=C.getAxesPermutation(d,o),p=r;u!=null&&(p=cn({inputs:{x:r},backend:n,attrs:{perm:u}}),d=C.getInnerMostAxes(d.length,o)),C.assertAxesAreInnerMostDims("all",d,o);let[c,h]=C.computeOutAndReduceShapes(p.shape,d),m=k.sizeFromShape(h),f=Ae({inputs:{x:p},backend:n,attrs:{shape:[-1,m]}}),A=Si(f,f.dtype,"all",n),y;if(i){let g=C.expandShapeToKeepDim(c,l);y=Ae({inputs:{x:A},backend:n,attrs:{shape:g}})}else y=Ae({inputs:{x:A},backend:n,attrs:{shape:c}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(A),u!=null&&n.disposeIntermediateTensorInfo(p),y}var EB={kernelName:no,backendName:"webgl",kernelFunc:TB};function CB(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=k.parseAxisParam(s,r.shape),d=l,u=C.getAxesPermutation(d,o),p=r;u!=null&&(p=cn({inputs:{x:r},backend:n,attrs:{perm:u}}),d=C.getInnerMostAxes(d.length,o)),C.assertAxesAreInnerMostDims("any",d,o);let[c,h]=C.computeOutAndReduceShapes(p.shape,d),m=k.sizeFromShape(h),f=Ae({inputs:{x:p},backend:n,attrs:{shape:[-1,m]}}),A=Si(f,f.dtype,"any",n),y;if(i){let g=C.expandShapeToKeepDim(c,l);y=Ae({inputs:{x:A},backend:n,attrs:{shape:g}})}else y=Ae({inputs:{x:A},backend:n,attrs:{shape:c}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(A),u!=null&&n.disposeIntermediateTensorInfo(p),y}var RB={kernelName:ao,backendName:"webgl",kernelFunc:CB},MB=class{constructor(e,t,n){this.variableNames=["A"];let{windowSize:a,batchSize:r,outSize:s}=e;n||this.variableNames.push("bestIndicesA"),this.outputShape=[r,s];let i=t==="max"?">":"<",o=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode=` + `}};function kh(e){let{inputs:t,backend:n}=e,a=t;if(a.length===1)return Pn({inputs:{x:a[0]},backend:n});if(a.length>J().get("WEBGL_MAX_TEXTURES_IN_SHADER")){let o=Math.floor(a.length/2),l=kh({inputs:a.slice(0,o),backend:n}),d=kh({inputs:a.slice(o),backend:n});return kh({inputs:[l,d],backend:n})}let r=a.map(o=>o.dtype).reduce((o,l)=>sa(o,l)),s=a.map(o=>o.shape),i=J().getBool("WEBGL_PACK")?new NB(a[0].shape,s):new SB(a[0].shape,s);return n.runWebGLProgram(i,a,r)}var TB={kernelName:os,backendName:"webgl",kernelFunc:kh};function EB(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=k.parseAxisParam(s,r.shape),d=l,u=C.getAxesPermutation(d,o),p=r;u!=null&&(p=cn({inputs:{x:r},backend:n,attrs:{perm:u}}),d=C.getInnerMostAxes(d.length,o)),C.assertAxesAreInnerMostDims("all",d,o);let[c,h]=C.computeOutAndReduceShapes(p.shape,d),m=k.sizeFromShape(h),f=Ae({inputs:{x:p},backend:n,attrs:{shape:[-1,m]}}),A=Ni(f,f.dtype,"all",n),y;if(i){let g=C.expandShapeToKeepDim(c,l);y=Ae({inputs:{x:A},backend:n,attrs:{shape:g}})}else y=Ae({inputs:{x:A},backend:n,attrs:{shape:c}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(A),u!=null&&n.disposeIntermediateTensorInfo(p),y}var CB={kernelName:ao,backendName:"webgl",kernelFunc:EB};function RB(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=k.parseAxisParam(s,r.shape),d=l,u=C.getAxesPermutation(d,o),p=r;u!=null&&(p=cn({inputs:{x:r},backend:n,attrs:{perm:u}}),d=C.getInnerMostAxes(d.length,o)),C.assertAxesAreInnerMostDims("any",d,o);let[c,h]=C.computeOutAndReduceShapes(p.shape,d),m=k.sizeFromShape(h),f=Ae({inputs:{x:p},backend:n,attrs:{shape:[-1,m]}}),A=Ni(f,f.dtype,"any",n),y;if(i){let g=C.expandShapeToKeepDim(c,l);y=Ae({inputs:{x:A},backend:n,attrs:{shape:g}})}else y=Ae({inputs:{x:A},backend:n,attrs:{shape:c}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(A),u!=null&&n.disposeIntermediateTensorInfo(p),y}var MB={kernelName:ro,backendName:"webgl",kernelFunc:RB},FB=class{constructor(e,t,n){this.variableNames=["A"];let{windowSize:a,batchSize:r,outSize:s}=e;n||this.variableNames.push("bestIndicesA"),this.outputShape=[r,s];let i=t==="max"?">":"<",o=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode=` void main() { ivec2 coords = getOutputCoords(); int batch = coords[0]; @@ -1268,7 +1268,7 @@ return log(x + sqrt(x * x - 1.0));`,bB=qe({opSnippet:xB}),vB={kernelName:to,back } setOutput(float(bestIndex)); } - `}},FB=class{constructor(e,t,n,a){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,k.assert(e.length>2,()=>`Packed arg${n.charAt(0).toUpperCase()+n.slice(1)} supports only inputs with rank above 2.`);let r=e[e.length-1],s=Math.ceil(r/t);this.outputShape=e.slice(0,-1),s>1&&this.outputShape.push(s),a||this.variableNames.push("bestIndicesA");let i=this.outputShape,o=i.length,l=lt(o),d=pn("coords",o),u,p;if(s===1){p=o+1;let N=lt(p);u=` + `}},$B=class{constructor(e,t,n,a){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,k.assert(e.length>2,()=>`Packed arg${n.charAt(0).toUpperCase()+n.slice(1)} supports only inputs with rank above 2.`);let r=e[e.length-1],s=Math.ceil(r/t);this.outputShape=e.slice(0,-1),s>1&&this.outputShape.push(s),a||this.variableNames.push("bestIndicesA");let i=this.outputShape,o=i.length,l=lt(o),d=pn("coords",o),u,p;if(s===1){p=o+1;let N=lt(p);u=` ${N} sourceLocR = ${N}(${d.join()}, 0); ++${d[o-1]}; ${N} sourceLocG = ${N}(${d.join()}, 0); @@ -1330,23 +1330,23 @@ return log(x + sqrt(x * x - 1.0));`,bB=qe({opSnippet:xB}),vB={kernelName:to,back } setOutput(bestIndex); } - `}};function _v(e,t,n,a=null){let r=t.shape[0],s=t.shape[1];a!=null&&(r=a.shape[0],s=a.shape[1]);let i=C.computeOptimalWindowSize(s),o={windowSize:i,inSize:s,batchSize:r,outSize:Math.ceil(s/i)},l=new MB(o,n,a==null),d=[t];a!=null&&d.push(a);let u=e.runWebGLProgram(l,d,"int32");if(u.shape[1]===1)return u;let p=_v(e,t,n,u);return e.disposeIntermediateTensorInfo(u),p}function Pv(e,t,n,a=null){let r=a!=null?a.shape:t.shape,s=r[r.length-1],i=C.computeOptimalWindowSize(s),o=new FB(r,i,n,a==null),l=a==null?[t]:[t,a],d=e.runWebGLProgram(o,l,"int32");if(d.shape.length===t.shape.length){let u=Pv(e,t,n,d);return e.disposeIntermediateTensorInfo(d),u}return d}function Lv(e,t,n,a){let r=[n];if(C.assertAxesAreInnerMostDims("arg"+a.charAt(0).toUpperCase()+a.slice(1),r,t.shape.length),!J().getBool("WEBGL_PACK_REDUCE")||t.shape.length<=2){let s=[],[i,o]=C.computeOutAndReduceShapes(t.shape,r),l=k.sizeFromShape(o),d=Ae({inputs:{x:t},backend:e,attrs:{shape:[-1,l]}});s.push(d);let u=_v(e,d,a);s.push(u);let p=Ae({inputs:{x:u},backend:e,attrs:{shape:i}});return s.forEach(c=>e.disposeIntermediateTensorInfo(c)),p}return Pv(e,t,a)}function $B(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s}=a,i=k.parseAxisParam(s,r.shape),o=C.getAxesPermutation(i,r.shape.length),l=r,d=[];o!=null&&(l=cn({inputs:{x:r},backend:n,attrs:{perm:o}}),d.push(l),i=C.getInnerMostAxes(i.length,l.shape.length)),C.assertAxesAreInnerMostDims("argMax",[i[0]],l.shape.length);let u=Lv(n,l,i[0],"max");return d.forEach(p=>n.disposeIntermediateTensorInfo(p)),u}var DB={kernelName:os,backendName:"webgl",kernelFunc:$B};function OB(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s}=a,i=k.parseAxisParam(s,r.shape),o=C.getAxesPermutation(i,r.shape.length),l=r,d=[];o!=null&&(l=cn({inputs:{x:r},backend:n,attrs:{perm:o}}),d.push(l),i=C.getInnerMostAxes(i.length,l.shape.length)),C.assertAxesAreInnerMostDims("argMin",[i[0]],l.shape.length);let u=Lv(n,l,i[0],"min");return d.forEach(p=>n.disposeIntermediateTensorInfo(p)),u}var zB={kernelName:Au,backendName:"webgl",kernelFunc:OB},_B=ga+` + `}};function Pv(e,t,n,a=null){let r=t.shape[0],s=t.shape[1];a!=null&&(r=a.shape[0],s=a.shape[1]);let i=C.computeOptimalWindowSize(s),o={windowSize:i,inSize:s,batchSize:r,outSize:Math.ceil(s/i)},l=new FB(o,n,a==null),d=[t];a!=null&&d.push(a);let u=e.runWebGLProgram(l,d,"int32");if(u.shape[1]===1)return u;let p=Pv(e,t,n,u);return e.disposeIntermediateTensorInfo(u),p}function Lv(e,t,n,a=null){let r=a!=null?a.shape:t.shape,s=r[r.length-1],i=C.computeOptimalWindowSize(s),o=new $B(r,i,n,a==null),l=a==null?[t]:[t,a],d=e.runWebGLProgram(o,l,"int32");if(d.shape.length===t.shape.length){let u=Lv(e,t,n,d);return e.disposeIntermediateTensorInfo(d),u}return d}function Wv(e,t,n,a){let r=[n];if(C.assertAxesAreInnerMostDims("arg"+a.charAt(0).toUpperCase()+a.slice(1),r,t.shape.length),!J().getBool("WEBGL_PACK_REDUCE")||t.shape.length<=2){let s=[],[i,o]=C.computeOutAndReduceShapes(t.shape,r),l=k.sizeFromShape(o),d=Ae({inputs:{x:t},backend:e,attrs:{shape:[-1,l]}});s.push(d);let u=Pv(e,d,a);s.push(u);let p=Ae({inputs:{x:u},backend:e,attrs:{shape:i}});return s.forEach(c=>e.disposeIntermediateTensorInfo(c)),p}return Lv(e,t,a)}function DB(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s}=a,i=k.parseAxisParam(s,r.shape),o=C.getAxesPermutation(i,r.shape.length),l=r,d=[];o!=null&&(l=cn({inputs:{x:r},backend:n,attrs:{perm:o}}),d.push(l),i=C.getInnerMostAxes(i.length,l.shape.length)),C.assertAxesAreInnerMostDims("argMax",[i[0]],l.shape.length);let u=Wv(n,l,i[0],"max");return d.forEach(p=>n.disposeIntermediateTensorInfo(p)),u}var OB={kernelName:ls,backendName:"webgl",kernelFunc:DB};function zB(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s}=a,i=k.parseAxisParam(s,r.shape),o=C.getAxesPermutation(i,r.shape.length),l=r,d=[];o!=null&&(l=cn({inputs:{x:r},backend:n,attrs:{perm:o}}),d.push(l),i=C.getInnerMostAxes(i.length,l.shape.length)),C.assertAxesAreInnerMostDims("argMin",[i[0]],l.shape.length);let u=Wv(n,l,i[0],"min");return d.forEach(p=>n.disposeIntermediateTensorInfo(p)),u}var _B={kernelName:yu,backendName:"webgl",kernelFunc:zB},PB=ga+` if (abs(x) > 1.) { return NAN; } return asin(x); -`,PB=qe({opSnippet:_B}),LB={kernelName:ro,backendName:"webgl",kernelFunc:PB},WB=ga+"return log(x + sqrt(x * x + 1.0));",BB=qe({opSnippet:WB}),VB={kernelName:so,backendName:"webgl",kernelFunc:BB},jB=ga+` +`,LB=qe({opSnippet:PB}),WB={kernelName:so,backendName:"webgl",kernelFunc:LB},BB=ga+"return log(x + sqrt(x * x + 1.0));",VB=qe({opSnippet:BB}),jB={kernelName:io,backendName:"webgl",kernelFunc:VB},UB=ga+` return atan(x); -`,UB=qe({opSnippet:jB}),HB={kernelName:io,backendName:"webgl",kernelFunc:UB},GB=QW+` +`,HB=qe({opSnippet:UB}),GB={kernelName:oo,backendName:"webgl",kernelFunc:HB},qB=eB+` return atan(a, b); -`,qB=` +`,XB=` vec4 result = atan(a, b); vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0)); - `+eB+` + `+tB+` return result; -`,XB=en({opSnippet:GB,packedOpSnippet:qB}),KB={kernelName:lo,backendName:"webgl",kernelFunc:XB},ZB=ga+` +`,KB=en({opSnippet:qB,packedOpSnippet:XB}),ZB={kernelName:uo,backendName:"webgl",kernelFunc:KB},YB=ga+` if ((x < -1.0) || (x > 1.0)) return NAN; -return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelName:oo,backendName:"webgl",kernelFunc:YB},yd=class{constructor(e,t,n,a=!1,r=!1){if(this.variableNames=["x"],t==="avg"&&n)throw new Error("Cannot compute positions for average pool.");let s=e.filterWidth,i=e.strideHeight,o=e.strideWidth,l=e.dilationHeight,d=e.dilationWidth,u=e.effectiveFilterHeight,p=e.effectiveFilterWidth,c=e.padInfo.top,h=e.padInfo.left;this.outputShape=e.outShape;let m=t==="avg",f=`((batch * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + d`,A=`(xR * ${e.inWidth} + xC) * ${e.inChannels} + d`,y="0.0";if(m||(y="-1.0 / 1e-20"),n){let N=">=";this.userCode=` +return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,JB=qe({opSnippet:YB}),QB={kernelName:lo,backendName:"webgl",kernelFunc:JB},gd=class{constructor(e,t,n,a=!1,r=!1){if(this.variableNames=["x"],t==="avg"&&n)throw new Error("Cannot compute positions for average pool.");let s=e.filterWidth,i=e.strideHeight,o=e.strideWidth,l=e.dilationHeight,d=e.dilationWidth,u=e.effectiveFilterHeight,p=e.effectiveFilterWidth,c=e.padInfo.top,h=e.padInfo.left;this.outputShape=e.outShape;let m=t==="avg",f=`((batch * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + d`,A=`(xR * ${e.inWidth} + xC) * ${e.inChannels} + d`,y="0.0";if(m||(y="-1.0 / 1e-20"),n){let N=">=";this.userCode=` const ivec2 strides = ivec2(${i}, ${o}); const ivec2 pads = ivec2(${c}, ${h}); @@ -1487,7 +1487,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(${x}); } - `}},g1=class{constructor(e,t,n,a=!1,r=!1){if(this.variableNames=["x"],t==="avg"&&n)throw new Error("Cannot compute positions for average pool.");let s=e.filterWidth,i=e.strideDepth,o=e.strideHeight,l=e.strideWidth,d=e.dilationDepth,u=e.dilationHeight,p=e.dilationWidth,c=e.effectiveFilterDepth,h=e.effectiveFilterHeight,m=e.effectiveFilterWidth,f=e.padInfo.front,A=e.padInfo.top,y=e.padInfo.left;this.outputShape=e.outShape;let g=t==="avg",x="0.0";if(g||(x="-1.0 / 1e-20"),n){let R=">=";this.userCode=` + `}},x1=class{constructor(e,t,n,a=!1,r=!1){if(this.variableNames=["x"],t==="avg"&&n)throw new Error("Cannot compute positions for average pool.");let s=e.filterWidth,i=e.strideDepth,o=e.strideHeight,l=e.strideWidth,d=e.dilationDepth,u=e.dilationHeight,p=e.dilationWidth,c=e.effectiveFilterDepth,h=e.effectiveFilterHeight,m=e.effectiveFilterWidth,f=e.padInfo.front,A=e.padInfo.top,y=e.padInfo.left;this.outputShape=e.outShape;let g=t==="avg",x="0.0";if(g||(x="-1.0 / 1e-20"),n){let R=">=";this.userCode=` const ivec3 strides = ivec3(${i}, ${o}, ${l}); const ivec3 pads = ivec3(${f}, ${A}, ${y}); @@ -1650,7 +1650,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam setOutput(${b}); } } - `}};function QB(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t;El(r,"avgPool");let{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=a,d=1;k.assert(C.eitherStridesOrDilationsAreOne(i,d),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);let u=C.computePool2DInfo(r.shape,s,i,d,o,l);if(u.filterWidth===1&&u.filterHeight===1&&k.arraysEqual(u.inShape,u.outShape))return Pn({inputs:{x:r},backend:n});let p=new yd(u,"avg",!1);return n.runWebGLProgram(p,[r],"float32")}var eV={kernelName:ls,backendName:"webgl",kernelFunc:QB};function tV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:d}=a,u=[1,1,1],p=C.computePool3DInfo(r.shape,s,i,u,o,l,d),c=new g1(p,"avg",!1);return n.runWebGLProgram(c,[r],"float32")}var nV={kernelName:yu,backendName:"webgl",kernelFunc:tV},aV=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,a=e.strideHeight,r=e.strideWidth,s=e.dilationHeight,i=e.dilationWidth,o=e.effectiveFilterHeight,l=e.effectiveFilterWidth,d=o-1-e.padInfo.top,u=l-1-e.padInfo.left,p=1/(t*n);this.userCode=` + `}};function eV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t;Cl(r,"avgPool");let{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=a,d=1;k.assert(C.eitherStridesOrDilationsAreOne(i,d),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);let u=C.computePool2DInfo(r.shape,s,i,d,o,l);if(u.filterWidth===1&&u.filterHeight===1&&k.arraysEqual(u.inShape,u.outShape))return Pn({inputs:{x:r},backend:n});let p=new gd(u,"avg",!1);return n.runWebGLProgram(p,[r],"float32")}var tV={kernelName:us,backendName:"webgl",kernelFunc:eV};function nV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:d}=a,u=[1,1,1],p=C.computePool3DInfo(r.shape,s,i,u,o,l,d),c=new x1(p,"avg",!1);return n.runWebGLProgram(c,[r],"float32")}var aV={kernelName:gu,backendName:"webgl",kernelFunc:nV},rV=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,a=e.strideHeight,r=e.strideWidth,s=e.dilationHeight,i=e.dilationWidth,o=e.effectiveFilterHeight,l=e.effectiveFilterWidth,d=o-1-e.padInfo.top,u=l-1-e.padInfo.left,p=1/(t*n);this.userCode=` const ivec2 pads = ivec2(${d}, ${u}); const float avgMultiplier = float(${p}); @@ -1692,7 +1692,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(dotProd); } - `}},rV=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;let t=e.filterDepth,n=e.filterHeight,a=e.filterWidth,r=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=e.dilationDepth,l=e.dilationHeight,d=e.dilationWidth,u=e.effectiveFilterDepth,p=e.effectiveFilterHeight,c=e.effectiveFilterWidth,h=u-1-e.padInfo.front,m=p-1-e.padInfo.top,f=c-1-e.padInfo.left,A=1/(t*n*a);this.userCode=` + `}},sV=class{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;let t=e.filterDepth,n=e.filterHeight,a=e.filterWidth,r=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=e.dilationDepth,l=e.dilationHeight,d=e.dilationWidth,u=e.effectiveFilterDepth,p=e.effectiveFilterHeight,c=e.effectiveFilterWidth,h=u-1-e.padInfo.front,m=p-1-e.padInfo.top,f=c-1-e.padInfo.left,A=1/(t*n*a);this.userCode=` const ivec3 pads = ivec3(${h}, ${m}, ${f}); const float avgMultiplier = float(${A}); @@ -1748,7 +1748,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(dotProd); } - `}};function sV(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s,{filterSize:o,strides:l,pad:d,dimRoundingMode:u}=a,p=[1,1,1],c=C.computePool3DInfo(i.shape,o,l,p,d,u),h=new rV(c);return n.runWebGLProgram(h,[r],i.dtype)}var iV={kernelName:Cp,backendName:"webgl",kernelFunc:sV};function oV(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s;El([r,s],"avgPoolGrad");let{filterSize:o,strides:l,pad:d}=a,u=C.computePool2DInfo(i.shape,o,l,1,d),p=new aV(u);return n.runWebGLProgram(p,[r],i.dtype)}var lV={kernelName:Ep,backendName:"webgl",kernelFunc:oV};function uV(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s}=t,{transposeA:i,transposeB:o}=a;return vh({a:r,b:s,transposeA:i,transposeB:o,backend:n})}var dV={kernelName:us,backendName:"webgl",kernelFunc:uV},pV=class{constructor(e,t,n,a,r,s){this.outputShape=[],this.variableNames=["x","mean","variance"],C.assertAndGetBroadcastShape(e,t),C.assertAndGetBroadcastShape(e,n);let i="0.0";a!=null&&(C.assertAndGetBroadcastShape(e,a),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="1.0";r!=null&&(C.assertAndGetBroadcastShape(e,r),this.variableNames.push("scale"),o="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=` + `}};function iV(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s,{filterSize:o,strides:l,pad:d,dimRoundingMode:u}=a,p=[1,1,1],c=C.computePool3DInfo(i.shape,o,l,p,d,u),h=new sV(c);return n.runWebGLProgram(h,[r],i.dtype)}var oV={kernelName:Rp,backendName:"webgl",kernelFunc:iV};function lV(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s;Cl([r,s],"avgPoolGrad");let{filterSize:o,strides:l,pad:d}=a,u=C.computePool2DInfo(i.shape,o,l,1,d),p=new rV(u);return n.runWebGLProgram(p,[r],i.dtype)}var uV={kernelName:Cp,backendName:"webgl",kernelFunc:lV};function dV(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s}=t,{transposeA:i,transposeB:o}=a;return wh({a:r,b:s,transposeA:i,transposeB:o,backend:n})}var pV={kernelName:ds,backendName:"webgl",kernelFunc:dV},cV=class{constructor(e,t,n,a,r,s){this.outputShape=[],this.variableNames=["x","mean","variance"],C.assertAndGetBroadcastShape(e,t),C.assertAndGetBroadcastShape(e,n);let i="0.0";a!=null&&(C.assertAndGetBroadcastShape(e,a),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="1.0";r!=null&&(C.assertAndGetBroadcastShape(e,r),this.variableNames.push("scale"),o="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=` void main() { float x = getXAtOutCoords(); float mean = getMeanAtOutCoords(); @@ -1758,7 +1758,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam float inv = scale * inversesqrt(variance + float(${s})); setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1))); } - `}},cV=class{constructor(e,t,n,a,r,s){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],C.assertAndGetBroadcastShape(e,t),C.assertAndGetBroadcastShape(e,n);let i="vec4(0.0)";a!=null&&(C.assertAndGetBroadcastShape(e,a),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="vec4(1.0)";r!=null&&(C.assertAndGetBroadcastShape(e,r),this.variableNames.push("scale"),o="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=` + `}},hV=class{constructor(e,t,n,a,r,s){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],C.assertAndGetBroadcastShape(e,t),C.assertAndGetBroadcastShape(e,n);let i="vec4(0.0)";a!=null&&(C.assertAndGetBroadcastShape(e,a),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="vec4(1.0)";r!=null&&(C.assertAndGetBroadcastShape(e,r),this.variableNames.push("scale"),o="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=` void main() { vec4 offset = ${i}; vec4 scale = ${o}; @@ -1771,7 +1771,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam setOutput((x - mean) * inv + offset); } - `}},hV=({inputs:e,backend:t,attrs:n})=>{let{x:a,mean:r,variance:s,offset:i,scale:o}=e;k.assert(r.shape.length===s.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),k.assert(i==null||r.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),k.assert(o==null||r.shape.length===o.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let{varianceEpsilon:l}=n;l==null&&(l=.001);let d=[a,r,s],u=null;i!=null&&(u=i.shape,d.push(i));let p=null;o!=null&&(p=o.shape,d.push(o));let c=J().getBool("WEBGL_PACK_NORMALIZATION")?new cV(a.shape,r.shape,s.shape,u,p,l):new pV(a.shape,r.shape,s.shape,u,p,l);return t.runWebGLProgram(c,d,d[0].dtype)},fV={kernelName:vs,backendName:"webgl",kernelFunc:hV},AV=class{constructor(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;let t=lt(this.rank),n=`uniform int start[${this.rank}];`,a=mV(this.rank),r,s=e.map((i,o)=>`sourceLoc.${x1[o]} = start[${o}] + coords.${x1[o]};`);r=` + `}},fV=({inputs:e,backend:t,attrs:n})=>{let{x:a,mean:r,variance:s,offset:i,scale:o}=e;k.assert(r.shape.length===s.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),k.assert(i==null||r.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),k.assert(o==null||r.shape.length===o.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let{varianceEpsilon:l}=n;l==null&&(l=.001);let d=[a,r,s],u=null;i!=null&&(u=i.shape,d.push(i));let p=null;o!=null&&(p=o.shape,d.push(o));let c=J().getBool("WEBGL_PACK_NORMALIZATION")?new hV(a.shape,r.shape,s.shape,u,p,l):new cV(a.shape,r.shape,s.shape,u,p,l);return t.runWebGLProgram(c,d,d[0].dtype)},mV={kernelName:ws,backendName:"webgl",kernelFunc:fV},yV=class{constructor(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;let t=lt(this.rank),n=`uniform int start[${this.rank}];`,a=AV(this.rank),r,s=e.map((i,o)=>`sourceLoc.${b1[o]} = start[${o}] + coords.${b1[o]};`);r=` ${t} sourceLoc; ${t} coords = getOutputCoords(); ${s.join(` @@ -1782,7 +1782,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam ${r} setOutput(getSource(${a})); } - `}getCustomSetupFunc(e){if(e.length!==this.rank)throw Error(`The rank (${this.rank}) of the program must match the length of start (${e.length})`);return(t,n)=>{this.startLoc==null&&(this.startLoc=t.getUniformLocationNoThrow(n,"start"),this.startLoc==null)||t.gl.uniform1iv(this.startLoc,e)}}},x1=["x","y","z","w","u","v"];function mV(e){if(e===1)return"sourceLoc";if(e<=6)return x1.slice(0,e).map(t=>"sourceLoc."+t).join(",");throw Error(`Slicing for rank ${e} is not yet supported`)}var yV=class{constructor(e){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.rank=e.length;let t=lt(this.rank),n=pn("coords",this.rank),a=pn("sourceLoc",this.rank),r=this.rank===1?"sourceLoc":`vec2(${a.slice(-2).join()})`,s=`getChannel(getSource(${a.join()}), ${r})`,i=` + `}getCustomSetupFunc(e){if(e.length!==this.rank)throw Error(`The rank (${this.rank}) of the program must match the length of start (${e.length})`);return(t,n)=>{this.startLoc==null&&(this.startLoc=t.getUniformLocationNoThrow(n,"start"),this.startLoc==null)||t.gl.uniform1iv(this.startLoc,e)}}},b1=["x","y","z","w","u","v"];function AV(e){if(e===1)return"sourceLoc";if(e<=6)return b1.slice(0,e).map(t=>"sourceLoc."+t).join(",");throw Error(`Slicing for rank ${e} is not yet supported`)}var gV=class{constructor(e){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.rank=e.length;let t=lt(this.rank),n=pn("coords",this.rank),a=pn("sourceLoc",this.rank),r=this.rank===1?"sourceLoc":`vec2(${a.slice(-2).join()})`,s=`getChannel(getSource(${a.join()}), ${r})`,i=` result.x = ${s}; if (++${n[this.rank-1]} < ${e[this.rank-1]}) { ++${a[this.rank-1]}; @@ -1812,7 +1812,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam ${o} setOutput(result); } - `}getCustomSetupFunc(e){if(e.length!==this.rank)throw Error(`The rank (${this.rank}) of the program must match the length of start (${e.length})`);return(t,n)=>{this.startLoc==null&&(this.startLoc=t.getUniformLocationNoThrow(n,"start"),this.startLoc==null)||t.gl.uniform1iv(this.startLoc,e)}}};function gV(e,t,n,a){let r=a.texData.get(e.dataId),s=a.makeTensorInfo(n,e.dtype),i=a.texData.get(s.dataId);Object.assign(i,r),i.refCount=1,i.shape=n,i.dtype=e.dtype;let o=on.computeFlatOffset(t,k.computeStrides(e.shape));r.slice&&(o+=r.slice.flatOffset),i.slice={flatOffset:o,origDataId:r.slice&&r.slice.origDataId||e.dataId};let l=a.dataRefCount.get(i.slice.origDataId)||1;return a.dataRefCount.set(i.slice.origDataId,l+1),s}function gd(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,size:i}=a,[o,l]=on.parseSliceParams(r,s,i);if(on.assertParamsValid(r,o,l),k.sizeFromShape(l)===0)return n.makeTensorInfo(l,r.dtype,[]);if(n.shouldExecuteOnCPU([r])||r.dtype==="string"){let p=n.texData.get(r.dataId),c=lW(p.values,o,l,r.shape,r.dtype);return n.makeTensorInfo(l,r.dtype,c)}let{isPacked:d}=n.texData.get(r.dataId),u=on.isSliceContinous(r.shape,o,l);if(d||!u){let p=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new yV(l):new AV(l),c=p.getCustomSetupFunc(o);return n.runWebGLProgram(p,[r],r.dtype,c)}return n.uploadToGPU(r.dataId),gV(r,o,l,n)}var xV={kernelName:Uo,backendName:"webgl",kernelFunc:gd},bV=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,crops:i}=a;k.assert(r.shape.length<=4,()=>"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet");let o=s.reduce((g,x)=>g*x),l=C.getReshaped(r.shape,s,o),d=C.getPermuted(l.length,s.length),u=C.getReshapedPermuted(r.shape,s,o),p=C.getSliceBeginCoords(i,s.length),c=C.getSliceSize(u,i,s.length),h=[],m=Ae({inputs:{x:r},backend:n,attrs:{shape:l}}),f=cn({inputs:{x:m},backend:n,attrs:{perm:d}}),A=Ae({inputs:{x:f},backend:n,attrs:{shape:u}}),y=gd({inputs:{x:A},backend:n,attrs:{begin:p,size:c}});return h.push(m),h.push(f),h.push(A),h.forEach(g=>n.disposeIntermediateTensorInfo(g)),y},vV={kernelName:gu,backendName:"webgl",kernelFunc:bV};function wV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,weights:s}=t,{size:i}=a,o=n.readSync(r.dataId),l=n.readSync(s.dataId),d=hv(o,l,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,d)}var kV={kernelName:Rp,backendName:"webgl",kernelFunc:wV},IV="return float(a != b);",Wv=en({opSnippet:IV,dtype:"bool"}),SV={kernelName:Fo,backendName:"webgl",kernelFunc:Wv};function xd(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.texData.get(a.dataId);return Pn({inputs:{x:r.complexTensorInfos.real},backend:n})}var NV={kernelName:Jp,backendName:"webgl",kernelFunc:xd},TV="return float(int(x));";function EV(e,t){let n=new Pr(e.shape,TV),a=t.runWebGLProgram(n,[e],"int32");return{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}function b1(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dtype:s}=a;if(s==="complex64"){if(r.dtype==="complex64")return Pn({inputs:{x:r},backend:n});let i=Ct(r.shape),o=b1({inputs:{x:r},backend:n,attrs:{dtype:"float32"}}),l=Lr({inputs:{real:o,imag:i},backend:n});return i.dispose(),n.disposeIntermediateTensorInfo(o),l}if(r.dtype==="complex64"){let i=xd({inputs:{input:r},backend:n}),o=b1({inputs:{x:i},backend:n,attrs:{dtype:s}});return n.disposeIntermediateTensorInfo(i),o}if(!k.hasEncodingLoss(r.dtype,s)){let i=Pn({inputs:{x:r},backend:n});return{dataId:i.dataId,shape:i.shape,dtype:s}}if(s==="int32")return EV(r,n);if(s==="bool"){let i=n.makeTensorInfo([],"bool",k.getTypedArrayFromDType("bool",1)),o=Wv({inputs:{a:r,b:i},backend:n});return n.disposeIntermediateTensorInfo(i),o}throw new Error(`Error in Cast: failed to cast ${r.dtype} to ${s}`)}var CV={kernelName:ds,backendName:"webgl",kernelFunc:b1},Bv="return ceil(x);",RV=qe({opSnippet:Bv,packedOpSnippet:Bv,cpuKernelImpl:UL}),MV={kernelName:ps,backendName:"webgl",kernelFunc:RV},FV=class{constructor(e){this.variableNames=["A"],this.outputShape=e,this.userCode=` + `}getCustomSetupFunc(e){if(e.length!==this.rank)throw Error(`The rank (${this.rank}) of the program must match the length of start (${e.length})`);return(t,n)=>{this.startLoc==null&&(this.startLoc=t.getUniformLocationNoThrow(n,"start"),this.startLoc==null)||t.gl.uniform1iv(this.startLoc,e)}}};function xV(e,t,n,a){let r=a.texData.get(e.dataId),s=a.makeTensorInfo(n,e.dtype),i=a.texData.get(s.dataId);Object.assign(i,r),i.refCount=1,i.shape=n,i.dtype=e.dtype;let o=on.computeFlatOffset(t,k.computeStrides(e.shape));r.slice&&(o+=r.slice.flatOffset),i.slice={flatOffset:o,origDataId:r.slice&&r.slice.origDataId||e.dataId};let l=a.dataRefCount.get(i.slice.origDataId)||1;return a.dataRefCount.set(i.slice.origDataId,l+1),s}function xd(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,size:i}=a,[o,l]=on.parseSliceParams(r,s,i);if(on.assertParamsValid(r,o,l),k.sizeFromShape(l)===0)return n.makeTensorInfo(l,r.dtype,[]);if(n.shouldExecuteOnCPU([r])||r.dtype==="string"){let p=n.texData.get(r.dataId),c=uW(p.values,o,l,r.shape,r.dtype);return n.makeTensorInfo(l,r.dtype,c)}let{isPacked:d}=n.texData.get(r.dataId),u=on.isSliceContinous(r.shape,o,l);if(d||!u){let p=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new gV(l):new yV(l),c=p.getCustomSetupFunc(o);return n.runWebGLProgram(p,[r],r.dtype,c)}return n.uploadToGPU(r.dataId),xV(r,o,l,n)}var bV={kernelName:Ho,backendName:"webgl",kernelFunc:xd},vV=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,crops:i}=a;k.assert(r.shape.length<=4,()=>"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet");let o=s.reduce((g,x)=>g*x),l=C.getReshaped(r.shape,s,o),d=C.getPermuted(l.length,s.length),u=C.getReshapedPermuted(r.shape,s,o),p=C.getSliceBeginCoords(i,s.length),c=C.getSliceSize(u,i,s.length),h=[],m=Ae({inputs:{x:r},backend:n,attrs:{shape:l}}),f=cn({inputs:{x:m},backend:n,attrs:{perm:d}}),A=Ae({inputs:{x:f},backend:n,attrs:{shape:u}}),y=xd({inputs:{x:A},backend:n,attrs:{begin:p,size:c}});return h.push(m),h.push(f),h.push(A),h.forEach(g=>n.disposeIntermediateTensorInfo(g)),y},wV={kernelName:xu,backendName:"webgl",kernelFunc:vV};function kV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,weights:s}=t,{size:i}=a,o=n.readSync(r.dataId),l=n.readSync(s.dataId),d=fv(o,l,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,d)}var IV={kernelName:Mp,backendName:"webgl",kernelFunc:kV},SV="return float(a != b);",Bv=en({opSnippet:SV,dtype:"bool"}),NV={kernelName:$o,backendName:"webgl",kernelFunc:Bv};function bd(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.texData.get(a.dataId);return Pn({inputs:{x:r.complexTensorInfos.real},backend:n})}var TV={kernelName:Qp,backendName:"webgl",kernelFunc:bd},EV="return float(int(x));";function CV(e,t){let n=new Lr(e.shape,EV),a=t.runWebGLProgram(n,[e],"int32");return{dataId:a.dataId,shape:a.shape,dtype:a.dtype}}function v1(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dtype:s}=a;if(s==="complex64"){if(r.dtype==="complex64")return Pn({inputs:{x:r},backend:n});let i=Ct(r.shape),o=v1({inputs:{x:r},backend:n,attrs:{dtype:"float32"}}),l=Wr({inputs:{real:o,imag:i},backend:n});return i.dispose(),n.disposeIntermediateTensorInfo(o),l}if(r.dtype==="complex64"){let i=bd({inputs:{input:r},backend:n}),o=v1({inputs:{x:i},backend:n,attrs:{dtype:s}});return n.disposeIntermediateTensorInfo(i),o}if(!k.hasEncodingLoss(r.dtype,s)){let i=Pn({inputs:{x:r},backend:n});return{dataId:i.dataId,shape:i.shape,dtype:s}}if(s==="int32")return CV(r,n);if(s==="bool"){let i=n.makeTensorInfo([],"bool",k.getTypedArrayFromDType("bool",1)),o=Bv({inputs:{a:r,b:i},backend:n});return n.disposeIntermediateTensorInfo(i),o}throw new Error(`Error in Cast: failed to cast ${r.dtype} to ${s}`)}var RV={kernelName:ps,backendName:"webgl",kernelFunc:v1},Vv="return ceil(x);",MV=qe({opSnippet:Vv,packedOpSnippet:Vv,cpuKernelImpl:HL}),FV={kernelName:cs,backendName:"webgl",kernelFunc:MV},$V=class{constructor(e){this.variableNames=["A"],this.outputShape=e,this.userCode=` uniform float minVal; uniform float maxVal; @@ -1825,7 +1825,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam setOutput(clamp(value, minVal, maxVal)); } - `}getCustomSetupFunc(e,t){return(n,a)=>{this.minLoc==null&&(this.minLoc=n.getUniformLocationNoThrow(a,"minVal"),this.maxLoc=n.getUniformLocationNoThrow(a,"maxVal")),n.gl.uniform1f(this.minLoc,e),n.gl.uniform1f(this.maxLoc,t)}}},$V=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.userCode=` + `}getCustomSetupFunc(e,t){return(n,a)=>{this.minLoc==null&&(this.minLoc=n.getUniformLocationNoThrow(a,"minVal"),this.maxLoc=n.getUniformLocationNoThrow(a,"maxVal")),n.gl.uniform1f(this.minLoc,e),n.gl.uniform1f(this.maxLoc,t)}}},DV=class{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.userCode=` uniform float minVal; uniform float maxVal; @@ -1839,7 +1839,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam setOutput(clamp(value, vec4(minVal), vec4(maxVal))); } - `}getCustomSetupFunc(e,t){return(n,a)=>{this.minLoc==null&&(this.minLoc=n.getUniformLocationNoThrow(a,"minVal"),this.maxLoc=n.getUniformLocationNoThrow(a,"maxVal")),n.gl.uniform1f(this.minLoc,e),n.gl.uniform1f(this.maxLoc,t)}}};function DV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{clipValueMin:s,clipValueMax:i}=a,o;J().getBool("WEBGL_PACK_CLIP")?o=new $V(r.shape):o=new FV(r.shape);let l=o.getCustomSetupFunc(s,i);return n.runWebGLProgram(o,[r],r.dtype,l)}var OV={kernelName:kr,backendName:"webgl",kernelFunc:DV},zV=class{constructor(e){this.variableNames=["real","imag"],this.outputShape=e,this.userCode=` + `}getCustomSetupFunc(e,t){return(n,a)=>{this.minLoc==null&&(this.minLoc=n.getUniformLocationNoThrow(a,"minVal"),this.maxLoc=n.getUniformLocationNoThrow(a,"maxVal")),n.gl.uniform1f(this.minLoc,e),n.gl.uniform1f(this.maxLoc,t)}}};function OV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{clipValueMin:s,clipValueMax:i}=a,o;J().getBool("WEBGL_PACK_CLIP")?o=new DV(r.shape):o=new $V(r.shape);let l=o.getCustomSetupFunc(s,i);return n.runWebGLProgram(o,[r],r.dtype,l)}var zV={kernelName:Ir,backendName:"webgl",kernelFunc:OV},_V=class{constructor(e){this.variableNames=["real","imag"],this.outputShape=e,this.userCode=` void main() { float re = abs(getRealAtOutCoords()); float im = abs(getImagAtOutCoords()); @@ -1852,7 +1852,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx)) ); } - `}};function Vv(e,t){return{dataId:t.dataId,dtype:t.dtype,shape:e.shape}}function _V(e){let{inputs:t,backend:n}=e,{x:a}=t,r=n.texData.get(a.dataId),s=new zV(a.shape),i=[Vv(a,r.complexTensorInfos.real),Vv(a,r.complexTensorInfos.imag)];return n.runWebGLProgram(s,i,i[0].dtype)}var PV={kernelName:xu,backendName:"webgl",kernelFunc:_V},LV=class{constructor(e){this.outputShape=[],this.outputShape=C.computeOutShape(e,1),this.variableNames=e.map((s,i)=>`T${i}`);let t=new Array(e.length-1);t[0]=e[0][1];for(let s=1;s`T${i}`);let t=new Array(e.length-1);t[0]=e[0][1];for(let s=1;s`T${f}`);let o=new Array(e.length-1);o[0]=e[0][t];for(let m=1;m`T${f}`);let o=new Array(e.length-1);o[0]=e[0][t];for(let m=1;m= ${o[m-1]}) { return getChannel( - getT${m}(${kh(i,l,f)}), - vec2(${kh(d,l,f)})); + getT${m}(${Ih(i,l,f)}), + vec2(${Ih(d,l,f)})); }`}let c=o.length,h=o[o.length-1];p+=` return getChannel( - getT${c}(${kh(i,l,h)}), - vec2(${kh(d,l,h)}));`,this.userCode=` + getT${c}(${Ih(i,l,h)}), + vec2(${Ih(d,l,h)}));`,this.userCode=` float getValue(${i.map(m=>"int "+m)}) { ${p} } @@ -1898,7 +1898,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(result); } - `}};function kh(e,t,n){let a=e.indexOf(t);return e.map((r,s)=>s===a?`${r} - ${n}`:r).join()}function Ih(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.texData.get(a.dataId);return Pn({inputs:{x:r.complexTensorInfos.imag},backend:n})}var BV={kernelName:Hp,backendName:"webgl",kernelFunc:Ih};function _l(e,t,n){let a=e[0].dtype;if(a==="complex64"){let u=e.map(f=>xd({inputs:{input:f},backend:n})),p=e.map(f=>Ih({inputs:{input:f},backend:n})),c=_l(u,t,n),h=_l(p,t,n),m=Lr({inputs:{real:c,imag:h},backend:n});return u.forEach(f=>n.disposeIntermediateTensorInfo(f)),p.forEach(f=>n.disposeIntermediateTensorInfo(f)),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h),m}let r=n.shouldExecuteOnCPU(e);if(a==="string"&&(r=!0),r){let u=e.map(y=>{let g=k.sizeFromShape(y.shape.slice(t));return Ae({inputs:{x:y},backend:n,attrs:{shape:[-1,g]}})}),p=u.map(y=>({vals:n.readSync(y.dataId),shape:y.shape})),c=C.computeOutShape(u.map(y=>y.shape),1),h=u[0].shape[0]===1,m=HL(p,c,a,h),f=C.computeOutShape(e.map(y=>y.shape),t),A=n.makeTensorInfo(f,a,m);return u.forEach(y=>n.disposeIntermediateTensorInfo(y)),A}if(e.length>J().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){let u=Math.floor(e.length/2),p=_l(e.slice(0,u),t,n),c=_l(e.slice(u),t,n),h=_l([p,c],t,n);return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),h}if(J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&e[0].shape.length>1){let u=new WV(e.map(p=>p.shape),t);return n.runWebGLProgram(u,e,a)}let{tensors2D:s,outShape:i}=VV(e,t,n),o=new LV(s.map(u=>u.shape)),l=n.runWebGLProgram(o,s,a);s.forEach(u=>n.disposeIntermediateTensorInfo(u));let d=Ae({inputs:{x:l},attrs:{shape:i},backend:n});return n.disposeIntermediateTensorInfo(l),d}function VV(e,t,n){let a=C.computeOutShape(e.map(r=>r.shape),t);return{tensors2D:e.map(r=>Ae({inputs:{x:r},attrs:{shape:[-1,k.sizeFromShape(r.shape.slice(t))]},backend:n})),outShape:a}}function jv(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a,s=k.parseAxisParam(r,t[0].shape)[0],i=C.computeOutShape(t.map(d=>d.shape),s);if(k.sizeFromShape(i)===0)return n.makeTensorInfo(i,t[0].dtype,[]);let o=t.filter(d=>k.sizeFromShape(d.shape)>0);if(o.length===1)return Pn({inputs:{x:o[0]},backend:n});let l=o.map(d=>d.shape);return C.assertParamsConsistent(l,s),_l(o,s,n)}var jV={kernelName:uo,backendName:"webgl",kernelFunc:jv},Uv=class{constructor(e,t=!1,n=null,a=!1,r=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;let s=e.padInfo.top,i=e.padInfo.left,o=e.strideHeight,l=e.strideWidth,d=e.dilationHeight,u=e.dilationWidth,p=e.filterHeight,c=e.filterWidth,h=Math.floor(e.inChannels/4)*4,m=e.inChannels%4,f=e.dataFormat==="channelsLast",A=f?1:2,y=f?2:3,g=f?3:1,x="",w="";n&&(a?x=`float activation(float a) { + `}};function Ih(e,t,n){let a=e.indexOf(t);return e.map((r,s)=>s===a?`${r} - ${n}`:r).join()}function Sh(e){let{inputs:t,backend:n}=e,{input:a}=t,r=n.texData.get(a.dataId);return Pn({inputs:{x:r.complexTensorInfos.imag},backend:n})}var VV={kernelName:Gp,backendName:"webgl",kernelFunc:Sh};function Pl(e,t,n){let a=e[0].dtype;if(a==="complex64"){let u=e.map(f=>bd({inputs:{input:f},backend:n})),p=e.map(f=>Sh({inputs:{input:f},backend:n})),c=Pl(u,t,n),h=Pl(p,t,n),m=Wr({inputs:{real:c,imag:h},backend:n});return u.forEach(f=>n.disposeIntermediateTensorInfo(f)),p.forEach(f=>n.disposeIntermediateTensorInfo(f)),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h),m}let r=n.shouldExecuteOnCPU(e);if(a==="string"&&(r=!0),r){let u=e.map(y=>{let g=k.sizeFromShape(y.shape.slice(t));return Ae({inputs:{x:y},backend:n,attrs:{shape:[-1,g]}})}),p=u.map(y=>({vals:n.readSync(y.dataId),shape:y.shape})),c=C.computeOutShape(u.map(y=>y.shape),1),h=u[0].shape[0]===1,m=GL(p,c,a,h),f=C.computeOutShape(e.map(y=>y.shape),t),A=n.makeTensorInfo(f,a,m);return u.forEach(y=>n.disposeIntermediateTensorInfo(y)),A}if(e.length>J().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){let u=Math.floor(e.length/2),p=Pl(e.slice(0,u),t,n),c=Pl(e.slice(u),t,n),h=Pl([p,c],t,n);return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),h}if(J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&e[0].shape.length>1){let u=new BV(e.map(p=>p.shape),t);return n.runWebGLProgram(u,e,a)}let{tensors2D:s,outShape:i}=jV(e,t,n),o=new WV(s.map(u=>u.shape)),l=n.runWebGLProgram(o,s,a);s.forEach(u=>n.disposeIntermediateTensorInfo(u));let d=Ae({inputs:{x:l},attrs:{shape:i},backend:n});return n.disposeIntermediateTensorInfo(l),d}function jV(e,t,n){let a=C.computeOutShape(e.map(r=>r.shape),t);return{tensors2D:e.map(r=>Ae({inputs:{x:r},attrs:{shape:[-1,k.sizeFromShape(r.shape.slice(t))]},backend:n})),outShape:a}}function Uv(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a,s=k.parseAxisParam(r,t[0].shape)[0],i=C.computeOutShape(t.map(d=>d.shape),s);if(k.sizeFromShape(i)===0)return n.makeTensorInfo(i,t[0].dtype,[]);let o=t.filter(d=>k.sizeFromShape(d.shape)>0);if(o.length===1)return Pn({inputs:{x:o[0]},backend:n});let l=o.map(d=>d.shape);return C.assertParamsConsistent(l,s),Pl(o,s,n)}var UV={kernelName:po,backendName:"webgl",kernelFunc:Uv},Hv=class{constructor(e,t=!1,n=null,a=!1,r=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;let s=e.padInfo.top,i=e.padInfo.left,o=e.strideHeight,l=e.strideWidth,d=e.dilationHeight,u=e.dilationWidth,p=e.filterHeight,c=e.filterWidth,h=Math.floor(e.inChannels/4)*4,m=e.inChannels%4,f=e.dataFormat==="channelsLast",A=f?1:2,y=f?2:3,g=f?3:1,x="",w="";n&&(a?x=`float activation(float a) { float b = getPreluActivationWeightsAtOutCoords(); ${n} }`:r?x=`float activation(float a) { @@ -2032,7 +2032,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam ${w} setOutput(result); } - `}},UV=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;let t=e.padInfo.front,n=e.padInfo.top,a=e.padInfo.left,r=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=e.dilationDepth,l=e.dilationHeight,d=e.dilationWidth,u=e.filterDepth,p=e.filterHeight,c=e.filterWidth,h=Math.floor(e.inChannels/4)*4,m=e.inChannels%4;this.userCode=` + `}},HV=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;let t=e.padInfo.front,n=e.padInfo.top,a=e.padInfo.left,r=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=e.dilationDepth,l=e.dilationHeight,d=e.dilationWidth,u=e.filterDepth,p=e.filterHeight,c=e.filterWidth,h=Math.floor(e.inChannels/4)*4,m=e.inChannels%4;this.userCode=` const ivec3 strides = ivec3(${r}, ${s}, ${i}); const ivec3 pads = ivec3(${t}, ${n}, ${a}); @@ -2120,7 +2120,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(dotProd); } - `}},HV=class{constructor(e,t,n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e;let{filterWidth:a,inChannels:r,strideWidth:s,strideHeight:i,padInfo:o,outWidth:l,dilationWidth:d,dilationHeight:u,dataFormat:p}=n,{left:c,top:h}=o,m=r*a,f=dn(),A=p==="channelsLast",y=A?0:1,g=A?1:2,x="";for(let w=0;w<=1;w++)for(let b=0;b<=1;b++)x+=` + `}},GV=class{constructor(e,t,n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e;let{filterWidth:a,inChannels:r,strideWidth:s,strideHeight:i,padInfo:o,outWidth:l,dilationWidth:d,dilationHeight:u,dataFormat:p}=n,{left:c,top:h}=o,m=r*a,f=dn(),A=p==="channelsLast",y=A?0:1,g=A?1:2,x="";for(let w=0;w<=1;w++)for(let b=0;b<=1;b++)x+=` blockIndex = rc.y + ${b}; pos = rc.x + ${w}; @@ -2164,7 +2164,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam ${f.output} = result; } - `}};function Hv({x:e,filter:t,convInfo:n,backend:a,bias:r=null,preluActivationWeights:s=null,leakyreluAlpha:i=0,activation:o=null}){let l=e.shape,d=a.texData.get(e.dataId),u=n.inChannels,p=l[0]*l[1]*l[2],c=n.outChannels,h=n.dataFormat==="channelsLast",m=!1,f=!1,A,y=[],g=(p===1||c===1)&&u>Dv,x=l[2]%2!=0&&!!d.isPacked;if(g||!J().getBool("WEBGL_LAZILY_UNPACK")||!J().getBool("WEBGL_PACK_BINARY_OPERATIONS")||!x){let w=h?l[0]*l[1]*l[2]:l[0]*l[2]*l[3],b=Ae({inputs:{x:e},backend:a,attrs:{shape:[1,w,n.inChannels]}}),v=Ae({inputs:{x:t},backend:a,attrs:{shape:[1,n.inChannels,n.outChannels]}}),N=vh({a:b,b:v,transposeA:m,transposeB:f,backend:a,bias:r,activation:o,preluActivationWeights:s,leakyreluAlpha:i});A=Ae({inputs:{x:N},backend:a,attrs:{shape:n.outShape}}),y.push(b),y.push(v),y.push(N)}else{let w=h?l[0]*l[1]*(l[2]+1):l[0]*l[2]*(l[3]+1),b={dataId:e.dataId,shape:[1,w,n.inChannels],dtype:e.dtype},v=d.shape;d.shape=d.shape.slice(),d.shape[d.shape.length-2]++,k.assert(pd(d.shape,b.shape),()=>`packed reshape ${d.shape} to ${b.shape} isn't free`);let N=Ae({inputs:{x:t},backend:a,attrs:{shape:[1,n.inChannels,n.outChannels]}});y.push(N);let T=vh({a:b,b:N,backend:a,transposeA:m,transposeB:f,bias:r,activation:o,preluActivationWeights:s,leakyreluAlpha:i}),R=a.texData.get(T.dataId);k.assert(R.isPacked,()=>"batchMatMul result is expected to be packed"),d.shape=v,R.shape=n.outShape,A=Pn({inputs:{x:T},backend:a}),A.shape=n.outShape,y.push(T)}for(let w of y)a.disposeIntermediateTensorInfo(w);return A}function Gv({x:e,filter:t,convInfo:n,backend:a,bias:r=null,preluActivationWeights:s=null,leakyreluAlpha:i=0,activation:o=null}){let{filterWidth:l,filterHeight:d,inChannels:u,outWidth:p,outHeight:c,dataFormat:h}=n,m=h==="channelsLast",f=l*d*u,A=c*p,y=[f,A],g=!0,x=!1,w=[],b=Ae({inputs:{x:e},backend:a,attrs:{shape:e.shape.slice(1)}}),v=Ae({inputs:{x:t},backend:a,attrs:{shape:[1,f,k.sizeFromShape(t.shape)/f]}});w.push(b),w.push(v);let N=new HV(y,b.shape,n),T=a.runWebGLProgram(N,[b],"float32"),R=Ae({inputs:{x:T},backend:a,attrs:{shape:[1,y[0],y[1]]}});w.push(T),w.push(R);let $=r!=null,z=s!=null,P=o==="leakyrelu",V=o?gh(o,!0):null,j=new Cv(R.shape,v.shape,[1,A,n.outChannels],g,x,$,V,z,P),U=[R,v];if(r&&U.push(r),z&&U.push(s),P){let Y=a.makeTensorInfo([],"float32",k.createScalarValue(i,"float32"));U.push(Y),w.push(Y)}let X=a.runWebGLProgram(j,U,"float32"),G=m?[1,c,p,n.outChannels]:[1,n.outChannels,c,p],ee=Ae({inputs:{x:X},backend:a,attrs:{shape:G}});w.push(X);for(let Y of w)a.disposeIntermediateTensorInfo(Y);return ee}function GV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dataFormat:l,dilations:d,dimRoundingMode:u}=a,p=C.convertConv2DDataFormat(l),c=C.computeConv2DInfo(r.shape,s.shape,i,d,o,u,!1,p),h;if(c.filterHeight===1&&c.filterWidth===1&&c.dilationHeight===1&&c.dilationWidth===1&&c.strideHeight===1&&c.strideWidth===1&&(c.padInfo.type==="SAME"||c.padInfo.type==="VALID"))h=Hv({x:r,filter:s,convInfo:c,backend:n});else if(J().getBool("WEBGL_CONV_IM2COL")&&r.shape[0]===1)h=Gv({x:r,filter:s,convInfo:c,backend:n});else{let f=new Uv(c);h=n.runWebGLProgram(f,[r,s],"float32")}let m=Ae({inputs:{x:h},backend:n,attrs:{shape:c.outShape}});return n.disposeIntermediateTensorInfo(h),m}var qV={kernelName:cs,backendName:"webgl",kernelFunc:GV},XV=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideHeight,n=e.strideWidth,a=e.padInfo.top,r=e.padInfo.left,s=e.dataFormat==="channelsLast";this.userCode=` + `}};function Gv({x:e,filter:t,convInfo:n,backend:a,bias:r=null,preluActivationWeights:s=null,leakyreluAlpha:i=0,activation:o=null}){let l=e.shape,d=a.texData.get(e.dataId),u=n.inChannels,p=l[0]*l[1]*l[2],c=n.outChannels,h=n.dataFormat==="channelsLast",m=!1,f=!1,A,y=[],g=(p===1||c===1)&&u>Ov,x=l[2]%2!=0&&!!d.isPacked;if(g||!J().getBool("WEBGL_LAZILY_UNPACK")||!J().getBool("WEBGL_PACK_BINARY_OPERATIONS")||!x){let w=h?l[0]*l[1]*l[2]:l[0]*l[2]*l[3],b=Ae({inputs:{x:e},backend:a,attrs:{shape:[1,w,n.inChannels]}}),v=Ae({inputs:{x:t},backend:a,attrs:{shape:[1,n.inChannels,n.outChannels]}}),N=wh({a:b,b:v,transposeA:m,transposeB:f,backend:a,bias:r,activation:o,preluActivationWeights:s,leakyreluAlpha:i});A=Ae({inputs:{x:N},backend:a,attrs:{shape:n.outShape}}),y.push(b),y.push(v),y.push(N)}else{let w=h?l[0]*l[1]*(l[2]+1):l[0]*l[2]*(l[3]+1),b={dataId:e.dataId,shape:[1,w,n.inChannels],dtype:e.dtype},v=d.shape;d.shape=d.shape.slice(),d.shape[d.shape.length-2]++,k.assert(cd(d.shape,b.shape),()=>`packed reshape ${d.shape} to ${b.shape} isn't free`);let N=Ae({inputs:{x:t},backend:a,attrs:{shape:[1,n.inChannels,n.outChannels]}});y.push(N);let T=wh({a:b,b:N,backend:a,transposeA:m,transposeB:f,bias:r,activation:o,preluActivationWeights:s,leakyreluAlpha:i}),R=a.texData.get(T.dataId);k.assert(R.isPacked,()=>"batchMatMul result is expected to be packed"),d.shape=v,R.shape=n.outShape,A=Pn({inputs:{x:T},backend:a}),A.shape=n.outShape,y.push(T)}for(let w of y)a.disposeIntermediateTensorInfo(w);return A}function qv({x:e,filter:t,convInfo:n,backend:a,bias:r=null,preluActivationWeights:s=null,leakyreluAlpha:i=0,activation:o=null}){let{filterWidth:l,filterHeight:d,inChannels:u,outWidth:p,outHeight:c,dataFormat:h}=n,m=h==="channelsLast",f=l*d*u,A=c*p,y=[f,A],g=!0,x=!1,w=[],b=Ae({inputs:{x:e},backend:a,attrs:{shape:e.shape.slice(1)}}),v=Ae({inputs:{x:t},backend:a,attrs:{shape:[1,f,k.sizeFromShape(t.shape)/f]}});w.push(b),w.push(v);let N=new GV(y,b.shape,n),T=a.runWebGLProgram(N,[b],"float32"),R=Ae({inputs:{x:T},backend:a,attrs:{shape:[1,y[0],y[1]]}});w.push(T),w.push(R);let $=r!=null,z=s!=null,P=o==="leakyrelu",V=o?xh(o,!0):null,j=new Rv(R.shape,v.shape,[1,A,n.outChannels],g,x,$,V,z,P),U=[R,v];if(r&&U.push(r),z&&U.push(s),P){let Y=a.makeTensorInfo([],"float32",k.createScalarValue(i,"float32"));U.push(Y),w.push(Y)}let X=a.runWebGLProgram(j,U,"float32"),G=m?[1,c,p,n.outChannels]:[1,n.outChannels,c,p],ee=Ae({inputs:{x:X},backend:a,attrs:{shape:G}});w.push(X);for(let Y of w)a.disposeIntermediateTensorInfo(Y);return ee}function qV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dataFormat:l,dilations:d,dimRoundingMode:u}=a,p=C.convertConv2DDataFormat(l),c=C.computeConv2DInfo(r.shape,s.shape,i,d,o,u,!1,p),h;if(c.filterHeight===1&&c.filterWidth===1&&c.dilationHeight===1&&c.dilationWidth===1&&c.strideHeight===1&&c.strideWidth===1&&(c.padInfo.type==="SAME"||c.padInfo.type==="VALID"))h=Gv({x:r,filter:s,convInfo:c,backend:n});else if(J().getBool("WEBGL_CONV_IM2COL")&&r.shape[0]===1)h=qv({x:r,filter:s,convInfo:c,backend:n});else{let f=new Hv(c);h=n.runWebGLProgram(f,[r,s],"float32")}let m=Ae({inputs:{x:h},backend:n,attrs:{shape:c.outShape}});return n.disposeIntermediateTensorInfo(h),m}var XV={kernelName:hs,backendName:"webgl",kernelFunc:qV},KV=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideHeight,n=e.strideWidth,a=e.padInfo.top,r=e.padInfo.left,s=e.dataFormat==="channelsLast";this.userCode=` void main() { ivec4 coords = getOutputCoords(); int wR = coords.x; @@ -2206,7 +2206,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(dotProd); } - `}},KV=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,a=e.strideHeight,r=e.strideWidth,s=e.dataFormat==="channelsLast",i=t-1-e.padInfo.top,o=n-1-e.padInfo.left,l=s?1:2,d=s?2:3,u=s?3:1;this.userCode=` + `}},ZV=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,a=e.strideHeight,r=e.strideWidth,s=e.dataFormat==="channelsLast",i=t-1-e.padInfo.top,o=n-1-e.padInfo.left,l=s?1:2,d=s?2:3,u=s?3:1;this.userCode=` const ivec2 pads = ivec2(${i}, ${o}); void main() { @@ -2259,7 +2259,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(dotProd); } - `}},ZV=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideDepth,n=e.strideHeight,a=e.strideWidth,r=e.padInfo.front,s=e.padInfo.top,i=e.padInfo.left;this.userCode=` + `}},YV=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideDepth,n=e.strideHeight,a=e.strideWidth,r=e.padInfo.front,s=e.padInfo.top,i=e.padInfo.left;this.userCode=` void main() { ivec5 coords = getOutputCoords(); int wF = coords.x; @@ -2301,7 +2301,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(dotProd); } - `}},YV=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterDepth,n=e.filterHeight,a=e.filterWidth,r=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=t-1-e.padInfo.front,l=n-1-e.padInfo.top,d=a-1-e.padInfo.left;this.userCode=` + `}},JV=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterDepth,n=e.filterHeight,a=e.filterWidth,r=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=t-1-e.padInfo.front,l=n-1-e.padInfo.top,d=a-1-e.padInfo.left;this.userCode=` const ivec3 pads = ivec3(${o}, ${l}, ${d}); void main() { @@ -2358,12 +2358,12 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(dotProd); } - `}};function JV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,pad:o,dataFormat:l,dimRoundingMode:d,filterShape:u}=a,p=C.convertConv2DDataFormat(l),c=C.computeConv2DInfo(r.shape,u,i,1,o,d,!1,p),h=new XV(c);return n.runWebGLProgram(h,[r,s],"float32")}var QV={kernelName:Fp,backendName:"webgl",kernelFunc:JV};function ej(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{inputShape:i,strides:o,pad:l,dataFormat:d,dimRoundingMode:u}=a,p=C.convertConv2DDataFormat(d),c=C.computeConv2DInfo(i,s.shape,o,1,l,u,!1,p),h=new KV(c);return n.runWebGLProgram(h,[r,s],"float32")}var tj={kernelName:hs,backendName:"webgl",kernelFunc:ej};function nj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l}=a,d=C.computeConv3DInfo(r.shape,s.shape,i,l,o),u=new UV(d);return n.runWebGLProgram(u,[r,s],"float32")}var aj={kernelName:bu,backendName:"webgl",kernelFunc:nj};function rj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,pad:o,filterShape:l}=a,d=C.computeConv3DInfo(r.shape,l,i,1,o),u=new ZV(d);return n.runWebGLProgram(u,[r,s],"float32")}var sj={kernelName:$p,backendName:"webgl",kernelFunc:rj};function ij(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{pad:i,strides:o,inputShape:l}=a,d=C.computeConv3DInfo(l,s.shape,o,1,i),u=new YV(d);return n.runWebGLProgram(u,[r,s],"float32")}var oj={kernelName:Dp,backendName:"webgl",kernelFunc:ij},lj=Ev+` + `}};function QV(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,pad:o,dataFormat:l,dimRoundingMode:d,filterShape:u}=a,p=C.convertConv2DDataFormat(l),c=C.computeConv2DInfo(r.shape,u,i,1,o,d,!1,p),h=new KV(c);return n.runWebGLProgram(h,[r,s],"float32")}var ej={kernelName:$p,backendName:"webgl",kernelFunc:QV};function tj(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{inputShape:i,strides:o,pad:l,dataFormat:d,dimRoundingMode:u}=a,p=C.convertConv2DDataFormat(d),c=C.computeConv2DInfo(i,s.shape,o,1,l,u,!1,p),h=new ZV(c);return n.runWebGLProgram(h,[r,s],"float32")}var nj={kernelName:fs,backendName:"webgl",kernelFunc:tj};function aj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l}=a,d=C.computeConv3DInfo(r.shape,s.shape,i,l,o),u=new HV(d);return n.runWebGLProgram(u,[r,s],"float32")}var rj={kernelName:vu,backendName:"webgl",kernelFunc:aj};function sj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,pad:o,filterShape:l}=a,d=C.computeConv3DInfo(r.shape,l,i,1,o),u=new YV(d);return n.runWebGLProgram(u,[r,s],"float32")}var ij={kernelName:Dp,backendName:"webgl",kernelFunc:sj};function oj(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{pad:i,strides:o,inputShape:l}=a,d=C.computeConv3DInfo(l,s.shape,o,1,i),u=new JV(d);return n.runWebGLProgram(u,[r,s],"float32")}var lj={kernelName:Op,backendName:"webgl",kernelFunc:oj},uj=Cv+` return cos(x); -`,uj=qe({opSnippet:lj}),dj={kernelName:fs,backendName:"webgl",kernelFunc:uj},pj=` +`,dj=qe({opSnippet:uj}),pj={kernelName:ms,backendName:"webgl",kernelFunc:dj},cj=` float e2x = exp(-x); return (e2x + 1.0 / e2x) / 2.0; -`,cj=qe({opSnippet:pj}),hj={kernelName:po,backendName:"webgl",kernelFunc:cj},fj=class{constructor(e,t,n,a,r){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];let[s,i,o,l]=e,[d]=t,[u,p]=n;this.outputShape=[d,u,p,l];let c=a==="bilinear"?1:0,[h,m]=[`${i-1}.0`,`${o-1}.0`],[f,A,y]=u>1?[`${(i-1)/(u-1)}`,"(y2-y1) * height_ratio",`y1*${h} + float(y)*(height_scale)`]:["0.0","0.0",`0.5 * (y1+y2) * ${h}`],[g,x,w]=p>1?[`${(o-1)/(p-1)}`,"(x2-x1) * width_ratio",`x1*${m} + float(x)*(width_scale)`]:["0.0","0.0",`0.5 * (x1+x2) * ${m}`];this.userCode=` +`,hj=qe({opSnippet:cj}),fj={kernelName:co,backendName:"webgl",kernelFunc:hj},mj=class{constructor(e,t,n,a,r){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];let[s,i,o,l]=e,[d]=t,[u,p]=n;this.outputShape=[d,u,p,l];let c=a==="bilinear"?1:0,[h,m]=[`${i-1}.0`,`${o-1}.0`],[f,A,y]=u>1?[`${(i-1)/(u-1)}`,"(y2-y1) * height_ratio",`y1*${h} + float(y)*(height_scale)`]:["0.0","0.0",`0.5 * (y1+y2) * ${h}`],[g,x,w]=p>1?[`${(o-1)/(p-1)}`,"(x2-x1) * width_ratio",`x1*${m} + float(x)*(width_scale)`]:["0.0","0.0",`0.5 * (x1+x2) * ${m}`];this.userCode=` const float height_ratio = float(${f}); const float width_ratio = float(${g}); void main() { @@ -2424,21 +2424,21 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam setOutput(newValue); } } - `}},mj=e=>{let{inputs:t,backend:n,attrs:a}=e,{image:r,boxes:s,boxInd:i}=t,{cropSize:o,method:l,extrapolationValue:d}=a,u=new fj(r.shape,s.shape,o,l,d);return n.runWebGLProgram(u,[r,s,i],"float32")},Aj={kernelName:co,backendName:"webgl",kernelFunc:mj},Kv=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=e;let a=e.length,r=t?"0.0":`getX(${qv(a,"coords")})`,s=e[e.length-1],i="",o="";t?(i=n?`end != ${s-1}`:"end != 0",o=n?"end + 1":"end - 1"):(i=n?`end + pow2 < ${s}`:"end >= pow2",o=n?"end + pow2":"end - pow2"),this.userCode=` + `}},Aj=e=>{let{inputs:t,backend:n,attrs:a}=e,{image:r,boxes:s,boxInd:i}=t,{cropSize:o,method:l,extrapolationValue:d}=a,u=new mj(r.shape,s.shape,o,l,d);return n.runWebGLProgram(u,[r,s,i],"float32")},yj={kernelName:ho,backendName:"webgl",kernelFunc:Aj},Zv=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=e;let a=e.length,r=t?"0.0":`getX(${Xv(a,"coords")})`,s=e[e.length-1],i="",o="";t?(i=n?`end != ${s-1}`:"end != 0",o=n?"end + 1":"end - 1"):(i=n?`end + pow2 < ${s}`:"end >= pow2",o=n?"end + pow2":"end - pow2"),this.userCode=` uniform float index; void main() { ${lt(a)} coords = getOutputCoords(); - int end = ${Xv(a,"coords")}; + int end = ${Kv(a,"coords")}; float val = ${r}; int pow2 = int(pow(2.0, index)); if (${i}) { int idx = ${o}; - ${Xv(a,"coords")} = idx; - val += getX(${qv(a,"coords")}); + ${Kv(a,"coords")} = idx; + val += getX(${Xv(a,"coords")}); } setOutput(val); } - `}getCustomSetupFunc(e){return(t,n)=>{this.index==null&&(this.index=t.getUniformLocation(n,"index")),t.gl.uniform1f(this.index,e)}}};function qv(e,t){if(e===1)return`${t}`;if(e===2)return`${t}.x, ${t}.y`;if(e===3)return`${t}.x, ${t}.y, ${t}.z`;if(e===4)return`${t}.x, ${t}.y, ${t}.z, ${t}.w`;throw Error(`Cumulative sum for rank ${e} is not yet supported`)}function Xv(e,t){if(e===1)return`${t}`;if(e===2)return`${t}.y`;if(e===3)return`${t}.z`;if(e===4)return`${t}.w`;throw Error(`Cumulative sum for rank ${e} is not yet supported`)}function yj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,exclusive:i,reverse:o}=a,l=r.shape.length,d=C.getAxesPermutation([s],l),u=r;d!=null&&(u=cn({inputs:{x:r},backend:n,attrs:{perm:d}}));let p=C.getInnerMostAxes(1,l)[0];if(p!==l-1)throw new Error(`WebGL cumsum shader expects an inner-most axis=${r.shape.length-1} but got axis=${s}`);let c=u.shape[p],h=Pn({inputs:{x:u},backend:n});for(let m=0;m<=Math.ceil(Math.log2(c))-1;m++){let f=new Kv(u.shape,!1,o),A=f.getCustomSetupFunc(m),y=h;h=n.runWebGLProgram(f,[h],h.dtype,A),n.disposeIntermediateTensorInfo(y)}if(i){let m=new Kv(u.shape,i,o),f=h;h=n.runWebGLProgram(m,[h],h.dtype),n.disposeIntermediateTensorInfo(f)}if(d!=null){let m=C.getUndoAxesPermutation(d),f=cn({inputs:{x:h},backend:n,attrs:{perm:m}});return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(u),f}return h}var gj={kernelName:ms,backendName:"webgl",kernelFunc:yj};function xj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,weights:s}=t,{size:i,binaryOutput:o}=a;if(r.shape.length===1){let l=n.readSync(r.dataId),d=n.readSync(s.dataId),u=hv(l,d,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,u)}else if(r.shape.length===2){let l=n.bufferSync(r),d=n.bufferSync(s),u=jL(l,d,i,o);return n.makeTensorInfo(u.shape,s.dtype,u.values)}throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${r.shape.length}.`)}var bj={kernelName:Op,backendName:"webgl",kernelFunc:xj},vj=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=e,this.blockSize=t,this.dataFormat=n,this.userCode=` + `}getCustomSetupFunc(e){return(t,n)=>{this.index==null&&(this.index=t.getUniformLocation(n,"index")),t.gl.uniform1f(this.index,e)}}};function Xv(e,t){if(e===1)return`${t}`;if(e===2)return`${t}.x, ${t}.y`;if(e===3)return`${t}.x, ${t}.y, ${t}.z`;if(e===4)return`${t}.x, ${t}.y, ${t}.z, ${t}.w`;throw Error(`Cumulative sum for rank ${e} is not yet supported`)}function Kv(e,t){if(e===1)return`${t}`;if(e===2)return`${t}.y`;if(e===3)return`${t}.z`;if(e===4)return`${t}.w`;throw Error(`Cumulative sum for rank ${e} is not yet supported`)}function gj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,exclusive:i,reverse:o}=a,l=r.shape.length,d=C.getAxesPermutation([s],l),u=r;d!=null&&(u=cn({inputs:{x:r},backend:n,attrs:{perm:d}}));let p=C.getInnerMostAxes(1,l)[0];if(p!==l-1)throw new Error(`WebGL cumsum shader expects an inner-most axis=${r.shape.length-1} but got axis=${s}`);let c=u.shape[p],h=Pn({inputs:{x:u},backend:n});for(let m=0;m<=Math.ceil(Math.log2(c))-1;m++){let f=new Zv(u.shape,!1,o),A=f.getCustomSetupFunc(m),y=h;h=n.runWebGLProgram(f,[h],h.dtype,A),n.disposeIntermediateTensorInfo(y)}if(i){let m=new Zv(u.shape,i,o),f=h;h=n.runWebGLProgram(m,[h],h.dtype),n.disposeIntermediateTensorInfo(f)}if(d!=null){let m=C.getUndoAxesPermutation(d),f=cn({inputs:{x:h},backend:n,attrs:{perm:m}});return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(u),f}return h}var xj={kernelName:As,backendName:"webgl",kernelFunc:gj};function bj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,weights:s}=t,{size:i,binaryOutput:o}=a;if(r.shape.length===1){let l=n.readSync(r.dataId),d=n.readSync(s.dataId),u=fv(l,d,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,u)}else if(r.shape.length===2){let l=n.bufferSync(r),d=n.bufferSync(s),u=UL(l,d,i,o);return n.makeTensorInfo(u.shape,s.dtype,u.values)}throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${r.shape.length}.`)}var vj={kernelName:zp,backendName:"webgl",kernelFunc:bj},wj=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=e,this.blockSize=t,this.dataFormat=n,this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords[0]; @@ -2457,7 +2457,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam float result = ${this.getInputSamplingString()}; setOutput(result); } - `}getHeightCoordString(){return this.dataFormat==="NHWC"?"coords[1]":"coords[2]"}getWidthCoordString(){return this.dataFormat==="NHWC"?"coords[2]":"coords[3]"}getDepthCoordString(){return this.dataFormat==="NHWC"?"coords[3]":"coords[1]"}getOutputDepthSize(){return this.dataFormat==="NHWC"?this.outputShape[3]:this.outputShape[1]}getInputSamplingString(){return this.dataFormat==="NHWC"?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"}};function wj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockSize:s,dataFormat:i}=a;k.assert(s>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${s}`);let o=r.shape[0],l=i==="NHWC"?r.shape[1]:r.shape[2],d=i==="NHWC"?r.shape[2]:r.shape[3],u=i==="NHWC"?r.shape[3]:r.shape[1],p=l*s,c=d*s,h=u/(s*s),m=i==="NHWC"?[o,p,c,h]:[o,h,p,c],f=new vj(m,s,i);return n.runWebGLProgram(f,[r],r.dtype)}var kj={kernelName:ho,backendName:"webgl",kernelFunc:wj},Zv=class{constructor(e,t=!1,n=null,a=!1,r=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;let s=e.inHeight,i=e.inWidth,o=e.padInfo.top,l=e.padInfo.left,d=e.strideHeight,u=e.strideWidth,p=e.dilationHeight,c=e.dilationWidth,h=e.filterHeight,m=e.filterWidth,f=e.outChannels/e.inChannels,A="",y="";n&&(a?A=`float activation(float a) { + `}getHeightCoordString(){return this.dataFormat==="NHWC"?"coords[1]":"coords[2]"}getWidthCoordString(){return this.dataFormat==="NHWC"?"coords[2]":"coords[3]"}getDepthCoordString(){return this.dataFormat==="NHWC"?"coords[3]":"coords[1]"}getOutputDepthSize(){return this.dataFormat==="NHWC"?this.outputShape[3]:this.outputShape[1]}getInputSamplingString(){return this.dataFormat==="NHWC"?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"}};function kj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockSize:s,dataFormat:i}=a;k.assert(s>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${s}`);let o=r.shape[0],l=i==="NHWC"?r.shape[1]:r.shape[2],d=i==="NHWC"?r.shape[2]:r.shape[3],u=i==="NHWC"?r.shape[3]:r.shape[1],p=l*s,c=d*s,h=u/(s*s),m=i==="NHWC"?[o,p,c,h]:[o,h,p,c],f=new wj(m,s,i);return n.runWebGLProgram(f,[r],r.dtype)}var Ij={kernelName:fo,backendName:"webgl",kernelFunc:kj},Yv=class{constructor(e,t=!1,n=null,a=!1,r=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;let s=e.inHeight,i=e.inWidth,o=e.padInfo.top,l=e.padInfo.left,d=e.strideHeight,u=e.strideWidth,p=e.dilationHeight,c=e.dilationWidth,h=e.filterHeight,m=e.filterWidth,f=e.outChannels/e.inChannels,A="",y="";n&&(a?A=`float activation(float a) { float b = getPreluActivationWeightsAtOutCoords(); ${n} }`:r?A=`float activation(float a) { @@ -2513,7 +2513,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam ${y} setOutput(result); } - `}},Yv=class{constructor(e,t=!1,n=null,a=!1,r=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e.outShape;let s=e.outChannels/e.inChannels,i=e.inHeight,o=e.inWidth,l=e.padInfo.top,d=e.padInfo.left,u=e.strideHeight,p=e.strideWidth,c=e.dilationHeight,h=e.dilationWidth,m=e.filterHeight,f=e.filterWidth,A=f,y=` + `}},Jv=class{constructor(e,t=!1,n=null,a=!1,r=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e.outShape;let s=e.outChannels/e.inChannels,i=e.inHeight,o=e.inWidth,l=e.padInfo.top,d=e.padInfo.left,u=e.strideHeight,p=e.strideWidth,c=e.dilationHeight,h=e.dilationWidth,m=e.filterHeight,f=e.filterWidth,A=f,y=` int xR; int xC; int xCOffset; vec4 wTexel; vec4 previous; vec4 final;`;for(let b=0;b`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${u}'`);let p=C.computeConv2DInfo(r.shape,s.shape,i,u,o,d,!0),c;return J().getBool("WEBGL_PACK_DEPTHWISECONV")&&p.strideWidth<=2&&p.outChannels/p.inChannels==1?c=new Yv(p):c=new Zv(p),n.runWebGLProgram(c,[r,s],"float32")}var Sj={kernelName:As,backendName:"webgl",kernelFunc:Ij},Nj=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideHeight,n=e.strideWidth,a=e.padInfo.top,r=e.padInfo.left,s=e.outChannels/e.inChannels;this.userCode=` + `}};function Sj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l,dimRoundingMode:d}=a,u=l;u==null&&(u=[1,1]),k.assert(C.eitherStridesOrDilationsAreOne(i,u),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${u}'`);let p=C.computeConv2DInfo(r.shape,s.shape,i,u,o,d,!0),c;return J().getBool("WEBGL_PACK_DEPTHWISECONV")&&p.strideWidth<=2&&p.outChannels/p.inChannels==1?c=new Jv(p):c=new Yv(p),n.runWebGLProgram(c,[r,s],"float32")}var Nj={kernelName:ys,backendName:"webgl",kernelFunc:Sj},Tj=class{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;let t=e.strideHeight,n=e.strideWidth,a=e.padInfo.top,r=e.padInfo.left,s=e.outChannels/e.inChannels;this.userCode=` void main() { ivec4 coords = getOutputCoords(); int wR = coords.x; @@ -2731,7 +2731,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(dotProd); } - `}},Tj=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,a=e.strideHeight,r=e.strideWidth,s=t-1-e.padInfo.top,i=n-1-e.padInfo.left,o=e.outChannels/e.inChannels;this.userCode=` + `}},Ej=class{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;let t=e.filterHeight,n=e.filterWidth,a=e.strideHeight,r=e.strideWidth,s=t-1-e.padInfo.top,i=n-1-e.padInfo.left,o=e.outChannels/e.inChannels;this.userCode=` const ivec2 pads = ivec2(${s}, ${i}); void main() { @@ -2776,13 +2776,13 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(dotProd); } - `}};function Ej(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:d,filterShape:u}=a,p=C.computeConv2DInfo(r.shape,u,i,o,l,d,!0),c=new Nj(p);return n.runWebGLProgram(c,[r,s],"float32")}var Cj={kernelName:zp,backendName:"webgl",kernelFunc:Ej};function Rj(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:d,inputShape:u}=a,p=C.computeConv2DInfo(u,s.shape,i,o,l,d,!0),c=new Tj(p);return n.runWebGLProgram(c,[r,s],"float32")}var Mj={kernelName:_p,backendName:"webgl",kernelFunc:Rj},Fj=class{constructor(e){this.variableNames=["X"],this.outputShape=[e,e],this.userCode=` + `}};function Cj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,dy:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:d,filterShape:u}=a,p=C.computeConv2DInfo(r.shape,u,i,o,l,d,!0),c=new Tj(p);return n.runWebGLProgram(c,[r,s],"float32")}var Rj={kernelName:_p,backendName:"webgl",kernelFunc:Cj};function Mj(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,filter:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:d,inputShape:u}=a,p=C.computeConv2DInfo(u,s.shape,i,o,l,d,!0),c=new Ej(p);return n.runWebGLProgram(c,[r,s],"float32")}var Fj={kernelName:Pp,backendName:"webgl",kernelFunc:Mj},$j=class{constructor(e){this.variableNames=["X"],this.outputShape=[e,e],this.userCode=` void main() { ivec2 coords = getOutputCoords(); float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0; setOutput(val); } - `}};function $j(e){let{inputs:t,backend:n}=e,{x:a}=t,r=[...a.shape,...a.shape],s=k.sizeFromShape(a.shape),i=Ae({inputs:{x:a},backend:n,attrs:{shape:[s]}}),o=new Fj(s),l=n.runWebGLProgram(o,[i],i.dtype),d=Ae({inputs:{x:l},backend:n,attrs:{shape:r}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(l),d}var Dj={kernelName:Pp,backendName:"webgl",kernelFunc:$j},Oj=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;let{inHeight:t,inWidth:n,padInfo:a,strideHeight:r,strideWidth:s,filterHeight:i,filterWidth:o,dilationHeight:l,dilationWidth:d}=e,{top:u,left:p}=a;this.userCode=` + `}};function Dj(e){let{inputs:t,backend:n}=e,{x:a}=t,r=[...a.shape,...a.shape],s=k.sizeFromShape(a.shape),i=Ae({inputs:{x:a},backend:n,attrs:{shape:[s]}}),o=new $j(s),l=n.runWebGLProgram(o,[i],i.dtype),d=Ae({inputs:{x:l},backend:n,attrs:{shape:r}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(l),d}var Oj={kernelName:Lp,backendName:"webgl",kernelFunc:Dj},zj=class{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;let{inHeight:t,inWidth:n,padInfo:a,strideHeight:r,strideWidth:s,filterHeight:i,filterWidth:o,dilationHeight:l,dilationWidth:d}=e,{top:u,left:p}=a;this.userCode=` const ivec2 strides = ivec2(${r}, ${s}); const ivec2 pads = ivec2(${u}, ${p}); const float neg_infinity = -3.4e38; @@ -2820,7 +2820,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam float result = curVal; setOutput(result); } - `}};function zj(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l}=a,d=C.computeDilation2DInfo(r.shape,s.shape,i,o,"NHWC",l),u,p=new Oj(d);u=n.runWebGLProgram(p,[r,s],"float32");let c=Ae({inputs:{x:u},backend:n,attrs:{shape:d.outShape}});return n.disposeIntermediateTensorInfo(u),c}var _j={kernelName:vu,backendName:"webgl",kernelFunc:zj};function Pj(e){let{inputs:t,backend:n,attrs:a}=e,{equation:r}=a,s=t,{allDims:i,summedDims:o,idDims:l}=C.decodeEinsumEquation(r,s.length);C.checkEinsumDimSizes(i.length,l,s);let{path:d,steps:u}=C.getEinsumComputePath(o,l),p=u.length,c=null,h=i.length,m=[];for(let f=0;f=0&&(c=bh({inputs:{x:c},backend:n,attrs:{axis:d[f]-(i.length-h),keepDims:!1}}),m.push(c)),h--)}for(let f of m)f!==c&&n.disposeIntermediateTensorInfo(f);return c}var Lj={kernelName:Bp,backendName:"webgl",kernelFunc:Pj},Wj="return (x >= 0.0) ? x : (exp(x) - 1.0);",Bj=` + `}};function _j(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s}=t,{strides:i,pad:o,dilations:l}=a,d=C.computeDilation2DInfo(r.shape,s.shape,i,o,"NHWC",l),u,p=new zj(d);u=n.runWebGLProgram(p,[r,s],"float32");let c=Ae({inputs:{x:u},backend:n,attrs:{shape:d.outShape}});return n.disposeIntermediateTensorInfo(u),c}var Pj={kernelName:wu,backendName:"webgl",kernelFunc:_j};function Lj(e){let{inputs:t,backend:n,attrs:a}=e,{equation:r}=a,s=t,{allDims:i,summedDims:o,idDims:l}=C.decodeEinsumEquation(r,s.length);C.checkEinsumDimSizes(i.length,l,s);let{path:d,steps:u}=C.getEinsumComputePath(o,l),p=u.length,c=null,h=i.length,m=[];for(let f=0;f=0&&(c=vh({inputs:{x:c},backend:n,attrs:{axis:d[f]-(i.length-h),keepDims:!1}}),m.push(c)),h--)}for(let f of m)f!==c&&n.disposeIntermediateTensorInfo(f);return c}var Wj={kernelName:Vp,backendName:"webgl",kernelFunc:Lj},Bj="return (x >= 0.0) ? x : (exp(x) - 1.0);",Vj=` vec4 result; result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0); @@ -2829,12 +2829,12 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0); return result; -`,Vj=qe({opSnippet:Wj,packedOpSnippet:Bj}),jj={kernelName:fo,backendName:"webgl",kernelFunc:Vj},Uj="return (b >= 1.0) ? a : a * (b + 1.0);",Hj=` +`,jj=qe({opSnippet:Bj,packedOpSnippet:Vj}),Uj={kernelName:mo,backendName:"webgl",kernelFunc:jj},Hj="return (b >= 1.0) ? a : a * (b + 1.0);",Gj=` vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.))); return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0)))); -`,Gj=e=>{let{inputs:t,backend:n}=e,{dy:a,y:r}=t,s=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Ad(Hj,a.shape,r.shape):new zl(Uj,a.shape,r.shape);return n.runWebGLProgram(s,[a,r],a.dtype)},qj={kernelName:Vp,backendName:"webgl",kernelFunc:Gj},Xj=` +`,qj=e=>{let{inputs:t,backend:n}=e,{dy:a,y:r}=t,s=J().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new yd(Gj,a.shape,r.shape):new _l(Hj,a.shape,r.shape);return n.runWebGLProgram(s,[a,r],a.dtype)},Xj={kernelName:jp,backendName:"webgl",kernelFunc:qj},Kj=` return vec4(equal(a, b)); -`,Kj="return float(a == b);",Zj=en({opSnippet:Kj,packedOpSnippet:Xj,dtype:"bool"}),Yj={kernelName:Ao,backendName:"webgl",kernelFunc:Zj},Jj=` +`,Zj="return float(a == b);",Yj=en({opSnippet:Zj,packedOpSnippet:Kj,dtype:"bool"}),Jj={kernelName:yo,backendName:"webgl",kernelFunc:Yj},Qj=` // Error function is calculated approximately with elementary function. // See "Handbook of Mathematical Functions with Formulas, // Graphs, and Mathematical Tables", Abramowitz and Stegun. @@ -2849,7 +2849,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam x = abs(x); float t = 1.0 / (1.0 + p * x); return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x)); -`,Qj=qe({opSnippet:Jj}),eU={kernelName:mo,backendName:"webgl",kernelFunc:Qj},Jv="return exp(x);",Qv=qe({opSnippet:Jv,packedOpSnippet:Jv,cpuKernelImpl:GL}),tU={kernelName:gs,backendName:"webgl",kernelFunc:Qv};function v1(e){let{inputs:t,attrs:n,backend:a}=e,{dim:r}=n,{input:s}=t,i=s.shape.length,o=s.shape.slice(),l=r;return r<0&&(k.assert(-(i+1)<=r,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+r+1),o.splice(l,0,1),Ae({inputs:{x:s},backend:a,attrs:{shape:o}})}var nU={kernelName:yo,backendName:"webgl",kernelFunc:v1},ew="return exp(x) - 1.0;",aU=qe({opSnippet:ew,packedOpSnippet:ew,cpuKernelImpl:qL}),rU={kernelName:go,backendName:"webgl",kernelFunc:aU},tw=class{constructor(e,t,n){this.variableNames=["real","imag"];let a=t[1];this.outputShape=t;let r=n?`2.0 * ${Math.PI}`:`-2.0 * ${Math.PI}`,s=n?`${a}.0`:"1.0",i;if(e==="real")i="return real * expR - imag * expI;";else if(e==="imag")i="return real * expI + imag * expR;";else throw new Error(`FFT component must be either "real" or "imag", got ${e}.`);this.userCode=` +`,eU=qe({opSnippet:Qj}),tU={kernelName:Ao,backendName:"webgl",kernelFunc:eU},Qv="return exp(x);",ew=qe({opSnippet:Qv,packedOpSnippet:Qv,cpuKernelImpl:qL}),nU={kernelName:xs,backendName:"webgl",kernelFunc:ew};function w1(e){let{inputs:t,attrs:n,backend:a}=e,{dim:r}=n,{input:s}=t,i=s.shape.length,o=s.shape.slice(),l=r;return r<0&&(k.assert(-(i+1)<=r,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+r+1),o.splice(l,0,1),Ae({inputs:{x:s},backend:a,attrs:{shape:o}})}var aU={kernelName:go,backendName:"webgl",kernelFunc:w1},tw="return exp(x) - 1.0;",rU=qe({opSnippet:tw,packedOpSnippet:tw,cpuKernelImpl:XL}),sU={kernelName:xo,backendName:"webgl",kernelFunc:rU},nw=class{constructor(e,t,n){this.variableNames=["real","imag"];let a=t[1];this.outputShape=t;let r=n?`2.0 * ${Math.PI}`:`-2.0 * ${Math.PI}`,s=n?`${a}.0`:"1.0",i;if(e==="real")i="return real * expR - imag * expI;";else if(e==="imag")i="return real * expI + imag * expR;";else throw new Error(`FFT component must be either "real" or "imag", got ${e}.`);this.userCode=` const float exponentMultiplier = ${r}; float unaryOpComplex(float real, float expR, float imag, float expI) { @@ -2882,13 +2882,13 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam ivec2 coords = getOutputCoords(); setOutput(mulMatDFT(coords[0], coords[1])); } - `}};function nw(e,t,n){let a=n.texData.get(e.dataId),r=k.sizeFromShape(e.shape),s=e.shape[e.shape.length-1],i=r/s,o=Ae({inputs:{x:e},backend:n,attrs:{shape:[i,s]}}),l=o.shape,d=new tw("real",l,t),u=new tw("imag",l,t),p=[{dataId:a.complexTensorInfos.real.dataId,dtype:a.complexTensorInfos.real.dtype,shape:l},{dataId:a.complexTensorInfos.imag.dataId,dtype:a.complexTensorInfos.imag.dtype,shape:l}],c=n.runWebGLProgram(d,p,"float32"),h=n.runWebGLProgram(u,p,"float32"),m=Lr({inputs:{real:c,imag:h},backend:n});n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h);let f=Ae({inputs:{x:m},backend:n,attrs:{shape:e.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(m),f}function sU(e){let{inputs:t,backend:n}=e,{input:a}=t;return nw(a,!1,n)}var iU={kernelName:jp,backendName:"webgl",kernelFunc:sU},oU=class{constructor(e,t){this.outputShape=[],this.variableNames=["x"],this.outputShape=e,this.userCode=` + `}};function aw(e,t,n){let a=n.texData.get(e.dataId),r=k.sizeFromShape(e.shape),s=e.shape[e.shape.length-1],i=r/s,o=Ae({inputs:{x:e},backend:n,attrs:{shape:[i,s]}}),l=o.shape,d=new nw("real",l,t),u=new nw("imag",l,t),p=[{dataId:a.complexTensorInfos.real.dataId,dtype:a.complexTensorInfos.real.dtype,shape:l},{dataId:a.complexTensorInfos.imag.dataId,dtype:a.complexTensorInfos.imag.dtype,shape:l}],c=n.runWebGLProgram(d,p,"float32"),h=n.runWebGLProgram(u,p,"float32"),m=Wr({inputs:{real:c,imag:h},backend:n});n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h);let f=Ae({inputs:{x:m},backend:n,attrs:{shape:e.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(m),f}function iU(e){let{inputs:t,backend:n}=e,{input:a}=t;return aw(a,!1,n)}var oU={kernelName:Up,backendName:"webgl",kernelFunc:iU},lU=class{constructor(e,t){this.outputShape=[],this.variableNames=["x"],this.outputShape=e,this.userCode=` uniform float value; void main() { // Input can be obtained from uniform value. setOutput(value); } - `}getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}};function w1(e){let{backend:t,attrs:n}=e,{shape:a,value:r}=n,{dtype:s}=n;if(s=s||k.inferDtype(r),s==="string"){let i=k.getArrayFromDType(s,k.sizeFromShape(a));return i.fill(r),t.makeTensorInfo(a,s,i)}else{let i=new oU(a,r),o=i.getCustomSetupFunc(r);return t.runWebGLProgram(i,[],s,o)}}var lU={kernelName:wu,backendName:"webgl",kernelFunc:w1},uU=class{constructor(e){this.variableNames=["Image"],this.outputShape=[];let t=e[2];this.outputShape=e,this.userCode=` + `}getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}};function k1(e){let{backend:t,attrs:n}=e,{shape:a,value:r}=n,{dtype:s}=n;if(s=s||k.inferDtype(r),s==="string"){let i=k.getArrayFromDType(s,k.sizeFromShape(a));return i.fill(r),t.makeTensorInfo(a,s,i)}else{let i=new lU(a,r),o=i.getCustomSetupFunc(r);return t.runWebGLProgram(i,[],s,o)}}var uU={kernelName:ku,backendName:"webgl",kernelFunc:k1},dU=class{constructor(e){this.variableNames=["Image"],this.outputShape=[];let t=e[2];this.outputShape=e,this.userCode=` void main() { ivec4 coords = getOutputCoords(); int x = coords[2]; @@ -2902,7 +2902,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(outputValue); } - `}},dU={kernelName:xo,backendName:"webgl",kernelFunc:({inputs:e,backend:t})=>{let{image:n}=e,a=t,r=new uU(n.shape);return a.runWebGLProgram(r,[n],n.dtype)}},aw="return floor(x);",pU=qe({opSnippet:aw,packedOpSnippet:aw,cpuKernelImpl:XL}),cU={kernelName:xs,backendName:"webgl",kernelFunc:pU},hU=` + `}},pU={kernelName:bo,backendName:"webgl",kernelFunc:({inputs:e,backend:t})=>{let{image:n}=e,a=t,r=new dU(n.shape);return a.runWebGLProgram(r,[n],n.dtype)}},rw="return floor(x);",cU=qe({opSnippet:rw,packedOpSnippet:rw,cpuKernelImpl:KL}),hU={kernelName:bs,backendName:"webgl",kernelFunc:cU},fU=` float s = sign(a) * sign(b); int ia = round(a); int ib = round(b); @@ -2912,7 +2912,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } else { return NAN; } -`,fU=` +`,mU=` ivec4 ia = round(a); ivec4 ib = round(b); bvec4 cond = notEqual(ib, ivec4(0)); @@ -2933,7 +2933,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam result[3] = idiv(ia[3], ib[3], s[3]); } return vec4(result); -`,mU=en({opSnippet:hU,packedOpSnippet:fU,dtype:"int32"}),AU={kernelName:bs,backendName:"webgl",kernelFunc:mU},yU=class{constructor(e){this.variableNames=["A"];let t=dn(),[n,a]=e;this.outputShape=e,this.userCode=` +`,AU=en({opSnippet:fU,packedOpSnippet:mU,dtype:"int32"}),yU={kernelName:vs,backendName:"webgl",kernelFunc:AU},gU=class{constructor(e){this.variableNames=["A"];let t=dn(),[n,a]=e;this.outputShape=e,this.userCode=` void main() { ivec3 coords = getOutputCoords(); int texR = coords[0]; @@ -2955,7 +2955,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam setOutput(floor(value * 255.0 + 0.5)); } - `}},gU=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;let t=dn(),[n,a]=e;this.outputShape=e,this.userCode=` + `}},xU=class{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;let t=dn(),[n,a]=e;this.outputShape=e,this.userCode=` void main() { ivec3 coords = getOutputCoords(); int texR = coords[0]; @@ -2989,7 +2989,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam ${t.output} = result; } - `}},bU={kernelName:sc,backendName:"webgl",kernelFunc:xU},Pl;function xU(e){let{inputs:t,backend:n,attrs:a}=e,{pixels:r}=t,{numChannels:s}=a,i=typeof HTMLVideoElement!="undefined"&&r instanceof HTMLVideoElement,o=typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement,[l,d]=i?[r.videoWidth,r.videoHeight]:[r.width,r.height],u=[d,l],p=[d,l,s];(o||i)&&(Pl==null&&(Pl=document.createElement("canvas").getContext("2d")),Pl.canvas.width=l,Pl.canvas.height=d,Pl.drawImage(r,0,0,l,d),r=Pl.canvas);let c=n.makeTensorInfo(u,"int32");n.texData.get(c.dataId).usage=Yn.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(c.dataId),r);let h=J().getBool("WEBGL_PACK")?new gU(p):new yU(p),m=n.runWebGLProgram(h,[c],"int32");return n.disposeData(c.dataId),m}function vU(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dataFormat:u,dilations:p,dimRoundingMode:c,activation:h,leakyreluAlpha:m}=a,f=C.convertConv2DDataFormat(u),A=C.computeConv2DInfo(r.shape,s.shape,l,p,d,c,!1,f),y,g=[];if(A.filterHeight===1&&A.filterWidth===1&&A.dilationHeight===1&&A.dilationWidth===1&&A.strideHeight===1&&A.strideWidth===1&&(A.padInfo.type==="SAME"||A.padInfo.type==="VALID"))y=Hv({x:r,filter:s,convInfo:A,backend:n,bias:i,activation:h,preluActivationWeights:o,leakyreluAlpha:m});else if(J().getBool("WEBGL_CONV_IM2COL")&&r.shape[0]===1)y=Gv({x:r,filter:s,convInfo:A,backend:n,bias:i,activation:h,preluActivationWeights:o,leakyreluAlpha:m});else{let w=i!=null,b=o!=null,v=h==="leakyrelu",N=h?gh(h,!1):null,T=new Uv(A,w,N,b,v),R=[r,s];if(i&&R.push(i),o&&R.push(o),v){let $=n.makeTensorInfo([],"float32",k.createScalarValue(m,"float32"));R.push($),g.push($)}y=n.runWebGLProgram(T,R,"float32")}let x=Ae({inputs:{x:y},backend:n,attrs:{shape:A.outShape}});return g.push(y),g.forEach(w=>n.disposeIntermediateTensorInfo(w)),x}var wU={kernelName:ti,backendName:"webgl",kernelFunc:vU};function kU(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dilations:u,dimRoundingMode:p,activation:c,leakyreluAlpha:h}=a,m=[],f=u;f==null&&(f=[1,1]),k.assert(C.eitherStridesOrDilationsAreOne(l,f),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${l} and dilations '${f}'`);let A=C.computeConv2DInfo(r.shape,s.shape,l,f,d,p,!0),y=J().getBool("WEBGL_PACK_DEPTHWISECONV")&&A.strideWidth<=2&&A.outChannels/A.inChannels==1,g=c?gh(c,y):null,x=[r,s],w=i!=null,b=o!=null,v=c==="leakyrelu";if(w&&x.push(i),b&&x.push(o),v){let R=n.makeTensorInfo([],"float32",k.createScalarValue(h,"float32"));x.push(R),m.push(R)}let N;y?N=new Yv(A,w,g,b,v):N=new Zv(A,w,g,b,v);let T=n.runWebGLProgram(N,x,"float32");return m.forEach(R=>n.disposeIntermediateTensorInfo(R)),T}var IU={kernelName:ni,backendName:"webgl",kernelFunc:kU},SU=class{constructor(e,t,n){this.sliceDim=e,this.strides=t,this.variableNames=["x","indices"],this.outputShape=n;let a=lt(t.length),r=lt(n.length),s=this.sliceDim>1?"strides[j]":"strides";this.userCode=` + `}},vU={kernelName:ic,backendName:"webgl",kernelFunc:bU},Ll;function bU(e){let{inputs:t,backend:n,attrs:a}=e,{pixels:r}=t,{numChannels:s}=a,i=typeof HTMLVideoElement!="undefined"&&r instanceof HTMLVideoElement,o=typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement,[l,d]=i?[r.videoWidth,r.videoHeight]:[r.width,r.height],u=[d,l],p=[d,l,s];(o||i)&&(Ll==null&&(Ll=document.createElement("canvas").getContext("2d")),Ll.canvas.width=l,Ll.canvas.height=d,Ll.drawImage(r,0,0,l,d),r=Ll.canvas);let c=n.makeTensorInfo(u,"int32");n.texData.get(c.dataId).usage=Yn.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(c.dataId),r);let h=J().getBool("WEBGL_PACK")?new xU(p):new gU(p),m=n.runWebGLProgram(h,[c],"int32");return n.disposeData(c.dataId),m}function wU(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dataFormat:u,dilations:p,dimRoundingMode:c,activation:h,leakyreluAlpha:m}=a,f=C.convertConv2DDataFormat(u),A=C.computeConv2DInfo(r.shape,s.shape,l,p,d,c,!1,f),y,g=[];if(A.filterHeight===1&&A.filterWidth===1&&A.dilationHeight===1&&A.dilationWidth===1&&A.strideHeight===1&&A.strideWidth===1&&(A.padInfo.type==="SAME"||A.padInfo.type==="VALID"))y=Gv({x:r,filter:s,convInfo:A,backend:n,bias:i,activation:h,preluActivationWeights:o,leakyreluAlpha:m});else if(J().getBool("WEBGL_CONV_IM2COL")&&r.shape[0]===1)y=qv({x:r,filter:s,convInfo:A,backend:n,bias:i,activation:h,preluActivationWeights:o,leakyreluAlpha:m});else{let w=i!=null,b=o!=null,v=h==="leakyrelu",N=h?xh(h,!1):null,T=new Hv(A,w,N,b,v),R=[r,s];if(i&&R.push(i),o&&R.push(o),v){let $=n.makeTensorInfo([],"float32",k.createScalarValue(m,"float32"));R.push($),g.push($)}y=n.runWebGLProgram(T,R,"float32")}let x=Ae({inputs:{x:y},backend:n,attrs:{shape:A.outShape}});return g.push(y),g.forEach(w=>n.disposeIntermediateTensorInfo(w)),x}var kU={kernelName:ni,backendName:"webgl",kernelFunc:wU};function IU(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dilations:u,dimRoundingMode:p,activation:c,leakyreluAlpha:h}=a,m=[],f=u;f==null&&(f=[1,1]),k.assert(C.eitherStridesOrDilationsAreOne(l,f),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${l} and dilations '${f}'`);let A=C.computeConv2DInfo(r.shape,s.shape,l,f,d,p,!0),y=J().getBool("WEBGL_PACK_DEPTHWISECONV")&&A.strideWidth<=2&&A.outChannels/A.inChannels==1,g=c?xh(c,y):null,x=[r,s],w=i!=null,b=o!=null,v=c==="leakyrelu";if(w&&x.push(i),b&&x.push(o),v){let R=n.makeTensorInfo([],"float32",k.createScalarValue(h,"float32"));x.push(R),m.push(R)}let N;y?N=new Jv(A,w,g,b,v):N=new Yv(A,w,g,b,v);let T=n.runWebGLProgram(N,x,"float32");return m.forEach(R=>n.disposeIntermediateTensorInfo(R)),T}var SU={kernelName:ai,backendName:"webgl",kernelFunc:IU},NU=class{constructor(e,t,n){this.sliceDim=e,this.strides=t,this.variableNames=["x","indices"],this.outputShape=n;let a=lt(t.length),r=lt(n.length),s=this.sliceDim>1?"strides[j]":"strides";this.userCode=` ${a} strides = ${a}(${this.strides}); void main() { ${r} coords = getOutputCoords(); @@ -3000,21 +3000,21 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(getX(flattenIndex, coords[1])); } - `}};function NU(e){let{inputs:t,backend:n}=e,{params:a,indices:r}=t,s=r.shape,i=s[s.length-1],[o,l,d,u]=C.prepareAndValidate(a,r),p=Ae({inputs:{x:r},backend:n,attrs:{shape:[l,i]}}),c=Ae({inputs:{x:a},backend:n,attrs:{shape:[k.sizeFromShape(a.shape)/d,d]}}),h=new SU(i,u,[l,d]),m=n.runWebGLProgram(h,[c,p],c.dtype),f=Ae({inputs:{x:m},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(m),f}var TU={kernelName:vo,backendName:"webgl",kernelFunc:NU},CU=class{constructor(e,t){this.variableNames=["A","indices"],this.outputShape=t,this.rank=t.length;let n=lt(this.rank),a=EU(e,2);this.userCode=` + `}};function TU(e){let{inputs:t,backend:n}=e,{params:a,indices:r}=t,s=r.shape,i=s[s.length-1],[o,l,d,u]=C.prepareAndValidate(a,r),p=Ae({inputs:{x:r},backend:n,attrs:{shape:[l,i]}}),c=Ae({inputs:{x:a},backend:n,attrs:{shape:[k.sizeFromShape(a.shape)/d,d]}}),h=new NU(i,u,[l,d]),m=n.runWebGLProgram(h,[c,p],c.dtype),f=Ae({inputs:{x:m},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(m),f}var EU={kernelName:wo,backendName:"webgl",kernelFunc:TU},RU=class{constructor(e,t){this.variableNames=["A","indices"],this.outputShape=t,this.rank=t.length;let n=lt(this.rank),a=CU(e,2);this.userCode=` void main() { ${n} resRC = getOutputCoords(); setOutput(getA(${a})); } - `}};function EU(e,t){let n=["resRC.x","resRC.y","resRC.z","resRC.w"],a=[];for(let r=0;rn.disposeIntermediateTensorInfo(b)),n.makeTensorInfo(d.outputShape,w.dtype,w.values)}let f=new CU(c.shape,m),A=n.runWebGLProgram(f,[c,h],c.dtype);p.push(A);let y=Ae({inputs:{x:A},backend:n,attrs:{shape:d.outputShape}});return p.forEach(g=>n.disposeIntermediateTensorInfo(g)),y}var MU={kernelName:bo,backendName:"webgl",kernelFunc:RU},FU="return float(a > b);",$U=` + `}};function CU(e,t){let n=["resRC.x","resRC.y","resRC.z","resRC.w"],a=[];for(let r=0;rn.disposeIntermediateTensorInfo(b)),n.makeTensorInfo(d.outputShape,w.dtype,w.values)}let f=new RU(c.shape,m),A=n.runWebGLProgram(f,[c,h],c.dtype);p.push(A);let y=Ae({inputs:{x:A},backend:n,attrs:{shape:d.outputShape}});return p.forEach(g=>n.disposeIntermediateTensorInfo(g)),y}var FU={kernelName:vo,backendName:"webgl",kernelFunc:MU},$U="return float(a > b);",DU=` return vec4(greaterThan(a, b)); -`,DU=en({opSnippet:FU,packedOpSnippet:$U,cpuKernelImpl:ZL,dtype:"bool"}),OU={kernelName:wo,backendName:"webgl",kernelFunc:DU},zU="return float(a >= b);",_U=` +`,OU=en({opSnippet:$U,packedOpSnippet:DU,cpuKernelImpl:YL,dtype:"bool"}),zU={kernelName:ko,backendName:"webgl",kernelFunc:OU},_U="return float(a >= b);",PU=` return vec4(greaterThanEqual(a, b)); -`,PU=en({opSnippet:zU,packedOpSnippet:_U,dtype:"bool"}),LU={kernelName:ws,backendName:"webgl",kernelFunc:PU};function WU(e){let{inputs:t,backend:n}=e,{input:a}=t;return nw(a,!0,n)}var BU={kernelName:Up,backendName:"webgl",kernelFunc:WU},VU="return float(!isnan(x) && !isinf(x));",jU=qe({opSnippet:VU,dtype:"bool"}),UU={kernelName:ko,backendName:"webgl",kernelFunc:jU},HU="return float(isinf(x));",GU=qe({opSnippet:HU,dtype:"bool"}),qU={kernelName:Io,backendName:"webgl",kernelFunc:GU},XU="return float(isnan(x));",KU=qe({opSnippet:XU,dtype:"bool"}),ZU={kernelName:So,backendName:"webgl",kernelFunc:KU},YU="return float(a < b);",JU=` +`,LU=en({opSnippet:_U,packedOpSnippet:PU,dtype:"bool"}),WU={kernelName:ks,backendName:"webgl",kernelFunc:LU};function BU(e){let{inputs:t,backend:n}=e,{input:a}=t;return aw(a,!0,n)}var VU={kernelName:Hp,backendName:"webgl",kernelFunc:BU},jU="return float(!isnan(x) && !isinf(x));",UU=qe({opSnippet:jU,dtype:"bool"}),HU={kernelName:Io,backendName:"webgl",kernelFunc:UU},GU="return float(isinf(x));",qU=qe({opSnippet:GU,dtype:"bool"}),XU={kernelName:So,backendName:"webgl",kernelFunc:qU},KU="return float(isnan(x));",ZU=qe({opSnippet:KU,dtype:"bool"}),YU={kernelName:No,backendName:"webgl",kernelFunc:ZU},JU="return float(a < b);",QU=` return vec4(lessThan(a, b)); -`,QU=en({opSnippet:YU,packedOpSnippet:JU,cpuKernelImpl:YL,dtype:"bool"}),eH={kernelName:No,backendName:"webgl",kernelFunc:QU},tH="return float(a <= b);",nH=` +`,eH=en({opSnippet:JU,packedOpSnippet:QU,cpuKernelImpl:JL,dtype:"bool"}),tH={kernelName:To,backendName:"webgl",kernelFunc:eH},nH="return float(a <= b);",aH=` return vec4(lessThanEqual(a, b)); -`,aH=en({opSnippet:tH,packedOpSnippet:nH,dtype:"bool"}),rH={kernelName:To,backendName:"webgl",kernelFunc:aH};function sH(e){let{backend:t,attrs:n}=e,{start:a,stop:r,num:s}=n,i=JL(a,r,s);return t.makeTensorInfo([i.length],"float32",i)}var iH={kernelName:Gp,backendName:"webgl",kernelFunc:sH},oH=`if (x < 0.0) return NAN; - return log(x);`,lH=` +`,rH=en({opSnippet:nH,packedOpSnippet:aH,dtype:"bool"}),sH={kernelName:Eo,backendName:"webgl",kernelFunc:rH};function iH(e){let{backend:t,attrs:n}=e,{start:a,stop:r,num:s}=n,i=QL(a,r,s);return t.makeTensorInfo([i.length],"float32",i)}var oH={kernelName:qp,backendName:"webgl",kernelFunc:iH},lH=`if (x < 0.0) return NAN; + return log(x);`,uH=` vec4 result = log(x); vec4 isNaN = vec4(lessThan(x, vec4(0.0))); result.r = isNaN.r == 1.0 ? NAN : result.r; @@ -3023,16 +3023,16 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam result.a = isNaN.a == 1.0 ? NAN : result.a; return result; -`,uH=qe({opSnippet:oH,packedOpSnippet:lH,cpuKernelImpl:QL}),dH={kernelName:Ss,backendName:"webgl",kernelFunc:uH},pH="return log(1.0 + x);",cH=qe({opSnippet:pH}),hH={kernelName:Eo,backendName:"webgl",kernelFunc:cH},fH="return float(a >= 1.0 && b >= 1.0);",mH=` +`,dH=qe({opSnippet:lH,packedOpSnippet:uH,cpuKernelImpl:eW}),pH={kernelName:Ns,backendName:"webgl",kernelFunc:dH},cH="return log(1.0 + x);",hH=qe({opSnippet:cH}),fH={kernelName:Co,backendName:"webgl",kernelFunc:hH},mH="return float(a >= 1.0 && b >= 1.0);",AH=` return vec4( vec4(greaterThanEqual(a, vec4(1.0))) * vec4(greaterThanEqual(b, vec4(1.0)))); -`,AH=en({opSnippet:fH,packedOpSnippet:mH,dtype:"bool"}),yH={kernelName:Co,backendName:"webgl",kernelFunc:AH},gH="return float(!(x >= 1.0));",xH=qe({opSnippet:gH}),bH={kernelName:ku,backendName:"webgl",kernelFunc:xH},vH="return float(a >= 1.0 || b >= 1.0);",wH=` +`,yH=en({opSnippet:mH,packedOpSnippet:AH,dtype:"bool"}),gH={kernelName:Ro,backendName:"webgl",kernelFunc:yH},xH="return float(!(x >= 1.0));",bH=qe({opSnippet:xH}),vH={kernelName:Iu,backendName:"webgl",kernelFunc:bH},wH="return float(a >= 1.0 || b >= 1.0);",kH=` return min( vec4(greaterThanEqual(a, vec4(1.0))) + vec4(greaterThanEqual(b, vec4(1.0))), vec4(1.0)); -`,kH=en({opSnippet:vH,packedOpSnippet:wH,dtype:"bool"}),IH={kernelName:Iu,backendName:"webgl",kernelFunc:kH},SH=class{constructor(e,t,n,a,r){this.variableNames=["x"],this.outputShape=[];let s=t,i=e[3]-1;this.outputShape=e;let o,l=`float(${n}) + float(${a}) * sum`;r===.5?o=`inversesqrt(${l})`:r===1?o=`1.0/(${l})`:o=`exp(log(${l}) * float(-${r}));`,this.userCode=` +`,IH=en({opSnippet:wH,packedOpSnippet:kH,dtype:"bool"}),SH={kernelName:Su,backendName:"webgl",kernelFunc:IH},NH=class{constructor(e,t,n,a,r){this.variableNames=["x"],this.outputShape=[];let s=t,i=e[3]-1;this.outputShape=e;let o,l=`float(${n}) + float(${a}) * sum`;r===.5?o=`inversesqrt(${l})`:r===1?o=`1.0/(${l})`:o=`exp(log(${l}) * float(-${r}));`,this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords[0]; @@ -3051,7 +3051,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam float val = x * ${o}; setOutput(val); } - `}},NH=class{constructor(e,t,n,a,r){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;let s=t,i=e[3]-1;this.outputShape=e;let o,l=`float(${n}) + float(${a}) * sum`;r===.5?o=`inversesqrt(${l})`:r===1?o=`1.0/(${l})`:o=`exp(log(${l}) * float(-${r}));`,this.userCode=` + `}},TH=class{constructor(e,t,n,a,r){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;let s=t,i=e[3]-1;this.outputShape=e;let o,l=`float(${n}) + float(${a}) * sum`;r===.5?o=`inversesqrt(${l})`:r===1?o=`1.0/(${l})`:o=`exp(log(${l}) * float(-${r}));`,this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords.x; @@ -3113,7 +3113,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam vec4 result = xAtOutputCoords * ${o}; setOutput(result); } - `}},TH=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{depthRadius:s,bias:i,alpha:o,beta:l}=a,d=J().getBool("WEBGL_PACK_NORMALIZATION")?new NH(r.shape,s,i,o,l):new SH(r.shape,s,i,o,l);return n.runWebGLProgram(d,[r],r.dtype)},EH={kernelName:Su,backendName:"webgl",kernelFunc:TH},CH=class{constructor(e,t,n,a,r){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=e,this.depth=e[3],this.depthRadius=t,this.bias=n,this.alpha=a,this.beta=r,this.userCode=` + `}},EH=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{depthRadius:s,bias:i,alpha:o,beta:l}=a,d=J().getBool("WEBGL_PACK_NORMALIZATION")?new TH(r.shape,s,i,o,l):new NH(r.shape,s,i,o,l);return n.runWebGLProgram(d,[r],r.dtype)},CH={kernelName:Nu,backendName:"webgl",kernelFunc:EH},RH=class{constructor(e,t,n,a,r){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=e,this.depth=e[3],this.depthRadius=t,this.bias=n,this.alpha=a,this.beta=r,this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords[0]; @@ -3168,14 +3168,14 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(result); } - `}},RH=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r,y:s,dy:i}=t,{depthRadius:o,bias:l,alpha:d,beta:u}=a,p=new CH(r.shape,o,l,d,u);return n.runWebGLProgram(p,[r,s,i],r.dtype)},MH={kernelName:qp,backendName:"webgl",kernelFunc:RH};function FH(e,t,n,a){let r=k.sizeFromShape(t),s=k.sizeFromShape(e.shape)/r,i=Ae({inputs:{x:e},attrs:{shape:[s,r]},backend:a}),o=Si(i,e.dtype,"max",a),l=Ae({inputs:{x:o},attrs:{shape:n},backend:a});return a.disposeIntermediateTensorInfo(i),a.disposeIntermediateTensorInfo(o),l}function rw(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{reductionIndices:s,keepDims:i}=a,o=r.shape.length,l=k.parseAxisParam(s,r.shape),d=l,u=C.getAxesPermutation(d,o),p=u!=null,c=n.shouldExecuteOnCPU([r]),h=r;if(p){if(c){let g=n.texData.get(h.dataId).values,x=new Array(o);for(let v=0;v{let{inputs:t,backend:n,attrs:a}=e,{x:r,y:s,dy:i}=t,{depthRadius:o,bias:l,alpha:d,beta:u}=a,p=new RH(r.shape,o,l,d,u);return n.runWebGLProgram(p,[r,s,i],r.dtype)},FH={kernelName:Xp,backendName:"webgl",kernelFunc:MH};function $H(e,t,n,a){let r=k.sizeFromShape(t),s=k.sizeFromShape(e.shape)/r,i=Ae({inputs:{x:e},attrs:{shape:[s,r]},backend:a}),o=Ni(i,e.dtype,"max",a),l=Ae({inputs:{x:o},attrs:{shape:n},backend:a});return a.disposeIntermediateTensorInfo(i),a.disposeIntermediateTensorInfo(o),l}function sw(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{reductionIndices:s,keepDims:i}=a,o=r.shape.length,l=k.parseAxisParam(s,r.shape),d=l,u=C.getAxesPermutation(d,o),p=u!=null,c=n.shouldExecuteOnCPU([r]),h=r;if(p){if(c){let g=n.texData.get(h.dataId).values,x=new Array(o);for(let v=0;v`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);let u=C.computePool2DInfo(r.shape,s,i,d,o,l);if(u.filterWidth===1&&u.filterHeight===1&&k.arraysEqual(u.inShape,u.outShape))return Pn({inputs:{x:r},backend:n});let p=new yd(u,"max",!1);return n.runWebGLProgram(p,[r],r.dtype)}var LH={kernelName:Es,backendName:"webgl",kernelFunc:PH};function WH(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dataFormat:l,dimRoundingMode:d}=a,u=[1,1,1],p=C.computePool3DInfo(r.shape,s,i,u,o,d,l),c=new g1(p,"max",!1);return n.runWebGLProgram(c,[r],r.dtype)}var BH={kernelName:Nu,backendName:"webgl",kernelFunc:WH},VH=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;let t=e.strideHeight,n=e.strideWidth,a=e.dilationHeight,r=e.effectiveFilterHeight,s=e.effectiveFilterWidth,i=r-1-e.padInfo.top,o=s-1-e.padInfo.left,l=r*s-1;this.userCode=` +`,_H=en({opSnippet:OH,packedOpSnippet:zH,cpuKernelImpl:nW}),PH={kernelName:Es,backendName:"webgl",kernelFunc:_H};function LH(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t;Cl(r,"maxPool");let{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=a,d=1;k.assert(C.eitherStridesOrDilationsAreOne(i,d),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);let u=C.computePool2DInfo(r.shape,s,i,d,o,l);if(u.filterWidth===1&&u.filterHeight===1&&k.arraysEqual(u.inShape,u.outShape))return Pn({inputs:{x:r},backend:n});let p=new gd(u,"max",!1);return n.runWebGLProgram(p,[r],r.dtype)}var WH={kernelName:Cs,backendName:"webgl",kernelFunc:LH};function BH(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{filterSize:s,strides:i,pad:o,dataFormat:l,dimRoundingMode:d}=a,u=[1,1,1],p=C.computePool3DInfo(r.shape,s,i,u,o,d,l),c=new x1(p,"max",!1);return n.runWebGLProgram(c,[r],r.dtype)}var VH={kernelName:Tu,backendName:"webgl",kernelFunc:BH},jH=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;let t=e.strideHeight,n=e.strideWidth,a=e.dilationHeight,r=e.effectiveFilterHeight,s=e.effectiveFilterWidth,i=r-1-e.padInfo.top,o=s-1-e.padInfo.left,l=r*s-1;this.userCode=` const ivec2 pads = ivec2(${i}, ${o}); void main() { @@ -3221,7 +3221,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(dotProd); } - `}},jH=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;let t=e.strideDepth,n=e.strideHeight,a=e.strideWidth,r=e.dilationDepth,s=e.dilationHeight,i=e.dilationWidth,o=e.effectiveFilterDepth,l=e.effectiveFilterHeight,d=e.effectiveFilterWidth,u=o-1-e.padInfo.front,p=l-1-e.padInfo.top,c=d-1-e.padInfo.left,h=o*l*d-1;this.userCode=` + `}},UH=class{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;let t=e.strideDepth,n=e.strideHeight,a=e.strideWidth,r=e.dilationDepth,s=e.dilationHeight,i=e.dilationWidth,o=e.effectiveFilterDepth,l=e.effectiveFilterHeight,d=e.effectiveFilterWidth,u=o-1-e.padInfo.front,p=l-1-e.padInfo.top,c=d-1-e.padInfo.left,h=o*l*d-1;this.userCode=` const ivec3 pads = ivec3(${u}, ${p}, ${c}); void main() { @@ -3285,14 +3285,14 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam } setOutput(dotProd); } - `}};function UH(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s}=t,i=s,{filterSize:o,strides:l,pad:d,dimRoundingMode:u}=a,p=[1,1,1],c=C.computePool3DInfo(i.shape,o,l,p,d,u),h=new g1(c,"max",!0),m=n.runWebGLProgram(h,[i],i.dtype),f=new jH(c),A=n.runWebGLProgram(f,[r,m],i.dtype);return n.disposeIntermediateTensorInfo(m),A}var HH={kernelName:Kp,backendName:"webgl",kernelFunc:UH};function GH(e){let{inputs:t,backend:n,attrs:a}=e,{dy:r,input:s,output:i}=t,o=s;El([s,i],"maxPoolGrad");let{filterSize:l,strides:d,pad:u,dimRoundingMode:p}=a,c=C.computePool2DInfo(o.shape,l,d,1,u,p),h=!0,m=new yd(c,"max",h),f=n.runWebGLProgram(m,[o],o.dtype),A=new VH(c),y=n.runWebGLProgram(A,[r,f],o.dtype);return n.disposeIntermediateTensorInfo(f),y}var qH={kernelName:Xp,backendName:"webgl",kernelFunc:GH};function XH(e,t,n,a){let r=new yd(n,"max",!1),s=a.runWebGLProgram(r,[e],"float32");r=new yd(n,"max",!0,!0,t);let i=a.runWebGLProgram(r,[e],"float32");return[s,i]}var KH={kernelName:Zp,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:a}=e,{filterSize:r,strides:s,pad:i,includeBatchInIndex:o}=t,l=n;k.assert(a.shape.length===4,()=>`Error in maxPool: input must be rank 4 but got rank ${a.shape.length}.`);let d=[1,1];k.assert(C.eitherStridesOrDilationsAreOne(s,d),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${s} and dilations '${d}'`);let u=C.computePool2DInfo(a.shape,r,s,d,i),[p,c]=XH(a,o,u,l);return[p,c]}};function ZH(e,t,n,a){let r=k.sizeFromShape(t),s=k.sizeFromShape(e.shape)/r,i=Ae({inputs:{x:e},attrs:{shape:[s,r]},backend:a}),o=Si(i,"float32","mean",a),l=Ae({inputs:{x:o},attrs:{shape:n},backend:a});return a.disposeIntermediateTensorInfo(i),a.disposeIntermediateTensorInfo(o),l}var YH={kernelName:Cs,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:a}=e,{keepDims:r,axis:s}=t,i=n,o=a.shape.length,l=k.parseAxisParam(s,a.shape),d=l,u=C.getAxesPermutation(d,o),p=u!=null,c=i.shouldExecuteOnCPU([a]),h=[],m=a;if(p){if(c){let x=i.texData.get(m.dataId).values,w=new Array(o);for(let N=0;N{let{x:a}=e,{filterSize:r,strides:s,pad:i,includeBatchInIndex:o}=t,l=n;k.assert(a.shape.length===4,()=>`Error in maxPool: input must be rank 4 but got rank ${a.shape.length}.`);let d=[1,1];k.assert(C.eitherStridesOrDilationsAreOne(s,d),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${s} and dilations '${d}'`);let u=C.computePool2DInfo(a.shape,r,s,d,i),[p,c]=KH(a,o,u,l);return[p,c]}};function YH(e,t,n,a){let r=k.sizeFromShape(t),s=k.sizeFromShape(e.shape)/r,i=Ae({inputs:{x:e},attrs:{shape:[s,r]},backend:a}),o=Ni(i,"float32","mean",a),l=Ae({inputs:{x:o},attrs:{shape:n},backend:a});return a.disposeIntermediateTensorInfo(i),a.disposeIntermediateTensorInfo(o),l}var JH={kernelName:Rs,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{x:a}=e,{keepDims:r,axis:s}=t,i=n,o=a.shape.length,l=k.parseAxisParam(s,a.shape),d=l,u=C.getAxesPermutation(d,o),p=u!=null,c=i.shouldExecuteOnCPU([a]),h=[],m=a;if(p){if(c){let x=i.texData.get(m.dataId).values,w=new Array(o);for(let N=0;Nd[0]+e[u]+d[1]);let a=e.length,r=lt(a),s=t.map(d=>d[0]).join(","),i=t.map((d,u)=>d[0]+e[u]).join(","),o=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,a),l=n==="reflect"?0:1;if(a===1){this.userCode=` +`,aG=en({opSnippet:tG,packedOpSnippet:nG,cpuKernelImpl:aW}),rG={kernelName:Fs,backendName:"webgl",kernelFunc:aG},sG=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map((d,u)=>d[0]+e[u]+d[1]);let a=e.length,r=lt(a),s=t.map(d=>d[0]).join(","),i=t.map((d,u)=>d[0]+e[u]).join(","),o=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,a),l=n==="reflect"?0:1;if(a===1){this.userCode=` int start = ${s}; int end = ${i}; @@ -3321,7 +3321,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam ${r} coords = outC - start; setOutput(getX(${o})); } - `}},sG=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((h,m)=>h[0]+e[m]+h[1]);let a=e.length,r=lt(a),s=t.map(h=>h[0]).join(","),i=t.map((h,m)=>h[0]+e[m]).join(","),o=pn("rc",a),l=pn("source",a),d=`${o[a-1]} < ${this.outputShape[a-1]}`,u=a===1?"source":`vec2(${l.slice(-2).join()})`,p=n==="reflect"?0:1,c="";if(a===1){let h=` + `}},iG=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((h,m)=>h[0]+e[m]+h[1]);let a=e.length,r=lt(a),s=t.map(h=>h[0]).join(","),i=t.map((h,m)=>h[0]+e[m]).join(","),o=pn("rc",a),l=pn("source",a),d=`${o[a-1]} < ${this.outputShape[a-1]}`,u=a===1?"source":`vec2(${l.slice(-2).join()})`,p=n==="reflect"?0:1,c="";if(a===1){let h=` ${r} source = rc; if (source < start) { source = start * 2 - source - ${p}; @@ -3377,13 +3377,13 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam ${c} setOutput(result); } - `}},iG=({inputs:e,backend:t,attrs:n})=>{let{x:a}=e,{paddings:r,mode:s}=n,i=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new sG(a.shape,r,s):new rG(a.shape,r,s);return t.runWebGLProgram(i,[a],a.dtype)},oG={kernelName:Fs,backendName:"webgl",kernelFunc:iG},lG=`if (b == 0.0) return NAN; - return mod(a, b);`,uG=` + `}},oG=({inputs:e,backend:t,attrs:n})=>{let{x:a}=e,{paddings:r,mode:s}=n,i=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new iG(a.shape,r,s):new sG(a.shape,r,s);return t.runWebGLProgram(i,[a],a.dtype)},lG={kernelName:$s,backendName:"webgl",kernelFunc:oG},uG=`if (b == 0.0) return NAN; + return mod(a, b);`,dG=` vec4 result = mod(a, b); vec4 isNaN = vec4(equal(b, vec4(0.0))); - `+yh+` + `+gh+` return result; -`,dG=en({opSnippet:lG,packedOpSnippet:uG}),pG={kernelName:Ro,backendName:"webgl",kernelFunc:dG},cG=class{constructor(e,t,n){this.variableNames=["probs"],this.outputShape=[e,n],this.userCode=` +`,pG=en({opSnippet:uG,packedOpSnippet:dG}),cG={kernelName:Mo,backendName:"webgl",kernelFunc:pG},hG=class{constructor(e,t,n){this.variableNames=["probs"],this.outputShape=[e,n],this.userCode=` uniform float seed; void main() { @@ -3405,11 +3405,11 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,YB=qe({opSnippet:ZB}),JB={kernelNam // If no other event happened, last event happened. setOutput(float(${t-1})); } - `}getCustomSetupFunc(e){return(t,n)=>{this.seedLoc==null&&(this.seedLoc=t.getUniformLocation(n,"seed")),t.gl.uniform1f(this.seedLoc,e)}}},hG=` + `}getCustomSetupFunc(e){return(t,n)=>{this.seedLoc==null&&(this.seedLoc=t.getUniformLocation(n,"seed")),t.gl.uniform1f(this.seedLoc,e)}}},fG=` if (a == b) { return 1.0; }; -return a / b;`,fG=` +return a / b;`,mG=` // vec4 one = vec4(equal(a, b)); // return one + (vec4(1.0) - one) * a / b; vec4 result = a / b; @@ -3427,14 +3427,14 @@ return a / b;`,fG=` } return result; -`,sw=en({opSnippet:hG,packedOpSnippet:fG,checkOutOfBounds:!0}),mG={kernelName:ys,backendName:"webgl",kernelFunc:sw},iw="return a - b;",ow=en({opSnippet:iw,packedOpSnippet:iw,supportsComplex:!0,cpuKernelImpl:cW}),AG={kernelName:Zs,backendName:"webgl",kernelFunc:ow};function lw(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{dim:s}=a,i=k.parseAxisParam([s],r.shape),o=rw({inputs:{x:r},backend:n,attrs:{reductionIndices:i,keepDims:!1}}),l=C.expandShapeToKeepDim(o.shape,i),d=Ae({inputs:{x:o},backend:n,attrs:{shape:l}}),u=ow({inputs:{a:r,b:d},backend:n}),p=Qv({inputs:{x:u},backend:n}),c=bh({inputs:{x:p},backend:n,attrs:{axis:i,keepDims:!1}}),h=Ae({inputs:{x:c},backend:n,attrs:{shape:l}}),m=sw({inputs:{a:p,b:h},backend:n});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h),m}var yG={kernelName:Xs,backendName:"webgl",kernelFunc:lw};function gG(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{numSamples:s,seed:i,normalized:o}=a,l=o?r:lw({inputs:{logits:r},backend:n,attrs:{dim:r.shape.length-1}}),d=l.shape[0],u=l.shape[1],p=new cG(d,u,s),c=p.getCustomSetupFunc(i),h=n.runWebGLProgram(p,[l],"int32",c);return o||n.disposeIntermediateTensorInfo(l),h}var xG={kernelName:Yp,backendName:"webgl",kernelFunc:gG},uw="return -x;";function bG(e){let{inputs:t,backend:n}=e,{x:a}=t;if(n.shouldExecuteOnCPU([a])){let s=n.texData.get(a.dataId),[i,o]=rW(s.values,a.shape,a.dtype);return n.makeTensorInfo(o,a.dtype,i)}let r;return J().getBool("WEBGL_PACK_UNARY_OPERATIONS")?r=new Dl(a.shape,uw):r=new Pr(a.shape,uw),n.runWebGLProgram(r,[a],a.dtype)}var vG={kernelName:Mo,backendName:"webgl",kernelFunc:bG},wG=La.nonMaxSuppressionV3Impl;function kG(e){C.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l}=a,d=n.readSync(r.dataId),u=n.readSync(s.dataId),{selectedIndices:p}=wG(d,u,i,o,l);return n.makeTensorInfo([p.length],"int32",new Int32Array(p))}var IG={kernelName:$o,backendName:"webgl",kernelFunc:kG},SG=La.nonMaxSuppressionV4Impl;function NG(e){C.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,padToMaxOutputSize:d}=a,u=n.readSync(r.dataId),p=n.readSync(s.dataId),{selectedIndices:c,validOutputs:h}=SG(u,p,i,o,l,d);return[n.makeTensorInfo([c.length],"int32",new Int32Array(c)),n.makeTensorInfo([],"int32",new Int32Array([h]))]}var TG={kernelName:Do,backendName:"webgl",kernelFunc:NG},EG=La.nonMaxSuppressionV5Impl;function CG(e){C.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,softNmsSigma:d}=a,u=n.readSync(r.dataId),p=n.readSync(s.dataId),c=i,h=o,m=l,f=d,{selectedIndices:A,selectedScores:y}=EG(u,p,c,h,m,f);return[n.makeTensorInfo([A.length],"int32",new Int32Array(A)),n.makeTensorInfo([y.length],"float32",new Float32Array(y))]}var RG={kernelName:Oo,backendName:"webgl",kernelFunc:CG},MG=class{constructor(e,t,n,a){this.variableNames=["indices"],this.outputShape=[e,t],this.userCode=` +`,iw=en({opSnippet:fG,packedOpSnippet:mG,checkOutOfBounds:!0}),AG={kernelName:gs,backendName:"webgl",kernelFunc:iw},ow="return a - b;",lw=en({opSnippet:ow,packedOpSnippet:ow,supportsComplex:!0,cpuKernelImpl:hW}),yG={kernelName:Ys,backendName:"webgl",kernelFunc:lw};function uw(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{dim:s}=a,i=k.parseAxisParam([s],r.shape),o=sw({inputs:{x:r},backend:n,attrs:{reductionIndices:i,keepDims:!1}}),l=C.expandShapeToKeepDim(o.shape,i),d=Ae({inputs:{x:o},backend:n,attrs:{shape:l}}),u=lw({inputs:{a:r,b:d},backend:n}),p=ew({inputs:{x:u},backend:n}),c=vh({inputs:{x:p},backend:n,attrs:{axis:i,keepDims:!1}}),h=Ae({inputs:{x:c},backend:n,attrs:{shape:l}}),m=iw({inputs:{a:p,b:h},backend:n});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h),m}var gG={kernelName:Ks,backendName:"webgl",kernelFunc:uw};function xG(e){let{inputs:t,backend:n,attrs:a}=e,{logits:r}=t,{numSamples:s,seed:i,normalized:o}=a,l=o?r:uw({inputs:{logits:r},backend:n,attrs:{dim:r.shape.length-1}}),d=l.shape[0],u=l.shape[1],p=new hG(d,u,s),c=p.getCustomSetupFunc(i),h=n.runWebGLProgram(p,[l],"int32",c);return o||n.disposeIntermediateTensorInfo(l),h}var bG={kernelName:Jp,backendName:"webgl",kernelFunc:xG},dw="return -x;";function vG(e){let{inputs:t,backend:n}=e,{x:a}=t;if(n.shouldExecuteOnCPU([a])){let s=n.texData.get(a.dataId),[i,o]=sW(s.values,a.shape,a.dtype);return n.makeTensorInfo(o,a.dtype,i)}let r;return J().getBool("WEBGL_PACK_UNARY_OPERATIONS")?r=new Ol(a.shape,dw):r=new Lr(a.shape,dw),n.runWebGLProgram(r,[a],a.dtype)}var wG={kernelName:Fo,backendName:"webgl",kernelFunc:vG},kG=Wa.nonMaxSuppressionV3Impl;function IG(e){C.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l}=a,d=n.readSync(r.dataId),u=n.readSync(s.dataId),{selectedIndices:p}=kG(d,u,i,o,l);return n.makeTensorInfo([p.length],"int32",new Int32Array(p))}var SG={kernelName:Do,backendName:"webgl",kernelFunc:IG},NG=Wa.nonMaxSuppressionV4Impl;function TG(e){C.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,padToMaxOutputSize:d}=a,u=n.readSync(r.dataId),p=n.readSync(s.dataId),{selectedIndices:c,validOutputs:h}=NG(u,p,i,o,l,d);return[n.makeTensorInfo([c.length],"int32",new Int32Array(c)),n.makeTensorInfo([],"int32",new Int32Array([h]))]}var EG={kernelName:Oo,backendName:"webgl",kernelFunc:TG},CG=Wa.nonMaxSuppressionV5Impl;function RG(e){C.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");let{inputs:t,backend:n,attrs:a}=e,{boxes:r,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,softNmsSigma:d}=a,u=n.readSync(r.dataId),p=n.readSync(s.dataId),c=i,h=o,m=l,f=d,{selectedIndices:A,selectedScores:y}=CG(u,p,c,h,m,f);return[n.makeTensorInfo([A.length],"int32",new Int32Array(A)),n.makeTensorInfo([y.length],"float32",new Float32Array(y))]}var MG={kernelName:zo,backendName:"webgl",kernelFunc:RG},FG=class{constructor(e,t,n,a){this.variableNames=["indices"],this.outputShape=[e,t],this.userCode=` void main() { ivec2 coords = getOutputCoords(); int index = round(getIndices(coords.x)); setOutput(mix(float(${a}), float(${n}), float(index == coords.y))); } - `}},FG=e=>{let{inputs:t,backend:n,attrs:a}=e,{indices:r}=t,{depth:s,onValue:i,offValue:o}=a,l=k.sizeFromShape(r.shape),d=new MG(l,s,i,o),u=Ae({inputs:{x:r},backend:n,attrs:{shape:[l]}}),p=n.runWebGLProgram(d,[u],r.dtype);n.disposeIntermediateTensorInfo(u);let c=[...r.shape,s],h=Ae({inputs:{x:p},backend:n,attrs:{shape:c}});return n.disposeIntermediateTensorInfo(p),h},$G={kernelName:Ds,backendName:"webgl",kernelFunc:FG};function Sh(e){let{inputs:t,backend:n}=e,{x:a}=t;if(a.dtype==="complex64"){let r=xd({inputs:{input:a},backend:n}),s=Sh({inputs:{x:r},backend:n}),i=Ih({inputs:{input:a},backend:n}),o=Sh({inputs:{x:i},backend:n}),l=Lr({inputs:{real:s,imag:o},backend:n});return n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}else return w1({attrs:{shape:a.shape,dtype:a.dtype,value:a.dtype==="string"?"":0},backend:n})}var DG={kernelName:Qo,backendName:"webgl",kernelFunc:Sh};function dw(e){let{inputs:t,backend:n}=e,{x:a}=t;if(a.dtype==="string")throw new Error("onesLike is not supported under string dtype");if(a.dtype==="complex64"){let r=xd({inputs:{input:a},backend:n}),s=dw({inputs:{x:r},backend:n}),i=Ih({inputs:{input:a},backend:n}),o=Sh({inputs:{x:i},backend:n}),l=Lr({inputs:{real:s,imag:o},backend:n});return n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}else return w1({attrs:{shape:a.shape,dtype:a.dtype,value:1},backend:n})}var OG={kernelName:zo,backendName:"webgl",kernelFunc:dw};function zG(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a;if(t.length===1)return v1({inputs:{input:t[0]},backend:n,attrs:{dim:r}});let s=t[0].shape,i=t[0].dtype;t.forEach(u=>{k.assertShapesMatch(s,u.shape,"All tensors passed to stack must have matching shapes"),k.assert(i===u.dtype,()=>"All tensors passed to stack must have matching dtypes")});let o=[],l=t.map(u=>{let p=v1({inputs:{input:u},backend:n,attrs:{dim:r}});return o.push(p),p}),d=jv({inputs:l,backend:n,attrs:{axis:r}});return o.forEach(u=>n.disposeIntermediateTensorInfo(u)),d}var _G={kernelName:_o,backendName:"webgl",kernelFunc:zG},PG=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map((l,d)=>l[0]+e[d]+l[1]);let a=e.length,r=lt(a),s=t.map(l=>l[0]).join(","),i=t.map((l,d)=>l[0]+e[d]).join(","),o=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,a);if(a===1){this.userCode=` + `}},$G=e=>{let{inputs:t,backend:n,attrs:a}=e,{indices:r}=t,{depth:s,onValue:i,offValue:o}=a,l=k.sizeFromShape(r.shape),d=new FG(l,s,i,o),u=Ae({inputs:{x:r},backend:n,attrs:{shape:[l]}}),p=n.runWebGLProgram(d,[u],r.dtype);n.disposeIntermediateTensorInfo(u);let c=[...r.shape,s],h=Ae({inputs:{x:p},backend:n,attrs:{shape:c}});return n.disposeIntermediateTensorInfo(p),h},DG={kernelName:Os,backendName:"webgl",kernelFunc:$G};function Nh(e){let{inputs:t,backend:n}=e,{x:a}=t;if(a.dtype==="complex64"){let r=bd({inputs:{input:a},backend:n}),s=Nh({inputs:{x:r},backend:n}),i=Sh({inputs:{input:a},backend:n}),o=Nh({inputs:{x:i},backend:n}),l=Wr({inputs:{real:s,imag:o},backend:n});return n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}else return k1({attrs:{shape:a.shape,dtype:a.dtype,value:a.dtype==="string"?"":0},backend:n})}var OG={kernelName:el,backendName:"webgl",kernelFunc:Nh};function pw(e){let{inputs:t,backend:n}=e,{x:a}=t;if(a.dtype==="string")throw new Error("onesLike is not supported under string dtype");if(a.dtype==="complex64"){let r=bd({inputs:{input:a},backend:n}),s=pw({inputs:{x:r},backend:n}),i=Sh({inputs:{input:a},backend:n}),o=Nh({inputs:{x:i},backend:n}),l=Wr({inputs:{real:s,imag:o},backend:n});return n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}else return k1({attrs:{shape:a.shape,dtype:a.dtype,value:1},backend:n})}var zG={kernelName:_o,backendName:"webgl",kernelFunc:pw};function _G(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a;if(t.length===1)return w1({inputs:{input:t[0]},backend:n,attrs:{dim:r}});let s=t[0].shape,i=t[0].dtype;t.forEach(u=>{k.assertShapesMatch(s,u.shape,"All tensors passed to stack must have matching shapes"),k.assert(i===u.dtype,()=>"All tensors passed to stack must have matching dtypes")});let o=[],l=t.map(u=>{let p=w1({inputs:{input:u},backend:n,attrs:{dim:r}});return o.push(p),p}),d=Uv({inputs:l,backend:n,attrs:{axis:r}});return o.forEach(u=>n.disposeIntermediateTensorInfo(u)),d}var PG={kernelName:Po,backendName:"webgl",kernelFunc:_G},LG=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map((l,d)=>l[0]+e[d]+l[1]);let a=e.length,r=lt(a),s=t.map(l=>l[0]).join(","),i=t.map((l,d)=>l[0]+e[d]).join(","),o=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,a);if(a===1){this.userCode=` int start = ${s}; int end = ${i}; uniform float value; @@ -3461,7 +3461,7 @@ return a / b;`,fG=` setOutput(getX(${o})); } } - `}getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}},LG=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((m,f)=>m[0]+e[f]+m[1]);let a=e.length,r=lt(a),s=t.map(m=>m[0]).join(","),i=t.map((m,f)=>m[0]+e[f]).join(","),o=pn("rc",a),l=pn("source",a),d=`${o[a-1]} < ${this.outputShape[a-1]}`,u=a===1?"source":`vec2(${l.slice(-2).join()})`,p=[`${r} rc = outputLoc;`,`${o[a-1]} += 1; + `}getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}},WG=class{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((m,f)=>m[0]+e[f]+m[1]);let a=e.length,r=lt(a),s=t.map(m=>m[0]).join(","),i=t.map((m,f)=>m[0]+e[f]).join(","),o=pn("rc",a),l=pn("source",a),d=`${o[a-1]} < ${this.outputShape[a-1]}`,u=a===1?"source":`vec2(${l.slice(-2).join()})`,p=[`${r} rc = outputLoc;`,`${o[a-1]} += 1; if(${d}) { `,a===1?"":`} rc = outputLoc; @@ -3486,7 +3486,7 @@ return a / b;`,fG=` ${h} setOutput(result); } - `}getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}},pw=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{paddings:s,constantValue:i}=a,o=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new LG(r.shape,s,i):new PG(r.shape,s,i),l=o.getCustomSetupFunc(i);return n.runWebGLProgram(o,[r],r.dtype,l)},WG={kernelName:Os,backendName:"webgl",kernelFunc:pw},BG=` + `}getCustomSetupFunc(e){return(t,n)=>{this.valueLoc==null&&(this.valueLoc=t.getUniformLocationNoThrow(n,"value")),t.gl.uniform1f(this.valueLoc,e)}}},cw=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{paddings:s,constantValue:i}=a,o=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new WG(r.shape,s,i):new LG(r.shape,s,i),l=o.getCustomSetupFunc(i);return n.runWebGLProgram(o,[r],r.dtype,l)},BG={kernelName:zs,backendName:"webgl",kernelFunc:cw},VG=` if(a < 0.0 && floor(b) < b){ return NAN; } @@ -3495,7 +3495,7 @@ return a / b;`,fG=` } return (round(mod(b, 2.0)) != 1) ? pow(abs(a), b) : sign(a) * pow(abs(a), b); -`,VG=` +`,jG=` // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise. vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1))); vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1); @@ -3509,11 +3509,11 @@ return a / b;`,fG=` result.a = isExpZero.a ? 1.0 : result.a; vec4 isNaN = vec4(lessThan(a, vec4(0.0))) * vec4(lessThan(floor(b), b)); - `+yh+` + `+gh+` return result; -`,jG=en({opSnippet:BG,packedOpSnippet:VG}),UG={kernelName:zs,backendName:"webgl",kernelFunc:jG};function HG(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=[],d=k.parseAxisParam(s,r.shape),u=d,p=C.getAxesPermutation(u,o),c=r;p!=null&&(c=cn({inputs:{x:r},backend:n,attrs:{perm:p}}),u=C.getInnerMostAxes(u.length,o),l.push(c)),C.assertAxesAreInnerMostDims("prod",u,o);let h;if(n.shouldExecuteOnCPU([c])){let m=n.texData.get(c.dataId).values,{outVals:f,outShape:A,outDtype:y}=sW(c.shape,c.dtype,m,u);h=n.makeTensorInfo(A,y,f)}else{let[m,f]=C.computeOutAndReduceShapes(c.shape,u),A=k.sizeFromShape(f),y=Ae({inputs:{x:c},backend:n,attrs:{shape:[-1,A]}}),g=dc(r.dtype),x=Si(y,g,"prod",n);h=Ae({inputs:{x},backend:n,attrs:{shape:m}}),l.push(y),l.push(x)}if(i){l.push(h);let m=C.expandShapeToKeepDim(h.shape,d);h=Ae({inputs:{x:h},backend:n,attrs:{shape:m}})}return l.forEach(m=>n.disposeIntermediateTensorInfo(m)),h}var GG={kernelName:Po,backendName:"webgl",kernelFunc:HG},cw=e=>{let{backend:t,attrs:n}=e,{start:a,stop:r,step:s,dtype:i}=n,o=iW(a,r,s,i);return t.makeTensorInfo([o.length],i,o)},qG={kernelName:Tu,backendName:"webgl",kernelFunc:cw},XG="return 1.0 / x;",KG=qe({opSnippet:XG}),ZG={kernelName:Lo,backendName:"webgl",kernelFunc:KG},YG=ga+` +`,UG=en({opSnippet:VG,packedOpSnippet:jG}),HG={kernelName:_s,backendName:"webgl",kernelFunc:UG};function GG(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{axis:s,keepDims:i}=a,o=r.shape.length,l=[],d=k.parseAxisParam(s,r.shape),u=d,p=C.getAxesPermutation(u,o),c=r;p!=null&&(c=cn({inputs:{x:r},backend:n,attrs:{perm:p}}),u=C.getInnerMostAxes(u.length,o),l.push(c)),C.assertAxesAreInnerMostDims("prod",u,o);let h;if(n.shouldExecuteOnCPU([c])){let m=n.texData.get(c.dataId).values,{outVals:f,outShape:A,outDtype:y}=iW(c.shape,c.dtype,m,u);h=n.makeTensorInfo(A,y,f)}else{let[m,f]=C.computeOutAndReduceShapes(c.shape,u),A=k.sizeFromShape(f),y=Ae({inputs:{x:c},backend:n,attrs:{shape:[-1,A]}}),g=pc(r.dtype),x=Ni(y,g,"prod",n);h=Ae({inputs:{x},backend:n,attrs:{shape:m}}),l.push(y),l.push(x)}if(i){l.push(h);let m=C.expandShapeToKeepDim(h.shape,d);h=Ae({inputs:{x:h},backend:n,attrs:{shape:m}})}return l.forEach(m=>n.disposeIntermediateTensorInfo(m)),h}var qG={kernelName:Lo,backendName:"webgl",kernelFunc:GG},hw=e=>{let{backend:t,attrs:n}=e,{start:a,stop:r,step:s,dtype:i}=n,o=oW(a,r,s,i);return t.makeTensorInfo([o.length],i,o)},XG={kernelName:Eu,backendName:"webgl",kernelFunc:hw},KG="return 1.0 / x;",ZG=qe({opSnippet:KG}),YG={kernelName:Wo,backendName:"webgl",kernelFunc:ZG},JG=ga+` return (x < 0.0) ? 0.0 : x; -`,JG=` +`,QG=` vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0))); bvec4 isNaN = isnan(x); @@ -3523,9 +3523,9 @@ return a / b;`,fG=` result.a = isNaN.a ? x.a : result.a; return result; -`,QG=qe({opSnippet:YG,packedOpSnippet:JG}),eq={kernelName:Ps,backendName:"webgl",kernelFunc:QG},tq=ga+` +`,eq=qe({opSnippet:JG,packedOpSnippet:QG}),tq={kernelName:Ls,backendName:"webgl",kernelFunc:eq},nq=ga+` return (x < 0.0) ? 0.0 : min(6.0, x); -`,nq=` +`,aq=` vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0))); bvec4 isNaN = isnan(x); @@ -3535,7 +3535,7 @@ return a / b;`,fG=` result.a = isNaN.a ? x.a : result.a; return result; -`,aq=qe({opSnippet:tq,packedOpSnippet:nq}),rq={kernelName:Ws,backendName:"webgl",kernelFunc:aq},sq=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let d=[a&&t>1?i-1:i,a&&n>1?o-1:o],u=[a&&t>1?t-1:t,a&&n>1?n-1:n],p;r?p="(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)":p="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` +`,rq=qe({opSnippet:nq,packedOpSnippet:aq}),sq={kernelName:Bs,backendName:"webgl",kernelFunc:rq},iq=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let d=[a&&t>1?i-1:i,a&&n>1?o-1:o],u=[a&&t>1?t-1:t,a&&n>1?n-1:n],p;r?p="(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)":p="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` const vec2 effectiveInputOverOutputRatioRC = vec2( ${d[0]/u[0]}, ${d[1]/u[1]}); @@ -3568,7 +3568,7 @@ return a / b;`,fG=` setOutput(newValue); } - `}},iq=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let d=[a&&t>1?i-1:i,a&&n>1?o-1:o],u=[a&&t>1?t-1:t,a&&n>1?n-1:n],p;r?p="(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)":p="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` + `}},oq=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let d=[a&&t>1?i-1:i,a&&n>1?o-1:o],u=[a&&t>1?t-1:t,a&&n>1?n-1:n],p;r?p="(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)":p="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` const vec3 effectiveInputOverOutputRatioRC = vec3( ${d[0]/u[0]}, ${d[1]/u[1]}, @@ -3645,7 +3645,7 @@ return a / b;`,fG=` setOutput(newValue); } - `}};function oq(e){let{inputs:t,backend:n,attrs:a}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:i,size:o}=a,[l,d]=o,u=J().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new iq(r.shape,l,d,s,i):new sq(r.shape,l,d,s,i);return n.runWebGLProgram(u,[r],"float32")}var lq={kernelName:Ls,backendName:"webgl",kernelFunc:oq},uq=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;let[,a,r]=t,[,s,i]=e,o=[n&&s>1?a-1:a,n&&i>1?r-1:r],l=[n&&s>1?s-1:s,n&&i>1?i-1:i],d=o[0]/l[0],u=o[1]/l[1],p=1/d,c=1/u,h=Math.ceil(p)*2+2,m=Math.ceil(c)*2+2;this.userCode=` + `}};function lq(e){let{inputs:t,backend:n,attrs:a}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:i,size:o}=a,[l,d]=o,u=J().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new oq(r.shape,l,d,s,i):new iq(r.shape,l,d,s,i);return n.runWebGLProgram(u,[r],"float32")}var uq={kernelName:Ws,backendName:"webgl",kernelFunc:lq},dq=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;let[,a,r]=t,[,s,i]=e,o=[n&&s>1?a-1:a,n&&i>1?r-1:r],l=[n&&s>1?s-1:s,n&&i>1?i-1:i],d=o[0]/l[0],u=o[1]/l[1],p=1/d,c=1/u,h=Math.ceil(p)*2+2,m=Math.ceil(c)*2+2;this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords[0]; @@ -3726,7 +3726,7 @@ return a / b;`,fG=` setOutput(accumulator); } - `}};function dq(e){let{inputs:t,backend:n,attrs:a}=e,{images:r,dy:s}=t,{alignCorners:i}=a,o=new uq(s.shape,r.shape,i);return n.runWebGLProgram(o,[s],s.dtype)}var pq={kernelName:ec,backendName:"webgl",kernelFunc:dq},cq=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let d=[a&&t>1?i-1:i,a&&n>1?o-1:o],u=[a&&t>1?t-1:t,a&&n>1?n-1:n],p=a?"0.5":"0.0",c;r?c="max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))":c="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` + `}};function pq(e){let{inputs:t,backend:n,attrs:a}=e,{images:r,dy:s}=t,{alignCorners:i}=a,o=new dq(s.shape,r.shape,i);return n.runWebGLProgram(o,[s],s.dtype)}var cq={kernelName:tc,backendName:"webgl",kernelFunc:pq},hq=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let d=[a&&t>1?i-1:i,a&&n>1?o-1:o],u=[a&&t>1?t-1:t,a&&n>1?n-1:n],p=a?"0.5":"0.0",c;r?c="max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))":c="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` const vec2 effectiveInputOverOutputRatioRC = vec2( ${d[0]/u[0]}, ${d[1]/u[1]}); @@ -3748,7 +3748,7 @@ return a / b;`,fG=` setOutput(newValue); } - `}},hq=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let d=[a&&t>1?i-1:i,a&&n>1?o-1:o],u=[a&&t>1?t-1:t,a&&n>1?n-1:n],p=a?"0.5":"0.0",c;r?c="max((vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC, vec3(0.0))":c="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` + `}},fq=class{constructor(e,t,n,a,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];let[s,i,o,l]=e;this.outputShape=[s,t,n,l];let d=[a&&t>1?i-1:i,a&&n>1?o-1:o],u=[a&&t>1?t-1:t,a&&n>1?n-1:n],p=a?"0.5":"0.0",c;r?c="max((vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC, vec3(0.0))":c="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` const vec3 effectiveInputOverOutputRatioRC = vec3( ${d[0]/u[0]}, ${d[1]/u[1]}, @@ -3789,7 +3789,7 @@ return a / b;`,fG=` setOutput(newValue); } - `}};function fq(e){let{inputs:t,backend:n,attrs:a}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:i,size:o}=a,[l,d]=o,u=J().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new hq(r.shape,l,d,s,i):new cq(r.shape,l,d,s,i);return n.runWebGLProgram(u,[r],r.dtype)}var mq={kernelName:Eu,backendName:"webgl",kernelFunc:fq},Aq=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;let[,a,r]=t,[,s,i]=e,o=[n&&s>1?a-1:a,n&&i>1?r-1:r],l=[n&&s>1?s-1:s,n&&i>1?i-1:i],d=o[0]/l[0],u=o[1]/l[1],p=1/d,c=1/u,h=Math.ceil(p)*2+2,m=Math.ceil(c)*2+2;this.userCode=` + `}};function mq(e){let{inputs:t,backend:n,attrs:a}=e,{images:r}=t,{alignCorners:s,halfPixelCenters:i,size:o}=a,[l,d]=o,u=J().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new fq(r.shape,l,d,s,i):new hq(r.shape,l,d,s,i);return n.runWebGLProgram(u,[r],r.dtype)}var Aq={kernelName:Cu,backendName:"webgl",kernelFunc:mq},yq=class{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;let[,a,r]=t,[,s,i]=e,o=[n&&s>1?a-1:a,n&&i>1?r-1:r],l=[n&&s>1?s-1:s,n&&i>1?i-1:i],d=o[0]/l[0],u=o[1]/l[1],p=1/d,c=1/u,h=Math.ceil(p)*2+2,m=Math.ceil(c)*2+2;this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords[0]; @@ -3859,7 +3859,7 @@ return a / b;`,fG=` setOutput(accumulator); } - `}};function yq(e){let{inputs:t,backend:n,attrs:a}=e,{images:r,dy:s}=t,{alignCorners:i}=a,o=new Aq(s.shape,r.shape,i);return n.runWebGLProgram(o,[s],s.dtype)}var gq={kernelName:Qp,backendName:"webgl",kernelFunc:yq},xq=class{constructor(e,t){this.variableNames=["x"];let n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);if(this.outputShape=e,n===1){this.userCode=` + `}};function gq(e){let{inputs:t,backend:n,attrs:a}=e,{images:r,dy:s}=t,{alignCorners:i}=a,o=new yq(s.shape,r.shape,i);return n.runWebGLProgram(o,[s],s.dtype)}var xq={kernelName:ec,backendName:"webgl",kernelFunc:gq},bq=class{constructor(e,t){this.variableNames=["x"];let n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);if(this.outputShape=e,n===1){this.userCode=` void main() { int coord = getOutputCoords(); setOutput(getX(${e[0]} - coord - 1)); @@ -3869,7 +3869,7 @@ return a / b;`,fG=` ${s} coords = getOutputCoords(); setOutput(getX(${r})); } - `}},bq=class{constructor(e,t){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;let n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);this.outputShape=e;let a=pn("rc",n),r=`${a[n-1]} + 1 < ${this.outputShape[n-1]}`,s=`${a[n-2]} + 1 < ${this.outputShape[n-2]}`,i=lt(n);n===1?this.userCode=` + `}},vq=class{constructor(e,t){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;let n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);this.outputShape=e;let a=pn("rc",n),r=`${a[n-1]} + 1 < ${this.outputShape[n-1]}`,s=`${a[n-2]} + 1 < ${this.outputShape[n-2]}`,i=lt(n);n===1?this.userCode=` void main(){ int rc = getOutputCoords(); vec4 result = vec4(0.); @@ -3897,7 +3897,7 @@ return a / b;`,fG=` } setOutput(result); } - `;function o(h){return p(h)}function l(h){return h[n-1]="("+h[n-1]+" + 1)",p(h)}function d(h){return h[n-2]="("+h[n-2]+" + 1)",p(h)}function u(h){return h[n-1]="("+h[n-1]+" + 1)",h[n-2]="("+h[n-2]+" + 1)",p(h)}function p(h){let m=e.map((y,g)=>c(g,h)),f=m.join(","),A=m.slice(-2).join(",");return`getChannel(getX(${f}), vec2(${A}))`}function c(h,m){return t.indexOf(h)!==-1&&e[h]!==1?`${e[h]} - ${m[h]} - 1`:`${m[h]}`}}};function vq(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dims:s}=a,i=r.shape.length,o=k.parseAxisParam(s,r.shape);if(i===0)return Pn({inputs:{x:r},backend:n});let l=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new bq(r.shape,o):new xq(r.shape,o);return n.runWebGLProgram(l,[r],r.dtype)}var wq={kernelName:Bs,backendName:"webgl",kernelFunc:vq},kq=class{constructor(e,t){this.variableNames=["Image"],this.outputShape=[];let n=e[1],a=e[2];this.outputShape=e;let r="";typeof t=="number"?r=`float outputValue = ${t.toFixed(2)};`:r=` + `;function o(h){return p(h)}function l(h){return h[n-1]="("+h[n-1]+" + 1)",p(h)}function d(h){return h[n-2]="("+h[n-2]+" + 1)",p(h)}function u(h){return h[n-1]="("+h[n-1]+" + 1)",h[n-2]="("+h[n-2]+" + 1)",p(h)}function p(h){let m=e.map((y,g)=>c(g,h)),f=m.join(","),A=m.slice(-2).join(",");return`getChannel(getX(${f}), vec2(${A}))`}function c(h,m){return t.indexOf(h)!==-1&&e[h]!==1?`${e[h]} - ${m[h]} - 1`:`${m[h]}`}}};function wq(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dims:s}=a,i=r.shape.length,o=k.parseAxisParam(s,r.shape);if(i===0)return Pn({inputs:{x:r},backend:n});let l=J().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new vq(r.shape,o):new bq(r.shape,o);return n.runWebGLProgram(l,[r],r.dtype)}var kq={kernelName:Vs,backendName:"webgl",kernelFunc:wq},Iq=class{constructor(e,t){this.variableNames=["Image"],this.outputShape=[];let n=e[1],a=e[2];this.outputShape=e;let r="";typeof t=="number"?r=`float outputValue = ${t.toFixed(2)};`:r=` vec3 fill = vec3(${t.join(",")}); float outputValue = fill[coords[3]];`,this.userCode=` uniform vec4 params; @@ -3917,7 +3917,7 @@ return a / b;`,fG=` } setOutput(outputValue); } - `}getCustomSetupFunc(e,t,n,a){return(r,s)=>{this.paramsLoc==null&&(this.paramsLoc=r.getUniformLocationNoThrow(s,"params")),r.gl.uniform4f(this.paramsLoc,e,t,n,a)}}},Iq={kernelName:el,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{image:a}=e,{radians:r,fillValue:s,center:i}=t,o=n,l=new kq(a.shape,s),[d,u]=C.getImageCenter(i,a.shape[1],a.shape[2]),p=l.getCustomSetupFunc(d,u,Math.sin(r),Math.cos(r));return o.runWebGLProgram(l,[a],a.dtype,p)}},Sq=` + `}getCustomSetupFunc(e,t,n,a){return(r,s)=>{this.paramsLoc==null&&(this.paramsLoc=r.getUniformLocationNoThrow(s,"params")),r.gl.uniform4f(this.paramsLoc,e,t,n,a)}}},Sq={kernelName:tl,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{let{image:a}=e,{radians:r,fillValue:s,center:i}=t,o=n,l=new Iq(a.shape,s),[d,u]=C.getImageCenter(i,a.shape[1],a.shape[2]),p=l.getCustomSetupFunc(d,u,Math.sin(r),Math.cos(r));return o.runWebGLProgram(l,[a],a.dtype,p)}},Nq=` // OpenGL ES does not support round function. // The algorithm is based on banker's rounding. float base = floor(x); @@ -3932,7 +3932,7 @@ return a / b;`,fG=` return base + 1.0; } } -`,Nq=qe({opSnippet:Sq}),Tq={kernelName:Vs,backendName:"webgl",kernelFunc:Nq},Eq="return inversesqrt(x);",Cq=qe({opSnippet:Eq,cpuKernelImpl:oW}),Rq={kernelName:js,backendName:"webgl",kernelFunc:Cq},hw=class{constructor(e,t,n,a,r,s,i=!0){this.variableNames=["updates","indices","defaultValue"],this.outputShape=s;let o=lt(r.length),l=lt(s.length),d="";n===1?d="i":n===2&&(d="i, j");let u=`getIndices(${d})`,p="";a===1?p="i":a===2&&(p="i, coords[1]");let c=`getUpdates(${p})`,h=t>1?"strides[j]":"strides";this.userCode=` +`,Tq=qe({opSnippet:Nq}),Eq={kernelName:js,backendName:"webgl",kernelFunc:Tq},Cq="return inversesqrt(x);",Rq=qe({opSnippet:Cq,cpuKernelImpl:lW}),Mq={kernelName:Us,backendName:"webgl",kernelFunc:Rq},fw=class{constructor(e,t,n,a,r,s,i=!0){this.variableNames=["updates","indices","defaultValue"],this.outputShape=s;let o=lt(r.length),l=lt(s.length),d="";n===1?d="i":n===2&&(d="i, j");let u=`getIndices(${d})`,p="";a===1?p="i":a===2&&(p="i, coords[1]");let c=`getUpdates(${p})`,h=t>1?"strides[j]":"strides";this.userCode=` ${o} strides = ${o}(${r}); void main() { @@ -3952,7 +3952,7 @@ return a / b;`,fG=` } setOutput(mix(getDefaultValue(), sum, float(found))); } - `}};function Mq(e){let{inputs:t,backend:n,attrs:a}=e,{indices:r,updates:s}=t,{shape:i}=a,{sliceRank:o,numUpdates:l,sliceSize:d,strides:u,outputSize:p}=C.calculateShapes(s,r,i),c=[p/d,d];if(p===0)return n.makeTensorInfo(i,r.dtype);let h=Ae({inputs:{x:r},backend:n,attrs:{shape:[l,o]}}),m=Ae({inputs:{x:s},backend:n,attrs:{shape:[l,d]}}),f=n.makeTensorInfo([],"float32",new Float32Array([0])),A=new hw(l,o,h.shape.length,m.shape.length,u,c),y=n.runWebGLProgram(A,[m,h,f],m.dtype),g=Ae({inputs:{x:y},backend:n,attrs:{shape:i}});return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(f),g}var Fq={kernelName:Bo,backendName:"webgl",kernelFunc:Mq},$q=class{constructor(e,t,n){this.variableNames=["c","a","b"],this.outputShape=t;let a,r;if(n>4)throw Error(`Where for rank ${n} is not yet supported`);if(n===1)r="resRC",a="resRC";else{let i=["resRC.x","resRC.y","resRC.z","resRC.w"],o=[],l=[];for(let d=0;d4)throw Error(`Where for rank ${n} is not yet supported`);if(n===1)r="resRC",a="resRC";else{let i=["resRC.x","resRC.y","resRC.z","resRC.w"],o=[],l=[];for(let d=0;d= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0); -`,_q=qe({opSnippet:zq}),Pq={kernelName:jo,backendName:"webgl",kernelFunc:_q},Lq="return 1.0 / (1.0 + exp(-1.0 * x));",Wq=qe({opSnippet:Lq}),Bq={kernelName:Hs,backendName:"webgl",kernelFunc:Wq},Vq=` +`,Pq=qe({opSnippet:_q}),Lq={kernelName:Uo,backendName:"webgl",kernelFunc:Pq},Wq="return 1.0 / (1.0 + exp(-1.0 * x));",Bq=qe({opSnippet:Wq}),Vq={kernelName:Gs,backendName:"webgl",kernelFunc:Bq},jq=` if (isnan(x)) { return 0.0; } return sign(x); -`,jq=qe({opSnippet:Vq}),Uq={kernelName:Go,backendName:"webgl",kernelFunc:jq},Hq=Ev+` +`,Uq=qe({opSnippet:jq}),Hq={kernelName:qo,backendName:"webgl",kernelFunc:Uq},Gq=Cv+` return sin(x); -`,Gq=qe({opSnippet:Hq}),qq={kernelName:Us,backendName:"webgl",kernelFunc:Gq},Xq=` +`,qq=qe({opSnippet:Gq}),Xq={kernelName:Hs,backendName:"webgl",kernelFunc:qq},Kq=` float e2x = exp(x); return (e2x - 1.0 / e2x) / 2.0; -`,Kq=qe({opSnippet:Xq}),Zq={kernelName:Ho,backendName:"webgl",kernelFunc:Kq},Yq=` +`,Zq=qe({opSnippet:Kq}),Yq={kernelName:Go,backendName:"webgl",kernelFunc:Zq},Jq=` float epsilon = 1.1920928955078125e-7; float threshold = log(epsilon) + 2.0; @@ -3996,13 +3996,13 @@ return a / b;`,fG=` result = log(exp_x + 1.0); } return result; -`,Jq=qe({opSnippet:Yq}),Qq={kernelName:qo,backendName:"webgl",kernelFunc:Jq},eX=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,paddings:i}=a;k.assert(r.shape.length<=4,()=>"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet");let o=s.reduce((y,g)=>y*g),l=[[0,0]];l.push(...i);for(let y=1+s.length;yn.disposeIntermediateTensorInfo(y)),A},tX={kernelName:Cu,backendName:"webgl",kernelFunc:eX};function nX(e){let{inputs:t,backend:n}=e,{indices:a,values:r,denseShape:s,defaultValue:i}=t;if(s.shape.length!==1)throw new Error(`Dense shape must be a vector, saw: +`,Qq=qe({opSnippet:Jq}),eX={kernelName:Xo,backendName:"webgl",kernelFunc:Qq},tX=e=>{let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{blockShape:s,paddings:i}=a;k.assert(r.shape.length<=4,()=>"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet");let o=s.reduce((y,g)=>y*g),l=[[0,0]];l.push(...i);for(let y=1+s.length;yn.disposeIntermediateTensorInfo(y)),A},nX={kernelName:Ru,backendName:"webgl",kernelFunc:tX};function aX(e){let{inputs:t,backend:n}=e,{indices:a,values:r,denseShape:s,defaultValue:i}=t;if(s.shape.length!==1)throw new Error(`Dense shape must be a vector, saw: ${s.shape}`);if(a.shape.length!==2)throw new Error(`Indices must be a matrix, saw: ${a.shape}`);if(r.shape.length!==1)throw new Error(`Values must be a vector, saw: ${r.shape}`);if(i.shape.length!==0)throw new Error(`Default value must be a scalar, saw: - ${i.shape}`);let o=n.readSync(a.dataId),l=n.readSync(r.dataId),d=n.readSync(s.dataId),u=n.readSync(i.dataId)[0],[p,c,h,m,f]=uW(o,a.shape,a.dtype,l,r.dtype,d,u);return[n.makeTensorInfo(c,a.dtype,p),n.makeTensorInfo([c[0]],r.dtype,h),n.makeTensorInfo([m.length],"bool",new Uint8Array(m.map(A=>Number(A)))),n.makeTensorInfo([f.length],a.dtype,new Int32Array(f))]}var aX={kernelName:tc,backendName:"webgl",kernelFunc:nX};function rX(e){let{inputs:t,backend:n}=e,{inputIndices:a,inputShape:r,newShape:s}=t;if(a.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape ${a.shape}`);if(r.shape.length!==1)throw new Error(`Input shape should be a vector but received shape ${r.shape}`);if(s.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${s.shape}`);let i=Array.from(n.readSync(r.dataId)),o=n.readSync(a.dataId),l=Array.from(n.readSync(s.dataId)),[d,u,p]=dW(o,a.shape,a.dtype,i,l);return[n.makeTensorInfo(u,a.dtype,d),n.makeTensorInfo([p.length],s.dtype,new Int32Array(p))]}var sX={kernelName:nc,backendName:"webgl",kernelFunc:rX};function iX(e){let{inputs:t,backend:n,attrs:a}=e,{sparseIndices:r,sparseValues:s,defaultValue:i}=t,{outputShape:o}=a,{sliceRank:l,numUpdates:d,strides:u,outputSize:p}=C.calculateShapes(s,r,o),c=!1,h=new hw(d,l,r.shape.length,s.shape.length,u,[p,1],c),m=n.runWebGLProgram(h,[s,r,i],s.dtype),f=Ae({inputs:{x:m},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(m),f}var oX={kernelName:ac,backendName:"webgl",kernelFunc:iX};function lX(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{numOrSizeSplits:s,axis:i}=a,o=k.parseAxisParam(i,r.shape)[0],l=C.prepareSplitSize(r,s,o),d=r.shape.length,u=new Array(d).fill(0),p=r.shape.slice();return l.map(c=>{let h=[...p];h[o]=c;let m=gd({inputs:{x:r},backend:n,attrs:{begin:u,size:h}});return u[o]+=c,m})}var uX={kernelName:Xo,backendName:"webgl",kernelFunc:lX},dX="return sqrt(x);",pX=qe({opSnippet:dX}),cX={kernelName:Gs,backendName:"webgl",kernelFunc:pX},hX="return x * x;",fX=qe({opSnippet:hX}),mX={kernelName:Ru,backendName:"webgl",kernelFunc:fX},fw="return (a - b) * (a - b);",AX=en({opSnippet:fw,packedOpSnippet:fw}),yX={kernelName:Ks,backendName:"webgl",kernelFunc:AX};function gX({inputs:e,attrs:t,backend:n}){let{x:a}=e,r=ga+` + ${i.shape}`);let o=n.readSync(a.dataId),l=n.readSync(r.dataId),d=n.readSync(s.dataId),u=n.readSync(i.dataId)[0],[p,c,h,m,f]=dW(o,a.shape,a.dtype,l,r.dtype,d,u);return[n.makeTensorInfo(c,a.dtype,p),n.makeTensorInfo([c[0]],r.dtype,h),n.makeTensorInfo([m.length],"bool",new Uint8Array(m.map(A=>Number(A)))),n.makeTensorInfo([f.length],a.dtype,new Int32Array(f))]}var rX={kernelName:nc,backendName:"webgl",kernelFunc:aX};function sX(e){let{inputs:t,backend:n}=e,{inputIndices:a,inputShape:r,newShape:s}=t;if(a.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape ${a.shape}`);if(r.shape.length!==1)throw new Error(`Input shape should be a vector but received shape ${r.shape}`);if(s.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${s.shape}`);let i=Array.from(n.readSync(r.dataId)),o=n.readSync(a.dataId),l=Array.from(n.readSync(s.dataId)),[d,u,p]=pW(o,a.shape,a.dtype,i,l);return[n.makeTensorInfo(u,a.dtype,d),n.makeTensorInfo([p.length],s.dtype,new Int32Array(p))]}var iX={kernelName:ac,backendName:"webgl",kernelFunc:sX};function oX(e){let{inputs:t,backend:n,attrs:a}=e,{sparseIndices:r,sparseValues:s,defaultValue:i}=t,{outputShape:o}=a,{sliceRank:l,numUpdates:d,strides:u,outputSize:p}=C.calculateShapes(s,r,o),c=!1,h=new fw(d,l,r.shape.length,s.shape.length,u,[p,1],c),m=n.runWebGLProgram(h,[s,r,i],s.dtype),f=Ae({inputs:{x:m},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(m),f}var lX={kernelName:rc,backendName:"webgl",kernelFunc:oX};function uX(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{numOrSizeSplits:s,axis:i}=a,o=k.parseAxisParam(i,r.shape)[0],l=C.prepareSplitSize(r,s,o),d=r.shape.length,u=new Array(d).fill(0),p=r.shape.slice();return l.map(c=>{let h=[...p];h[o]=c;let m=xd({inputs:{x:r},backend:n,attrs:{begin:u,size:h}});return u[o]+=c,m})}var dX={kernelName:Ko,backendName:"webgl",kernelFunc:uX},pX="return sqrt(x);",cX=qe({opSnippet:pX}),hX={kernelName:qs,backendName:"webgl",kernelFunc:cX},fX="return x * x;",mX=qe({opSnippet:fX}),AX={kernelName:Mu,backendName:"webgl",kernelFunc:mX},mw="return (a - b) * (a - b);",yX=en({opSnippet:mw,packedOpSnippet:mw}),gX={kernelName:Zs,backendName:"webgl",kernelFunc:yX};function xX({inputs:e,attrs:t,backend:n}){let{x:a}=e,r=ga+` return x > 0.0 ? 1.0 : float(${t.alpha}); - `,s=new Pr(a.shape,r);return n.runWebGLProgram(s,[a],a.dtype)}var xX={kernelName:Sr,backendName:"webgl",kernelFunc:gX},bX=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=n;let a=n.length,r=lt(n.length),s=lt(n.length),i="";if(a===1)i="coords * strides + begin";else{let o=0;i=n.map((l,d)=>(o++,n.length===1?`coords * strides[${d}] + begin[${d}]`:`coords[${o-1}] * strides[${d}] + begin[${d}]`)).join(",")}this.userCode=` + `,s=new Lr(a.shape,r);return n.runWebGLProgram(s,[a],a.dtype)}var bX={kernelName:Nr,backendName:"webgl",kernelFunc:xX},vX=class{constructor(e,t,n){this.variableNames=["x"],this.outputShape=n;let a=n.length,r=lt(n.length),s=lt(n.length),i="";if(a===1)i="coords * strides + begin";else{let o=0;i=n.map((l,d)=>(o++,n.length===1?`coords * strides[${d}] + begin[${d}]`:`coords[${o-1}] * strides[${d}] + begin[${d}]`)).join(",")}this.userCode=` ${r} begin = ${r}(${e}); ${r} strides = ${r}(${t}); @@ -4010,15 +4010,15 @@ return a / b;`,fG=` ${s} coords = getOutputCoords(); setOutput(getX(${i})); } - `}};function vX(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,end:i,strides:o,beginMask:l,endMask:d,ellipsisMask:u,newAxisMask:p,shrinkAxisMask:c}=a,{nonStrided:h,$begin:m,$strides:f,size:A,newShape:y,outShape:g}=on.sliceInfo(r.shape,s,i,o,l,d,u,p,c),x=Ae({inputs:{x:r},backend:n,attrs:{shape:y}}),w;if(h){let v=gd({inputs:{x},backend:n,attrs:{begin:m,size:A}});w=Ae({inputs:{x:v},backend:n,attrs:{shape:g}}),n.disposeIntermediateTensorInfo(v)}else if(g.some(v=>v===0))w=n.makeTensorInfo(g,r.dtype,[]);else if(n.shouldExecuteOnCPU([x])){let v=n.texData.get(x.dataId).values,N=We(x.shape,x.dtype,v),T=pW(g,N,f,m);w=n.makeTensorInfo(g,x.dtype,T.values)}else{let v=new bX(m,f,g);w=n.runWebGLProgram(v,[x],x.dtype)}let b=Ae({inputs:{x:w},backend:n,attrs:{shape:g}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(w),b}var wX={kernelName:Ko,backendName:"webgl",kernelFunc:vX},kX="return tan(x);",IX=qe({opSnippet:kX}),SX={kernelName:Ys,backendName:"webgl",kernelFunc:IX},NX=` + `}};function wX(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{begin:s,end:i,strides:o,beginMask:l,endMask:d,ellipsisMask:u,newAxisMask:p,shrinkAxisMask:c}=a,{nonStrided:h,$begin:m,$strides:f,size:A,newShape:y,outShape:g}=on.sliceInfo(r.shape,s,i,o,l,d,u,p,c),x=Ae({inputs:{x:r},backend:n,attrs:{shape:y}}),w;if(h){let v=xd({inputs:{x},backend:n,attrs:{begin:m,size:A}});w=Ae({inputs:{x:v},backend:n,attrs:{shape:g}}),n.disposeIntermediateTensorInfo(v)}else if(g.some(v=>v===0))w=n.makeTensorInfo(g,r.dtype,[]);else if(n.shouldExecuteOnCPU([x])){let v=n.texData.get(x.dataId).values,N=We(x.shape,x.dtype,v),T=cW(g,N,f,m);w=n.makeTensorInfo(g,x.dtype,T.values)}else{let v=new vX(m,f,g);w=n.runWebGLProgram(v,[x],x.dtype)}let b=Ae({inputs:{x:w},backend:n,attrs:{shape:g}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(w),b}var kX={kernelName:Zo,backendName:"webgl",kernelFunc:wX},IX="return tan(x);",SX=qe({opSnippet:IX}),NX={kernelName:Js,backendName:"webgl",kernelFunc:SX},TX=` float e2x = exp(-2.0 * abs(x)); return sign(x) * (1.0 - e2x) / (1.0 + e2x); -`,TX=qe({opSnippet:NX}),EX={kernelName:Js,backendName:"webgl",kernelFunc:TX},RX=class{constructor(e,t){this.variableNames=["A"];let n=new Array(e.length);for(let s=0;s5)throw Error(`Tile for rank ${t} is not yet supported`);if(t===1)return`imod(resRC, ${e[0]})`;let n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],a=[];for(let r=0;r5){let o=n.readSync(r.dataId),l=r.dtype==="string"?o.map(p=>k.decodeString(p)):o,d=We(r.shape,r.dtype,l),u=hW(d,s);return n.makeTensorInfo(u.shape,u.dtype,u.values)}let i=new RX(r.shape,s);return n.runWebGLProgram(i,[r],r.dtype)}var MX={kernelName:Ir,backendName:"webgl",kernelFunc:mw};function FX(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{k:s,sorted:i}=a,o=n.readSync(r.dataId),[l,d]=fW(o,r.shape,r.dtype,s,i);return[n.makeTensorInfo(l.shape,l.dtype,l.values),n.makeTensorInfo(d.shape,d.dtype,d.values)]}var $X={kernelName:Zo,backendName:"webgl",kernelFunc:FX},DX=class{constructor(e,t,n,a,r,s){this.variableNames=["Image","Transforms"],this.outputShape=s;let i=n==="nearest"?1:2,o;switch(a){case"constant":o=1;break;case"reflect":o=2;break;case"wrap":o=3;break;case"nearest":o=4;break;default:o=1;break}this.userCode=` + `}};function RX(e){let t=e.length;if(t>5)throw Error(`Tile for rank ${t} is not yet supported`);if(t===1)return`imod(resRC, ${e[0]})`;let n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],a=[];for(let r=0;r5){let o=n.readSync(r.dataId),l=r.dtype==="string"?o.map(p=>k.decodeString(p)):o,d=We(r.shape,r.dtype,l),u=fW(d,s);return n.makeTensorInfo(u.shape,u.dtype,u.values)}let i=new MX(r.shape,s);return n.runWebGLProgram(i,[r],r.dtype)}var FX={kernelName:Sr,backendName:"webgl",kernelFunc:Aw};function $X(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{k:s,sorted:i}=a,o=n.readSync(r.dataId),[l,d]=mW(o,r.shape,r.dtype,s,i);return[n.makeTensorInfo(l.shape,l.dtype,l.values),n.makeTensorInfo(d.shape,d.dtype,d.values)]}var DX={kernelName:Yo,backendName:"webgl",kernelFunc:$X},OX=class{constructor(e,t,n,a,r,s){this.variableNames=["Image","Transforms"],this.outputShape=s;let i=n==="nearest"?1:2,o;switch(a){case"constant":o=1;break;case"reflect":o=2;break;case"wrap":o=3;break;case"nearest":o=4;break;default:o=1;break}this.userCode=` float mapCoord(float outCoord, float len) { float inCoord = outCoord; if(${o} == 2) { @@ -4130,7 +4130,7 @@ return a / b;`,fG=` } setOutput(outputValue); } - `}};function OX(e){let{inputs:t,backend:n,attrs:a}=e,{image:r,transforms:s}=t,{interpolation:i,fillMode:o,fillValue:l,outputShape:d}=a,[u,p,c,h]=r.shape,[m,f]=d!=null?d:[p,c],A=[u,m,f,h],y=new DX(p,c,i,o,l,A);return n.runWebGLProgram(y,[r,s],"float32")}var zX={kernelName:Yo,backendName:"webgl",kernelFunc:OX};function _X(e){let{inputs:t,attrs:n,backend:a}=e,{axis:r}=n,{x:s}=t;El(s,"unique"),console.warn("WARNING: ","UI might be locked temporarily as data is being downloaded");let i=a.readSync(s.dataId),{outputValues:o,outputShape:l,indices:d}=mW(i,r,s.shape,s.dtype);return[a.makeTensorInfo(l,s.dtype,o),a.makeTensorInfo([d.length],"int32",d)]}var PX={kernelName:rc,backendName:"webgl",kernelFunc:_X};function LX(e){let{inputs:t,backend:n,attrs:a}=e,{value:r}=t,{axis:s}=a;s<0&&(s+=r.shape.length);let i=r,o=i.shape.length,l=r.shape[s],d=new Array(o-1),u=0;for(let f=0;fn.disposeIntermediateTensorInfo(f)),m}var WX={kernelName:Jo,backendName:"webgl",kernelFunc:LX},BX=class{constructor(e,t){this.variableNames=["x","segmentIds"];let n=e.windowSize,a=e.batchSize,r=e.inSize,s=e.numSegments,i=s*Math.ceil(r/n);this.outputShape=[a,i];let o="0.0",l="sumValue",d=Math.floor(n/4)*4,u=n%4,p=` + `}};function zX(e){let{inputs:t,backend:n,attrs:a}=e,{image:r,transforms:s}=t,{interpolation:i,fillMode:o,fillValue:l,outputShape:d}=a,[u,p,c,h]=r.shape,[m,f]=d!=null?d:[p,c],A=[u,m,f,h],y=new OX(p,c,i,o,l,A);return n.runWebGLProgram(y,[r,s],"float32")}var _X={kernelName:Jo,backendName:"webgl",kernelFunc:zX};function PX(e){let{inputs:t,attrs:n,backend:a}=e,{axis:r}=n,{x:s}=t;Cl(s,"unique"),console.warn("WARNING: ","UI might be locked temporarily as data is being downloaded");let i=a.readSync(s.dataId),{outputValues:o,outputShape:l,indices:d}=AW(i,r,s.shape,s.dtype);return[a.makeTensorInfo(l,s.dtype,o),a.makeTensorInfo([d.length],"int32",d)]}var LX={kernelName:sc,backendName:"webgl",kernelFunc:PX};function WX(e){let{inputs:t,backend:n,attrs:a}=e,{value:r}=t,{axis:s}=a;s<0&&(s+=r.shape.length);let i=r,o=i.shape.length,l=r.shape[s],d=new Array(o-1),u=0;for(let f=0;fn.disposeIntermediateTensorInfo(f)),m}var BX={kernelName:Qo,backendName:"webgl",kernelFunc:WX},VX=class{constructor(e,t){this.variableNames=["x","segmentIds"];let n=e.windowSize,a=e.batchSize,r=e.inSize,s=e.numSegments,i=s*Math.ceil(r/n);this.outputShape=[a,i];let o="0.0",l="sumValue",d=Math.floor(n/4)*4,u=n%4,p=` sumValue += dot(values, segFilter); `,c="";r%n>0&&(c=` if (inIdx < 0 || inIdx >= ${r}) { @@ -4236,26 +4236,26 @@ return a / b;`,fG=` } setOutput(${l}); } - `}};function VX(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,segmentIds:s}=t,{numSegments:i}=a,o=r.shape.length,l=[],d=0,u=C.getAxesPermutation([d],o),p=r;u!=null&&(p=cn({inputs:{x:r},backend:n,attrs:{perm:u}}),l.push(p),d=C.getInnerMostAxes(1,o)[0]);let c=C.segment_util.computeOutShape(p.shape,d,i),h=k.sizeFromShape([p.shape[d]]),m=Ae({inputs:{x:p},backend:n,attrs:{shape:[-1,h]}});l.push(m);let f=dc(r.dtype),A=(w,b,v,N,T)=>{let R=w.shape[0],$=w.shape[1],z=C.segment_util.segOpComputeOptimalWindowSize($,T),P={windowSize:z,inSize:$,batchSize:R,numSegments:T},V=new BX(P,b),j=n.compileAndRun(V,[w,v],N);if(l.push(j),j.shape[1]===T)return j;let U=cw({backend:n,attrs:{start:0,stop:T,step:1,dtype:"float32"}}),X=mw({inputs:{x:U},backend:n,attrs:{reps:[$/z]}});return l.push(U),l.push(X),A(j,b,X,N,T)},y=A(m,"unsortedSegmentSum",s,f,i),g=Ae({inputs:{x:y},backend:n,attrs:{shape:c}}),x=g;if(u!=null){l.push(g);let w=C.getUndoAxesPermutation(u);x=cn({inputs:{x},backend:n,attrs:{perm:w}})}return l.forEach(w=>n.disposeIntermediateTensorInfo(w)),x}var jX={kernelName:Mu,backendName:"webgl",kernelFunc:VX},UX=[EH,MH,hB,mB,gB,vB,kB,NB,EB,RB,DB,zB,LB,VB,KB,HB,JB,nV,eV,iV,lV,dV,fV,vV,kV,CV,MV,OV,PV,XW,jV,QV,tj,qV,sj,oj,aj,dj,hj,Aj,gj,bj,kj,Cj,Mj,Sj,Dj,_j,Lj,jj,qj,Yj,eU,tU,nU,rU,iU,lU,dU,cU,AU,bU,wU,IU,TU,MU,OU,LU,qW,BU,BV,UU,qU,ZU,ZW,eH,rH,iH,hH,dH,yH,bH,IH,$H,BH,LH,HH,qH,KH,_H,YH,QH,aG,oG,pG,xG,tB,vG,IG,TG,RG,SV,$G,OG,_G,WG,UG,JW,GG,qG,NV,mG,ZG,rq,eq,aB,lq,pq,mq,gq,wq,Iq,Tq,Rq,Fq,Oq,Pq,Bq,Uq,qq,Zq,xV,yG,Qq,tX,aX,sX,oX,uX,cX,mX,yX,xX,wX,AG,dB,SX,EX,MX,$X,zX,pB,PX,WX,jX,DG];for(let e of UX)ai(e);var In;(function(e){e[e.float32=0]="float32",e[e.int32=1]="int32",e[e.bool=2]="bool",e[e.string=3]="string",e[e.complex64=4]="complex64"})(In||(In={}));var bd;(function(e){e[e.linear=0]="linear",e[e.relu=1]="relu",e[e.relu6=2]="relu6",e[e.prelu=3]="prelu",e[e.leakyrelu=4]="leakyrelu",e[e.sigmoid=5]="sigmoid"})(bd||(bd={}));var Aw;function HX(e){Aw=e.wasm.cwrap(ei,null,["number","array","number","number","array","number","number","number","number","number","number","number","number"])}function GX(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s,bias:i,preluActivationWeights:o}=t;if(r.dtype!=="float32"||s.dtype!=="float32")throw new Error("_FusedMatMul for non non-float32 tensors not yet supported.");let{transposeA:l,transposeB:d,activation:u,leakyreluAlpha:p}=a,c=n.dataIdMap.get(r.dataId).id,h=n.dataIdMap.get(s.dataId).id,m=0;if(i!=null){let T=n.dataIdMap.get(i.dataId);if(T.shape.length!==1)throw new Error(`_FusedMatMul only supports rank-1 bias but got rank ${T.shape.length}.`);m=T.id}let f=o==null?0:n.dataIdMap.get(o.dataId).id,A=bd[u];if(A==null)throw new Error(`${u} activation not yet supported for FusedConv2D in the wasm backend.`);let y=l?r.shape[2]:r.shape[1],g=d?s.shape[1]:s.shape[2],x=r.shape[0],w=n.makeOutput([x,y,g],r.dtype),b=n.dataIdMap.get(w.dataId).id,v=new Uint8Array(new Int32Array(r.shape).buffer),N=new Uint8Array(new Int32Array(s.shape).buffer);return Aw(c,v,r.shape.length,h,N,s.shape.length,l,d,A,m,f,p||0,b),w}var qX={kernelName:ei,backendName:"wasm",setupFunc:HX,kernelFunc:GX};function hn(e){let t;function n(r){t=r.wasm.cwrap(e,null,["number","number"])}function a(r){let{backend:s,inputs:{x:i}}=r,o=s.dataIdMap.get(i.dataId).id,l=s.makeOutput(i.shape,i.dtype),d=s.dataIdMap.get(l.dataId).id;return k.sizeFromShape(l.shape)===0||t(o,d),l}return{kernelName:e,backendName:"wasm",setupFunc:n,kernelFunc:a}}var XX=hn(Qi);function fn(e,t,n){let a;function r(i){a=i.wasm.cwrap(e,null,["number","array","number","number","array","number","number","number"])}function s(i){let{backend:o,inputs:l}=i,{a:d,b:u}=l,p=o.dataIdMap.get(d.dataId).id,c=o.dataIdMap.get(u.dataId).id,h=n!=null?n:d.dtype,m=C.assertAndGetBroadcastShape(d.shape,u.shape),f=o.makeOutput(m,h);if(k.sizeFromShape(m)===0)return f;let A=new Uint8Array(new Int32Array(d.shape).buffer),y=new Uint8Array(new Int32Array(u.shape).buffer),g=o.dataIdMap.get(f.dataId).id,x=()=>a(p,A,d.shape.length,c,y,u.shape.length,In[d.dtype],g);if(t&&d.dtype==="float32")return x(),f;let w=C.getBroadcastDims(d.shape,m),b=C.getBroadcastDims(u.shape,m),v=w.every((T,R)=>T===R),N=b.every((T,R)=>T===R);if(v&&N)return x(),f;throw new Error(`Broadcasting along outer dims is not yet supported for ${d.dtype} ${e}.`)}return{kernelName:e,backendName:"wasm",setupFunc:r,kernelFunc:s}}var KX=!0,ZX=fn(wr,KX),yw;function YX(e){yw=e.wasm.cwrap(is,null,["array","number","number","number"])}function JX(e){let{inputs:t,backend:n}=e,a=n.makeOutput(t[0].shape,t[0].dtype);if(k.sizeFromShape(a.shape)===0)return a;let r=t.map(o=>n.dataIdMap.get(o.dataId).id),s=new Uint8Array(new Int32Array(r).buffer),i=n.dataIdMap.get(a.dataId).id;return yw(s,r.length,In[a.dtype],i),a}var QX={kernelName:is,backendName:"wasm",setupFunc:YX,kernelFunc:JX};function Nh(e){let{inputs:{x:t},backend:n}=e,a=n.makeOutput(t.shape,t.dtype),r=n.typedArrayFromHeap(t);return n.typedArrayFromHeap(a).set(r),a}var eK={kernelName:ks,backendName:"wasm",kernelFunc:Nh},gw;function tK(e){gw=e.wasm.cwrap(Qs,null,["number","array","number","number","number","array","number"])}function Th(e){let{inputs:t,backend:n,attrs:a}=e,[r,s]=aK(t.x.shape,a.perm),i=!0;for(let m=0;m=r&&(s===-1||a[s]>a[i])&&(s=i);a[s]=r}return[n,a]}var rK={kernelName:Qs,backendName:"wasm",kernelFunc:Th,setupFunc:tK};function Wr(e,t,n){let a=e.shape,r=e.shape.length,s=k.parseAxisParam(t,a),i=s,o=C.getAxesPermutation(i,r),l=null,d=!1;if(o!=null){let u=new Array(r);for(let c=0;c`new shape: ${i}, old shape: ${a.shape}. New shape and old shape must have the same number of elements.`),e.backend.incRef(a.dataId),{dataId:a.dataId,shape:i,dtype:a.dtype}}var yK={kernelName:Wo,backendName:"wasm",kernelFunc:xa},kw;function gK(e){kw=e.wasm.cwrap(us,null,["number","array","number","number","array","number","number","number","number"])}function xK(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s}=t,{transposeA:i,transposeB:o}=a;if(r.dtype!=="float32"||s.dtype!=="float32")throw new Error("BatchMatMul for non non-float32 tensors not yet supported.");let l=r.shape.length,d=s.shape.length,u=i?r.shape[l-2]:r.shape[l-1],p=o?s.shape[d-1]:s.shape[d-2],c=i?r.shape[l-1]:r.shape[l-2],h=o?s.shape[d-2]:s.shape[d-1],m=r.shape.slice(0,-2),f=s.shape.slice(0,-2),A=k.sizeFromShape(m),y=k.sizeFromShape(f),g=A===y||A===1||y===1;k.assert(l>=2&&d>=2&&g,()=>`Error in matMul: the input batch dimensions must either be the same or at least one input batch dimension must be 1. Got input batch dimensions of (${m}) and (${f}).`);let x=(A>y?r.shape.slice(0,-2):s.shape.slice(0,-2)).concat([c,h]);k.assert(u===p,()=>`Error in matMul: inner shapes (${u}) and (${p}) of Tensors with shapes ${r.shape} and ${s.shape} and transposeA=${i} and transposeB=${o} must match.`);let w=i?[A,u,c]:[A,c,u],b=o?[y,h,p]:[y,p,h],v=xa({inputs:{x:r},backend:n,attrs:{shape:w}}),N=xa({inputs:{x:s},backend:n,attrs:{shape:b}}),T=n.dataIdMap.get(v.dataId).id,R=n.dataIdMap.get(N.dataId).id,$=i?v.shape[2]:v.shape[1],z=o?N.shape[1]:N.shape[2],P=Math.max(A,y),V=n.makeOutput([P,$,z],v.dtype),j=n.dataIdMap.get(V.dataId).id,U=new Uint8Array(new Int32Array(v.shape).buffer),X=new Uint8Array(new Int32Array(N.shape).buffer);return kw(T,U,v.shape.length,R,X,N.shape.length,i,o,j),n.disposeData(v.dataId),n.disposeData(N.dataId),V.shape=x,V}var bK={kernelName:us,backendName:"wasm",setupFunc:gK,kernelFunc:xK};function Eh(e){let{inputs:{x:t},attrs:{dtype:n},backend:a}=e,r=a.makeOutput(t.shape,n),s=a.typedArrayFromHeap(t);return a.typedArrayFromHeap(r).set(s),r}var vK={kernelName:ds,backendName:"wasm",kernelFunc:Eh},wK=hn(ps),Iw;function kK(e){Iw=e.wasm.cwrap(kr,null,["number","number","number","number"])}function IK(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{clipValueMin:s,clipValueMax:i}=a,o=n.dataIdMap.get(r.dataId).id,l=n.makeOutput(r.shape,r.dtype),d=n.dataIdMap.get(l.dataId).id;return Iw(o,s,i,d),l}var SK={kernelName:kr,backendName:"wasm",setupFunc:kK,kernelFunc:IK};function Sw(e){let{inputs:t,backend:n}=e,a=k.parseAxisParam(e.attrs.axis,t[0].shape)[0],r=C.computeOutShape(t.map(h=>h.shape),a),s=t.filter(h=>k.sizeFromShape(h.shape)>0);if(s.length===1)return Nh({inputs:{x:s[0]},backend:n});let i=n.makeOutput(r,t[0].dtype);if(k.sizeFromShape(r)===0)return i;let o=s.map(h=>h.shape);if(C.assertParamsConsistent(o,a),s[0].dtype==="string"){let h=s.map(x=>{let w=k.sizeFromShape(x.shape.slice(a));return xa({inputs:{x},backend:n,attrs:{shape:[-1,w]}})}),m=h.map(x=>({vals:n.readSync(x.dataId),shape:x.shape}));r=C.computeOutShape(h.map(x=>x.shape),1);let f=h[0].shape[0]===1,A=HA(m,r,t[0].dtype,f),y=C.computeOutShape(s.map(x=>x.shape),a);i.shape=y;let g=n.dataIdMap.get(i.dataId);return g.stringBytes=C.fromStringArrayToUint8(A),h.forEach(x=>n.disposeData(x.dataId)),i}let l=k.sizeFromShape(s[0].shape.slice(0,a)),d=0,u=s.map(h=>{let m=k.sizeFromShape(h.shape.slice(a));return d+=m,m}),p=s.map(h=>n.typedArrayFromHeap(h)),c=n.typedArrayFromHeap(i);for(let h=0;h`cumsum does not support ${r.dtype} tensors in the WASM backend`);let d=C.getAxesPermutation([s],l),u=r;d!==null&&(u=Th({inputs:{x:r},attrs:{perm:d},backend:n}));let p=C.getInnerMostAxes(1,l)[0];C.assertAxesAreInnerMostDims("cumsum",[p],l);let c=n.makeOutput(u.shape,u.dtype),h=u.shape[p],m=n.dataIdMap.get(u.dataId).id,f=n.dataIdMap.get(c.dataId).id;Cw(m,i?1:0,o?1:0,h,f,In[r.dtype]);let A=c;if(d!==null){let y=C.getUndoAxesPermutation(d);A=Th({inputs:{x:c},attrs:{perm:y},backend:n}),n.disposeData(u.dataId),n.disposeData(c.dataId)}return A}var LK={kernelName:ms,backendName:"wasm",setupFunc:_K,kernelFunc:PK},Rw;function WK(e){Rw=e.wasm.cwrap(ho,null,["number","number","number","array","number","array","array","number","number"])}function BK(e){let{backend:t,inputs:n,attrs:a}=e,{x:r}=n,{blockSize:s,dataFormat:i}=a;k.assert(s>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${s}`);let o=r.shape[0],l=i==="NHWC"?r.shape[1]:r.shape[2],d=i==="NHWC"?r.shape[2]:r.shape[3],u=i==="NHWC"?r.shape[3]:r.shape[1],p=l*s,c=d*s,h=u/(s*s),m=i==="NHWC"?[o,p,c,h]:[o,h,p,c],f=t.makeOutput(m,"float32"),A=t.dataIdMap.get(r.dataId).id,y=new Uint8Array(new Int32Array(k.computeStrides(r.shape)).buffer),g=new Uint8Array(new Int32Array(m).buffer),x=new Uint8Array(new Int32Array(k.computeStrides(m)).buffer),w=t.dataIdMap.get(f.dataId).id;return Rw(A,s,i==="NHWC"?1:0,y,r.shape.length-1,g,x,m.length,w),f}var VK={kernelName:ho,backendName:"wasm",setupFunc:WK,kernelFunc:BK},Mw;function jK(e){Mw=e.wasm.cwrap(As,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function UK(e){let{inputs:t,attrs:n,backend:a}=e,{x:r,filter:s}=t,i=a.dataIdMap.get(r.dataId).id,o=a.dataIdMap.get(s.dataId).id,{strides:l,dilations:d,pad:u,dimRoundingMode:p}=n,c=d==null?[1,1]:d,h=C.computeConv2DInfo(r.shape,s.shape,l,c,u,p,!0),m=h.filterHeight,f=h.filterWidth,A=h.padInfo.top,y=h.padInfo.right,g=h.padInfo.bottom,x=h.padInfo.left,w=h.dilationHeight,b=h.dilationWidth,v=h.strideHeight,N=h.strideWidth,T=h.inChannels,R=h.outChannels,$=h.padInfo.type==="SAME"?1:0;if(h.dataFormat!=="channelsLast")throw new Error(`wasm backend DepthwiseConv2dNative does not support dataFormat:'${h.dataFormat}'. Please use 'channelsLast'.`);let z=a.makeOutput(h.outShape,"float32"),P=a.dataIdMap.get(z.dataId).id;return Mw(i,r.shape[0],r.shape[1],r.shape[2],o,m,f,A,y,g,x,$,w,b,v,N,T,R,P),z}var HK={kernelName:As,backendName:"wasm",setupFunc:jK,kernelFunc:UK},GK=!1,qK=fn(Ao,GK,"bool"),XK=hn(gs);function I1(e){let{inputs:t,attrs:n,backend:a}=e,{input:r}=t,{dim:s}=n,i=r.shape.length,o=r.shape.slice(),l=s;return s<0&&(k.assert(-(i+1)<=s,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+s+1),o.splice(l,0,1),xa({inputs:{x:r},backend:a,attrs:{shape:o}})}var KK={kernelName:yo,backendName:"wasm",kernelFunc:I1};function ZK(e){let{attrs:{shape:t,value:n,dtype:a},backend:r}=e,s=r.makeOutput(t,a);return r.typedArrayFromHeap(s).fill(n),s}var YK={kernelName:wu,backendName:"wasm",kernelFunc:ZK},Fw;function JK(e){Fw=e.wasm.cwrap(xo,null,["number","number","number","number","number","number"])}function QK(e){let{inputs:t,backend:n}=e,{image:a}=t,r=n.makeOutput(a.shape,a.dtype),s=n.dataIdMap.get(a.dataId).id,i=n.dataIdMap.get(r.dataId).id,[o,l,d,u]=a.shape;return Fw(s,o,l,d,u,i),r}var eZ={kernelName:xo,backendName:"wasm",kernelFunc:QK,setupFunc:JK},tZ=hn(xs),nZ=!1,aZ=fn(bs,nZ),$w;function rZ(e){$w=e.wasm.cwrap(vs,null,["number","number","number","number","number","number","number"])}function sZ(e){let{backend:t,inputs:n,attrs:a}=e,{varianceEpsilon:r}=a,{x:s,mean:i,variance:o,offset:l,scale:d}=n,u=t.dataIdMap.get(s.dataId).id,p=t.dataIdMap.get(i.dataId).id,c=t.dataIdMap.get(o.dataId).id,h=l!=null?t.dataIdMap.get(l.dataId).id:0,m=d!=null?t.dataIdMap.get(d.dataId).id:0,f=t.makeOutput(s.shape,s.dtype);if(k.sizeFromShape(s.shape)===0)return f;let A=t.dataIdMap.get(f.dataId).id;return $w(u,p,c,h,m,r,A),f}var iZ={kernelName:vs,backendName:"wasm",setupFunc:rZ,kernelFunc:sZ},Dw;function oZ(e){Dw=e.wasm.cwrap(ti,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function lZ(e){let{inputs:t,attrs:n,backend:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dilations:u,dataFormat:p,dimRoundingMode:c,activation:h,leakyreluAlpha:m}=n,f=C.computeConv2DInfo(r.shape,s.shape,l,u,d,c),A=bd[h];if(A==null)throw new Error(`${h} activation not yet supported for FusedConv2D in the wasm backend.`);let y=a.dataIdMap.get(r.dataId).id,g=a.dataIdMap.get(s.dataId).id,x=f.outChannels,w=0;if(i!=null){let Q=a.dataIdMap.get(i.dataId);if(Q.shape.length!==1)throw new Error(`FusedConv2D only supports rank-1 bias but got rank ${Q.shape.length}.`);if(Q.shape[0]!==x)throw new Error(`FusedConv2D bias shape (${Q.shape}) does not match the number of output channels (${x})`);w=Q.id}let b=f.filterHeight,v=f.filterWidth,N=f.padInfo.top,T=f.padInfo.right,R=f.padInfo.bottom,$=f.padInfo.left,z=f.dilationHeight,P=f.dilationWidth,V=f.strideHeight,j=f.strideWidth,U=f.inChannels,X=f.padInfo.type==="SAME"?1:0,G=f.batchSize,ee=f.inHeight,Y=f.inWidth;if(p!=="NHWC")throw new Error(`wasm backend FusedConv2D does not support dataFormat:'${p}'. Please use 'NHWC'.`);let re=a.makeOutput(f.outShape,"float32"),ne=a.dataIdMap.get(re.dataId).id,ie=o==null?0:a.dataIdMap.get(o.dataId).id;return Dw(y,G,ee,Y,g,b,v,w,N,T,R,$,X,z,P,V,j,U,x,A,ie,m||0,ne),re}var uZ={kernelName:ti,backendName:"wasm",setupFunc:oZ,kernelFunc:lZ},Ow;function dZ(e){Ow=e.wasm.cwrap(ni,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function pZ(e){let{inputs:t,attrs:n,backend:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dilations:u,dataFormat:p,dimRoundingMode:c,activation:h,leakyreluAlpha:m}=n,f=C.computeConv2DInfo(r.shape,s.shape,l,u,d,c,!0),A=bd[h];if(A==null)throw new Error(`${h} activation not yet supported for FusedDepthwiseConv2D in the wasm backend.`);let y=a.dataIdMap.get(r.dataId).id,g=a.dataIdMap.get(s.dataId).id,x=f.outChannels,w=0;if(i!=null){let Q=a.dataIdMap.get(i.dataId);if(Q.shape.length!==1)throw new Error(`FusedDepthwiseConv2D only supports rank-1 bias but got rank ${Q.shape.length}.`);if(Q.shape[0]!==x)throw new Error(`FusedDepthwiseConv2D bias shape (${Q.shape}) does not match the number of output channels (${x})`);w=Q.id}let b=f.filterHeight,v=f.filterWidth,N=f.padInfo.top,T=f.padInfo.right,R=f.padInfo.bottom,$=f.padInfo.left,z=f.dilationHeight,P=f.dilationWidth,V=f.strideHeight,j=f.strideWidth,U=f.inChannels,X=f.padInfo.type==="SAME"?1:0,G=f.batchSize,ee=f.inHeight,Y=f.inWidth;if(p!=="NHWC")throw new Error(`wasm backend FusedDepthwiseConv2D does not support dataFormat:'${p}'. Please use 'NHWC'.`);let re=a.makeOutput(f.outShape,"float32"),ne=a.dataIdMap.get(re.dataId).id,ie=o==null?0:a.dataIdMap.get(o.dataId).id;return Ow(y,G,ee,Y,g,b,v,w,N,T,R,$,X,z,P,V,j,U,x,A,ie,m||0,ne),re}var cZ={kernelName:ni,backendName:"wasm",setupFunc:dZ,kernelFunc:pZ},zw;function hZ(e){zw=e.wasm.cwrap(vo,null,["number","number","number","number","number","number","array","number"])}function fZ(e){let{backend:t,inputs:n}=e,{params:a,indices:r}=n,[s,i,o,l]=Vm.prepareAndValidate(a,r),d=t.makeOutput(s,a.dtype);if(i===0)return d;let u=r.shape,p=u[u.length-1],c=t.dataIdMap.get(a.dataId).id,h=t.dataIdMap.get(r.dataId).id,m=new Uint8Array(new Int32Array(l).buffer),f=t.dataIdMap.get(d.dataId).id;return zw(c,In[a.dtype],h,i,p,o,m,f),d}var mZ={kernelName:vo,backendName:"wasm",setupFunc:hZ,kernelFunc:fZ},_w;function AZ(e){_w=e.wasm.cwrap("Gather",null,["number","number","array","number","number","number","array","number"])}function yZ(e){let{backend:t,inputs:n,attrs:a}=e,{x:r,indices:s}=n,{axis:i,batchDims:o}=a,l=k.parseAxisParam(i,r.shape)[0],d=C.segment_util.collectGatherOpShapeInfo(r,s,l,o),u=xa({inputs:{x:r},attrs:{shape:[d.batchSize,d.outerSize,d.dimSize,d.sliceSize]},backend:t}),p=k.sizeFromShape(s.shape),c=xa({inputs:{x:s},attrs:{shape:[d.batchSize,p/d.batchSize]},backend:t}),h=[d.batchSize,d.outerSize,p/d.batchSize,d.sliceSize],m=t.makeOutput(h,r.dtype);if(k.sizeFromShape(r.shape)===0)return m;let f=u.shape.length-1,A=t.dataIdMap.get(u.dataId).id,y=t.dataIdMap.get(c.dataId).id,g=t.dataIdMap.get(m.dataId).id,x=new Uint8Array(new Int32Array(k.computeStrides(u.shape)).buffer),w=new Uint8Array(new Int32Array(k.computeStrides(h)).buffer);return _w(A,In[r.dtype],x,f,y,d.batchSize,w,g),t.disposeData(u.dataId),t.disposeData(c.dataId),m.shape=d.outputShape,m}var gZ={kernelName:bo,backendName:"wasm",setupFunc:AZ,kernelFunc:yZ},xZ=!1,bZ=fn(wo,xZ,"bool"),vZ=!1,wZ=fn(ws,vZ,"bool"),Pw;function kZ(e){Pw=e.wasm.cwrap(Is,null,["number","number","number"])}function IZ(e){let{inputs:{x:t},attrs:{alpha:n},backend:a}=e,r=a.dataIdMap.get(t.dataId).id,s=a.makeOutput(t.shape,t.dtype);if(k.sizeFromShape(t.shape)!==0){let i=a.dataIdMap.get(s.dataId).id;Pw(r,n,i)}return s}var SZ={kernelName:Is,backendName:"wasm",setupFunc:kZ,kernelFunc:IZ},NZ=!1,TZ=fn(No,NZ,"bool"),EZ=!1,CZ=fn(To,EZ,"bool"),RZ=hn(Ss),MZ=!1,FZ=fn(Co,MZ,"bool"),Lw;function $Z(e){Lw=e.wasm.cwrap(Ns,null,["number, number, number"])}function DZ(e){let{backend:t,inputs:n,attrs:a}=e,{reductionIndices:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=i,{transposed:d,axes:u,originalAxes:p,inputWasTransposed:c}=Wr(i,r,t);if(c){let g=t.dataIdMap.get(d.dataId).id;l=d,o=g}let h=l.shape.length;C.assertAxesAreInnerMostDims("max",u,h);let[m,f]=C.computeOutAndReduceShapes(l.shape,u),A=k.sizeFromShape(f),y=t.makeOutput(m,i.dtype);if(k.sizeFromShape(l.shape)!==0){let g=t.dataIdMap.get(y.dataId).id;Lw(o,A,g)}if(c&&t.disposeData(d.dataId),s){let g=C.expandShapeToKeepDim(y.shape,p);y.shape=g}return y}var OZ={kernelName:Ns,backendName:"wasm",setupFunc:$Z,kernelFunc:DZ},zZ=!1,_Z=fn(Ts,zZ),Ww;function PZ(e){Ww=e.wasm.cwrap(Es,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function LZ(e){let{inputs:t,attrs:n,backend:a}=e,r=t.x,s=a.dataIdMap.get(r.dataId).id,{filterSize:i,strides:o,pad:l,dimRoundingMode:d}=n,u=C.computePool2DInfo(r.shape,i,o,1,l,d),p=u.filterHeight,c=u.filterWidth,h=u.padInfo.top,m=u.padInfo.right,f=u.padInfo.bottom,A=u.padInfo.left,y=u.dilationHeight,g=u.dilationWidth,x=u.strideHeight,w=u.strideWidth,b=u.inChannels,v=u.outChannels;if(u.dataFormat!=="channelsLast")throw new Error(`wasm backend does not support dataFormat:'${u.dataFormat}'. Please use 'channelsLast'.`);let N=a.makeOutput(u.outShape,"float32"),T=a.dataIdMap.get(N.dataId).id;return Ww(s,r.shape[0],r.shape[1],r.shape[2],p,c,h,m,f,A,y,g,x,w,b,v,T),N}var WZ={kernelName:Es,backendName:"wasm",setupFunc:PZ,kernelFunc:LZ},Bw;function BZ(e){Bw=e.wasm.cwrap(Cs,null,["number, number, number"])}function VZ(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,d=i,{transposed:u,axes:p,originalAxes:c,inputWasTransposed:h}=Wr(i,r,t),m=p;if(h){let w=t.dataIdMap.get(u.dataId).id;w!==o&&(d=u,l=w,m=C.getInnerMostAxes(m.length,d.shape.length))}C.assertAxesAreInnerMostDims("mean",m,d.shape.length);let[f,A]=C.computeOutAndReduceShapes(d.shape,m),y=k.sizeFromShape(A),g=d;d.dtype!=="float32"&&(g=Eh({backend:t,inputs:{x:d},attrs:{dtype:"float32"}}),l=t.dataIdMap.get(g.dataId).id);let x=t.makeOutput(f,"float32");if(k.sizeFromShape(d.shape)!==0){let w=t.dataIdMap.get(x.dataId).id;Bw(l,y,w)}if(h&&t.disposeData(u.dataId),s){let w=C.expandShapeToKeepDim(x.shape,c);x.shape=w}return d.dtype!=="float32"&&t.disposeData(g.dataId),x}var jZ={kernelName:Cs,backendName:"wasm",setupFunc:BZ,kernelFunc:VZ},Vw;function UZ(e){Vw=e.wasm.cwrap(Rs,null,["number, number, number"])}function HZ(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,d=i,{transposed:u,axes:p,originalAxes:c,inputWasTransposed:h}=Wr(i,r,t);if(h){let x=t.dataIdMap.get(u.dataId).id;x!==o&&(d=u,l=x)}let m=d.shape.length;C.assertAxesAreInnerMostDims("min",p,m);let[f,A]=C.computeOutAndReduceShapes(d.shape,p),y=k.sizeFromShape(A),g=t.makeOutput(f,d.dtype);if(k.sizeFromShape(d.shape)!==0){let x=t.dataIdMap.get(g.dataId).id;Vw(l,y,x)}if(h&&t.disposeData(u.dataId),s){let x=C.expandShapeToKeepDim(g.shape,c);g.shape=x}return g}var GZ={kernelName:Rs,backendName:"wasm",setupFunc:UZ,kernelFunc:HZ},qZ=!1,XZ=fn(Ms,qZ),S1;(function(e){e[e.reflect=0]="reflect",e[e.symmetric=1]="symmetric"})(S1||(S1={}));var jw;function KZ(e){jw=e.wasm.cwrap(Fs,null,["number","array","number","number","array","array","number","number"])}function ZZ(e){let{inputs:{x:t},backend:n,attrs:{paddings:a,mode:r}}=e,s=a.map((m,f)=>m[0]+t.shape[f]+m[1]),i=n.dataIdMap.get(t.dataId).id,o=n.makeOutput(s,t.dtype),l=n.dataIdMap.get(o.dataId).id,d=new Uint8Array(new Int32Array(t.shape).buffer),u=a.map(m=>m[0]),p=a.map(m=>m[1]),c=new Uint8Array(new Int32Array(u).buffer),h=new Uint8Array(new Int32Array(p).buffer);return jw(i,d,t.shape.length,In[t.dtype],c,h,S1[r],l),o}var YZ={kernelName:Fs,backendName:"wasm",kernelFunc:ZZ,setupFunc:KZ},JZ=!0,QZ=fn($s,JZ),eY=hn(Mo);function N1(e,t){let n=new Int32Array(e.wasm.HEAPU8.buffer,t,4),a=n[0],r=n[1],s=n[2],i=n[3];return e.wasm._free(t),{pSelectedIndices:a,selectedSize:r,pSelectedScores:s,pValidOutputs:i}}var Uw;function tY(e){Uw=e.wasm.cwrap($o,"number",["number","number","number","number","number"])}function nY(e){let{backend:t,inputs:n,attrs:a}=e,{iouThreshold:r,maxOutputSize:s,scoreThreshold:i}=a,{boxes:o,scores:l}=n,d=t.dataIdMap.get(o.dataId).id,u=t.dataIdMap.get(l.dataId).id,p=Uw(d,u,s,r,i),{pSelectedIndices:c,selectedSize:h,pSelectedScores:m,pValidOutputs:f}=N1(t,p);return t.wasm._free(m),t.wasm._free(f),t.makeOutput([h],"int32",c)}var aY={kernelName:$o,backendName:"wasm",setupFunc:tY,kernelFunc:nY},Hw;function rY(e){Hw=e.wasm.cwrap(Do,"number",["number","number","number","number","number","bool"])}function sY(e){let{backend:t,inputs:n,attrs:a}=e,{iouThreshold:r,maxOutputSize:s,scoreThreshold:i,padToMaxOutputSize:o}=a,{boxes:l,scores:d}=n,u=t.dataIdMap.get(l.dataId).id,p=t.dataIdMap.get(d.dataId).id,c=Hw(u,p,s,r,i,o),{pSelectedIndices:h,selectedSize:m,pSelectedScores:f,pValidOutputs:A}=N1(t,c);t.wasm._free(f);let y=t.makeOutput([m],"int32",h),g=t.makeOutput([],"int32",A);return[y,g]}var iY={kernelName:Do,backendName:"wasm",setupFunc:rY,kernelFunc:sY},Gw;function oY(e){Gw=e.wasm.cwrap(Oo,"number",["number","number","number","number","number","number"])}function lY(e){let{backend:t,inputs:n,attrs:a}=e,{iouThreshold:r,maxOutputSize:s,scoreThreshold:i,softNmsSigma:o}=a,{boxes:l,scores:d}=n,u=t.dataIdMap.get(l.dataId).id,p=t.dataIdMap.get(d.dataId).id,c=Gw(u,p,s,r,i,o),{pSelectedIndices:h,selectedSize:m,pSelectedScores:f,pValidOutputs:A}=N1(t,c);t.wasm._free(A);let y=t.makeOutput([m],"int32",h),g=t.makeOutput([m],"float32",f);return[y,g]}var uY={kernelName:Oo,backendName:"wasm",setupFunc:oY,kernelFunc:lY},dY=!1,pY=fn(Fo,dY,"bool"),qw;function cY(e){qw=e.wasm.cwrap(Ds,null,["number","number","number","number","number"])}function hY(e){let{inputs:t,backend:n,attrs:a}=e,{indices:r}=t,{depth:s,onValue:i,offValue:o}=a,l=n.makeOutput([...r.shape,s],"int32"),d=n.dataIdMap.get(l.dataId).id,u=n.dataIdMap.get(r.dataId).id;return qw(u,s,i,o,d),l}var fY={kernelName:Ds,backendName:"wasm",setupFunc:cY,kernelFunc:hY};function mY(e){let{inputs:{x:t},backend:n}=e,a=n.makeOutput(t.shape,t.dtype);return n.typedArrayFromHeap(a).fill(1),a}var AY={kernelName:zo,backendName:"wasm",kernelFunc:mY};function yY(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a;if(t.length===1)return I1({inputs:{input:t[0]},backend:n,attrs:{dim:r}});let s=t[0].shape,i=t[0].dtype;t.forEach(u=>{k.assertShapesMatch(s,u.shape,"All tensors passed to stack must have matching shapes"),k.assert(i===u.dtype,()=>"All tensors passed to stack must have matching dtypes")});let o=[],l=t.map(u=>{let p=I1({inputs:{input:u},backend:n,attrs:{dim:r}});return o.push(p),p}),d=Sw({inputs:l,backend:n,attrs:{axis:r}});return o.forEach(u=>n.disposeData(u.dataId)),d}var gY={kernelName:_o,backendName:"wasm",kernelFunc:yY},Xw;function xY(e){Xw=e.wasm.cwrap(Os,null,["number","array","number","number","array","array","number","number"])}function bY(e){let{inputs:{x:t},backend:n,attrs:{paddings:a,constantValue:r}}=e,s=a.map((m,f)=>m[0]+t.shape[f]+m[1]),i=n.dataIdMap.get(t.dataId).id,o=n.makeOutput(s,t.dtype),l=n.dataIdMap.get(o.dataId).id,d=new Uint8Array(new Int32Array(t.shape).buffer),u=a.map(m=>m[0]),p=a.map(m=>m[1]),c=new Uint8Array(new Int32Array(u).buffer),h=new Uint8Array(new Int32Array(p).buffer);return Xw(i,d,t.shape.length,In[t.dtype],c,h,r,l),o}var vY={kernelName:Os,backendName:"wasm",kernelFunc:bY,setupFunc:xY},wY=!1,kY=fn(zs,wY),Kw;function IY(e){Kw=e.wasm.cwrap(_s,null,["number","number","number"])}function SY(e){let{inputs:t,backend:n}=e,{x:a,alpha:r}=t,s=n.dataIdMap.get(a.dataId).id,i=n.dataIdMap.get(r.dataId).id,o=n.makeOutput(a.shape,"float32"),l=n.dataIdMap.get(o.dataId).id;return Kw(s,i,l),o}var NY={kernelName:_s,backendName:"wasm",setupFunc:IY,kernelFunc:SY},Zw;function TY(e){Zw=e.wasm.cwrap(Po,null,["number","number","number","number"])}function EY(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,d=i,{transposed:u,axes:p,originalAxes:c,inputWasTransposed:h}=Wr(i,r,t),m=p;if(h){let x=t.dataIdMap.get(u.dataId).id;x!==o&&(d=u,l=x,m=C.getInnerMostAxes(m.length,d.shape.length))}C.assertAxesAreInnerMostDims("prod",m,d.shape.length);let[f,A]=C.computeOutAndReduceShapes(d.shape,m),y=k.sizeFromShape(A),g=t.makeOutput(f,d.dtype);if(k.sizeFromShape(d.shape)!==0){let x=t.dataIdMap.get(g.dataId).id;Zw(l,y,In[g.dtype],x)}if(h&&t.disposeData(u.dataId),s){let x=C.expandShapeToKeepDim(g.shape,c);g.shape=x}return g}var CY={kernelName:Po,backendName:"wasm",setupFunc:TY,kernelFunc:EY},RY=e=>{let{backend:t,attrs:n}=e,{start:a,stop:r,step:s,dtype:i}=n,o=XA(a,r,s,i),l=t.makeOutput([o.length],i);return t.typedArrayFromHeap(l).set(o),l},MY={kernelName:Tu,backendName:"wasm",kernelFunc:RY},FY=!0,$Y=fn(ys,FY),DY=hn(Ps),OY=hn(Ws),Yw;function zY(e){Yw=e.wasm.cwrap(Ls,null,["number","number","number","number","number","number","number","number","number","number"])}function _Y(e){let{backend:t,inputs:n,attrs:a}=e,{images:r}=n,{alignCorners:s,halfPixelCenters:i,size:o}=a,[l,d]=o,[u,p,c,h]=r.shape,m=[u,l,d,h],f=t.dataIdMap.get(r.dataId),A;f.dtype!=="float32"&&(A=Eh({backend:t,inputs:{x:r},attrs:{dtype:"float32"}}),f=t.dataIdMap.get(A.dataId));let y=f.id,g=t.makeOutput(m,"float32");if(k.sizeFromShape(r.shape)===0)return g;let x=t.dataIdMap.get(g.dataId).id;return Yw(y,u,p,c,h,l,d,s?1:0,i?1:0,x),A!=null&&t.disposeData(A.dataId),g}var PY={kernelName:Ls,backendName:"wasm",setupFunc:zY,kernelFunc:_Y},Jw;function LY(e){Jw=e.wasm.cwrap(Bs,null,["number","array","number","array","number","number"])}function WY(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dims:s}=a,i=k.parseAxisParam(s,r.shape);if(r.shape.length===0)return Nh({inputs:{x:r},backend:n});let o=n.makeOutput(r.shape,r.dtype),l=n.dataIdMap.get(r.dataId).id,d=n.dataIdMap.get(o.dataId).id,u=new Uint8Array(new Int32Array(i).buffer),p=new Uint8Array(new Int32Array(r.shape).buffer);Jw(l,u,i.length,p,r.shape.length,d);let c=xa({inputs:{x:o},attrs:{shape:r.shape},backend:n});return n.disposeData(o.dataId),c}var BY={kernelName:Bs,backendName:"wasm",kernelFunc:WY,setupFunc:LY},Qw;function VY(e){Qw=e.wasm.cwrap(el,null,["number","number","number","number","number","number","number","number","array","number","number"])}function jY(e){let{inputs:t,backend:n,attrs:a}=e,{image:r}=t,{radians:s,fillValue:i,center:o}=a,l=n.makeOutput(r.shape,r.dtype),d=n.dataIdMap.get(r.dataId).id,u=n.dataIdMap.get(l.dataId).id,[p,c,h,m]=r.shape,[f,A]=C.getImageCenter(o,c,h),y=i===0,g=255,x=typeof i=="number"?[i,i,i,y?0:g]:[...i,g],w=new Uint8Array(new Int32Array(x).buffer);return Qw(d,p,c,h,m,s,f,A,w,x.length,u),l}var UY={kernelName:el,backendName:"wasm",kernelFunc:jY,setupFunc:VY},HY=hn(Vs),GY=hn(js),e6;function qY(e){e6=e.wasm.cwrap(Bo,null,["number","number","number","number","number","number","array","number","number"])}function XY(e){let{backend:t,inputs:n,attrs:a}=e,{indices:r,updates:s}=n,{shape:i}=a,o=t.makeOutput(i,s.dtype);if(k.sizeFromShape(i)===0)return o;let{sliceRank:l,numUpdates:d,sliceSize:u,strides:p,outputSize:c}=jm.calculateShapes(s,r,i),h=t.dataIdMap.get(r.dataId).id,m=t.dataIdMap.get(s.dataId).id,f=new Uint8Array(new Int32Array(p).buffer),A=t.dataIdMap.get(o.dataId).id;return e6(h,m,In[s.dtype],l,d,u,f,c,A),o}var KY={kernelName:Bo,backendName:"wasm",setupFunc:qY,kernelFunc:XY},t6;function ZY(e){t6=e.wasm.cwrap("SelectV2",null,["number","number","number","number","number"])}function YY(e){let{inputs:t,backend:n}=e,{condition:a,t:r,e:s}=t,i=n.dataIdMap.get(a.dataId).id,o=n.dataIdMap.get(r.dataId).id,l=n.dataIdMap.get(s.dataId).id,d=n.makeOutput(r.shape,r.dtype),u=n.dataIdMap.get(d.dataId).id,p=a.shape.length,c=r.shape.length,h=p===0||p>1||c===1?1:k.sizeFromShape(r.shape.slice(1));return t6(i,o,l,h,u),d}var JY={kernelName:Vo,backendName:"wasm",kernelFunc:YY,setupFunc:ZY},n6;function QY(e){n6=e.wasm.cwrap(Hs,null,["number","number"])}function eJ(e){let{backend:t,inputs:{x:n}}=e,a=t.dataIdMap.get(n.dataId).id,r=t.makeOutput(n.shape,n.dtype),s=t.dataIdMap.get(r.dataId).id;return k.sizeFromShape(r.shape)===0||n6(a,s),r}var tJ={kernelName:"Sigmoid",backendName:"wasm",setupFunc:QY,kernelFunc:eJ},nJ=hn(Us);function Ch(e){let{inputs:{x:t},attrs:{begin:n,size:a},backend:r}=e,[s,i]=on.parseSliceParams(t,n,a),o=on.isSliceContinous(t.shape,s,i),l=r.readSync(t.dataId),d=r.makeOutput(i,t.dtype),u=k.computeStrides(t.shape),p=r.dataIdMap.get(d.dataId);if(o){let m=on.computeFlatOffset(s,u);return t.dtype==="string"?p.stringBytes=l.slice(m,m+k.sizeFromShape(i)):r.typedArrayFromHeap(d).set(l.subarray(m,m+k.sizeFromShape(i))),d}if(t.dtype==="string"){let m=ah(l,s,i,t.shape,t.dtype);return p.stringBytes=m,d}let c=r.typedArrayFromHeap(d),h=t.shape.length;if(h===2)aJ(l,u[0],c,s,i);else if(h===3)rJ(l,u[0],u[1],c,s,i);else if(h===4)sJ(l,u[0],u[1],u[2],c,s,i);else{let m=ah(l,s,i,t.shape,t.dtype);c.set(m)}return d}function aJ(e,t,n,a,r){let s=0,i=a[0],o=a[1],l=i+r[0];for(let d=i;d{let c=[...u];c[o]=p;let h=Ch({inputs:{x:r},attrs:{begin:d,size:c},backend:a});return d[o]+=p,h})}var pJ={kernelName:Xo,backendName:"wasm",kernelFunc:dJ},cJ=hn(Gs),hJ=hn(Ru),fJ=!0,mJ=fn(Ks,fJ),r6;function AJ(e){r6=e.wasm.cwrap(Sr,null,["number","number","number"])}function yJ(e){let{backend:t,inputs:n,attrs:a}=e,{alpha:r}=a,{x:s}=n,i=t.dataIdMap.get(s.dataId).id,o=t.makeOutput(s.shape,s.dtype),l=t.dataIdMap.get(o.dataId).id;return r6(i,r,l),o}var gJ={kernelName:Sr,backendName:"wasm",setupFunc:AJ,kernelFunc:yJ},s6;function xJ(e){s6=e.wasm.cwrap(Ko,null,["number","array","number","array","array","array","array","array","number","number"])}function bJ(e){let{backend:t,inputs:n,attrs:a}=e,{x:r}=n,{begin:s,end:i,strides:o}=a;o==null&&(o=new Array(s.length));let{beginMask:l,endMask:d,ellipsisMask:u,newAxisMask:p,shrinkAxisMask:c}=a,h=C.slice_util.maskToAxes(u);if(h.length>1)throw new Error("Multiple ellipses in slice is not allowed.");if(u!==0&&p!==0)throw new Error("Using both ellipsisMask and newAxisMask is not yet supported.");if(u!==0&&c!==0)throw new Error("Using both ellipsisMask and shrinkAxisMask is not yet supported.");let m=r.shape.length-s.length,f=C.slice_util.maskToAxes(p),A=r.shape.slice();f.forEach($=>{s[$]=0,i[$]=1,A.splice($,0,1)});let y=xa({inputs:{x:r},attrs:{shape:A},backend:t}),{begin:g,end:x,strides:w}=C.slice_util.getNormalizedAxes(y.shape,h,m,s,i,o,l,d,u);s=g,i=x,o=w;let b=C.slice_util.maskToAxes(c);b.forEach($=>{i[$]=s[$]+1,o[$]=1});let v=C.slice_util.computeOutShape(s,i,o),N=v.filter(($,z)=>b.indexOf(z)===-1);if(o.every($=>$===1)){let $=Ch({inputs:{x:y},attrs:{begin:s,size:v},backend:t});t.disposeData(y.dataId);let z=xa({inputs:{x:$},attrs:{shape:N},backend:t});return t.disposeData($.dataId),z}let T=t.makeOutput(N,"float32");if(!N.some($=>$===0)){let $=t.dataIdMap.get(y.dataId).id,z=new Uint8Array(new Int32Array(k.computeStrides(y.shape)).buffer),P=new Uint8Array(new Int32Array(s).buffer),V=new Uint8Array(new Int32Array(i).buffer),j=new Uint8Array(new Int32Array(o).buffer),U=new Uint8Array(new Int32Array(N).buffer),X=new Uint8Array(new Int32Array(k.computeStrides(N)).buffer),G=t.dataIdMap.get(T.dataId).id;s6($,z,y.shape.length,P,V,j,U,X,N.length,G)}t.disposeData(y.dataId);let R=xa({inputs:{x:T},attrs:{shape:N},backend:t});return t.disposeData(T.dataId),R}var vJ={kernelName:Ko,backendName:"wasm",setupFunc:xJ,kernelFunc:bJ},wJ=!0,kJ=fn(Zs,wJ),i6;function IJ(e){i6=e.wasm.cwrap(qs,null,["number, number, number"])}function SJ(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,d=i,{transposed:u,axes:p,originalAxes:c,inputWasTransposed:h}=Wr(i,r,t),m=p;if(h){let x=t.dataIdMap.get(u.dataId).id;x!==o&&(d=u,l=x,m=C.getInnerMostAxes(m.length,d.shape.length))}C.assertAxesAreInnerMostDims("sum",m,d.shape.length);let[f,A]=C.computeOutAndReduceShapes(d.shape,m),y=k.sizeFromShape(A),g=t.makeOutput(f,d.dtype);if(k.sizeFromShape(d.shape)!==0){let x=t.dataIdMap.get(g.dataId).id;i6(l,y,x)}if(h&&t.disposeData(u.dataId),s){let x=C.expandShapeToKeepDim(g.shape,c);g.shape=x}return g}var NJ={kernelName:qs,backendName:"wasm",setupFunc:IJ,kernelFunc:SJ},TJ=hn(Ys),EJ=hn(Js),o6;function CJ(e){o6=e.wasm.cwrap(Ir,null,["number","array","number","array","number","number"])}function RJ(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,s=n.dataIdMap.get(r.dataId).id,{reps:i}=a,o=new Array(r.shape.length);for(let c=0;c{let{x:a}=e,{k:r,sorted:s}=n,i=t.dataIdMap.get(a.dataId).id,o=new Uint8Array(new Int32Array(a.shape).buffer),l=a.shape.slice();l[l.length-1]=r;let d=t.makeOutput(l,a.dtype),u=t.dataIdMap.get(d.dataId).id,p=t.makeOutput(l,"int32"),c=t.dataIdMap.get(p.dataId).id;return l6(i,o,a.shape.length,In[a.dtype],r,s,u,c),[d,p]},DJ={kernelName:Zo,backendName:"wasm",setupFunc:FJ,kernelFunc:$J},u6;function OJ(e){u6=e.wasm.cwrap(Yo,null,["number","number","bool","number","number","number","number","number","number","array","number","number","number","number","number"])}function zJ(e){let{backend:t,inputs:n,attrs:a}=e,{image:r,transforms:s}=n,{interpolation:i,fillMode:o,fillValue:l,outputShape:d}=a,[u,p,c,h]=r.shape,[m,f]=d!=null?d:[p,c],A=[u,m,f,h],y=new Uint8Array(new Int32Array(k.computeStrides(r.shape)).buffer),g=t.makeOutput(A,r.dtype),x=t.dataIdMap.get(g.dataId).id,w=t.dataIdMap.get(r.dataId).id,b=t.dataIdMap.get(s.dataId).id,v=i==="nearest"?1:2,N;switch(o){case"constant":N=1;break;case"reflect":N=2;break;case"wrap":N=3;break;case"nearest":N=4;break;default:N=1;break}return u6(w,b,s.shape[0]>1,u,m,f,h,c,p,y,r.shape.length-1,v,N,l,x),g}var _J={kernelName:Yo,backendName:"wasm",setupFunc:OJ,kernelFunc:zJ};function PJ(e){let{inputs:t,backend:n,attrs:a}=e,{value:r}=t,{axis:s}=a;s<0&&(s+=r.shape.length);let i=r.shape[s],o=r.shape.length,l=new Array(o-1),d=0;for(let h=0;h({dataId:h,dtype:m,shape:l}))}var LJ={kernelName:Jo,backendName:"wasm",kernelFunc:PJ};function WJ(e){let{inputs:{x:t},backend:n}=e,a=n.makeOutput(t.shape,t.dtype);return n.typedArrayFromHeap(a).fill(0),a}var BJ={kernelName:Qo,backendName:"wasm",kernelFunc:WJ},VJ=[XX,ZX,QX,oK,dK,hK,AK,bK,vK,wK,SK,NK,CK,FK,$K,zK,LK,VK,HK,qK,XK,KK,YK,eZ,tZ,aZ,qX,iZ,uZ,cZ,mZ,gZ,bZ,wZ,eK,SZ,TZ,CZ,RZ,FZ,OZ,_Z,WZ,jZ,GZ,XZ,YZ,QZ,eY,aY,iY,uY,pY,fY,AY,gY,vY,kY,NY,CY,MY,$Y,DY,OY,yK,PY,BY,UY,GY,HY,KY,JY,tJ,nJ,iJ,uJ,pJ,cJ,hJ,mJ,gJ,vJ,kJ,NJ,TJ,EJ,MJ,DJ,_J,rK,LJ,BJ];for(let e of VJ)ai(e);var T1=J();T1.registerFlag("WASM_HAS_SIMD_SUPPORT",async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11])));T1.registerFlag("WASM_HAS_MULTITHREAD_SUPPORT",async()=>{if(T1.get("IS_NODE"))return!1;try{return new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch(e){return!1}});var d6=Zi(nI()),jJ='var Module={};function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;this.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);Module["wasmModule"]=null;receiveInstance(instance);return instance.exports};function moduleLoaded(){}this.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}WasmBackendModuleThreadedSimd(Module).then(function(instance){Module=instance;moduleLoaded()})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["_emscripten_tls_init"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].setThreadStatus(Module["_pthread_self"](),1);try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(!Module["getNoExitRuntime"]())Module["PThread"].threadExit(result)}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["getNoExitRuntime"]()){}else{Module["PThread"].threadExit(ex.status)}}else{Module["PThread"].threadExit(-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){self={location:{href:__filename}};var onmessage=this.onmessage;var nodeWorkerThreads=require("worker_threads");global.Worker=nodeWorkerThreads.Worker;var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");var nodeRead=function(filename){return nodeFS.readFileSync(filename,"utf8")};function globalEval(x){global.require=require;global.Module=Module;eval.call(null,x)}importScripts=function(f){globalEval(nodeRead(f))};postMessage=function(msg){parentPort.postMessage(msg)};if(typeof performance==="undefined"){performance={now:function(){return Date.now()}}}}',UJ=Zi(aI()),p6=class extends hu{constructor(e){super();this.wasm=e,this.dataIdNextNumber=1,this.wasm.tfjs.init(),this.dataIdMap=new Ip(this,tr())}write(e,t,n){let a={id:this.dataIdNextNumber++};return this.move(a,e,t,n,1),a}numDataIds(){return this.dataIdMap.numDataIds()}async time(e){let t=k.now();return e(),{kernelMs:k.now()-t}}move(e,t,n,a,r){let s=this.dataIdNextNumber++;if(a==="string"){let d=t;this.dataIdMap.set(e,{id:s,stringBytes:d,shape:n,dtype:a,memoryOffset:null,refCount:r});return}let i=k.sizeFromShape(n),o=i*k.bytesPerElement(a),l=this.wasm._malloc(o);this.dataIdMap.set(e,{id:s,memoryOffset:l,shape:n,dtype:a,refCount:r}),this.wasm.tfjs.registerTensor(s,i,l),t!=null&&this.wasm.HEAPU8.set(new Uint8Array(t.buffer,t.byteOffset,o),l)}async read(e){return this.readSync(e)}readSync(e){let{memoryOffset:t,dtype:n,shape:a,stringBytes:r}=this.dataIdMap.get(e);if(n==="string")return r;let s=this.wasm.HEAPU8.slice(t,t+k.sizeFromShape(a)*k.bytesPerElement(n));return HJ(s.buffer,n)}disposeData(e,t=!1){if(this.dataIdMap.has(e)){let n=this.dataIdMap.get(e);if(n.refCount--,!t&&n.refCount>0)return!1;this.wasm._free(n.memoryOffset),this.wasm.tfjs.disposeData(n.id),this.dataIdMap.delete(e)}return!0}refCount(e){return this.dataIdMap.has(e)?this.dataIdMap.get(e).refCount:0}incRef(e){let t=this.dataIdMap.get(e);t!=null&&t.refCount++}floatPrecision(){return 32}getMemoryOffset(e){return this.dataIdMap.get(e).memoryOffset}dispose(){this.wasm.tfjs.dispose(),"PThread"in this.wasm&&this.wasm.PThread.terminateAllThreads(),this.wasm=null}memory(){return{unreliable:!1}}makeOutput(e,t,n){let a;if(n==null)a=this.write(null,e,t);else{let r=this.dataIdNextNumber++;a={id:r},this.dataIdMap.set(a,{id:r,memoryOffset:n,shape:e,dtype:t,refCount:1});let s=k.sizeFromShape(e);this.wasm.tfjs.registerTensor(r,s,n)}return{dataId:a,shape:e,dtype:t}}typedArrayFromHeap({shape:e,dtype:t,dataId:n}){let a=this.wasm.HEAPU8.buffer,{memoryOffset:r}=this.dataIdMap.get(n),s=k.sizeFromShape(e);switch(t){case"float32":return new Float32Array(a,r,s);case"int32":return new Int32Array(a,r,s);case"bool":return new Uint8Array(a,r,s);default:throw new Error(`Unknown dtype ${t}`)}}};function GJ(e){return(t,n)=>(k.fetch(e,{credentials:"same-origin"}).then(a=>{a.ok||t.env.a(`failed to load wasm binary file at '${e}'`),a.arrayBuffer().then(r=>{WebAssembly.instantiate(r,t).then(s=>{n(s.instance,s.module)})})}),{})}function c6(e,t,n){if(Rh!=null)return Rh;let a="tfjs-backend-wasm.wasm";return e&&t?a="tfjs-backend-wasm-threaded-simd.wasm":e&&(a="tfjs-backend-wasm-simd.wasm"),vd!=null&&vd[a]!=null?vd[a]:n+a}async function qJ(){let[e,t]=await Promise.all([J().getAsync("WASM_HAS_SIMD_SUPPORT"),J().getAsync("WASM_HAS_MULTITHREAD_SUPPORT")]);return new Promise((n,a)=>{let r={};r.locateFile=(o,l)=>{if(o.endsWith(".worker.js")){let d=jJ,u=new Blob([d],{type:"application/javascript"});return URL.createObjectURL(u)}return o.endsWith(".wasm")?c6(e,t,wd!=null?wd:l):l+o},E1&&(r.instantiateWasm=GJ(c6(e,t,wd!=null?wd:"")));let s=!1;r.onAbort=()=>{s||kd||(kd=!0,a({message:"Make sure the server can serve the `.wasm` file relative to the bundled js file. For more details see https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-wasm/README.md#using-bundlers"}))};let i;t&&e&&Rh==null?(r.mainScriptUrlOrBlob=new Blob(["var WasmBackendModuleThreadedSimd = "+d6.default.toString()],{type:"text/javascript"}),i=(0,d6.default)(r)):i=(0,UJ.default)(r),i.then(o=>{s=!0,kd=!1;let l=null;o.tfjs={init:o.cwrap("init",null,[]),registerTensor:o.cwrap("register_tensor",null,["number","number","number"]),disposeData:o.cwrap("dispose_data",l,["number"]),dispose:o.cwrap("dispose",l,[])},n({wasm:o})})})}function HJ(e,t){switch(t){case"float32":return new Float32Array(e);case"int32":return new Int32Array(e);case"bool":return new Uint8Array(e);default:throw new Error(`Unknown dtype ${t}`)}}var XJ=["tfjs-backend-wasm.wasm","tfjs-backend-wasm-simd.wasm","tfjs-backend-wasm-threaded-simd.wasm"],Rh=null,wd=null,vd={},kd=!1,E1=!1;function KJ(e,t=!1){if(Km("setWasmPath has been deprecated in favor of setWasmPaths and will be removed in a future release."),kd)throw new Error("The WASM backend was already initialized. Make sure you call `setWasmPath()` before you call `tf.setBackend()` or `tf.ready()`");Rh=e,E1=t}function ZJ(e,t=!1){if(kd)throw new Error("The WASM backend was already initialized. Make sure you call `setWasmPaths()` before you call `tf.setBackend()` or `tf.ready()`");if(typeof e=="string")wd=e;else{vd=e;let n=XJ.filter(a=>vd[a]==null);if(n.length>0)throw new Error(`There were no entries found for the following binaries: ${n.join(",")}. Please either call setWasmPaths with a map providing a path for each binary, or with a string indicating the directory where all the binaries can be found.`)}E1=t}var h6="3.6.0",YJ=2;ul("wasm",async()=>{let{wasm:e}=await qJ();return new p6(e)},YJ);Z().prototype.abs=function(){return this.throwIfDisposed(),Ot(this)};Z().prototype.acos=function(){return this.throwIfDisposed(),Ym(this)};Z().prototype.acosh=function(){return this.throwIfDisposed(),Jm(this)};Z().prototype.add=function(e){return this.throwIfDisposed(),se(this,e)};Z().prototype.all=function(e,t){return this.throwIfDisposed(),gc(this,e,t)};Z().prototype.any=function(e,t){return this.throwIfDisposed(),ju(this,e,t)};Z().prototype.argMax=function(e){return this.throwIfDisposed(),Uu(this,e)};Z().prototype.argMin=function(e){return this.throwIfDisposed(),Qm(this,e)};Z().prototype.asScalar=function(){return this.throwIfDisposed(),F(this.size===1,()=>"The array must have only 1 element."),H(this,[])};Z().prototype.asType=function(e){return this.throwIfDisposed(),fe(this,e)};Z().prototype.as1D=function(){return this.throwIfDisposed(),H(this,[this.size])};Z().prototype.as2D=function(e,t){return this.throwIfDisposed(),H(this,[e,t])};Z().prototype.as3D=function(e,t,n){return this.throwIfDisposed(),H(this,[e,t,n])};Z().prototype.as4D=function(e,t,n,a){return this.throwIfDisposed(),H(this,[e,t,n,a])};Z().prototype.as5D=function(e,t,n,a,r){return this.throwIfDisposed(),H(this,[e,t,n,a,r])};Z().prototype.asin=function(){return this.throwIfDisposed(),eA(this)};Z().prototype.asinh=function(){return this.throwIfDisposed(),tA(this)};Z().prototype.atan=function(){return this.throwIfDisposed(),nA(this)};Z().prototype.atan2=function(e){return this.throwIfDisposed(),aA(this,e)};Z().prototype.atanh=function(){return this.throwIfDisposed(),rA(this)};Z().prototype.avgPool=function(e,t,n,a){return this.throwIfDisposed(),Gu(this,e,t,n,a)};Z().prototype.batchToSpaceND=function(e,t){return this.throwIfDisposed(),qu(this,e,t)};Z().prototype.batchNorm=function(e,t,n,a,r){return this.throwIfDisposed(),pi(this,e,t,n,a,r)};Z().prototype.broadcastTo=function(e){return this.throwIfDisposed(),pl(this,e)};Z().prototype.cast=function(e){return this.throwIfDisposed(),fe(this,e)};Z().prototype.ceil=function(){return this.throwIfDisposed(),uA(this)};Z().prototype.clipByValue=function(e,t){return this.throwIfDisposed(),kn(this,e,t)};Z().prototype.concat=function(e,t){return this.throwIfDisposed(),e instanceof Le&&(e=[e]),ot([this,...e],t)};Z().prototype.conv1d=function(e,t,n,a,r,s){return this.throwIfDisposed(),bc(this,e,t,n,a,r,s)};Z().prototype.conv2dTranspose=function(e,t,n,a,r){return this.throwIfDisposed(),vc(this,e,t,n,a,r)};Z().prototype.conv2d=function(e,t,n,a,r,s){return this.throwIfDisposed(),nr(this,e,t,n,a,r,s)};Z().prototype.cos=function(){return this.throwIfDisposed(),Xu(this)};Z().prototype.cosh=function(){return this.throwIfDisposed(),wc(this)};Z().prototype.cumsum=function(e,t,n){return this.throwIfDisposed(),kc(this,e,t,n)};Z().prototype.depthToSpace=function(e,t){return this.throwIfDisposed(),cA(this,e,t)};Z().prototype.depthwiseConv2d=function(e,t,n,a,r,s){return this.throwIfDisposed(),hl(this,e,t,n,a,r,s)};Z().prototype.dilation2d=function(e,t,n,a,r){return this.throwIfDisposed(),hA(this,e,t,n,a,r)};Z().prototype.divNoNan=function(e){return this.throwIfDisposed(),fA(this,e)};Z().prototype.div=function(e){return this.throwIfDisposed(),me(this,e)};Z().prototype.dot=function(e){return this.throwIfDisposed(),_b(this,e)};Z().prototype.elu=function(){return this.throwIfDisposed(),fl(this)};Z().prototype.equal=function(e){return this.throwIfDisposed(),Mr(this,e)};Z().prototype.erf=function(){return this.throwIfDisposed(),mA(this)};Z().prototype.exp=function(){return this.throwIfDisposed(),qn(this)};Z().prototype.expandDims=function(e){return this.throwIfDisposed(),ln(this,e)};Z().prototype.expm1=function(){return this.throwIfDisposed(),AA(this)};Z().prototype.fft=function(){return this.throwIfDisposed(),ad(this)};Z().prototype.flatten=function(){return this.throwIfDisposed(),H(this,[this.size])};Z().prototype.floor=function(){return this.throwIfDisposed(),Al(this)};Z().prototype.floorDiv=function(e){return this.throwIfDisposed(),Ac(this,e)};Z().prototype.gather=function(e,t){return this.throwIfDisposed(),ci(this,e,t)};Z().prototype.greaterEqual=function(e){return this.throwIfDisposed(),$r(this,e)};Z().prototype.greater=function(e){return this.throwIfDisposed(),Mn(this,e)};Z().prototype.ifft=function(){return this.throwIfDisposed(),vl(this)};Z().prototype.irfft=function(){return this.throwIfDisposed(),Wc(this)};Z().prototype.isFinite=function(){return this.throwIfDisposed(),Lb(this)};Z().prototype.isInf=function(){return this.throwIfDisposed(),Wb(this)};Z().prototype.isNaN=function(){return this.throwIfDisposed(),gA(this)};Z().prototype.leakyRelu=function(e){return this.throwIfDisposed(),Ku(this,e)};Z().prototype.lessEqual=function(e){return this.throwIfDisposed(),Dr(this,e)};Z().prototype.less=function(e){return this.throwIfDisposed(),Sc(this,e)};Z().prototype.localResponseNormalization=function(e,t,n,a){return this.throwIfDisposed(),xA(this,e,t,n,a)};Z().prototype.logSigmoid=function(){return this.throwIfDisposed(),jb(this)};Z().prototype.logSoftmax=function(e){return this.throwIfDisposed(),Ec(this,e)};Z().prototype.logSumExp=function(e,t){return this.throwIfDisposed(),wA(this,e,t)};Z().prototype.log=function(){return this.throwIfDisposed(),Fn(this)};Z().prototype.log1p=function(){return this.throwIfDisposed(),Nc(this)};Z().prototype.logicalAnd=function(e){return this.throwIfDisposed(),oa(this,e)};Z().prototype.logicalNot=function(){return this.throwIfDisposed(),Zu(this)};Z().prototype.logicalOr=function(e){return this.throwIfDisposed(),Cc(this,e)};Z().prototype.logicalXor=function(e){return this.throwIfDisposed(),qb(this,e)};Z().prototype.matMul=function(e,t,n){return this.throwIfDisposed(),Be(this,e,t,n)};Z().prototype.maxPool=function(e,t,n,a){return this.throwIfDisposed(),Yu(this,e,t,n,a)};Z().prototype.max=function(e,t){return this.throwIfDisposed(),Xn(this,e,t)};Z().prototype.maximum=function(e){return this.throwIfDisposed(),_a(this,e)};Z().prototype.mean=function(e,t){return this.throwIfDisposed(),wt(this,e,t)};Z().prototype.min=function(e,t){return this.throwIfDisposed(),yl(this,e,t)};Z().prototype.minimum=function(e){return this.throwIfDisposed(),gl(this,e)};Z().prototype.mirrorPad=function(e,t){return this.throwIfDisposed(),IA(this,e,t)};Z().prototype.mod=function(e){return this.throwIfDisposed(),SA(this,e)};Z().prototype.mul=function(e){return this.throwIfDisposed(),_(this,e)};Z().prototype.neg=function(){return this.throwIfDisposed(),vt(this)};Z().prototype.norm=function(e,t,n){return this.throwIfDisposed(),Uc(this,e,t,n)};Z().prototype.notEqual=function(e){return this.throwIfDisposed(),mi(this,e)};Z().prototype.oneHot=function(e,t=1,n=0){return this.throwIfDisposed(),ol(this,e,t,n)};Z().prototype.onesLike=function(){return this.throwIfDisposed(),Dn(this)};Z().prototype.pad=function(e,t){return this.throwIfDisposed(),ar(this,e,t)};Z().prototype.pool=function(e,t,n,a,r){return this.throwIfDisposed(),Zb(this,e,t,n,a,r)};Z().prototype.pow=function(e){return this.throwIfDisposed(),rr(this,e)};Z().prototype.prelu=function(e){return this.throwIfDisposed(),Qu(this,e)};Z().prototype.prod=function(e,t){return this.throwIfDisposed(),Mc(this,e,t)};Z().prototype.reciprocal=function(){return this.throwIfDisposed(),EA(this)};Z().prototype.relu=function(){return this.throwIfDisposed(),Pa(this)};Z().prototype.relu6=function(){return this.throwIfDisposed(),Fc(this)};Z().prototype.reshapeAs=function(e){return this.throwIfDisposed(),H(this,e.shape)};Z().prototype.reshape=function(e){return this.throwIfDisposed(),H(this,e)};Z().prototype.resizeBilinear=function(e,t,n){return this.throwIfDisposed(),f3(this,e,t,n)};Z().prototype.resizeNearestNeighbor=function(e,t,n){return this.throwIfDisposed(),m3(this,e,t,n)};Z().prototype.reverse=function(e){return this.throwIfDisposed(),On(this,e)};Z().prototype.rfft=function(){return this.throwIfDisposed(),rd(this)};Z().prototype.round=function(){return this.throwIfDisposed(),$c(this)};Z().prototype.rsqrt=function(){return this.throwIfDisposed(),Dc(this)};Z().prototype.selu=function(){return this.throwIfDisposed(),Oc(this)};Z().prototype.separableConv2d=function(e,t,n,a,r,s){return this.throwIfDisposed(),CA(this,e,t,n,a,r,s)};Z().prototype.sigmoid=function(){return this.throwIfDisposed(),wn(this)};Z().prototype.sign=function(){return this.throwIfDisposed(),RA(this)};Z().prototype.sin=function(){return this.throwIfDisposed(),zc(this)};Z().prototype.sinh=function(){return this.throwIfDisposed(),_c(this)};Z().prototype.slice=function(e,t){return this.throwIfDisposed(),Re(this,e,t)};Z().prototype.softmax=function(e){return this.throwIfDisposed(),nd(this,e)};Z().prototype.softplus=function(){return this.throwIfDisposed(),hi(this)};Z().prototype.spaceToBatchND=function(e,t){return this.throwIfDisposed(),Ju(this,e,t)};Z().prototype.split=function(e,t){return this.throwIfDisposed(),an(this,e,t)};Z().prototype.sqrt=function(){return this.throwIfDisposed(),Jt(this)};Z().prototype.square=function(){return this.throwIfDisposed(),st(this)};Z().prototype.squaredDifference=function(e){return this.throwIfDisposed(),Bc(this,e)};Z().prototype.squeeze=function(e){return this.throwIfDisposed(),Or(this,e)};Z().prototype.stack=function(e,t){this.throwIfDisposed();let n=e instanceof Le?[this,e]:[this,...e];return zn(n,t)};Z().prototype.step=function(e){return this.throwIfDisposed(),wl(this,e)};Z().prototype.stridedSlice=function(e,t,n,a,r,s,i,o){return this.throwIfDisposed(),FA(this,e,t,n,a,r,s,i,o)};Z().prototype.sub=function(e){return this.throwIfDisposed(),ge(this,e)};Z().prototype.sum=function(e,t){return this.throwIfDisposed(),ke(this,e,t)};Z().prototype.tan=function(){return this.throwIfDisposed(),$A(this)};Z().prototype.tanh=function(){return this.throwIfDisposed(),di(this)};Z().prototype.tile=function(e){return this.throwIfDisposed(),Fr(this,e)};Z().prototype.toBool=function(){return this.throwIfDisposed(),fe(this,"bool")};Z().prototype.toFloat=function(){return this.throwIfDisposed(),fe(this,"float32")};Z().prototype.toInt=function(){return this.throwIfDisposed(),fe(this,"int32")};Z().prototype.topk=function(e,t){return this.throwIfDisposed(),DA(this,e,t)};Z().prototype.transpose=function(e){return this.throwIfDisposed(),Ze(this,e)};Z().prototype.unique=function(e){return this.throwIfDisposed(),jc(this,e)};Z().prototype.unsortedSegmentSum=function(e,t){return this.throwIfDisposed(),OA(this,e,t)};Z().prototype.unstack=function(e){return this.throwIfDisposed(),la(this,e)};Z().prototype.where=function(e,t){return this.throwIfDisposed(),nn(e,this,t)};Z().prototype.zerosLike=function(){return this.throwIfDisposed(),Ue(this)};var f6={kernelName:Qi,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(e,wl(fe(n,"float32"),-1))}}},JJ={kernelName:eo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=st(fe(n,"float32")),r=Jt(ge(Se(1),a));return vt(me(e,r))}}}},QJ={kernelName:to,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=Jt(ge(st(fe(n,"float32")),1));return me(e,a)}}}},eQ={kernelName:wr,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=pt(n.shape,a.shape);return{a:()=>{let s=e,i=zt(n.shape,r);return i.length>0&&(s=ke(s,i)),H(s,n.shape)},b:()=>{let s=e,i=zt(a.shape,r);return i.length>0&&(s=ke(s,i)),H(s,a.shape)}}}},tQ={kernelName:is,saveAllInputs:!0,gradFunc:(e,t)=>{let n={};return t.forEach((a,r)=>{n[r]=()=>e.clone()}),n}},nQ={kernelName:os,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Ue(n)}}},aQ={kernelName:Au,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Ue(n)}}},rQ={kernelName:ro,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,Jt(ge(Se(1),st(fe(n,"float32")))))}}},sQ={kernelName:so,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=Jt(se(Se(1),st(fe(n,"float32"))));return me(e,a)}}}},iQ={kernelName:lo,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=pt(n.shape,a.shape);return{a:()=>{let s=se(st(n),st(a)),i=_(e,me(a,s)),o=zt(n.shape,r);return o.length>0&&(i=ke(i,o)),H(i,n.shape)},b:()=>{let s=se(st(n),st(a)),i=vt(_(e,me(n,s))),o=zt(a.shape,r);return o.length>0&&(i=ke(i,o)),H(i,a.shape)}}}},oQ={kernelName:io,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,se(st(fe(n,"float32")),1))}}},lQ={kernelName:oo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,ge(Se(1),st(fe(n,"float32"))))}}};function uQ(e,t,n,a,r,s){let i=M(e,"dy","avgPool3dGrad"),o=M(t,"input","avgPool3dGrad"),l=i,d=o,u=!1;o.rank===4&&(u=!0,l=H(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]]),d=H(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),F(l.rank===5,()=>`Error in avgPool3dGrad: dy must be rank 5 but got rank ${l.rank}.`),F(d.rank===5,()=>`Error in avgPool3dGrad: input must be rank 5 but got rank ${d.rank}.`),s!=null&&F(Vt(r),()=>`Error in avgPool3dGrad: pad must be an integer when using, dimRoundingMode ${s} but got pad ${r}.`);let p={dy:l,input:d},c={filterSize:n,strides:a,pad:r,dimRoundingMode:s},h=D.runKernel(Cp,p,c);return u?H(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}var dQ=O({avgPool3dGrad_:uQ}),pQ={kernelName:yu,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{filterSize:r,strides:s,pad:i,dimRoundingMode:o}=n;return{x:()=>dQ(e,a,r,s,i,o)}}};function cQ(e,t,n,a,r){let s=M(e,"dy","avgPoolGrad"),i=M(t,"input","avgPoolGrad");F(i.rank===s.rank,()=>`Rank of input (${i.rank}) does not match rank of dy (${s.rank})`);let o=i,l=s,d=!1;i.rank===3&&(d=!0,o=H(i,[1,i.shape[0],i.shape[1],i.shape[2]]),l=H(s,[1,s.shape[0],s.shape[1],s.shape[2]])),F(l.rank===4,()=>`Error in avgPoolGrad: dy must be rank 4 but got rank ${l.rank}.`),F(o.rank===4,()=>`Error in avgPoolGrad: input must be rank 4 but got rank ${o.rank}.`);let u={dy:l,input:o},p={filterSize:n,strides:a,pad:r},c=D.runKernel(Ep,u,p);return d?H(c,[c.shape[1],c.shape[2],c.shape[3]]):c}var hQ=O({avgPoolGrad_:cQ}),fQ={kernelName:ls,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{filterSize:r,strides:s,pad:i}=n;return{x:()=>hQ(e,a,r,s,i)}}},mQ={kernelName:us,inputsToSave:["a","b"],gradFunc:(e,t,n)=>{let[a,r]=t,{transposeA:s,transposeB:i}=n;return!s&&!i?{a:()=>Be(e,r,!1,!0),b:()=>Be(a,e,!0,!1)}:!s&&i?{a:()=>Be(e,r,!1,!1),b:()=>Be(e,a,!0,!1)}:s&&!i?{a:()=>Be(r,e,!1,!0),b:()=>Be(a,e,!1,!1)}:{a:()=>Be(r,e,!0,!0),b:()=>Be(e,a,!0,!0)}}},AQ={kernelName:gu,gradFunc:(e,t,n)=>{let{blockShape:a,crops:r}=n;return{x:()=>Ju(e,a,r)}}},yQ={kernelName:Mx,gradFunc:(e,t,n)=>{let a=n,r=a.inputShape,s=a.shape,i=Array.from(s);for(let l=r.length-1;l>=0;l--)if(r[l]===s[l])i[l]=1;else if(r[l]!==1)throw new Error(`broadcastTo(): [${r}] cannot be broadcast to [${s}].`);let o=[];for(let l=0;l1&&o.push(l);return{x:()=>ke(e,o,!0)}}},gQ={kernelName:ds,gradFunc:e=>({x:()=>e.clone()})},xQ={kernelName:ps,gradFunc:e=>({x:()=>Ue(e)})},bQ={kernelName:kr,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{clipValueMin:r,clipValueMax:s}=n;return{x:()=>nn(oa($r(a,r),Dr(a,s)),e,Ue(e))}}},vQ={kernelName:xu,inputsToSave:["x"],gradFunc:f6.gradFunc},wQ={kernelName:uo,saveAllInputs:!0,gradFunc:(e,t,n)=>{let a=t.map(o=>o.shape),{axis:r}=n,s=ra(r,t[0].shape)[0],i=a.map(o=>o[s]);return an(e,i,s).map(o=>()=>o)}},kQ={kernelName:cs,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let[a,r]=t,{dilations:s,strides:i,pad:o,dataFormat:l}=n;return F(Rr(s),()=>`Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`),{x:()=>dA(a.shape,e,r,i,o,l),filter:()=>LA(a,e,r.shape,i,o,l)}}},IQ={kernelName:hs,inputsToSave:["dy","filter"],gradFunc:(e,t,n)=>{let[a,r]=t,{strides:s,pad:i,dataFormat:o,dimRoundingMode:l}=n;return{dy:()=>nr(e,r,s,i,o,1,l),filter:()=>LA(e,a,r.shape,s,i,o,l)}}};function SQ(e,t,n,a,r){let s=e;e.rank===4&&(s=H(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]]));let i=t;i.rank===4&&(i=H(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]])),F(s.rank===5,()=>`Error in conv3dDerFilter: input must be rank 5, but got shape ${s.shape}.`),F(i.rank===5,()=>`Error in conv3dDerFilter: dy must be rank 5, but got shape ${i.shape}.`),F(n.length===5,()=>`Error in conv3dDerFilter: filterShape must be length 5, but got ${n}.`),F(s.shape[4]===n[3],()=>`Error in conv3dDerFilter: depth of input ${s.shape[4]}) must match input depth in filter (${n[3]}.`),F(i.shape[4]===n[4],()=>`Error in conv3dDerFilter: depth of dy (${i.shape[4]}) must match output depth for filter (${n[4]}).`);let o={x:s,dy:i},l={strides:a,pad:r,filterShape:n};return D.runKernel($p,o,l)}var NQ=O({conv3DBackpropFilter_:SQ}),TQ={kernelName:bu,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let{dilations:a,strides:r,pad:s}=n;F(Rr(a),()=>`Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${a}'`);let[i,o]=t;return{x:()=>Db(i.shape,e,o,r,s),filter:()=>NQ(i,e,o.shape,r,s)}}},EQ={kernelName:fs,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(vt(zc(fe(n,"float32"))),e)}}},CQ={kernelName:po,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(_c(fe(n,"float32")),e)}}},RQ={kernelName:ms,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{axis:r,exclusive:s,reverse:i}=n;return{x:()=>{let o=Gb([r],a.rank),l=kc(e,r,s,!i);return o!=null&&(l=Ze(l,o)),l}}}},MQ={kernelName:As,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let{dilations:a,strides:r,pad:s,dimRoundingMode:i}=n,o=a==null?[1,1]:a;F(Rr(o),()=>`Error in gradient of depthwiseConv2dNative: dilation rates greater than 1 are not yet supported. Got dilations '${o}'`);let[l,d]=t;return F(l.rank===4,()=>`Error in gradient of depthwiseConv2dNative: input must be rank 4, but got rank ${l.rank}.`),F(d.rank===4,()=>`Error in gradient of depthwiseConv2dNative: filter must be rank 4, but got rank ${d.rank}.`),F(l.shape[3]===d.shape[2],()=>`Error in gradient of depthwiseConv2d: number of input channels (${l.shape[3]}) must match the inChannels dimension in filter ${d.shape[2]}.`),F(Oa(r,o),()=>`Error in gradient of depthwiseConv2d: Either strides or dilations must be 1. Got strides ${r} and dilations '${o}'.`),i!=null&&F(Vt(s),()=>`Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${s}.`),{x:()=>o3(l.shape,e,d,r,s,a,i),filter:()=>i3(l,e,d.shape,r,s,a,i)}}},FQ={kernelName:vu,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let[a,r]=t,s={x:a,filter:r,dy:e},i={x:a,filter:r,dy:e};return{x:()=>D.runKernel(Lp,s,n),filter:()=>D.runKernel(Wp,i,n)}}},$Q={kernelName:fo,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t,a={dy:e,y:n};return{x:()=>D.runKernel(Vp,a)}}},DQ={kernelName:mo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t,a=_(qn(vt(st(n))),2/Math.sqrt(Math.PI));return{x:()=>_(e,a)}}},OQ={kernelName:gs,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(e,n)}}},zQ={kernelName:yo,inputsToSave:["input"],gradFunc:(e,t)=>{let[n]=t;return{input:()=>H(e,n.shape)}}},_Q={kernelName:go,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(e,qn(n))}}},PQ={kernelName:xs,gradFunc:e=>({x:()=>Ue(e)})},LQ={kernelName:bs,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=pt(n.shape,a.shape);return{a:()=>{let s=me(e,fe(a,"float32")),i=zt(n.shape,r);return i.length>0?H(ke(s,i),n.shape):s},b:()=>{let s=_(e,fe(n,"float32")),i=zt(a.shape,r);i.length>0&&(s=H(ke(s,i),a.shape));let o=st(a);return vt(me(s,fe(o,"float32")))}}}},WQ={kernelName:vs,inputsToSave:["x","mean","variance","scale"],gradFunc:(e,t,n)=>{let{varianceEpsilon:a}=n,[r,s,i,o]=t,l=o==null?Se(1):o,d=zt(s.shape,r.shape),u=[];if(s.rank===1){for(let f=0;fs.rank===1?H(_(_(e,Fr(H(h,[1,1,1,s.shape[0]]),u)),l),r.shape):H(_(_(e,h),l),r.shape),mean:()=>{let f=_(_(h,Se(-1)),c);return s.rank===1&&(f=ke(f,d)),H(f,s.shape)},variance:()=>{let f=_(_(m,p),c);return s.rank===1&&(f=ke(f,d)),H(f,s.shape)},scale:()=>{let f=_(p,h),A=_(e,f);return s.rank===1&&(A=ke(A,d)),H(A,s.shape)},offset:()=>{let f=e;return s.rank===1&&(f=ke(f,d)),H(f,s.shape)}}}},BQ={kernelName:bo,inputsToSave:["x","indices"],gradFunc:(e,t,n)=>{let[a,r]=t,{axis:s}=n,i=ra(s,a.shape)[0];return{x:()=>{let o=a.shape,l=r.size,d=o.slice(0,i),u=d.length,p=o.slice(s,o.length).slice(1),c=p.length,h=m6(0,u),m=m6(u+1,u+1+c),f=A6([d,[l],p]),A=H(e,f),y=H(r,[l]),g=A6([[u],h,m]),x=Ze(A,g),w=OA(x,y,a.shape[i]),b=vA(g);return w=Ze(w,b),w},indices:()=>r}}};function m6(e,t){let n=[];for(let a=e;a{let[n,a]=t;return{a:()=>Ue(n),b:()=>Ue(a)}}},jQ={kernelName:ks,gradFunc:e=>({x:()=>fe(e,"float32")})},UQ={kernelName:ko,gradFunc:e=>({x:()=>Ue(e)})},HQ={kernelName:Io,gradFunc:e=>({x:()=>Ue(e)})},GQ={kernelName:So,gradFunc:e=>({x:()=>Ue(e)})},qQ={kernelName:Is,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{alpha:r}=n,s=Mn(a,0);return{x:()=>nn(s,e,_(e,r))}}},XQ={kernelName:Eo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,se(n,1))}}},KQ={kernelName:Ss,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,fe(n,"float32"))}}},ZQ={kernelName:Fx,inputsToSave:[],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a]=t,{axis:r}=n;return{logits:()=>{let s=!0,i=qn(a);return ge(e,_(ke(e,r,s),i))}}}};function YQ(e,t,n,a=5,r=1,s=1,i=.5){let o={x:e,y:t,dy:n},l={depthRadius:a,bias:r,alpha:s,beta:i};return D.runKernel(qp,o,l)}var JQ=O({localResponseNormalizationBackprop_:YQ}),QQ={kernelName:Su,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a,r]=t,{depthRadius:s,bias:i,alpha:o,beta:l}=n;return{x:()=>JQ(a,r,e,s,i,o,l)}}};function y6(e,t,n,a){return t.rank_(e,fe(Mr(n,t),e.dtype))}}var g6={kernelName:Ns,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let a=n,{reductionIndices:r}=a,s=t[0],i=t[1],o=ra(r,s.shape),l=y6(e,i,s,o);return{x:()=>l.x()}}},eee={kernelName:Ts,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t;return{a:()=>_(e,fe($r(n,a),"float32")),b:()=>_(e,fe(Sc(n,a),"float32"))}}};function tee(e,t,n,a,r,s,i){let o=M(e,"dy","maxPool3dGrad"),l=M(t,"input","maxPool3dGrad"),d=M(n,"output","maxPool3dGrad"),u=o,p=l,c=d,h=!1;l.rank===4&&(h=!0,u=H(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]]),p=H(l,[1,l.shape[0],l.shape[1],l.shape[2],l.shape[3]]),c=H(d,[1,d.shape[0],d.shape[1],d.shape[2],d.shape[3]])),F(u.rank===5,()=>`Error in maxPool3dGrad: dy must be rank 5 but got rank ${u.rank}.`),F(p.rank===5,()=>`Error in maxPool3dGrad: input must be rank 5 but got rank ${p.rank}.`),F(c.rank===5,()=>`Error in maxPool3dGrad: output must be rank 5 but got rank ${c.rank}.`),i!=null&&F(Vt(s),()=>`Error in maxPool3dGrad: pad must be an integer when using, dimRoundingMode ${i} but got pad ${s}.`);let m={dy:u,input:p,output:c},f={filterSize:a,strides:r,pad:s,dimRoundingMode:i},A=D.runKernel(Kp,m,f);return h?H(A,[A.shape[1],A.shape[2],A.shape[3],A.shape[4]]):A}var nee=O({maxPool3dGrad_:tee}),aee={kernelName:Nu,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a,r]=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=n;return{x:()=>nee(e,a,r,s,i,o,l)}}};function ree(e,t,n,a,r,s,i){let o=M(e,"dy","maxPoolGrad"),l=M(t,"input","maxPoolGrad"),d=M(n,"output","maxPoolGrad");F(l.rank===o.rank,()=>`Rank of input (${l.rank}) does not match rank of dy (${o.rank})`),F(o.rank===4,()=>`Error in maxPoolGrad: dy must be rank 4 but got rank ${o.rank}.`),F(l.rank===4,()=>`Error in maxPoolGrad: input must be rank 4 but got rank ${l.rank}.`),i!=null&&F(Vt(s),()=>`Error in maxPoolGrad: pad must be an integer when using, dimRoundingMode ${i} but got pad ${s}.`);let u={dy:o,input:l,output:d},p={filterSize:a,strides:r,pad:s,dimRoundingMode:i};return D.runKernel(Xp,u,p)}var see=O({maxPoolGrad_:ree}),iee={kernelName:Es,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a,r]=t,{filterSize:s,strides:i,pad:o}=n;return{x:()=>see(e,a,r,s,i,o)}}},oee={kernelName:Cs,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{axis:r}=n,s=ra(r,a.shape),i=Hb(a.shape,s)[1],o=Nt(i);return{x:()=>{let l=a.shape.slice();s.forEach(u=>{l[u]=1});let d=H(e,l);return me(_(d,$n(a.shape,"float32")),o)}}}},lee={kernelName:Rs,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let a=n,{axis:r}=a,[s,i]=t,o=ra(r,s.shape),l=y6(e,i,s,o);return{x:()=>l.x()}}},uee={kernelName:Ms,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t;return{a:()=>_(e,fe(Dr(n,a),"float32")),b:()=>_(e,fe(Mn(n,a),"float32"))}}},dee={kernelName:Fs,inputsToSave:["x"],gradFunc:(e,t,n)=>{let a=t[0],{paddings:r}=n,s=r.map(i=>i[0]);return{x:()=>Re(e,s,a.shape)}}},pee={kernelName:Ro,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=pt(n.shape,a.shape);return{a:()=>{let s=zt(n.shape,r);return s.length>0?H(ke(e,s),n.shape):e},b:()=>{let s=_(e,vt(Al(me(n,a)))),i=zt(a.shape,r);return i.length>0?H(ke(s,i),a.shape):s}}}},cee={kernelName:$s,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=pt(n.shape,a.shape);return{a:()=>{let s=_(e,fe(a,"float32")),i=zt(n.shape,r);return i.length>0?H(ke(s,i),n.shape):s},b:()=>{let s=_(e,fe(n,"float32")),i=zt(a.shape,r);return i.length>0?H(ke(s,i),a.shape):s}}}},hee={kernelName:Mo,gradFunc:e=>({x:()=>vt(e)})},fee={kernelName:Ds,inputsToSave:["indices"],gradFunc:(e,t)=>{let n=t[0];return{indices:()=>Ct(n.shape,"float32")}}},mee={kernelName:zo,gradFunc:e=>({x:()=>Ue(e)})},Aee={kernelName:_o,saveAllInputs:!0,gradFunc:(e,t,n)=>{let{axis:a}=n;return la(e,a).map(r=>()=>r)}},x6={kernelName:Os,inputsToSave:["x"],gradFunc:(e,t,n)=>{let a=t[0],{paddings:r}=n,s=r.map(i=>i[0]);return{x:()=>Re(e,s,a.shape)}}},yee={kernelName:zs,inputsToSave:["a","b"],outputsToSave:[!0],gradFunc:(e,t)=>{let[n,a,r]=t,s=n,i=a,o=pt(s.shape,i.shape);return{a:()=>{let l=fe(i,"float32"),d=_(e,_(l,rr(s,ge(l,Se(1))))),u=zt(s.shape,o);return u.length>0&&(d=ke(d,u)),H(d,s.shape)},b:()=>{let l=Mn(s,0),d=nn(l,Fn(s),Ue(s)),u=_(e,_(r,d)),p=zt(i.shape,o);return p.length>0&&(u=ke(u,p)),H(u,i.shape)}}}},gee={kernelName:_s,inputsToSave:["x","alpha"],gradFunc:(e,t)=>{let[n,a]=t,r=Mn(n,0);return{x:()=>nn(r,e,_(e,a)),alpha:()=>{let s=nn(r,Ue(e),_(e,n)),i=zt(a.shape,e.shape);return i.length>0&&(s=ke(s,i)),H(s,a.shape)}}}},xee={kernelName:ys,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=pt(n.shape,a.shape);return{a:()=>{let s=me(e,fe(a,"float32")),i=zt(n.shape,r);return i.length>0?H(ke(s,i),n.shape):s},b:()=>{let s=_(e,fe(n,"float32")),i=zt(a.shape,r);i.length>0&&(s=H(ke(s,i),a.shape));let o=st(a);return vt(me(s,fe(o,"float32")))}}}},bee={kernelName:Lo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,vt(st(n)))}}},vee={kernelName:Ws,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t,a=_(Dr(n,6),wl(n));return{x:()=>_(e,fe(a,"float32"))}}},wee={kernelName:Ps,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(e,fe(wl(n),"float32"))}}},kee={kernelName:Wo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>H(e,n.shape)}}},Iee={kernelName:Ls,inputsToSave:["images"],gradFunc:(e,t,n)=>{let[a]=t,r={dy:e,images:a};return{images:()=>D.runKernel(ec,r,n)}}},See={kernelName:Eu,inputsToSave:["images"],gradFunc:(e,t,n)=>{let[a]=t,r={dy:e,images:a};return{images:()=>D.runKernel(Qp,r,n)}}},Nee={kernelName:Bs,gradFunc:(e,t,n)=>{let{dims:a}=n,r=ra(a,e.shape);return{x:()=>On(e,r)}}},Tee={kernelName:Vs,gradFunc:e=>({x:()=>Ue(e)})},Eee={kernelName:js,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>vt(me(e,_(rr(n,1.5),2)))}}},Cee={kernelName:Vo,inputsToSave:["condition"],gradFunc:(e,t)=>{let[n]=t;return{condition:()=>fe(Ue(n),"float32"),t:()=>_(e,fe(n,e.dtype)),e:()=>_(e,fe(Zu(n),e.dtype))}}},Ree={kernelName:jo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=Mn(n,Se(0)),r=Se(x3),s=Se(b3),i=_(e,s),o=_(_(e,r),qn(fe(n,"float32")));return nn(a,i,o)}}}},Mee={kernelName:Hs,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(e,_(n,ge(Se(1),n)))}}},Fee={kernelName:Go,gradFunc:e=>({x:()=>Ue(e)})},$ee={kernelName:Us,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(Xu(fe(n,"float32")),e)}}},Dee={kernelName:Ho,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(wc(fe(n,"float32")),e)}}},Oee={kernelName:Uo,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{begin:r,size:s}=n,i=a.shape,[o,l]=yb(a,r,s),d=[];for(let u=0;uar(e,d)}}},zee={kernelName:Xs,outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a]=t,{dim:r}=n,s=!0,i=_(e,a);return{logits:()=>ge(i,_(ke(i,[r],s),a))}}},_ee={kernelName:qo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(e,wn(n))}}},b6={kernelName:Cu,gradFunc:(e,t,n)=>{let{blockShape:a,paddings:r}=n;return{x:()=>qu(e,a,r)}}},v6={kernelName:Xo,gradFunc:(e,t,n)=>{let{axis:a}=n;return{x:()=>ot(e,a)}}},Pee={kernelName:Gs,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,_(Jt(fe(n,"float32")),2))}}},Lee={kernelName:Ru,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(e,_(fe(n,"float32"),2))}}},Wee={kernelName:Ks,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Se(2);return{a:()=>_(e,_(r,ge(n,a))),b:()=>_(e,_(r,ge(a,n)))}}},Bee={kernelName:Sr,gradFunc:e=>({x:()=>Ue(e)})},Vee={kernelName:Zs,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=pt(n.shape,a.shape);return{a:()=>{let s=e,i=zt(n.shape,r);return i.length>0&&(s=ke(s,i)),H(s,n.shape)},b:()=>{let s=e,i=zt(a.shape,r);return i.length>0&&(s=ke(s,i)),H(vt(s),a.shape)}}}},jee={kernelName:qs,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,r=a.shape.slice(),{axis:s}=n;ra(s,a.shape).forEach(l=>{r[l]=1});let i=H(e,r),o=_(i,$n(a.shape,"float32"));return{x:()=>o}}},Uee={kernelName:Ys,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,st(Xu(n)))}}},Hee={kernelName:Js,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(ge(Se(1),st(n)),e)}}},Gee={kernelName:Ir,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{reps:r}=n;return{x:()=>{let s=Ue(a);if(a.rank===1)for(let i=0;i{let a=n,{perm:r}=a,s=vA(r);return{x:()=>Ze(e,s)}}},Xee={kernelName:Jo,gradFunc:(e,t,n)=>{let a=n,{axis:r}=a;return{value:()=>zn(e,r)}}},Zee={kernelName:Mu,inputsToSave:["segmentIds"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Kee(e,n)}}};function Kee(e,t){let n=_a(t,Ue(t)),a=ci(e,n),r=$r(t,Se(0,"int32")),s=a.rank-r.rank;for(let o=0;o({x:()=>Ue(e)})},Jee=[f6,JJ,QJ,eQ,tQ,nQ,aQ,rQ,sQ,iQ,oQ,lQ,pQ,fQ,mQ,AQ,yQ,gQ,xQ,bQ,vQ,wQ,IQ,kQ,TQ,EQ,CQ,RQ,MQ,FQ,xee,$Q,DQ,OQ,zQ,_Q,LQ,PQ,WQ,BQ,VQ,jQ,UQ,HQ,GQ,qQ,XQ,KQ,ZQ,QQ,g6,g6,eee,aee,iee,oee,lee,uee,dee,pee,cee,hee,fee,mee,Aee,x6,x6,yee,gee,bee,vee,wee,kee,Iee,See,Nee,Tee,Eee,Cee,Ree,Mee,Fee,$ee,Dee,Oee,zee,_ee,b6,b6,v6,v6,Pee,Wee,Lee,Bee,Vee,jee,Uee,Hee,Gee,qee,Xee,Zee,Yee];for(let e of Jee)$x(e);var w6={};Fe(w6,{maxNorm:()=>Qee,minMaxNorm:()=>nte,nonNeg:()=>tte,unitNorm:()=>ete});var C1;function _t(){return C1==null&&(C1=Ib().epsilon()),C1}function ba(){return"channelsLast"}var lr=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,lr.prototype)}},va=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,va.prototype)}},B=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,B.prototype)}},Oe=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,Oe.prototype)}},k6=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,k6.prototype)}};function Ni(e,t){if(Array.isArray(e)){let n=[];for(let a=0;an.toUpperCase())}var ua={};function R1(e){if(e==null)return null;let t={};return t.className=e.getClassName(),t.config=e.getConfig(),t}function M1(e){if(!(e==null||typeof e!="object"))if(Array.isArray(e))e.forEach(t=>M1(t));else{let t=Object.keys(e);for(let n of t){let a=e[n];a!=null&&typeof a=="object"&&(!Array.isArray(a)&&a.type==="ndarray"&&typeof a.value=="number"?e[n]=a.value:M1(a))}}}function Id(e,t={},n={},a="object",r=!1){if(typeof e=="string"){let s=e,i;if(s in n)i=n[s];else if(s in ua)i=ua[s];else if(i=t[s],i==null)throw new B(`Unknown ${a}: ${e}. This may be due to one of the following reasons: + `}};function jX(e){let{inputs:t,backend:n,attrs:a}=e,{x:r,segmentIds:s}=t,{numSegments:i}=a,o=r.shape.length,l=[],d=0,u=C.getAxesPermutation([d],o),p=r;u!=null&&(p=cn({inputs:{x:r},backend:n,attrs:{perm:u}}),l.push(p),d=C.getInnerMostAxes(1,o)[0]);let c=C.segment_util.computeOutShape(p.shape,d,i),h=k.sizeFromShape([p.shape[d]]),m=Ae({inputs:{x:p},backend:n,attrs:{shape:[-1,h]}});l.push(m);let f=pc(r.dtype),A=(w,b,v,N,T)=>{let R=w.shape[0],$=w.shape[1],z=C.segment_util.segOpComputeOptimalWindowSize($,T),P={windowSize:z,inSize:$,batchSize:R,numSegments:T},V=new VX(P,b),j=n.compileAndRun(V,[w,v],N);if(l.push(j),j.shape[1]===T)return j;let U=hw({backend:n,attrs:{start:0,stop:T,step:1,dtype:"float32"}}),X=Aw({inputs:{x:U},backend:n,attrs:{reps:[$/z]}});return l.push(U),l.push(X),A(j,b,X,N,T)},y=A(m,"unsortedSegmentSum",s,f,i),g=Ae({inputs:{x:y},backend:n,attrs:{shape:c}}),x=g;if(u!=null){l.push(g);let w=C.getUndoAxesPermutation(u);x=cn({inputs:{x},backend:n,attrs:{perm:w}})}return l.forEach(w=>n.disposeIntermediateTensorInfo(w)),x}var UX={kernelName:Fu,backendName:"webgl",kernelFunc:jX},HX=[CH,FH,fB,AB,xB,wB,IB,TB,CB,MB,OB,_B,WB,jB,ZB,GB,QB,aV,tV,oV,uV,pV,mV,wV,IV,RV,FV,zV,LV,KW,UV,ej,nj,XV,ij,lj,rj,pj,fj,yj,xj,vj,Ij,Rj,Fj,Nj,Oj,Pj,Wj,Uj,Xj,Jj,tU,nU,aU,sU,oU,uU,pU,hU,yU,vU,kU,SU,EU,FU,zU,WU,XW,VU,VV,HU,XU,YU,YW,tH,sH,oH,fH,pH,gH,vH,SH,DH,VH,WH,GH,XH,ZH,PH,JH,eG,rG,lG,cG,bG,nB,wG,SG,EG,MG,NV,DG,zG,PG,BG,HG,QW,qG,XG,TV,AG,YG,sq,tq,rB,uq,cq,Aq,xq,kq,Sq,Eq,Mq,$q,zq,Lq,Vq,Hq,Xq,Yq,bV,gG,eX,nX,rX,iX,lX,dX,hX,AX,gX,bX,kX,yG,pB,NX,CX,FX,DX,_X,cB,LX,BX,UX,OG];for(let e of HX)ri(e);var In;(function(e){e[e.float32=0]="float32",e[e.int32=1]="int32",e[e.bool=2]="bool",e[e.string=3]="string",e[e.complex64=4]="complex64"})(In||(In={}));var vd;(function(e){e[e.linear=0]="linear",e[e.relu=1]="relu",e[e.relu6=2]="relu6",e[e.prelu=3]="prelu",e[e.leakyrelu=4]="leakyrelu",e[e.sigmoid=5]="sigmoid"})(vd||(vd={}));var yw;function GX(e){yw=e.wasm.cwrap(ti,null,["number","array","number","number","array","number","number","number","number","number","number","number","number"])}function qX(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s,bias:i,preluActivationWeights:o}=t;if(r.dtype!=="float32"||s.dtype!=="float32")throw new Error("_FusedMatMul for non non-float32 tensors not yet supported.");let{transposeA:l,transposeB:d,activation:u,leakyreluAlpha:p}=a,c=n.dataIdMap.get(r.dataId).id,h=n.dataIdMap.get(s.dataId).id,m=0;if(i!=null){let T=n.dataIdMap.get(i.dataId);if(T.shape.length!==1)throw new Error(`_FusedMatMul only supports rank-1 bias but got rank ${T.shape.length}.`);m=T.id}let f=o==null?0:n.dataIdMap.get(o.dataId).id,A=vd[u];if(A==null)throw new Error(`${u} activation not yet supported for FusedConv2D in the wasm backend.`);let y=l?r.shape[2]:r.shape[1],g=d?s.shape[1]:s.shape[2],x=r.shape[0],w=n.makeOutput([x,y,g],r.dtype),b=n.dataIdMap.get(w.dataId).id,v=new Uint8Array(new Int32Array(r.shape).buffer),N=new Uint8Array(new Int32Array(s.shape).buffer);return yw(c,v,r.shape.length,h,N,s.shape.length,l,d,A,m,f,p||0,b),w}var XX={kernelName:ti,backendName:"wasm",setupFunc:GX,kernelFunc:qX};function hn(e){let t;function n(r){t=r.wasm.cwrap(e,null,["number","number"])}function a(r){let{backend:s,inputs:{x:i}}=r,o=s.dataIdMap.get(i.dataId).id,l=s.makeOutput(i.shape,i.dtype),d=s.dataIdMap.get(l.dataId).id;return k.sizeFromShape(l.shape)===0||t(o,d),l}return{kernelName:e,backendName:"wasm",setupFunc:n,kernelFunc:a}}var KX=hn(eo);function fn(e,t,n){let a;function r(i){a=i.wasm.cwrap(e,null,["number","array","number","number","array","number","number","number"])}function s(i){let{backend:o,inputs:l}=i,{a:d,b:u}=l,p=o.dataIdMap.get(d.dataId).id,c=o.dataIdMap.get(u.dataId).id,h=n!=null?n:d.dtype,m=C.assertAndGetBroadcastShape(d.shape,u.shape),f=o.makeOutput(m,h);if(k.sizeFromShape(m)===0)return f;let A=new Uint8Array(new Int32Array(d.shape).buffer),y=new Uint8Array(new Int32Array(u.shape).buffer),g=o.dataIdMap.get(f.dataId).id,x=()=>a(p,A,d.shape.length,c,y,u.shape.length,In[d.dtype],g);if(t&&d.dtype==="float32")return x(),f;let w=C.getBroadcastDims(d.shape,m),b=C.getBroadcastDims(u.shape,m),v=w.every((T,R)=>T===R),N=b.every((T,R)=>T===R);if(v&&N)return x(),f;throw new Error(`Broadcasting along outer dims is not yet supported for ${d.dtype} ${e}.`)}return{kernelName:e,backendName:"wasm",setupFunc:r,kernelFunc:s}}var ZX=!0,YX=fn(kr,ZX),gw;function JX(e){gw=e.wasm.cwrap(os,null,["array","number","number","number"])}function QX(e){let{inputs:t,backend:n}=e,a=n.makeOutput(t[0].shape,t[0].dtype);if(k.sizeFromShape(a.shape)===0)return a;let r=t.map(o=>n.dataIdMap.get(o.dataId).id),s=new Uint8Array(new Int32Array(r).buffer),i=n.dataIdMap.get(a.dataId).id;return gw(s,r.length,In[a.dtype],i),a}var eK={kernelName:os,backendName:"wasm",setupFunc:JX,kernelFunc:QX};function Th(e){let{inputs:{x:t},backend:n}=e,a=n.makeOutput(t.shape,t.dtype),r=n.typedArrayFromHeap(t);return n.typedArrayFromHeap(a).set(r),a}var tK={kernelName:Is,backendName:"wasm",kernelFunc:Th},xw;function nK(e){xw=e.wasm.cwrap(ei,null,["number","array","number","number","number","array","number"])}function Eh(e){let{inputs:t,backend:n,attrs:a}=e,[r,s]=rK(t.x.shape,a.perm),i=!0;for(let m=0;m=r&&(s===-1||a[s]>a[i])&&(s=i);a[s]=r}return[n,a]}var sK={kernelName:ei,backendName:"wasm",kernelFunc:Eh,setupFunc:nK};function Br(e,t,n){let a=e.shape,r=e.shape.length,s=k.parseAxisParam(t,a),i=s,o=C.getAxesPermutation(i,r),l=null,d=!1;if(o!=null){let u=new Array(r);for(let c=0;c`new shape: ${i}, old shape: ${a.shape}. New shape and old shape must have the same number of elements.`),e.backend.incRef(a.dataId),{dataId:a.dataId,shape:i,dtype:a.dtype}}var gK={kernelName:Bo,backendName:"wasm",kernelFunc:xa},Iw;function xK(e){Iw=e.wasm.cwrap(ds,null,["number","array","number","number","array","number","number","number","number"])}function bK(e){let{inputs:t,backend:n,attrs:a}=e,{a:r,b:s}=t,{transposeA:i,transposeB:o}=a;if(r.dtype!=="float32"||s.dtype!=="float32")throw new Error("BatchMatMul for non non-float32 tensors not yet supported.");let l=r.shape.length,d=s.shape.length,u=i?r.shape[l-2]:r.shape[l-1],p=o?s.shape[d-1]:s.shape[d-2],c=i?r.shape[l-1]:r.shape[l-2],h=o?s.shape[d-2]:s.shape[d-1],m=r.shape.slice(0,-2),f=s.shape.slice(0,-2),A=k.sizeFromShape(m),y=k.sizeFromShape(f),g=A===y||A===1||y===1;k.assert(l>=2&&d>=2&&g,()=>`Error in matMul: the input batch dimensions must either be the same or at least one input batch dimension must be 1. Got input batch dimensions of (${m}) and (${f}).`);let x=(A>y?r.shape.slice(0,-2):s.shape.slice(0,-2)).concat([c,h]);k.assert(u===p,()=>`Error in matMul: inner shapes (${u}) and (${p}) of Tensors with shapes ${r.shape} and ${s.shape} and transposeA=${i} and transposeB=${o} must match.`);let w=i?[A,u,c]:[A,c,u],b=o?[y,h,p]:[y,p,h],v=xa({inputs:{x:r},backend:n,attrs:{shape:w}}),N=xa({inputs:{x:s},backend:n,attrs:{shape:b}}),T=n.dataIdMap.get(v.dataId).id,R=n.dataIdMap.get(N.dataId).id,$=i?v.shape[2]:v.shape[1],z=o?N.shape[1]:N.shape[2],P=Math.max(A,y),V=n.makeOutput([P,$,z],v.dtype),j=n.dataIdMap.get(V.dataId).id,U=new Uint8Array(new Int32Array(v.shape).buffer),X=new Uint8Array(new Int32Array(N.shape).buffer);return Iw(T,U,v.shape.length,R,X,N.shape.length,i,o,j),n.disposeData(v.dataId),n.disposeData(N.dataId),V.shape=x,V}var vK={kernelName:ds,backendName:"wasm",setupFunc:xK,kernelFunc:bK};function Ch(e){let{inputs:{x:t},attrs:{dtype:n},backend:a}=e,r=a.makeOutput(t.shape,n),s=a.typedArrayFromHeap(t);return a.typedArrayFromHeap(r).set(s),r}var wK={kernelName:ps,backendName:"wasm",kernelFunc:Ch},kK=hn(cs),Sw;function IK(e){Sw=e.wasm.cwrap(Ir,null,["number","number","number","number"])}function SK(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{clipValueMin:s,clipValueMax:i}=a,o=n.dataIdMap.get(r.dataId).id,l=n.makeOutput(r.shape,r.dtype),d=n.dataIdMap.get(l.dataId).id;return Sw(o,s,i,d),l}var NK={kernelName:Ir,backendName:"wasm",setupFunc:IK,kernelFunc:SK};function Nw(e){let{inputs:t,backend:n}=e,a=k.parseAxisParam(e.attrs.axis,t[0].shape)[0],r=C.computeOutShape(t.map(h=>h.shape),a),s=t.filter(h=>k.sizeFromShape(h.shape)>0);if(s.length===1)return Th({inputs:{x:s[0]},backend:n});let i=n.makeOutput(r,t[0].dtype);if(k.sizeFromShape(r)===0)return i;let o=s.map(h=>h.shape);if(C.assertParamsConsistent(o,a),s[0].dtype==="string"){let h=s.map(x=>{let w=k.sizeFromShape(x.shape.slice(a));return xa({inputs:{x},backend:n,attrs:{shape:[-1,w]}})}),m=h.map(x=>({vals:n.readSync(x.dataId),shape:x.shape}));r=C.computeOutShape(h.map(x=>x.shape),1);let f=h[0].shape[0]===1,A=GA(m,r,t[0].dtype,f),y=C.computeOutShape(s.map(x=>x.shape),a);i.shape=y;let g=n.dataIdMap.get(i.dataId);return g.stringBytes=C.fromStringArrayToUint8(A),h.forEach(x=>n.disposeData(x.dataId)),i}let l=k.sizeFromShape(s[0].shape.slice(0,a)),d=0,u=s.map(h=>{let m=k.sizeFromShape(h.shape.slice(a));return d+=m,m}),p=s.map(h=>n.typedArrayFromHeap(h)),c=n.typedArrayFromHeap(i);for(let h=0;h`cumsum does not support ${r.dtype} tensors in the WASM backend`);let d=C.getAxesPermutation([s],l),u=r;d!==null&&(u=Eh({inputs:{x:r},attrs:{perm:d},backend:n}));let p=C.getInnerMostAxes(1,l)[0];C.assertAxesAreInnerMostDims("cumsum",[p],l);let c=n.makeOutput(u.shape,u.dtype),h=u.shape[p],m=n.dataIdMap.get(u.dataId).id,f=n.dataIdMap.get(c.dataId).id;Rw(m,i?1:0,o?1:0,h,f,In[r.dtype]);let A=c;if(d!==null){let y=C.getUndoAxesPermutation(d);A=Eh({inputs:{x:c},attrs:{perm:y},backend:n}),n.disposeData(u.dataId),n.disposeData(c.dataId)}return A}var WK={kernelName:As,backendName:"wasm",setupFunc:PK,kernelFunc:LK},Mw;function BK(e){Mw=e.wasm.cwrap(fo,null,["number","number","number","array","number","array","array","number","number"])}function VK(e){let{backend:t,inputs:n,attrs:a}=e,{x:r}=n,{blockSize:s,dataFormat:i}=a;k.assert(s>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${s}`);let o=r.shape[0],l=i==="NHWC"?r.shape[1]:r.shape[2],d=i==="NHWC"?r.shape[2]:r.shape[3],u=i==="NHWC"?r.shape[3]:r.shape[1],p=l*s,c=d*s,h=u/(s*s),m=i==="NHWC"?[o,p,c,h]:[o,h,p,c],f=t.makeOutput(m,"float32"),A=t.dataIdMap.get(r.dataId).id,y=new Uint8Array(new Int32Array(k.computeStrides(r.shape)).buffer),g=new Uint8Array(new Int32Array(m).buffer),x=new Uint8Array(new Int32Array(k.computeStrides(m)).buffer),w=t.dataIdMap.get(f.dataId).id;return Mw(A,s,i==="NHWC"?1:0,y,r.shape.length-1,g,x,m.length,w),f}var jK={kernelName:fo,backendName:"wasm",setupFunc:BK,kernelFunc:VK},Fw;function UK(e){Fw=e.wasm.cwrap(ys,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function HK(e){let{inputs:t,attrs:n,backend:a}=e,{x:r,filter:s}=t,i=a.dataIdMap.get(r.dataId).id,o=a.dataIdMap.get(s.dataId).id,{strides:l,dilations:d,pad:u,dimRoundingMode:p}=n,c=d==null?[1,1]:d,h=C.computeConv2DInfo(r.shape,s.shape,l,c,u,p,!0),m=h.filterHeight,f=h.filterWidth,A=h.padInfo.top,y=h.padInfo.right,g=h.padInfo.bottom,x=h.padInfo.left,w=h.dilationHeight,b=h.dilationWidth,v=h.strideHeight,N=h.strideWidth,T=h.inChannels,R=h.outChannels,$=h.padInfo.type==="SAME"?1:0;if(h.dataFormat!=="channelsLast")throw new Error(`wasm backend DepthwiseConv2dNative does not support dataFormat:'${h.dataFormat}'. Please use 'channelsLast'.`);let z=a.makeOutput(h.outShape,"float32"),P=a.dataIdMap.get(z.dataId).id;return Fw(i,r.shape[0],r.shape[1],r.shape[2],o,m,f,A,y,g,x,$,w,b,v,N,T,R,P),z}var GK={kernelName:ys,backendName:"wasm",setupFunc:UK,kernelFunc:HK},qK=!1,XK=fn(yo,qK,"bool"),KK=hn(xs);function S1(e){let{inputs:t,attrs:n,backend:a}=e,{input:r}=t,{dim:s}=n,i=r.shape.length,o=r.shape.slice(),l=s;return s<0&&(k.assert(-(i+1)<=s,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+s+1),o.splice(l,0,1),xa({inputs:{x:r},backend:a,attrs:{shape:o}})}var ZK={kernelName:go,backendName:"wasm",kernelFunc:S1};function YK(e){let{attrs:{shape:t,value:n,dtype:a},backend:r}=e,s=r.makeOutput(t,a);return r.typedArrayFromHeap(s).fill(n),s}var JK={kernelName:ku,backendName:"wasm",kernelFunc:YK},$w;function QK(e){$w=e.wasm.cwrap(bo,null,["number","number","number","number","number","number"])}function eZ(e){let{inputs:t,backend:n}=e,{image:a}=t,r=n.makeOutput(a.shape,a.dtype),s=n.dataIdMap.get(a.dataId).id,i=n.dataIdMap.get(r.dataId).id,[o,l,d,u]=a.shape;return $w(s,o,l,d,u,i),r}var tZ={kernelName:bo,backendName:"wasm",kernelFunc:eZ,setupFunc:QK},nZ=hn(bs),aZ=!1,rZ=fn(vs,aZ),Dw;function sZ(e){Dw=e.wasm.cwrap(ws,null,["number","number","number","number","number","number","number"])}function iZ(e){let{backend:t,inputs:n,attrs:a}=e,{varianceEpsilon:r}=a,{x:s,mean:i,variance:o,offset:l,scale:d}=n,u=t.dataIdMap.get(s.dataId).id,p=t.dataIdMap.get(i.dataId).id,c=t.dataIdMap.get(o.dataId).id,h=l!=null?t.dataIdMap.get(l.dataId).id:0,m=d!=null?t.dataIdMap.get(d.dataId).id:0,f=t.makeOutput(s.shape,s.dtype);if(k.sizeFromShape(s.shape)===0)return f;let A=t.dataIdMap.get(f.dataId).id;return Dw(u,p,c,h,m,r,A),f}var oZ={kernelName:ws,backendName:"wasm",setupFunc:sZ,kernelFunc:iZ},Ow;function lZ(e){Ow=e.wasm.cwrap(ni,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function uZ(e){let{inputs:t,attrs:n,backend:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dilations:u,dataFormat:p,dimRoundingMode:c,activation:h,leakyreluAlpha:m}=n,f=C.computeConv2DInfo(r.shape,s.shape,l,u,d,c),A=vd[h];if(A==null)throw new Error(`${h} activation not yet supported for FusedConv2D in the wasm backend.`);let y=a.dataIdMap.get(r.dataId).id,g=a.dataIdMap.get(s.dataId).id,x=f.outChannels,w=0;if(i!=null){let Q=a.dataIdMap.get(i.dataId);if(Q.shape.length!==1)throw new Error(`FusedConv2D only supports rank-1 bias but got rank ${Q.shape.length}.`);if(Q.shape[0]!==x)throw new Error(`FusedConv2D bias shape (${Q.shape}) does not match the number of output channels (${x})`);w=Q.id}let b=f.filterHeight,v=f.filterWidth,N=f.padInfo.top,T=f.padInfo.right,R=f.padInfo.bottom,$=f.padInfo.left,z=f.dilationHeight,P=f.dilationWidth,V=f.strideHeight,j=f.strideWidth,U=f.inChannels,X=f.padInfo.type==="SAME"?1:0,G=f.batchSize,ee=f.inHeight,Y=f.inWidth;if(p!=="NHWC")throw new Error(`wasm backend FusedConv2D does not support dataFormat:'${p}'. Please use 'NHWC'.`);let re=a.makeOutput(f.outShape,"float32"),ne=a.dataIdMap.get(re.dataId).id,ie=o==null?0:a.dataIdMap.get(o.dataId).id;return Ow(y,G,ee,Y,g,b,v,w,N,T,R,$,X,z,P,V,j,U,x,A,ie,m||0,ne),re}var dZ={kernelName:ni,backendName:"wasm",setupFunc:lZ,kernelFunc:uZ},zw;function pZ(e){zw=e.wasm.cwrap(ai,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function cZ(e){let{inputs:t,attrs:n,backend:a}=e,{x:r,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:d,dilations:u,dataFormat:p,dimRoundingMode:c,activation:h,leakyreluAlpha:m}=n,f=C.computeConv2DInfo(r.shape,s.shape,l,u,d,c,!0),A=vd[h];if(A==null)throw new Error(`${h} activation not yet supported for FusedDepthwiseConv2D in the wasm backend.`);let y=a.dataIdMap.get(r.dataId).id,g=a.dataIdMap.get(s.dataId).id,x=f.outChannels,w=0;if(i!=null){let Q=a.dataIdMap.get(i.dataId);if(Q.shape.length!==1)throw new Error(`FusedDepthwiseConv2D only supports rank-1 bias but got rank ${Q.shape.length}.`);if(Q.shape[0]!==x)throw new Error(`FusedDepthwiseConv2D bias shape (${Q.shape}) does not match the number of output channels (${x})`);w=Q.id}let b=f.filterHeight,v=f.filterWidth,N=f.padInfo.top,T=f.padInfo.right,R=f.padInfo.bottom,$=f.padInfo.left,z=f.dilationHeight,P=f.dilationWidth,V=f.strideHeight,j=f.strideWidth,U=f.inChannels,X=f.padInfo.type==="SAME"?1:0,G=f.batchSize,ee=f.inHeight,Y=f.inWidth;if(p!=="NHWC")throw new Error(`wasm backend FusedDepthwiseConv2D does not support dataFormat:'${p}'. Please use 'NHWC'.`);let re=a.makeOutput(f.outShape,"float32"),ne=a.dataIdMap.get(re.dataId).id,ie=o==null?0:a.dataIdMap.get(o.dataId).id;return zw(y,G,ee,Y,g,b,v,w,N,T,R,$,X,z,P,V,j,U,x,A,ie,m||0,ne),re}var hZ={kernelName:ai,backendName:"wasm",setupFunc:pZ,kernelFunc:cZ},_w;function fZ(e){_w=e.wasm.cwrap(wo,null,["number","number","number","number","number","number","array","number"])}function mZ(e){let{backend:t,inputs:n}=e,{params:a,indices:r}=n,[s,i,o,l]=jm.prepareAndValidate(a,r),d=t.makeOutput(s,a.dtype);if(i===0)return d;let u=r.shape,p=u[u.length-1],c=t.dataIdMap.get(a.dataId).id,h=t.dataIdMap.get(r.dataId).id,m=new Uint8Array(new Int32Array(l).buffer),f=t.dataIdMap.get(d.dataId).id;return _w(c,In[a.dtype],h,i,p,o,m,f),d}var AZ={kernelName:wo,backendName:"wasm",setupFunc:fZ,kernelFunc:mZ},Pw;function yZ(e){Pw=e.wasm.cwrap("Gather",null,["number","number","array","number","number","number","array","number"])}function gZ(e){let{backend:t,inputs:n,attrs:a}=e,{x:r,indices:s}=n,{axis:i,batchDims:o}=a,l=k.parseAxisParam(i,r.shape)[0],d=C.segment_util.collectGatherOpShapeInfo(r,s,l,o),u=xa({inputs:{x:r},attrs:{shape:[d.batchSize,d.outerSize,d.dimSize,d.sliceSize]},backend:t}),p=k.sizeFromShape(s.shape),c=xa({inputs:{x:s},attrs:{shape:[d.batchSize,p/d.batchSize]},backend:t}),h=[d.batchSize,d.outerSize,p/d.batchSize,d.sliceSize],m=t.makeOutput(h,r.dtype);if(k.sizeFromShape(r.shape)===0)return m;let f=u.shape.length-1,A=t.dataIdMap.get(u.dataId).id,y=t.dataIdMap.get(c.dataId).id,g=t.dataIdMap.get(m.dataId).id,x=new Uint8Array(new Int32Array(k.computeStrides(u.shape)).buffer),w=new Uint8Array(new Int32Array(k.computeStrides(h)).buffer);return Pw(A,In[r.dtype],x,f,y,d.batchSize,w,g),t.disposeData(u.dataId),t.disposeData(c.dataId),m.shape=d.outputShape,m}var xZ={kernelName:vo,backendName:"wasm",setupFunc:yZ,kernelFunc:gZ},bZ=!1,vZ=fn(ko,bZ,"bool"),wZ=!1,kZ=fn(ks,wZ,"bool"),Lw;function IZ(e){Lw=e.wasm.cwrap(Ss,null,["number","number","number"])}function SZ(e){let{inputs:{x:t},attrs:{alpha:n},backend:a}=e,r=a.dataIdMap.get(t.dataId).id,s=a.makeOutput(t.shape,t.dtype);if(k.sizeFromShape(t.shape)!==0){let i=a.dataIdMap.get(s.dataId).id;Lw(r,n,i)}return s}var NZ={kernelName:Ss,backendName:"wasm",setupFunc:IZ,kernelFunc:SZ},TZ=!1,EZ=fn(To,TZ,"bool"),CZ=!1,RZ=fn(Eo,CZ,"bool"),MZ=hn(Ns),FZ=!1,$Z=fn(Ro,FZ,"bool"),Ww;function DZ(e){Ww=e.wasm.cwrap(Ts,null,["number, number, number"])}function OZ(e){let{backend:t,inputs:n,attrs:a}=e,{reductionIndices:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=i,{transposed:d,axes:u,originalAxes:p,inputWasTransposed:c}=Br(i,r,t);if(c){let g=t.dataIdMap.get(d.dataId).id;l=d,o=g}let h=l.shape.length;C.assertAxesAreInnerMostDims("max",u,h);let[m,f]=C.computeOutAndReduceShapes(l.shape,u),A=k.sizeFromShape(f),y=t.makeOutput(m,i.dtype);if(k.sizeFromShape(l.shape)!==0){let g=t.dataIdMap.get(y.dataId).id;Ww(o,A,g)}if(c&&t.disposeData(d.dataId),s){let g=C.expandShapeToKeepDim(y.shape,p);y.shape=g}return y}var zZ={kernelName:Ts,backendName:"wasm",setupFunc:DZ,kernelFunc:OZ},_Z=!1,PZ=fn(Es,_Z),Bw;function LZ(e){Bw=e.wasm.cwrap(Cs,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function WZ(e){let{inputs:t,attrs:n,backend:a}=e,r=t.x,s=a.dataIdMap.get(r.dataId).id,{filterSize:i,strides:o,pad:l,dimRoundingMode:d}=n,u=C.computePool2DInfo(r.shape,i,o,1,l,d),p=u.filterHeight,c=u.filterWidth,h=u.padInfo.top,m=u.padInfo.right,f=u.padInfo.bottom,A=u.padInfo.left,y=u.dilationHeight,g=u.dilationWidth,x=u.strideHeight,w=u.strideWidth,b=u.inChannels,v=u.outChannels;if(u.dataFormat!=="channelsLast")throw new Error(`wasm backend does not support dataFormat:'${u.dataFormat}'. Please use 'channelsLast'.`);let N=a.makeOutput(u.outShape,"float32"),T=a.dataIdMap.get(N.dataId).id;return Bw(s,r.shape[0],r.shape[1],r.shape[2],p,c,h,m,f,A,y,g,x,w,b,v,T),N}var BZ={kernelName:Cs,backendName:"wasm",setupFunc:LZ,kernelFunc:WZ},Vw;function VZ(e){Vw=e.wasm.cwrap(Rs,null,["number, number, number"])}function jZ(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,d=i,{transposed:u,axes:p,originalAxes:c,inputWasTransposed:h}=Br(i,r,t),m=p;if(h){let w=t.dataIdMap.get(u.dataId).id;w!==o&&(d=u,l=w,m=C.getInnerMostAxes(m.length,d.shape.length))}C.assertAxesAreInnerMostDims("mean",m,d.shape.length);let[f,A]=C.computeOutAndReduceShapes(d.shape,m),y=k.sizeFromShape(A),g=d;d.dtype!=="float32"&&(g=Ch({backend:t,inputs:{x:d},attrs:{dtype:"float32"}}),l=t.dataIdMap.get(g.dataId).id);let x=t.makeOutput(f,"float32");if(k.sizeFromShape(d.shape)!==0){let w=t.dataIdMap.get(x.dataId).id;Vw(l,y,w)}if(h&&t.disposeData(u.dataId),s){let w=C.expandShapeToKeepDim(x.shape,c);x.shape=w}return d.dtype!=="float32"&&t.disposeData(g.dataId),x}var UZ={kernelName:Rs,backendName:"wasm",setupFunc:VZ,kernelFunc:jZ},jw;function HZ(e){jw=e.wasm.cwrap(Ms,null,["number, number, number"])}function GZ(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,d=i,{transposed:u,axes:p,originalAxes:c,inputWasTransposed:h}=Br(i,r,t);if(h){let x=t.dataIdMap.get(u.dataId).id;x!==o&&(d=u,l=x)}let m=d.shape.length;C.assertAxesAreInnerMostDims("min",p,m);let[f,A]=C.computeOutAndReduceShapes(d.shape,p),y=k.sizeFromShape(A),g=t.makeOutput(f,d.dtype);if(k.sizeFromShape(d.shape)!==0){let x=t.dataIdMap.get(g.dataId).id;jw(l,y,x)}if(h&&t.disposeData(u.dataId),s){let x=C.expandShapeToKeepDim(g.shape,c);g.shape=x}return g}var qZ={kernelName:Ms,backendName:"wasm",setupFunc:HZ,kernelFunc:GZ},XZ=!1,KZ=fn(Fs,XZ),N1;(function(e){e[e.reflect=0]="reflect",e[e.symmetric=1]="symmetric"})(N1||(N1={}));var Uw;function ZZ(e){Uw=e.wasm.cwrap($s,null,["number","array","number","number","array","array","number","number"])}function YZ(e){let{inputs:{x:t},backend:n,attrs:{paddings:a,mode:r}}=e,s=a.map((m,f)=>m[0]+t.shape[f]+m[1]),i=n.dataIdMap.get(t.dataId).id,o=n.makeOutput(s,t.dtype),l=n.dataIdMap.get(o.dataId).id,d=new Uint8Array(new Int32Array(t.shape).buffer),u=a.map(m=>m[0]),p=a.map(m=>m[1]),c=new Uint8Array(new Int32Array(u).buffer),h=new Uint8Array(new Int32Array(p).buffer);return Uw(i,d,t.shape.length,In[t.dtype],c,h,N1[r],l),o}var JZ={kernelName:$s,backendName:"wasm",kernelFunc:YZ,setupFunc:ZZ},QZ=!0,eY=fn(Ds,QZ),tY=hn(Fo);function T1(e,t){let n=new Int32Array(e.wasm.HEAPU8.buffer,t,4),a=n[0],r=n[1],s=n[2],i=n[3];return e.wasm._free(t),{pSelectedIndices:a,selectedSize:r,pSelectedScores:s,pValidOutputs:i}}var Hw;function nY(e){Hw=e.wasm.cwrap(Do,"number",["number","number","number","number","number"])}function aY(e){let{backend:t,inputs:n,attrs:a}=e,{iouThreshold:r,maxOutputSize:s,scoreThreshold:i}=a,{boxes:o,scores:l}=n,d=t.dataIdMap.get(o.dataId).id,u=t.dataIdMap.get(l.dataId).id,p=Hw(d,u,s,r,i),{pSelectedIndices:c,selectedSize:h,pSelectedScores:m,pValidOutputs:f}=T1(t,p);return t.wasm._free(m),t.wasm._free(f),t.makeOutput([h],"int32",c)}var rY={kernelName:Do,backendName:"wasm",setupFunc:nY,kernelFunc:aY},Gw;function sY(e){Gw=e.wasm.cwrap(Oo,"number",["number","number","number","number","number","bool"])}function iY(e){let{backend:t,inputs:n,attrs:a}=e,{iouThreshold:r,maxOutputSize:s,scoreThreshold:i,padToMaxOutputSize:o}=a,{boxes:l,scores:d}=n,u=t.dataIdMap.get(l.dataId).id,p=t.dataIdMap.get(d.dataId).id,c=Gw(u,p,s,r,i,o),{pSelectedIndices:h,selectedSize:m,pSelectedScores:f,pValidOutputs:A}=T1(t,c);t.wasm._free(f);let y=t.makeOutput([m],"int32",h),g=t.makeOutput([],"int32",A);return[y,g]}var oY={kernelName:Oo,backendName:"wasm",setupFunc:sY,kernelFunc:iY},qw;function lY(e){qw=e.wasm.cwrap(zo,"number",["number","number","number","number","number","number"])}function uY(e){let{backend:t,inputs:n,attrs:a}=e,{iouThreshold:r,maxOutputSize:s,scoreThreshold:i,softNmsSigma:o}=a,{boxes:l,scores:d}=n,u=t.dataIdMap.get(l.dataId).id,p=t.dataIdMap.get(d.dataId).id,c=qw(u,p,s,r,i,o),{pSelectedIndices:h,selectedSize:m,pSelectedScores:f,pValidOutputs:A}=T1(t,c);t.wasm._free(A);let y=t.makeOutput([m],"int32",h),g=t.makeOutput([m],"float32",f);return[y,g]}var dY={kernelName:zo,backendName:"wasm",setupFunc:lY,kernelFunc:uY},pY=!1,cY=fn($o,pY,"bool"),Xw;function hY(e){Xw=e.wasm.cwrap(Os,null,["number","number","number","number","number"])}function fY(e){let{inputs:t,backend:n,attrs:a}=e,{indices:r}=t,{depth:s,onValue:i,offValue:o}=a,l=n.makeOutput([...r.shape,s],"int32"),d=n.dataIdMap.get(l.dataId).id,u=n.dataIdMap.get(r.dataId).id;return Xw(u,s,i,o,d),l}var mY={kernelName:Os,backendName:"wasm",setupFunc:hY,kernelFunc:fY};function AY(e){let{inputs:{x:t},backend:n}=e,a=n.makeOutput(t.shape,t.dtype);return n.typedArrayFromHeap(a).fill(1),a}var yY={kernelName:_o,backendName:"wasm",kernelFunc:AY};function gY(e){let{inputs:t,backend:n,attrs:a}=e,{axis:r}=a;if(t.length===1)return S1({inputs:{input:t[0]},backend:n,attrs:{dim:r}});let s=t[0].shape,i=t[0].dtype;t.forEach(u=>{k.assertShapesMatch(s,u.shape,"All tensors passed to stack must have matching shapes"),k.assert(i===u.dtype,()=>"All tensors passed to stack must have matching dtypes")});let o=[],l=t.map(u=>{let p=S1({inputs:{input:u},backend:n,attrs:{dim:r}});return o.push(p),p}),d=Nw({inputs:l,backend:n,attrs:{axis:r}});return o.forEach(u=>n.disposeData(u.dataId)),d}var xY={kernelName:Po,backendName:"wasm",kernelFunc:gY},Kw;function bY(e){Kw=e.wasm.cwrap(zs,null,["number","array","number","number","array","array","number","number"])}function vY(e){let{inputs:{x:t},backend:n,attrs:{paddings:a,constantValue:r}}=e,s=a.map((m,f)=>m[0]+t.shape[f]+m[1]),i=n.dataIdMap.get(t.dataId).id,o=n.makeOutput(s,t.dtype),l=n.dataIdMap.get(o.dataId).id,d=new Uint8Array(new Int32Array(t.shape).buffer),u=a.map(m=>m[0]),p=a.map(m=>m[1]),c=new Uint8Array(new Int32Array(u).buffer),h=new Uint8Array(new Int32Array(p).buffer);return Kw(i,d,t.shape.length,In[t.dtype],c,h,r,l),o}var wY={kernelName:zs,backendName:"wasm",kernelFunc:vY,setupFunc:bY},kY=!1,IY=fn(_s,kY),Zw;function SY(e){Zw=e.wasm.cwrap(Ps,null,["number","number","number"])}function NY(e){let{inputs:t,backend:n}=e,{x:a,alpha:r}=t,s=n.dataIdMap.get(a.dataId).id,i=n.dataIdMap.get(r.dataId).id,o=n.makeOutput(a.shape,"float32"),l=n.dataIdMap.get(o.dataId).id;return Zw(s,i,l),o}var TY={kernelName:Ps,backendName:"wasm",setupFunc:SY,kernelFunc:NY},Yw;function EY(e){Yw=e.wasm.cwrap(Lo,null,["number","number","number","number"])}function CY(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,d=i,{transposed:u,axes:p,originalAxes:c,inputWasTransposed:h}=Br(i,r,t),m=p;if(h){let x=t.dataIdMap.get(u.dataId).id;x!==o&&(d=u,l=x,m=C.getInnerMostAxes(m.length,d.shape.length))}C.assertAxesAreInnerMostDims("prod",m,d.shape.length);let[f,A]=C.computeOutAndReduceShapes(d.shape,m),y=k.sizeFromShape(A),g=t.makeOutput(f,d.dtype);if(k.sizeFromShape(d.shape)!==0){let x=t.dataIdMap.get(g.dataId).id;Yw(l,y,In[g.dtype],x)}if(h&&t.disposeData(u.dataId),s){let x=C.expandShapeToKeepDim(g.shape,c);g.shape=x}return g}var RY={kernelName:Lo,backendName:"wasm",setupFunc:EY,kernelFunc:CY},MY=e=>{let{backend:t,attrs:n}=e,{start:a,stop:r,step:s,dtype:i}=n,o=KA(a,r,s,i),l=t.makeOutput([o.length],i);return t.typedArrayFromHeap(l).set(o),l},FY={kernelName:Eu,backendName:"wasm",kernelFunc:MY},$Y=!0,DY=fn(gs,$Y),OY=hn(Ls),zY=hn(Bs),Jw;function _Y(e){Jw=e.wasm.cwrap(Ws,null,["number","number","number","number","number","number","number","number","number","number"])}function PY(e){let{backend:t,inputs:n,attrs:a}=e,{images:r}=n,{alignCorners:s,halfPixelCenters:i,size:o}=a,[l,d]=o,[u,p,c,h]=r.shape,m=[u,l,d,h],f=t.dataIdMap.get(r.dataId),A;f.dtype!=="float32"&&(A=Ch({backend:t,inputs:{x:r},attrs:{dtype:"float32"}}),f=t.dataIdMap.get(A.dataId));let y=f.id,g=t.makeOutput(m,"float32");if(k.sizeFromShape(r.shape)===0)return g;let x=t.dataIdMap.get(g.dataId).id;return Jw(y,u,p,c,h,l,d,s?1:0,i?1:0,x),A!=null&&t.disposeData(A.dataId),g}var LY={kernelName:Ws,backendName:"wasm",setupFunc:_Y,kernelFunc:PY},Qw;function WY(e){Qw=e.wasm.cwrap(Vs,null,["number","array","number","array","number","number"])}function BY(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,{dims:s}=a,i=k.parseAxisParam(s,r.shape);if(r.shape.length===0)return Th({inputs:{x:r},backend:n});let o=n.makeOutput(r.shape,r.dtype),l=n.dataIdMap.get(r.dataId).id,d=n.dataIdMap.get(o.dataId).id,u=new Uint8Array(new Int32Array(i).buffer),p=new Uint8Array(new Int32Array(r.shape).buffer);Qw(l,u,i.length,p,r.shape.length,d);let c=xa({inputs:{x:o},attrs:{shape:r.shape},backend:n});return n.disposeData(o.dataId),c}var VY={kernelName:Vs,backendName:"wasm",kernelFunc:BY,setupFunc:WY},e6;function jY(e){e6=e.wasm.cwrap(tl,null,["number","number","number","number","number","number","number","number","array","number","number"])}function UY(e){let{inputs:t,backend:n,attrs:a}=e,{image:r}=t,{radians:s,fillValue:i,center:o}=a,l=n.makeOutput(r.shape,r.dtype),d=n.dataIdMap.get(r.dataId).id,u=n.dataIdMap.get(l.dataId).id,[p,c,h,m]=r.shape,[f,A]=C.getImageCenter(o,c,h),y=i===0,g=255,x=typeof i=="number"?[i,i,i,y?0:g]:[...i,g],w=new Uint8Array(new Int32Array(x).buffer);return e6(d,p,c,h,m,s,f,A,w,x.length,u),l}var HY={kernelName:tl,backendName:"wasm",kernelFunc:UY,setupFunc:jY},GY=hn(js),qY=hn(Us),t6;function XY(e){t6=e.wasm.cwrap(Vo,null,["number","number","number","number","number","number","array","number","number"])}function KY(e){let{backend:t,inputs:n,attrs:a}=e,{indices:r,updates:s}=n,{shape:i}=a,o=t.makeOutput(i,s.dtype);if(k.sizeFromShape(i)===0)return o;let{sliceRank:l,numUpdates:d,sliceSize:u,strides:p,outputSize:c}=Um.calculateShapes(s,r,i),h=t.dataIdMap.get(r.dataId).id,m=t.dataIdMap.get(s.dataId).id,f=new Uint8Array(new Int32Array(p).buffer),A=t.dataIdMap.get(o.dataId).id;return t6(h,m,In[s.dtype],l,d,u,f,c,A),o}var ZY={kernelName:Vo,backendName:"wasm",setupFunc:XY,kernelFunc:KY},n6;function YY(e){n6=e.wasm.cwrap("SelectV2",null,["number","number","number","number","number"])}function JY(e){let{inputs:t,backend:n}=e,{condition:a,t:r,e:s}=t,i=n.dataIdMap.get(a.dataId).id,o=n.dataIdMap.get(r.dataId).id,l=n.dataIdMap.get(s.dataId).id,d=n.makeOutput(r.shape,r.dtype),u=n.dataIdMap.get(d.dataId).id,p=a.shape.length,c=r.shape.length,h=p===0||p>1||c===1?1:k.sizeFromShape(r.shape.slice(1));return n6(i,o,l,h,u),d}var QY={kernelName:jo,backendName:"wasm",kernelFunc:JY,setupFunc:YY},a6;function eJ(e){a6=e.wasm.cwrap(Gs,null,["number","number"])}function tJ(e){let{backend:t,inputs:{x:n}}=e,a=t.dataIdMap.get(n.dataId).id,r=t.makeOutput(n.shape,n.dtype),s=t.dataIdMap.get(r.dataId).id;return k.sizeFromShape(r.shape)===0||a6(a,s),r}var nJ={kernelName:"Sigmoid",backendName:"wasm",setupFunc:eJ,kernelFunc:tJ},aJ=hn(Hs);function Rh(e){let{inputs:{x:t},attrs:{begin:n,size:a},backend:r}=e,[s,i]=on.parseSliceParams(t,n,a),o=on.isSliceContinous(t.shape,s,i),l=r.readSync(t.dataId),d=r.makeOutput(i,t.dtype),u=k.computeStrides(t.shape),p=r.dataIdMap.get(d.dataId);if(o){let m=on.computeFlatOffset(s,u);return t.dtype==="string"?p.stringBytes=l.slice(m,m+k.sizeFromShape(i)):r.typedArrayFromHeap(d).set(l.subarray(m,m+k.sizeFromShape(i))),d}if(t.dtype==="string"){let m=rh(l,s,i,t.shape,t.dtype);return p.stringBytes=m,d}let c=r.typedArrayFromHeap(d),h=t.shape.length;if(h===2)rJ(l,u[0],c,s,i);else if(h===3)sJ(l,u[0],u[1],c,s,i);else if(h===4)iJ(l,u[0],u[1],u[2],c,s,i);else{let m=rh(l,s,i,t.shape,t.dtype);c.set(m)}return d}function rJ(e,t,n,a,r){let s=0,i=a[0],o=a[1],l=i+r[0];for(let d=i;d{let c=[...u];c[o]=p;let h=Rh({inputs:{x:r},attrs:{begin:d,size:c},backend:a});return d[o]+=p,h})}var cJ={kernelName:Ko,backendName:"wasm",kernelFunc:pJ},hJ=hn(qs),fJ=hn(Mu),mJ=!0,AJ=fn(Zs,mJ),s6;function yJ(e){s6=e.wasm.cwrap(Nr,null,["number","number","number"])}function gJ(e){let{backend:t,inputs:n,attrs:a}=e,{alpha:r}=a,{x:s}=n,i=t.dataIdMap.get(s.dataId).id,o=t.makeOutput(s.shape,s.dtype),l=t.dataIdMap.get(o.dataId).id;return s6(i,r,l),o}var xJ={kernelName:Nr,backendName:"wasm",setupFunc:yJ,kernelFunc:gJ},i6;function bJ(e){i6=e.wasm.cwrap(Zo,null,["number","array","number","array","array","array","array","array","number","number"])}function vJ(e){let{backend:t,inputs:n,attrs:a}=e,{x:r}=n,{begin:s,end:i,strides:o}=a;o==null&&(o=new Array(s.length));let{beginMask:l,endMask:d,ellipsisMask:u,newAxisMask:p,shrinkAxisMask:c}=a,h=C.slice_util.maskToAxes(u);if(h.length>1)throw new Error("Multiple ellipses in slice is not allowed.");if(u!==0&&p!==0)throw new Error("Using both ellipsisMask and newAxisMask is not yet supported.");if(u!==0&&c!==0)throw new Error("Using both ellipsisMask and shrinkAxisMask is not yet supported.");let m=r.shape.length-s.length,f=C.slice_util.maskToAxes(p),A=r.shape.slice();f.forEach($=>{s[$]=0,i[$]=1,A.splice($,0,1)});let y=xa({inputs:{x:r},attrs:{shape:A},backend:t}),{begin:g,end:x,strides:w}=C.slice_util.getNormalizedAxes(y.shape,h,m,s,i,o,l,d,u);s=g,i=x,o=w;let b=C.slice_util.maskToAxes(c);b.forEach($=>{i[$]=s[$]+1,o[$]=1});let v=C.slice_util.computeOutShape(s,i,o),N=v.filter(($,z)=>b.indexOf(z)===-1);if(o.every($=>$===1)){let $=Rh({inputs:{x:y},attrs:{begin:s,size:v},backend:t});t.disposeData(y.dataId);let z=xa({inputs:{x:$},attrs:{shape:N},backend:t});return t.disposeData($.dataId),z}let T=t.makeOutput(N,"float32");if(!N.some($=>$===0)){let $=t.dataIdMap.get(y.dataId).id,z=new Uint8Array(new Int32Array(k.computeStrides(y.shape)).buffer),P=new Uint8Array(new Int32Array(s).buffer),V=new Uint8Array(new Int32Array(i).buffer),j=new Uint8Array(new Int32Array(o).buffer),U=new Uint8Array(new Int32Array(N).buffer),X=new Uint8Array(new Int32Array(k.computeStrides(N)).buffer),G=t.dataIdMap.get(T.dataId).id;i6($,z,y.shape.length,P,V,j,U,X,N.length,G)}t.disposeData(y.dataId);let R=xa({inputs:{x:T},attrs:{shape:N},backend:t});return t.disposeData(T.dataId),R}var wJ={kernelName:Zo,backendName:"wasm",setupFunc:bJ,kernelFunc:vJ},kJ=!0,IJ=fn(Ys,kJ),o6;function SJ(e){o6=e.wasm.cwrap(Xs,null,["number, number, number"])}function NJ(e){let{backend:t,inputs:n,attrs:a}=e,{axis:r,keepDims:s}=a,{x:i}=n,o=t.dataIdMap.get(i.dataId).id,l=o,d=i,{transposed:u,axes:p,originalAxes:c,inputWasTransposed:h}=Br(i,r,t),m=p;if(h){let x=t.dataIdMap.get(u.dataId).id;x!==o&&(d=u,l=x,m=C.getInnerMostAxes(m.length,d.shape.length))}C.assertAxesAreInnerMostDims("sum",m,d.shape.length);let[f,A]=C.computeOutAndReduceShapes(d.shape,m),y=k.sizeFromShape(A),g=t.makeOutput(f,d.dtype);if(k.sizeFromShape(d.shape)!==0){let x=t.dataIdMap.get(g.dataId).id;o6(l,y,x)}if(h&&t.disposeData(u.dataId),s){let x=C.expandShapeToKeepDim(g.shape,c);g.shape=x}return g}var TJ={kernelName:Xs,backendName:"wasm",setupFunc:SJ,kernelFunc:NJ},EJ=hn(Js),CJ=hn(Qs),l6;function RJ(e){l6=e.wasm.cwrap(Sr,null,["number","array","number","array","number","number"])}function MJ(e){let{inputs:t,backend:n,attrs:a}=e,{x:r}=t,s=n.dataIdMap.get(r.dataId).id,{reps:i}=a,o=new Array(r.shape.length);for(let c=0;c{let{x:a}=e,{k:r,sorted:s}=n,i=t.dataIdMap.get(a.dataId).id,o=new Uint8Array(new Int32Array(a.shape).buffer),l=a.shape.slice();l[l.length-1]=r;let d=t.makeOutput(l,a.dtype),u=t.dataIdMap.get(d.dataId).id,p=t.makeOutput(l,"int32"),c=t.dataIdMap.get(p.dataId).id;return u6(i,o,a.shape.length,In[a.dtype],r,s,u,c),[d,p]},OJ={kernelName:Yo,backendName:"wasm",setupFunc:$J,kernelFunc:DJ},d6;function zJ(e){d6=e.wasm.cwrap(Jo,null,["number","number","bool","number","number","number","number","number","number","array","number","number","number","number","number"])}function _J(e){let{backend:t,inputs:n,attrs:a}=e,{image:r,transforms:s}=n,{interpolation:i,fillMode:o,fillValue:l,outputShape:d}=a,[u,p,c,h]=r.shape,[m,f]=d!=null?d:[p,c],A=[u,m,f,h],y=new Uint8Array(new Int32Array(k.computeStrides(r.shape)).buffer),g=t.makeOutput(A,r.dtype),x=t.dataIdMap.get(g.dataId).id,w=t.dataIdMap.get(r.dataId).id,b=t.dataIdMap.get(s.dataId).id,v=i==="nearest"?1:2,N;switch(o){case"constant":N=1;break;case"reflect":N=2;break;case"wrap":N=3;break;case"nearest":N=4;break;default:N=1;break}return d6(w,b,s.shape[0]>1,u,m,f,h,c,p,y,r.shape.length-1,v,N,l,x),g}var PJ={kernelName:Jo,backendName:"wasm",setupFunc:zJ,kernelFunc:_J};function LJ(e){let{inputs:t,backend:n,attrs:a}=e,{value:r}=t,{axis:s}=a;s<0&&(s+=r.shape.length);let i=r.shape[s],o=r.shape.length,l=new Array(o-1),d=0;for(let h=0;h({dataId:h,dtype:m,shape:l}))}var WJ={kernelName:Qo,backendName:"wasm",kernelFunc:LJ};function BJ(e){let{inputs:{x:t},backend:n}=e,a=n.makeOutput(t.shape,t.dtype);return n.typedArrayFromHeap(a).fill(0),a}var VJ={kernelName:el,backendName:"wasm",kernelFunc:BJ},jJ=[KX,YX,eK,lK,pK,fK,yK,vK,wK,kK,NK,TK,RK,$K,DK,_K,WK,jK,GK,XK,KK,ZK,JK,tZ,nZ,rZ,XX,oZ,dZ,hZ,AZ,xZ,vZ,kZ,tK,NZ,EZ,RZ,MZ,$Z,zZ,PZ,BZ,UZ,qZ,KZ,JZ,eY,tY,rY,oY,dY,cY,mY,yY,xY,wY,IY,TY,RY,FY,DY,OY,zY,gK,LY,VY,HY,qY,GY,ZY,QY,nJ,aJ,oJ,dJ,cJ,hJ,fJ,AJ,xJ,wJ,IJ,TJ,EJ,CJ,FJ,OJ,PJ,sK,WJ,VJ];for(let e of jJ)ri(e);var E1=J();E1.registerFlag("WASM_HAS_SIMD_SUPPORT",async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11])));E1.registerFlag("WASM_HAS_MULTITHREAD_SUPPORT",async()=>{if(E1.get("IS_NODE"))return!1;try{return new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch(e){return!1}});var p6=Yi(aI()),UJ='var Module={};function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;this.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);Module["wasmModule"]=null;receiveInstance(instance);return instance.exports};function moduleLoaded(){}this.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}WasmBackendModuleThreadedSimd(Module).then(function(instance){Module=instance;moduleLoaded()})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["_emscripten_tls_init"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].setThreadStatus(Module["_pthread_self"](),1);try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(!Module["getNoExitRuntime"]())Module["PThread"].threadExit(result)}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["getNoExitRuntime"]()){}else{Module["PThread"].threadExit(ex.status)}}else{Module["PThread"].threadExit(-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){self={location:{href:__filename}};var onmessage=this.onmessage;var nodeWorkerThreads=require("worker_threads");global.Worker=nodeWorkerThreads.Worker;var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");var nodeRead=function(filename){return nodeFS.readFileSync(filename,"utf8")};function globalEval(x){global.require=require;global.Module=Module;eval.call(null,x)}importScripts=function(f){globalEval(nodeRead(f))};postMessage=function(msg){parentPort.postMessage(msg)};if(typeof performance==="undefined"){performance={now:function(){return Date.now()}}}}',HJ=Yi(rI()),c6=class extends fu{constructor(e){super();this.wasm=e,this.dataIdNextNumber=1,this.wasm.tfjs.init(),this.dataIdMap=new Sp(this,nr())}write(e,t,n){let a={id:this.dataIdNextNumber++};return this.move(a,e,t,n,1),a}numDataIds(){return this.dataIdMap.numDataIds()}async time(e){let t=k.now();return e(),{kernelMs:k.now()-t}}move(e,t,n,a,r){let s=this.dataIdNextNumber++;if(a==="string"){let d=t;this.dataIdMap.set(e,{id:s,stringBytes:d,shape:n,dtype:a,memoryOffset:null,refCount:r});return}let i=k.sizeFromShape(n),o=i*k.bytesPerElement(a),l=this.wasm._malloc(o);this.dataIdMap.set(e,{id:s,memoryOffset:l,shape:n,dtype:a,refCount:r}),this.wasm.tfjs.registerTensor(s,i,l),t!=null&&this.wasm.HEAPU8.set(new Uint8Array(t.buffer,t.byteOffset,o),l)}async read(e){return this.readSync(e)}readSync(e){let{memoryOffset:t,dtype:n,shape:a,stringBytes:r}=this.dataIdMap.get(e);if(n==="string")return r;let s=this.wasm.HEAPU8.slice(t,t+k.sizeFromShape(a)*k.bytesPerElement(n));return GJ(s.buffer,n)}disposeData(e,t=!1){if(this.dataIdMap.has(e)){let n=this.dataIdMap.get(e);if(n.refCount--,!t&&n.refCount>0)return!1;this.wasm._free(n.memoryOffset),this.wasm.tfjs.disposeData(n.id),this.dataIdMap.delete(e)}return!0}refCount(e){return this.dataIdMap.has(e)?this.dataIdMap.get(e).refCount:0}incRef(e){let t=this.dataIdMap.get(e);t!=null&&t.refCount++}floatPrecision(){return 32}getMemoryOffset(e){return this.dataIdMap.get(e).memoryOffset}dispose(){this.wasm.tfjs.dispose(),"PThread"in this.wasm&&this.wasm.PThread.terminateAllThreads(),this.wasm=null}memory(){return{unreliable:!1}}makeOutput(e,t,n){let a;if(n==null)a=this.write(null,e,t);else{let r=this.dataIdNextNumber++;a={id:r},this.dataIdMap.set(a,{id:r,memoryOffset:n,shape:e,dtype:t,refCount:1});let s=k.sizeFromShape(e);this.wasm.tfjs.registerTensor(r,s,n)}return{dataId:a,shape:e,dtype:t}}typedArrayFromHeap({shape:e,dtype:t,dataId:n}){let a=this.wasm.HEAPU8.buffer,{memoryOffset:r}=this.dataIdMap.get(n),s=k.sizeFromShape(e);switch(t){case"float32":return new Float32Array(a,r,s);case"int32":return new Int32Array(a,r,s);case"bool":return new Uint8Array(a,r,s);default:throw new Error(`Unknown dtype ${t}`)}}};function qJ(e){return(t,n)=>(k.fetch(e,{credentials:"same-origin"}).then(a=>{a.ok||t.env.a(`failed to load wasm binary file at '${e}'`),a.arrayBuffer().then(r=>{WebAssembly.instantiate(r,t).then(s=>{n(s.instance,s.module)})})}),{})}function h6(e,t,n){if(Mh!=null)return Mh;let a="tfjs-backend-wasm.wasm";return e&&t?a="tfjs-backend-wasm-threaded-simd.wasm":e&&(a="tfjs-backend-wasm-simd.wasm"),wd!=null&&wd[a]!=null?wd[a]:n+a}async function XJ(){let[e,t]=await Promise.all([J().getAsync("WASM_HAS_SIMD_SUPPORT"),J().getAsync("WASM_HAS_MULTITHREAD_SUPPORT")]);return new Promise((n,a)=>{let r={};r.locateFile=(o,l)=>{if(o.endsWith(".worker.js")){let d=UJ,u=new Blob([d],{type:"application/javascript"});return URL.createObjectURL(u)}return o.endsWith(".wasm")?h6(e,t,kd!=null?kd:l):l+o},C1&&(r.instantiateWasm=qJ(h6(e,t,kd!=null?kd:"")));let s=!1;r.onAbort=()=>{s||Id||(Id=!0,a({message:"Make sure the server can serve the `.wasm` file relative to the bundled js file. For more details see https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-wasm/README.md#using-bundlers"}))};let i;t&&e&&Mh==null?(r.mainScriptUrlOrBlob=new Blob(["var WasmBackendModuleThreadedSimd = "+p6.default.toString()],{type:"text/javascript"}),i=(0,p6.default)(r)):i=(0,HJ.default)(r),i.then(o=>{s=!0,Id=!1;let l=null;o.tfjs={init:o.cwrap("init",null,[]),registerTensor:o.cwrap("register_tensor",null,["number","number","number"]),disposeData:o.cwrap("dispose_data",l,["number"]),dispose:o.cwrap("dispose",l,[])},n({wasm:o})})})}function GJ(e,t){switch(t){case"float32":return new Float32Array(e);case"int32":return new Int32Array(e);case"bool":return new Uint8Array(e);default:throw new Error(`Unknown dtype ${t}`)}}var KJ=["tfjs-backend-wasm.wasm","tfjs-backend-wasm-simd.wasm","tfjs-backend-wasm-threaded-simd.wasm"],Mh=null,kd=null,wd={},Id=!1,C1=!1;function ZJ(e,t=!1){if(Zm("setWasmPath has been deprecated in favor of setWasmPaths and will be removed in a future release."),Id)throw new Error("The WASM backend was already initialized. Make sure you call `setWasmPath()` before you call `tf.setBackend()` or `tf.ready()`");Mh=e,C1=t}function YJ(e,t=!1){if(Id)throw new Error("The WASM backend was already initialized. Make sure you call `setWasmPaths()` before you call `tf.setBackend()` or `tf.ready()`");if(typeof e=="string")kd=e;else{wd=e;let n=KJ.filter(a=>wd[a]==null);if(n.length>0)throw new Error(`There were no entries found for the following binaries: ${n.join(",")}. Please either call setWasmPaths with a map providing a path for each binary, or with a string indicating the directory where all the binaries can be found.`)}C1=t}var f6="3.6.0",JJ=2;dl("wasm",async()=>{let{wasm:e}=await XJ();return new c6(e)},JJ);Z().prototype.abs=function(){return this.throwIfDisposed(),Ot(this)};Z().prototype.acos=function(){return this.throwIfDisposed(),Jm(this)};Z().prototype.acosh=function(){return this.throwIfDisposed(),Qm(this)};Z().prototype.add=function(e){return this.throwIfDisposed(),se(this,e)};Z().prototype.all=function(e,t){return this.throwIfDisposed(),xc(this,e,t)};Z().prototype.any=function(e,t){return this.throwIfDisposed(),Uu(this,e,t)};Z().prototype.argMax=function(e){return this.throwIfDisposed(),Hu(this,e)};Z().prototype.argMin=function(e){return this.throwIfDisposed(),eA(this,e)};Z().prototype.asScalar=function(){return this.throwIfDisposed(),F(this.size===1,()=>"The array must have only 1 element."),H(this,[])};Z().prototype.asType=function(e){return this.throwIfDisposed(),fe(this,e)};Z().prototype.as1D=function(){return this.throwIfDisposed(),H(this,[this.size])};Z().prototype.as2D=function(e,t){return this.throwIfDisposed(),H(this,[e,t])};Z().prototype.as3D=function(e,t,n){return this.throwIfDisposed(),H(this,[e,t,n])};Z().prototype.as4D=function(e,t,n,a){return this.throwIfDisposed(),H(this,[e,t,n,a])};Z().prototype.as5D=function(e,t,n,a,r){return this.throwIfDisposed(),H(this,[e,t,n,a,r])};Z().prototype.asin=function(){return this.throwIfDisposed(),tA(this)};Z().prototype.asinh=function(){return this.throwIfDisposed(),nA(this)};Z().prototype.atan=function(){return this.throwIfDisposed(),aA(this)};Z().prototype.atan2=function(e){return this.throwIfDisposed(),rA(this,e)};Z().prototype.atanh=function(){return this.throwIfDisposed(),sA(this)};Z().prototype.avgPool=function(e,t,n,a){return this.throwIfDisposed(),qu(this,e,t,n,a)};Z().prototype.batchToSpaceND=function(e,t){return this.throwIfDisposed(),Xu(this,e,t)};Z().prototype.batchNorm=function(e,t,n,a,r){return this.throwIfDisposed(),ci(this,e,t,n,a,r)};Z().prototype.broadcastTo=function(e){return this.throwIfDisposed(),cl(this,e)};Z().prototype.cast=function(e){return this.throwIfDisposed(),fe(this,e)};Z().prototype.ceil=function(){return this.throwIfDisposed(),dA(this)};Z().prototype.clipByValue=function(e,t){return this.throwIfDisposed(),kn(this,e,t)};Z().prototype.concat=function(e,t){return this.throwIfDisposed(),e instanceof Le&&(e=[e]),ot([this,...e],t)};Z().prototype.conv1d=function(e,t,n,a,r,s){return this.throwIfDisposed(),vc(this,e,t,n,a,r,s)};Z().prototype.conv2dTranspose=function(e,t,n,a,r){return this.throwIfDisposed(),wc(this,e,t,n,a,r)};Z().prototype.conv2d=function(e,t,n,a,r,s){return this.throwIfDisposed(),ar(this,e,t,n,a,r,s)};Z().prototype.cos=function(){return this.throwIfDisposed(),Ku(this)};Z().prototype.cosh=function(){return this.throwIfDisposed(),kc(this)};Z().prototype.cumsum=function(e,t,n){return this.throwIfDisposed(),Ic(this,e,t,n)};Z().prototype.depthToSpace=function(e,t){return this.throwIfDisposed(),hA(this,e,t)};Z().prototype.depthwiseConv2d=function(e,t,n,a,r,s){return this.throwIfDisposed(),fl(this,e,t,n,a,r,s)};Z().prototype.dilation2d=function(e,t,n,a,r){return this.throwIfDisposed(),fA(this,e,t,n,a,r)};Z().prototype.divNoNan=function(e){return this.throwIfDisposed(),mA(this,e)};Z().prototype.div=function(e){return this.throwIfDisposed(),me(this,e)};Z().prototype.dot=function(e){return this.throwIfDisposed(),Pb(this,e)};Z().prototype.elu=function(){return this.throwIfDisposed(),ml(this)};Z().prototype.equal=function(e){return this.throwIfDisposed(),Fr(this,e)};Z().prototype.erf=function(){return this.throwIfDisposed(),AA(this)};Z().prototype.exp=function(){return this.throwIfDisposed(),qn(this)};Z().prototype.expandDims=function(e){return this.throwIfDisposed(),ln(this,e)};Z().prototype.expm1=function(){return this.throwIfDisposed(),yA(this)};Z().prototype.fft=function(){return this.throwIfDisposed(),rd(this)};Z().prototype.flatten=function(){return this.throwIfDisposed(),H(this,[this.size])};Z().prototype.floor=function(){return this.throwIfDisposed(),yl(this)};Z().prototype.floorDiv=function(e){return this.throwIfDisposed(),yc(this,e)};Z().prototype.gather=function(e,t){return this.throwIfDisposed(),hi(this,e,t)};Z().prototype.greaterEqual=function(e){return this.throwIfDisposed(),Dr(this,e)};Z().prototype.greater=function(e){return this.throwIfDisposed(),Mn(this,e)};Z().prototype.ifft=function(){return this.throwIfDisposed(),wl(this)};Z().prototype.irfft=function(){return this.throwIfDisposed(),Bc(this)};Z().prototype.isFinite=function(){return this.throwIfDisposed(),Wb(this)};Z().prototype.isInf=function(){return this.throwIfDisposed(),Bb(this)};Z().prototype.isNaN=function(){return this.throwIfDisposed(),xA(this)};Z().prototype.leakyRelu=function(e){return this.throwIfDisposed(),Zu(this,e)};Z().prototype.lessEqual=function(e){return this.throwIfDisposed(),Or(this,e)};Z().prototype.less=function(e){return this.throwIfDisposed(),Nc(this,e)};Z().prototype.localResponseNormalization=function(e,t,n,a){return this.throwIfDisposed(),bA(this,e,t,n,a)};Z().prototype.logSigmoid=function(){return this.throwIfDisposed(),Ub(this)};Z().prototype.logSoftmax=function(e){return this.throwIfDisposed(),Cc(this,e)};Z().prototype.logSumExp=function(e,t){return this.throwIfDisposed(),kA(this,e,t)};Z().prototype.log=function(){return this.throwIfDisposed(),Fn(this)};Z().prototype.log1p=function(){return this.throwIfDisposed(),Tc(this)};Z().prototype.logicalAnd=function(e){return this.throwIfDisposed(),oa(this,e)};Z().prototype.logicalNot=function(){return this.throwIfDisposed(),Yu(this)};Z().prototype.logicalOr=function(e){return this.throwIfDisposed(),Rc(this,e)};Z().prototype.logicalXor=function(e){return this.throwIfDisposed(),Xb(this,e)};Z().prototype.matMul=function(e,t,n){return this.throwIfDisposed(),Be(this,e,t,n)};Z().prototype.maxPool=function(e,t,n,a){return this.throwIfDisposed(),Ju(this,e,t,n,a)};Z().prototype.max=function(e,t){return this.throwIfDisposed(),Xn(this,e,t)};Z().prototype.maximum=function(e){return this.throwIfDisposed(),Pa(this,e)};Z().prototype.mean=function(e,t){return this.throwIfDisposed(),wt(this,e,t)};Z().prototype.min=function(e,t){return this.throwIfDisposed(),gl(this,e,t)};Z().prototype.minimum=function(e){return this.throwIfDisposed(),xl(this,e)};Z().prototype.mirrorPad=function(e,t){return this.throwIfDisposed(),SA(this,e,t)};Z().prototype.mod=function(e){return this.throwIfDisposed(),NA(this,e)};Z().prototype.mul=function(e){return this.throwIfDisposed(),_(this,e)};Z().prototype.neg=function(){return this.throwIfDisposed(),vt(this)};Z().prototype.norm=function(e,t,n){return this.throwIfDisposed(),Hc(this,e,t,n)};Z().prototype.notEqual=function(e){return this.throwIfDisposed(),Ai(this,e)};Z().prototype.oneHot=function(e,t=1,n=0){return this.throwIfDisposed(),ll(this,e,t,n)};Z().prototype.onesLike=function(){return this.throwIfDisposed(),Dn(this)};Z().prototype.pad=function(e,t){return this.throwIfDisposed(),rr(this,e,t)};Z().prototype.pool=function(e,t,n,a,r){return this.throwIfDisposed(),Yb(this,e,t,n,a,r)};Z().prototype.pow=function(e){return this.throwIfDisposed(),sr(this,e)};Z().prototype.prelu=function(e){return this.throwIfDisposed(),ed(this,e)};Z().prototype.prod=function(e,t){return this.throwIfDisposed(),Fc(this,e,t)};Z().prototype.reciprocal=function(){return this.throwIfDisposed(),CA(this)};Z().prototype.relu=function(){return this.throwIfDisposed(),La(this)};Z().prototype.relu6=function(){return this.throwIfDisposed(),$c(this)};Z().prototype.reshapeAs=function(e){return this.throwIfDisposed(),H(this,e.shape)};Z().prototype.reshape=function(e){return this.throwIfDisposed(),H(this,e)};Z().prototype.resizeBilinear=function(e,t,n){return this.throwIfDisposed(),m3(this,e,t,n)};Z().prototype.resizeNearestNeighbor=function(e,t,n){return this.throwIfDisposed(),A3(this,e,t,n)};Z().prototype.reverse=function(e){return this.throwIfDisposed(),On(this,e)};Z().prototype.rfft=function(){return this.throwIfDisposed(),sd(this)};Z().prototype.round=function(){return this.throwIfDisposed(),Dc(this)};Z().prototype.rsqrt=function(){return this.throwIfDisposed(),Oc(this)};Z().prototype.selu=function(){return this.throwIfDisposed(),zc(this)};Z().prototype.separableConv2d=function(e,t,n,a,r,s){return this.throwIfDisposed(),RA(this,e,t,n,a,r,s)};Z().prototype.sigmoid=function(){return this.throwIfDisposed(),wn(this)};Z().prototype.sign=function(){return this.throwIfDisposed(),MA(this)};Z().prototype.sin=function(){return this.throwIfDisposed(),_c(this)};Z().prototype.sinh=function(){return this.throwIfDisposed(),Pc(this)};Z().prototype.slice=function(e,t){return this.throwIfDisposed(),Re(this,e,t)};Z().prototype.softmax=function(e){return this.throwIfDisposed(),ad(this,e)};Z().prototype.softplus=function(){return this.throwIfDisposed(),fi(this)};Z().prototype.spaceToBatchND=function(e,t){return this.throwIfDisposed(),Qu(this,e,t)};Z().prototype.split=function(e,t){return this.throwIfDisposed(),an(this,e,t)};Z().prototype.sqrt=function(){return this.throwIfDisposed(),Jt(this)};Z().prototype.square=function(){return this.throwIfDisposed(),st(this)};Z().prototype.squaredDifference=function(e){return this.throwIfDisposed(),Vc(this,e)};Z().prototype.squeeze=function(e){return this.throwIfDisposed(),zr(this,e)};Z().prototype.stack=function(e,t){this.throwIfDisposed();let n=e instanceof Le?[this,e]:[this,...e];return zn(n,t)};Z().prototype.step=function(e){return this.throwIfDisposed(),kl(this,e)};Z().prototype.stridedSlice=function(e,t,n,a,r,s,i,o){return this.throwIfDisposed(),$A(this,e,t,n,a,r,s,i,o)};Z().prototype.sub=function(e){return this.throwIfDisposed(),ge(this,e)};Z().prototype.sum=function(e,t){return this.throwIfDisposed(),ke(this,e,t)};Z().prototype.tan=function(){return this.throwIfDisposed(),DA(this)};Z().prototype.tanh=function(){return this.throwIfDisposed(),pi(this)};Z().prototype.tile=function(e){return this.throwIfDisposed(),$r(this,e)};Z().prototype.toBool=function(){return this.throwIfDisposed(),fe(this,"bool")};Z().prototype.toFloat=function(){return this.throwIfDisposed(),fe(this,"float32")};Z().prototype.toInt=function(){return this.throwIfDisposed(),fe(this,"int32")};Z().prototype.topk=function(e,t){return this.throwIfDisposed(),OA(this,e,t)};Z().prototype.transpose=function(e){return this.throwIfDisposed(),Ze(this,e)};Z().prototype.unique=function(e){return this.throwIfDisposed(),Uc(this,e)};Z().prototype.unsortedSegmentSum=function(e,t){return this.throwIfDisposed(),zA(this,e,t)};Z().prototype.unstack=function(e){return this.throwIfDisposed(),la(this,e)};Z().prototype.where=function(e,t){return this.throwIfDisposed(),nn(e,this,t)};Z().prototype.zerosLike=function(){return this.throwIfDisposed(),Ue(this)};var m6={kernelName:eo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(e,kl(fe(n,"float32"),-1))}}},QJ={kernelName:to,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=st(fe(n,"float32")),r=Jt(ge(Se(1),a));return vt(me(e,r))}}}},eQ={kernelName:no,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=Jt(ge(st(fe(n,"float32")),1));return me(e,a)}}}},tQ={kernelName:kr,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=pt(n.shape,a.shape);return{a:()=>{let s=e,i=zt(n.shape,r);return i.length>0&&(s=ke(s,i)),H(s,n.shape)},b:()=>{let s=e,i=zt(a.shape,r);return i.length>0&&(s=ke(s,i)),H(s,a.shape)}}}},nQ={kernelName:os,saveAllInputs:!0,gradFunc:(e,t)=>{let n={};return t.forEach((a,r)=>{n[r]=()=>e.clone()}),n}},aQ={kernelName:ls,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Ue(n)}}},rQ={kernelName:yu,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Ue(n)}}},sQ={kernelName:so,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,Jt(ge(Se(1),st(fe(n,"float32")))))}}},iQ={kernelName:io,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=Jt(se(Se(1),st(fe(n,"float32"))));return me(e,a)}}}},oQ={kernelName:uo,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=pt(n.shape,a.shape);return{a:()=>{let s=se(st(n),st(a)),i=_(e,me(a,s)),o=zt(n.shape,r);return o.length>0&&(i=ke(i,o)),H(i,n.shape)},b:()=>{let s=se(st(n),st(a)),i=vt(_(e,me(n,s))),o=zt(a.shape,r);return o.length>0&&(i=ke(i,o)),H(i,a.shape)}}}},lQ={kernelName:oo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,se(st(fe(n,"float32")),1))}}},uQ={kernelName:lo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,ge(Se(1),st(fe(n,"float32"))))}}};function dQ(e,t,n,a,r,s){let i=M(e,"dy","avgPool3dGrad"),o=M(t,"input","avgPool3dGrad"),l=i,d=o,u=!1;o.rank===4&&(u=!0,l=H(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]]),d=H(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),F(l.rank===5,()=>`Error in avgPool3dGrad: dy must be rank 5 but got rank ${l.rank}.`),F(d.rank===5,()=>`Error in avgPool3dGrad: input must be rank 5 but got rank ${d.rank}.`),s!=null&&F(Vt(r),()=>`Error in avgPool3dGrad: pad must be an integer when using, dimRoundingMode ${s} but got pad ${r}.`);let p={dy:l,input:d},c={filterSize:n,strides:a,pad:r,dimRoundingMode:s},h=D.runKernel(Rp,p,c);return u?H(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}var pQ=O({avgPool3dGrad_:dQ}),cQ={kernelName:gu,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{filterSize:r,strides:s,pad:i,dimRoundingMode:o}=n;return{x:()=>pQ(e,a,r,s,i,o)}}};function hQ(e,t,n,a,r){let s=M(e,"dy","avgPoolGrad"),i=M(t,"input","avgPoolGrad");F(i.rank===s.rank,()=>`Rank of input (${i.rank}) does not match rank of dy (${s.rank})`);let o=i,l=s,d=!1;i.rank===3&&(d=!0,o=H(i,[1,i.shape[0],i.shape[1],i.shape[2]]),l=H(s,[1,s.shape[0],s.shape[1],s.shape[2]])),F(l.rank===4,()=>`Error in avgPoolGrad: dy must be rank 4 but got rank ${l.rank}.`),F(o.rank===4,()=>`Error in avgPoolGrad: input must be rank 4 but got rank ${o.rank}.`);let u={dy:l,input:o},p={filterSize:n,strides:a,pad:r},c=D.runKernel(Cp,u,p);return d?H(c,[c.shape[1],c.shape[2],c.shape[3]]):c}var fQ=O({avgPoolGrad_:hQ}),mQ={kernelName:us,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{filterSize:r,strides:s,pad:i}=n;return{x:()=>fQ(e,a,r,s,i)}}},AQ={kernelName:ds,inputsToSave:["a","b"],gradFunc:(e,t,n)=>{let[a,r]=t,{transposeA:s,transposeB:i}=n;return!s&&!i?{a:()=>Be(e,r,!1,!0),b:()=>Be(a,e,!0,!1)}:!s&&i?{a:()=>Be(e,r,!1,!1),b:()=>Be(e,a,!0,!1)}:s&&!i?{a:()=>Be(r,e,!1,!0),b:()=>Be(a,e,!1,!1)}:{a:()=>Be(r,e,!0,!0),b:()=>Be(e,a,!0,!0)}}},yQ={kernelName:xu,gradFunc:(e,t,n)=>{let{blockShape:a,crops:r}=n;return{x:()=>Qu(e,a,r)}}},gQ={kernelName:Fx,gradFunc:(e,t,n)=>{let a=n,r=a.inputShape,s=a.shape,i=Array.from(s);for(let l=r.length-1;l>=0;l--)if(r[l]===s[l])i[l]=1;else if(r[l]!==1)throw new Error(`broadcastTo(): [${r}] cannot be broadcast to [${s}].`);let o=[];for(let l=0;l1&&o.push(l);return{x:()=>ke(e,o,!0)}}},xQ={kernelName:ps,gradFunc:e=>({x:()=>e.clone()})},bQ={kernelName:cs,gradFunc:e=>({x:()=>Ue(e)})},vQ={kernelName:Ir,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{clipValueMin:r,clipValueMax:s}=n;return{x:()=>nn(oa(Dr(a,r),Or(a,s)),e,Ue(e))}}},wQ={kernelName:bu,inputsToSave:["x"],gradFunc:m6.gradFunc},kQ={kernelName:po,saveAllInputs:!0,gradFunc:(e,t,n)=>{let a=t.map(o=>o.shape),{axis:r}=n,s=ra(r,t[0].shape)[0],i=a.map(o=>o[s]);return an(e,i,s).map(o=>()=>o)}},IQ={kernelName:hs,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let[a,r]=t,{dilations:s,strides:i,pad:o,dataFormat:l}=n;return F(Mr(s),()=>`Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`),{x:()=>pA(a.shape,e,r,i,o,l),filter:()=>WA(a,e,r.shape,i,o,l)}}},SQ={kernelName:fs,inputsToSave:["dy","filter"],gradFunc:(e,t,n)=>{let[a,r]=t,{strides:s,pad:i,dataFormat:o,dimRoundingMode:l}=n;return{dy:()=>ar(e,r,s,i,o,1,l),filter:()=>WA(e,a,r.shape,s,i,o,l)}}};function NQ(e,t,n,a,r){let s=e;e.rank===4&&(s=H(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]]));let i=t;i.rank===4&&(i=H(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]])),F(s.rank===5,()=>`Error in conv3dDerFilter: input must be rank 5, but got shape ${s.shape}.`),F(i.rank===5,()=>`Error in conv3dDerFilter: dy must be rank 5, but got shape ${i.shape}.`),F(n.length===5,()=>`Error in conv3dDerFilter: filterShape must be length 5, but got ${n}.`),F(s.shape[4]===n[3],()=>`Error in conv3dDerFilter: depth of input ${s.shape[4]}) must match input depth in filter (${n[3]}.`),F(i.shape[4]===n[4],()=>`Error in conv3dDerFilter: depth of dy (${i.shape[4]}) must match output depth for filter (${n[4]}).`);let o={x:s,dy:i},l={strides:a,pad:r,filterShape:n};return D.runKernel(Dp,o,l)}var TQ=O({conv3DBackpropFilter_:NQ}),EQ={kernelName:vu,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let{dilations:a,strides:r,pad:s}=n;F(Mr(a),()=>`Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${a}'`);let[i,o]=t;return{x:()=>Ob(i.shape,e,o,r,s),filter:()=>TQ(i,e,o.shape,r,s)}}},CQ={kernelName:ms,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(vt(_c(fe(n,"float32"))),e)}}},RQ={kernelName:co,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(Pc(fe(n,"float32")),e)}}},MQ={kernelName:As,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{axis:r,exclusive:s,reverse:i}=n;return{x:()=>{let o=qb([r],a.rank),l=Ic(e,r,s,!i);return o!=null&&(l=Ze(l,o)),l}}}},FQ={kernelName:ys,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let{dilations:a,strides:r,pad:s,dimRoundingMode:i}=n,o=a==null?[1,1]:a;F(Mr(o),()=>`Error in gradient of depthwiseConv2dNative: dilation rates greater than 1 are not yet supported. Got dilations '${o}'`);let[l,d]=t;return F(l.rank===4,()=>`Error in gradient of depthwiseConv2dNative: input must be rank 4, but got rank ${l.rank}.`),F(d.rank===4,()=>`Error in gradient of depthwiseConv2dNative: filter must be rank 4, but got rank ${d.rank}.`),F(l.shape[3]===d.shape[2],()=>`Error in gradient of depthwiseConv2d: number of input channels (${l.shape[3]}) must match the inChannels dimension in filter ${d.shape[2]}.`),F(za(r,o),()=>`Error in gradient of depthwiseConv2d: Either strides or dilations must be 1. Got strides ${r} and dilations '${o}'.`),i!=null&&F(Vt(s),()=>`Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode ${i} but got pad ${s}.`),{x:()=>l3(l.shape,e,d,r,s,a,i),filter:()=>o3(l,e,d.shape,r,s,a,i)}}},$Q={kernelName:wu,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{let[a,r]=t,s={x:a,filter:r,dy:e},i={x:a,filter:r,dy:e};return{x:()=>D.runKernel(Wp,s,n),filter:()=>D.runKernel(Bp,i,n)}}},DQ={kernelName:mo,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t,a={dy:e,y:n};return{x:()=>D.runKernel(jp,a)}}},OQ={kernelName:Ao,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t,a=_(qn(vt(st(n))),2/Math.sqrt(Math.PI));return{x:()=>_(e,a)}}},zQ={kernelName:xs,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(e,n)}}},_Q={kernelName:go,inputsToSave:["input"],gradFunc:(e,t)=>{let[n]=t;return{input:()=>H(e,n.shape)}}},PQ={kernelName:xo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(e,qn(n))}}},LQ={kernelName:bs,gradFunc:e=>({x:()=>Ue(e)})},WQ={kernelName:vs,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=pt(n.shape,a.shape);return{a:()=>{let s=me(e,fe(a,"float32")),i=zt(n.shape,r);return i.length>0?H(ke(s,i),n.shape):s},b:()=>{let s=_(e,fe(n,"float32")),i=zt(a.shape,r);i.length>0&&(s=H(ke(s,i),a.shape));let o=st(a);return vt(me(s,fe(o,"float32")))}}}},BQ={kernelName:ws,inputsToSave:["x","mean","variance","scale"],gradFunc:(e,t,n)=>{let{varianceEpsilon:a}=n,[r,s,i,o]=t,l=o==null?Se(1):o,d=zt(s.shape,r.shape),u=[];if(s.rank===1){for(let f=0;fs.rank===1?H(_(_(e,$r(H(h,[1,1,1,s.shape[0]]),u)),l),r.shape):H(_(_(e,h),l),r.shape),mean:()=>{let f=_(_(h,Se(-1)),c);return s.rank===1&&(f=ke(f,d)),H(f,s.shape)},variance:()=>{let f=_(_(m,p),c);return s.rank===1&&(f=ke(f,d)),H(f,s.shape)},scale:()=>{let f=_(p,h),A=_(e,f);return s.rank===1&&(A=ke(A,d)),H(A,s.shape)},offset:()=>{let f=e;return s.rank===1&&(f=ke(f,d)),H(f,s.shape)}}}},VQ={kernelName:vo,inputsToSave:["x","indices"],gradFunc:(e,t,n)=>{let[a,r]=t,{axis:s}=n,i=ra(s,a.shape)[0];return{x:()=>{let o=a.shape,l=r.size,d=o.slice(0,i),u=d.length,p=o.slice(s,o.length).slice(1),c=p.length,h=A6(0,u),m=A6(u+1,u+1+c),f=y6([d,[l],p]),A=H(e,f),y=H(r,[l]),g=y6([[u],h,m]),x=Ze(A,g),w=zA(x,y,a.shape[i]),b=wA(g);return w=Ze(w,b),w},indices:()=>r}}};function A6(e,t){let n=[];for(let a=e;a{let[n,a]=t;return{a:()=>Ue(n),b:()=>Ue(a)}}},UQ={kernelName:Is,gradFunc:e=>({x:()=>fe(e,"float32")})},HQ={kernelName:Io,gradFunc:e=>({x:()=>Ue(e)})},GQ={kernelName:So,gradFunc:e=>({x:()=>Ue(e)})},qQ={kernelName:No,gradFunc:e=>({x:()=>Ue(e)})},XQ={kernelName:Ss,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{alpha:r}=n,s=Mn(a,0);return{x:()=>nn(s,e,_(e,r))}}},KQ={kernelName:Co,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,se(n,1))}}},ZQ={kernelName:Ns,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,fe(n,"float32"))}}},YQ={kernelName:$x,inputsToSave:[],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a]=t,{axis:r}=n;return{logits:()=>{let s=!0,i=qn(a);return ge(e,_(ke(e,r,s),i))}}}};function JQ(e,t,n,a=5,r=1,s=1,i=.5){let o={x:e,y:t,dy:n},l={depthRadius:a,bias:r,alpha:s,beta:i};return D.runKernel(Xp,o,l)}var QQ=O({localResponseNormalizationBackprop_:JQ}),eee={kernelName:Nu,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a,r]=t,{depthRadius:s,bias:i,alpha:o,beta:l}=n;return{x:()=>QQ(a,r,e,s,i,o,l)}}};function g6(e,t,n,a){return t.rank_(e,fe(Fr(n,t),e.dtype))}}var x6={kernelName:Ts,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let a=n,{reductionIndices:r}=a,s=t[0],i=t[1],o=ra(r,s.shape),l=g6(e,i,s,o);return{x:()=>l.x()}}},tee={kernelName:Es,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t;return{a:()=>_(e,fe(Dr(n,a),"float32")),b:()=>_(e,fe(Nc(n,a),"float32"))}}};function nee(e,t,n,a,r,s,i){let o=M(e,"dy","maxPool3dGrad"),l=M(t,"input","maxPool3dGrad"),d=M(n,"output","maxPool3dGrad"),u=o,p=l,c=d,h=!1;l.rank===4&&(h=!0,u=H(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]]),p=H(l,[1,l.shape[0],l.shape[1],l.shape[2],l.shape[3]]),c=H(d,[1,d.shape[0],d.shape[1],d.shape[2],d.shape[3]])),F(u.rank===5,()=>`Error in maxPool3dGrad: dy must be rank 5 but got rank ${u.rank}.`),F(p.rank===5,()=>`Error in maxPool3dGrad: input must be rank 5 but got rank ${p.rank}.`),F(c.rank===5,()=>`Error in maxPool3dGrad: output must be rank 5 but got rank ${c.rank}.`),i!=null&&F(Vt(s),()=>`Error in maxPool3dGrad: pad must be an integer when using, dimRoundingMode ${i} but got pad ${s}.`);let m={dy:u,input:p,output:c},f={filterSize:a,strides:r,pad:s,dimRoundingMode:i},A=D.runKernel(Zp,m,f);return h?H(A,[A.shape[1],A.shape[2],A.shape[3],A.shape[4]]):A}var aee=O({maxPool3dGrad_:nee}),ree={kernelName:Tu,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a,r]=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=n;return{x:()=>aee(e,a,r,s,i,o,l)}}};function see(e,t,n,a,r,s,i){let o=M(e,"dy","maxPoolGrad"),l=M(t,"input","maxPoolGrad"),d=M(n,"output","maxPoolGrad");F(l.rank===o.rank,()=>`Rank of input (${l.rank}) does not match rank of dy (${o.rank})`),F(o.rank===4,()=>`Error in maxPoolGrad: dy must be rank 4 but got rank ${o.rank}.`),F(l.rank===4,()=>`Error in maxPoolGrad: input must be rank 4 but got rank ${l.rank}.`),i!=null&&F(Vt(s),()=>`Error in maxPoolGrad: pad must be an integer when using, dimRoundingMode ${i} but got pad ${s}.`);let u={dy:o,input:l,output:d},p={filterSize:a,strides:r,pad:s,dimRoundingMode:i};return D.runKernel(Kp,u,p)}var iee=O({maxPoolGrad_:see}),oee={kernelName:Cs,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a,r]=t,{filterSize:s,strides:i,pad:o}=n;return{x:()=>iee(e,a,r,s,i,o)}}},lee={kernelName:Rs,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{axis:r}=n,s=ra(r,a.shape),i=Gb(a.shape,s)[1],o=Nt(i);return{x:()=>{let l=a.shape.slice();s.forEach(u=>{l[u]=1});let d=H(e,l);return me(_(d,$n(a.shape,"float32")),o)}}}},uee={kernelName:Ms,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{let a=n,{axis:r}=a,[s,i]=t,o=ra(r,s.shape),l=g6(e,i,s,o);return{x:()=>l.x()}}},dee={kernelName:Fs,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t;return{a:()=>_(e,fe(Or(n,a),"float32")),b:()=>_(e,fe(Mn(n,a),"float32"))}}},pee={kernelName:$s,inputsToSave:["x"],gradFunc:(e,t,n)=>{let a=t[0],{paddings:r}=n,s=r.map(i=>i[0]);return{x:()=>Re(e,s,a.shape)}}},cee={kernelName:Mo,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=pt(n.shape,a.shape);return{a:()=>{let s=zt(n.shape,r);return s.length>0?H(ke(e,s),n.shape):e},b:()=>{let s=_(e,vt(yl(me(n,a)))),i=zt(a.shape,r);return i.length>0?H(ke(s,i),a.shape):s}}}},hee={kernelName:Ds,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=pt(n.shape,a.shape);return{a:()=>{let s=_(e,fe(a,"float32")),i=zt(n.shape,r);return i.length>0?H(ke(s,i),n.shape):s},b:()=>{let s=_(e,fe(n,"float32")),i=zt(a.shape,r);return i.length>0?H(ke(s,i),a.shape):s}}}},fee={kernelName:Fo,gradFunc:e=>({x:()=>vt(e)})},mee={kernelName:Os,inputsToSave:["indices"],gradFunc:(e,t)=>{let n=t[0];return{indices:()=>Ct(n.shape,"float32")}}},Aee={kernelName:_o,gradFunc:e=>({x:()=>Ue(e)})},yee={kernelName:Po,saveAllInputs:!0,gradFunc:(e,t,n)=>{let{axis:a}=n;return la(e,a).map(r=>()=>r)}},b6={kernelName:zs,inputsToSave:["x"],gradFunc:(e,t,n)=>{let a=t[0],{paddings:r}=n,s=r.map(i=>i[0]);return{x:()=>Re(e,s,a.shape)}}},gee={kernelName:_s,inputsToSave:["a","b"],outputsToSave:[!0],gradFunc:(e,t)=>{let[n,a,r]=t,s=n,i=a,o=pt(s.shape,i.shape);return{a:()=>{let l=fe(i,"float32"),d=_(e,_(l,sr(s,ge(l,Se(1))))),u=zt(s.shape,o);return u.length>0&&(d=ke(d,u)),H(d,s.shape)},b:()=>{let l=Mn(s,0),d=nn(l,Fn(s),Ue(s)),u=_(e,_(r,d)),p=zt(i.shape,o);return p.length>0&&(u=ke(u,p)),H(u,i.shape)}}}},xee={kernelName:Ps,inputsToSave:["x","alpha"],gradFunc:(e,t)=>{let[n,a]=t,r=Mn(n,0);return{x:()=>nn(r,e,_(e,a)),alpha:()=>{let s=nn(r,Ue(e),_(e,n)),i=zt(a.shape,e.shape);return i.length>0&&(s=ke(s,i)),H(s,a.shape)}}}},bee={kernelName:gs,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=pt(n.shape,a.shape);return{a:()=>{let s=me(e,fe(a,"float32")),i=zt(n.shape,r);return i.length>0?H(ke(s,i),n.shape):s},b:()=>{let s=_(e,fe(n,"float32")),i=zt(a.shape,r);i.length>0&&(s=H(ke(s,i),a.shape));let o=st(a);return vt(me(s,fe(o,"float32")))}}}},vee={kernelName:Wo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,vt(st(n)))}}},wee={kernelName:Bs,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t,a=_(Or(n,6),kl(n));return{x:()=>_(e,fe(a,"float32"))}}},kee={kernelName:Ls,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(e,fe(kl(n),"float32"))}}},Iee={kernelName:Bo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>H(e,n.shape)}}},See={kernelName:Ws,inputsToSave:["images"],gradFunc:(e,t,n)=>{let[a]=t,r={dy:e,images:a};return{images:()=>D.runKernel(tc,r,n)}}},Nee={kernelName:Cu,inputsToSave:["images"],gradFunc:(e,t,n)=>{let[a]=t,r={dy:e,images:a};return{images:()=>D.runKernel(ec,r,n)}}},Tee={kernelName:Vs,gradFunc:(e,t,n)=>{let{dims:a}=n,r=ra(a,e.shape);return{x:()=>On(e,r)}}},Eee={kernelName:js,gradFunc:e=>({x:()=>Ue(e)})},Cee={kernelName:Us,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>vt(me(e,_(sr(n,1.5),2)))}}},Ree={kernelName:jo,inputsToSave:["condition"],gradFunc:(e,t)=>{let[n]=t;return{condition:()=>fe(Ue(n),"float32"),t:()=>_(e,fe(n,e.dtype)),e:()=>_(e,fe(Yu(n),e.dtype))}}},Mee={kernelName:Uo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>{let a=Mn(n,Se(0)),r=Se(b3),s=Se(v3),i=_(e,s),o=_(_(e,r),qn(fe(n,"float32")));return nn(a,i,o)}}}},Fee={kernelName:Gs,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(e,_(n,ge(Se(1),n)))}}},$ee={kernelName:qo,gradFunc:e=>({x:()=>Ue(e)})},Dee={kernelName:Hs,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(Ku(fe(n,"float32")),e)}}},Oee={kernelName:Go,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(kc(fe(n,"float32")),e)}}},zee={kernelName:Ho,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{begin:r,size:s}=n,i=a.shape,[o,l]=gb(a,r,s),d=[];for(let u=0;urr(e,d)}}},_ee={kernelName:Ks,outputsToSave:[!0],gradFunc:(e,t,n)=>{let[a]=t,{dim:r}=n,s=!0,i=_(e,a);return{logits:()=>ge(i,_(ke(i,[r],s),a))}}},Pee={kernelName:Xo,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(e,wn(n))}}},v6={kernelName:Ru,gradFunc:(e,t,n)=>{let{blockShape:a,paddings:r}=n;return{x:()=>Xu(e,a,r)}}},w6={kernelName:Ko,gradFunc:(e,t,n)=>{let{axis:a}=n;return{x:()=>ot(e,a)}}},Lee={kernelName:qs,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,_(Jt(fe(n,"float32")),2))}}},Wee={kernelName:Mu,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(e,_(fe(n,"float32"),2))}}},Bee={kernelName:Zs,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=Se(2);return{a:()=>_(e,_(r,ge(n,a))),b:()=>_(e,_(r,ge(a,n)))}}},Vee={kernelName:Nr,gradFunc:e=>({x:()=>Ue(e)})},jee={kernelName:Ys,inputsToSave:["a","b"],gradFunc:(e,t)=>{let[n,a]=t,r=pt(n.shape,a.shape);return{a:()=>{let s=e,i=zt(n.shape,r);return i.length>0&&(s=ke(s,i)),H(s,n.shape)},b:()=>{let s=e,i=zt(a.shape,r);return i.length>0&&(s=ke(s,i)),H(vt(s),a.shape)}}}},Uee={kernelName:Xs,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,r=a.shape.slice(),{axis:s}=n;ra(s,a.shape).forEach(l=>{r[l]=1});let i=H(e,r),o=_(i,$n(a.shape,"float32"));return{x:()=>o}}},Hee={kernelName:Js,inputsToSave:["x"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>me(e,st(Ku(n)))}}},Gee={kernelName:Qs,outputsToSave:[!0],gradFunc:(e,t)=>{let[n]=t;return{x:()=>_(ge(Se(1),st(n)),e)}}},qee={kernelName:Sr,inputsToSave:["x"],gradFunc:(e,t,n)=>{let[a]=t,{reps:r}=n;return{x:()=>{let s=Ue(a);if(a.rank===1)for(let i=0;i{let a=n,{perm:r}=a,s=wA(r);return{x:()=>Ze(e,s)}}},Kee={kernelName:Qo,gradFunc:(e,t,n)=>{let a=n,{axis:r}=a;return{value:()=>zn(e,r)}}},Yee={kernelName:Fu,inputsToSave:["segmentIds"],gradFunc:(e,t)=>{let[n]=t;return{x:()=>Zee(e,n)}}};function Zee(e,t){let n=Pa(t,Ue(t)),a=hi(e,n),r=Dr(t,Se(0,"int32")),s=a.rank-r.rank;for(let o=0;o({x:()=>Ue(e)})},Qee=[m6,QJ,eQ,tQ,nQ,aQ,rQ,sQ,iQ,oQ,lQ,uQ,cQ,mQ,AQ,yQ,gQ,xQ,bQ,vQ,wQ,kQ,SQ,IQ,EQ,CQ,RQ,MQ,FQ,$Q,bee,DQ,OQ,zQ,_Q,PQ,WQ,LQ,BQ,VQ,jQ,UQ,HQ,GQ,qQ,XQ,KQ,ZQ,YQ,eee,x6,x6,tee,ree,oee,lee,uee,dee,pee,cee,hee,fee,mee,Aee,yee,b6,b6,gee,xee,vee,wee,kee,Iee,See,Nee,Tee,Eee,Cee,Ree,Mee,Fee,$ee,Dee,Oee,zee,_ee,Pee,v6,v6,w6,w6,Lee,Bee,Wee,Vee,jee,Uee,Hee,Gee,qee,Xee,Kee,Yee,Jee];for(let e of Qee)Dx(e);var k6={};Fe(k6,{maxNorm:()=>ete,minMaxNorm:()=>ate,nonNeg:()=>nte,unitNorm:()=>tte});var R1;function _t(){return R1==null&&(R1=Sb().epsilon()),R1}function ba(){return"channelsLast"}var ur=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,ur.prototype)}},va=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,va.prototype)}},B=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,B.prototype)}},Oe=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,Oe.prototype)}},I6=class extends Error{constructor(e){super(e);Object.setPrototypeOf(this,I6.prototype)}};function Ti(e,t){if(Array.isArray(e)){let n=[];for(let a=0;an.toUpperCase())}var ua={};function M1(e){if(e==null)return null;let t={};return t.className=e.getClassName(),t.config=e.getConfig(),t}function F1(e){if(!(e==null||typeof e!="object"))if(Array.isArray(e))e.forEach(t=>F1(t));else{let t=Object.keys(e);for(let n of t){let a=e[n];a!=null&&typeof a=="object"&&(!Array.isArray(a)&&a.type==="ndarray"&&typeof a.value=="number"?e[n]=a.value:F1(a))}}}function Sd(e,t={},n={},a="object",r=!1){if(typeof e=="string"){let s=e,i;if(s in n)i=n[s];else if(s in ua)i=ua[s];else if(i=t[s],i==null)throw new B(`Unknown ${a}: ${e}. This may be due to one of the following reasons: 1. The ${a} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code. 2. The custom ${a} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);return i}else{let s=e;if(s.className==null||s.config==null)throw new B(`${a}: Improper config format: ${JSON.stringify(s)}. 'className' and 'config' must set.`);let i=s.className,o,l;if(i in n?[o,l]=n[i]:i in ua?[o,l]=ua.className:i in t&&([o,l]=t[i]),o==null)throw new B(`Unknown ${a}: ${i}. This may be due to one of the following reasons: 1. The ${a} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code. -2. The custom ${a} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);if(l!=null){let d={};for(let h of Object.keys(ua))d[h]=ua[h];for(let h of Object.keys(n))d[h]=n[h];let u=s.config;u.customObjects=d;let p=Object.assign({},ua);for(let h of Object.keys(n))ua[h]=n[h];M1(s.config);let c=l(o,s.config,n,r);return ua=Object.assign({},p),c}else{let d=Object.assign({},ua);for(let p of Object.keys(n))ua[p]=n[p];let u=new o(s.config);return ua=Object.assign({},d),u}}}function ate(e,t){return et?1:0}function Mh(e,t){return-1*ate(e,t)}function Br(e){if(e==null)return e;let t=[];for(let n of e)t.indexOf(n)===-1&&t.push(n);return t}function rte(e){if(e==null)throw new B(`Invalid value in obj: ${JSON.stringify(e)}`);for(let t in e)if(e.hasOwnProperty(t))return!1;return!0}function Ei(e,t,n){if(n!=null&&e.indexOf(n)<0)throw new B(`${n} is not a valid ${t}. Valid values are ${e} or null/undefined.`)}function F1(e,t,n=0,a=Infinity){return Va(n>=0),Va(a>=n),Array.isArray(e)&&e.length>=n&&e.length<=a&&e.every(r=>typeof r===t)}function Ht(e,t){Array.isArray(e)?(k.assert(e.length>0,()=>`${t} is unexpectedly an empty array.`),e.forEach((n,a)=>Ht(n,`element ${a+1} of ${t}`))):k.assert(Number.isInteger(e)&&e>0,()=>`Expected ${t} to be a positive integer, but got ${S6(e)}.`)}function S6(e){return e===null?"null":Array.isArray(e)?"["+e.map(t=>S6(t)).join(",")+"]":typeof e=="string"?`"${e}"`:`${e}`}function ste(e,t){let n=k.now(),a;return(...r)=>{let s=k.now();return s-nJt(ke(_(e,e),t,!0)))}var Sd=class extends ae.Serializable{getConfig(){return{}}},D1=class extends Sd{constructor(e){super();this.defaultMaxValue=2,this.defaultAxis=0,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return W(()=>{let t=$1(e,this.axis),n=kn(t,0,this.maxValue);return _(e,me(n,se(_t(),t)))})}getConfig(){return{maxValue:this.maxValue,axis:this.axis}}};D1.className="MaxNorm";ae.registerClass(D1);var O1=class extends Sd{constructor(e){super();this.defaultAxis=0,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return W(()=>me(e,se(_t(),$1(e,this.axis))))}getConfig(){return{axis:this.axis}}};O1.className="UnitNorm";ae.registerClass(O1);var z1=class extends Sd{apply(e){return Pa(e)}};z1.className="NonNeg";ae.registerClass(z1);var _1=class extends Sd{constructor(e){super();this.defaultMinValue=0,this.defaultMaxValue=1,this.defaultRate=1,this.defaultAxis=0,this.minValue=e.minValue!=null?e.minValue:this.defaultMinValue,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.rate=e.rate!=null?e.rate:this.defaultRate,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return W(()=>{let t=$1(e,this.axis),n=se(_(this.rate,kn(t,this.minValue,this.maxValue)),_(1-this.rate,t));return _(e,me(n,se(_t(),t)))})}getConfig(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}}};_1.className="MinMaxNorm";ae.registerClass(_1);var T6={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function Pt(e){return R1(e)}function E6(e,t={}){return Id(e,ae.SerializationMap.getMap().classNameMap,t,"constraint")}function Lt(e){if(e==null)return null;if(typeof e=="string"){let t={className:e in T6?T6[e]:e,config:{}};return E6(t)}else return e instanceof Sd?e:E6(e)}function Qee(e){return new D1(e)}function ete(e){return new O1(e)}function tte(){return new z1}function nte(e){return new _1(e)}var C6={};Fe(C6,{constant:()=>lte,glorotNormal:()=>mte,glorotUniform:()=>fte,heNormal:()=>Ate,heUniform:()=>yte,identity:()=>cte,leCunNormal:()=>gte,leCunUniform:()=>xte,ones:()=>ote,orthogonal:()=>bte,randomNormal:()=>dte,randomUniform:()=>ute,truncatedNormal:()=>pte,varianceScaling:()=>hte,zeros:()=>ite});var vte=["channelsFirst","channelsLast"],wte=["nearest","bilinear"],kte=["valid","same","causal"],Ite=["max","avg"],Ste=["sum","mul","concat","ave"],Ll=new Map;function Et(e){Ei(vte,"DataFormat",e)}function Nte(e){Ei(wte,"InterpolationFormat",e)}function Jn(e){Ei(kte,"PaddingMode",e)}function R6(e){Ei(Ite,"PoolMode",e)}var Nd=[],M6="/";function Ci(e,t){Nd.push(e);try{let n=t();return Nd.pop(),n}catch(n){throw Nd.pop(),n}}function Tte(){return Nd.length===0?"":Nd.join(M6)+M6}function $6(e){if(!F6(e))throw new Error("Not a valid tensor name: '"+e+"'");return Tte()+e}function D6(e){if(!F6(e))throw new Error("Not a valid tensor name: '"+e+"'");Ll.has(e)||Ll.set(e,0);let t=Ll.get(e);if(Ll.set(e,Ll.get(e)+1),t>0){let n=`${e}_${t}`;return Ll.set(n,1),n}else return e}var Ete=new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);function F6(e){return!!e.match(Ete)}function Cte(e){return e===parseInt(e.toString(),10)}function Vr(e,t,n){t==null&&(t=0),n==null&&(n=e.length);let a=1;for(let r=t;r{if(e.shape.length!==2)throw new B(`repeat() expects a rank-2 tensor, but received a rank-${e.shape.length} tensor.`);let n=Ed(e,1);return P1(n,[1,t,1])})}function Mte(e){let t=[Vr(e.shape)];return e.reshape(t)}function Fte(e){if(e.rank<=1)throw new B(`batchFlatten requires a minimum rank of 2. Got rank: ${e.rank}.`);let t=[e.shape[0],Vr(e.shape,1)];return e.reshape(t)}function Ri(e,t,n){return W(()=>{switch(e.rank){case 1:return Pc(e,t,n);case 2:return MA(e,[t,0],[n,e.shape[1]]);case 3:return Lc(e,[t,0,0],[n,e.shape[1],e.shape[2]]);case 4:return td(e,[t,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3]]);case 5:return Re(e,[t,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4]]);case 6:return Re(e,[t,0,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4],e.shape[5]]);default:throw new B(`sliceAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}})}function L1(e,t,n){return W(()=>{switch(e.rank){case 1:return Pc(e,t,n);case 2:return MA(e,[0,t],[e.shape[0],n]);case 3:return Lc(e,[0,0,t],[e.shape[0],e.shape[1],n]);case 4:return td(e,[0,0,0,t],[e.shape[0],e.shape[1],e.shape[2],n]);default:throw new B(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}})}function Fh(e,t,n,a){return W(()=>{switch(e.rank){case 1:return Pc(e,t,n);case 2:switch(a){case 1:return Ri(e,t,n);case 2:return L1(e,t,n);default:throw new B(`The axis is not within the rank of the tensor ${a}`)}case 3:switch(a){case 1:return Ri(e,t,n);case 2:return Lc(e,[0,t,0],[e.shape[0],n,e.shape[2]]);case 3:return L1(e,t,n);default:throw new B(`The axis is not within the rank of the tensor ${a}`)}case 4:switch(a){case 1:return Ri(e,t,n);case 2:return td(e,[0,t,0,0],[e.shape[0],n,e.shape[2],e.shape[3]]);case 3:return td(e,[0,0,t,0],[e.shape[0],e.shape[1],n,e.shape[3]]);case 4:return L1(e,t,n);default:throw new B(`The axis is not within the rank of the tensor ${a}`)}default:throw new B(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}})}function W1(e,t=-1){let n;return t<0&&(n=e[0].rank,n!==0?t=n:t=0),t===e[0].rank&&(t=-1),ot(e,t)}function z6(e,t){switch(e.rank){case 1:return Mb([e,t]);case 2:return cl([e,t],0);case 3:return Fb([e,t],0);case 4:return $b([e,t],0);default:throw new B(`concatAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}}function P1(e,t){if(Array.isArray(t)||(t=[t]),e.rank!==t.length)throw new B(`The length of input n (${t.length}) does not match the number of dimensions in input x (${e.rank})`);return Fr(e,t)}function $h(e,t=0,n=1,a,r){return Yb(e,t,n,a,r)}function ja(e,t,n,a){if(e.rank<2||t.rank<2)throw new Oe(`dot requires both inputs to be rank >= 2 but got x shape = ${e.shape} and y shape = ${t.shape}`);if(t.rank>=3){let r=e.shape.slice(-1)[0],s=t.shape.slice(-2)[0];if(r!==s)throw new Oe(`If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = ${e.shape} and y shape = ${t.shape}`)}if(e.rank===2&&t.rank===2){let r=!1,s=!1;return zr.matMul({a:e,b:t,transposeA:r,transposeB:s,bias:a?B1(e.rank,a,ba()):null,activation:n})}else{let r=e.shape.slice(),s=r.pop();e=e.reshape([-1,s]);let i=t.shape.slice(),o=i.pop(),l=i.pop(),d=[...i,o],u=Array.from({length:t.rank},(m,f)=>f===0?t.rank-2:f<=t.rank-2?f-1:f);t=t.transpose(u).reshape([l,-1]);let p=[...r,...d],c=!1,h=!1;return zr.matMul({a:e,b:t,transposeA:c,transposeB:h,bias:a?B1(e.rank,a,ba()):null,activation:n}).reshape(p)}}function _6(e,t,n){return W(()=>(Array.isArray(t)?t=Tt(t,"int32"):t=t.toInt(),ci(e,t,n)))}function Cd(e){return _(e,e)}function B1(e,t,n){let a=t.shape;if(t.rank!==1&&t.rank!==e)throw new B(`Unexpected bias dimensions: ${t.rank}; expected it to be 1 or ${e}`);if(e===5){if(n==="channelsFirst")return a.length===1?t.reshape([1,a[0],1,1,1]):t.reshape([1,a[3],a[0],a[1],a[2]]);if(n==="channelsLast")return a.length===1?t.reshape([1,1,1,1,a[0]]):t.reshape([1].concat(a))}else if(e===4){if(n==="channelsFirst")return a.length===1?t.reshape([1,a[0],1,1]):t.reshape([1,a[2],a[0],a[1]]);if(n==="channelsLast")return a.length===1?t.reshape([1,1,1,a[0]]):t.reshape([1].concat(a))}else if(e===3){if(n==="channelsFirst")return a.length===1?t.reshape([1,a[0],1]):t.reshape([1,a[1],a[0]]);if(n==="channelsLast")return a.length===1?t.reshape([1,1,a[0]]):t.reshape([1].concat(a))}else if(e<3)return t;throw new B(`Unsupported input rank by biasAdd: ${t.rank}`)}function ka(e,t,n){return W(()=>(n==null&&(n=ba()),Et(n),e.add(B1(e.rank,t,n))))}function $te(e,t=1){if(t!==1)throw new Oe(`Support for alpha values other than 1 (${t}) is not implemented yet.`);return fl(e)}function Dte(e){return W(()=>me(e,Ot(e).add(1)))}function P6(e,t,n,a){return W(()=>r3(e,t,n,a))}function Ote(e){return W(()=>{let t=se(.5,_(.2,e));return kn(t,0,1)})}function Rd(e,t,n=!1){return n?e():t()}var zte=["fanIn","fanOut","fanAvg"],_te=["normal","uniform","truncatedNormal"];function Pte(e){Ei(zte,"FanMode",e)}function Lte(e){Ei(_te,"Distribution",e)}var da=class extends ae.Serializable{fromConfigUsesCustomObjects(){return!1}getConfig(){return{}}},V1=class extends da{apply(e,t){return Ct(e,t)}};V1.className="Zeros";ae.registerClass(V1);var Dh=class extends da{apply(e,t){return $n(e,t)}};Dh.className="Ones";ae.registerClass(Dh);var j1=class extends da{constructor(e){super();if(typeof e!="object")throw new B(`Expected argument of type ConstantConfig but got ${e}`);if(e.value===void 0)throw new B(`config must have value set but got ${e}`);this.value=e.value}apply(e,t){return W(()=>_(Se(this.value),$n(e,t)))}getConfig(){return{value:this.value}}};j1.className="Constant";ae.registerClass(j1);var U1=class extends da{constructor(e){super();this.DEFAULT_MINVAL=-.05,this.DEFAULT_MAXVAL=.05,this.minval=e.minval||this.DEFAULT_MINVAL,this.maxval=e.maxval||this.DEFAULT_MAXVAL,this.seed=e.seed}apply(e,t){return xl(e,this.minval,this.maxval,t)}getConfig(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}}};U1.className="RandomUniform";ae.registerClass(U1);var H1=class extends da{constructor(e){super();this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if(t=t||"float32",t!=="float32"&&t!=="int32")throw new Oe(`randomNormal does not support dType ${t}.`);return $h(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}};H1.className="RandomNormal";ae.registerClass(H1);var G1=class extends da{constructor(e){super();this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if(t=t||"float32",t!=="float32"&&t!=="int32")throw new Oe(`truncatedNormal does not support dType ${t}.`);return Vc(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}};G1.className="TruncatedNormal";ae.registerClass(G1);var q1=class extends da{constructor(e){super();this.gain=e.gain!=null?e.gain:1}apply(e,t){return W(()=>{if(e.length!==2||e[0]!==e[1])throw new B("Identity matrix initializer can only be used for 2D square matrices.");return _(this.gain,yA(e[0]))})}getConfig(){return{gain:this.gain}}};q1.className="Identity";ae.registerClass(q1);function Wte(e,t="channelsLast"){let n,a;if(Et(t),e.length===2)n=e[0],a=e[1];else if([3,4,5].indexOf(e.length)!==-1){if(t==="channelsFirst"){let r=Vr(e,2);n=e[1]*r,a=e[0]*r}else if(t==="channelsLast"){let r=Vr(e,0,e.length-2);n=e[e.length-2]*r,a=e[e.length-1]*r}}else{let r=Vr(e);n=Math.sqrt(r),a=Math.sqrt(r)}return[n,a]}var Nn=class extends da{constructor(e){super();if(e.scale<0)throw new B(`scale must be a positive float. Got: ${e.scale}`);this.scale=e.scale==null?1:e.scale,this.mode=e.mode==null?"fanIn":e.mode,Pte(this.mode),this.distribution=e.distribution==null?"normal":e.distribution,Lte(this.distribution),this.seed=e.seed}apply(e,t){let n=Wte(e),a=n[0],r=n[1],s=this.scale;if(this.mode==="fanIn"?s/=Math.max(1,a):this.mode==="fanOut"?s/=Math.max(1,r):s/=Math.max(1,(a+r)/2),this.distribution==="normal"){let i=Math.sqrt(s);if(t=t||"float32",t!=="float32"&&t!=="int32")throw new Oe(`${this.getClassName()} does not support dType ${t}.`);return Vc(e,0,i,t,this.seed)}else{let i=Math.sqrt(3*s);return xl(e,-i,i,t)}}getConfig(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}}};Nn.className="VarianceScaling";ae.registerClass(Nn);var Oh=class extends Nn{constructor(e){super({scale:1,mode:"fanAvg",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Nn.className}};Oh.className="GlorotUniform";ae.registerClass(Oh);var zh=class extends Nn{constructor(e){super({scale:1,mode:"fanAvg",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Nn.className}};zh.className="GlorotNormal";ae.registerClass(zh);var _h=class extends Nn{constructor(e){super({scale:2,mode:"fanIn",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Nn.className}};_h.className="HeNormal";ae.registerClass(_h);var Ph=class extends Nn{constructor(e){super({scale:2,mode:"fanIn",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Nn.className}};Ph.className="HeUniform";ae.registerClass(Ph);var Lh=class extends Nn{constructor(e){super({scale:1,mode:"fanIn",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Nn.className}};Lh.className="LeCunNormal";ae.registerClass(Lh);var Wh=class extends Nn{constructor(e){super({scale:1,mode:"fanIn",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Nn.className}};Wh.className="LeCunNormal";ae.registerClass(Wh);var X1=class extends da{constructor(e){super();if(this.DEFAULT_GAIN=1,this.gain=e.gain==null?this.DEFAULT_GAIN:e.gain,this.seed=e.seed,this.seed!=null)throw new Oe("Random seed is not implemented for Orthogonal Initializer yet.")}apply(e,t){return W(()=>{if(e.length<2)throw new Oe("Shape must be at least 2D.");e[0]*e[1]>2e3&&console.warn(`Orthogonal initializer is being called on a matrix with more than 2000 (${e[0]*e[1]}) elements: Slowness may result.`);let n=e[0]>e[1]?[e[1],e[0]]:e,a=$h(n,0,1,"float32"),r=y3.gramSchmidt(a);return e[0]>e[1]&&(r=r.transpose()),_(this.gain,r)})}getConfig(){return{gain:this.gain,seed:this.seed}}};X1.className="Orthogonal";ae.registerClass(X1);var L6={constant:"Constant",glorotNormal:"GlorotNormal",glorotUniform:"GlorotUniform",heNormal:"HeNormal",heUniform:"HeUniform",identity:"Identity",leCunNormal:"LeCunNormal",leCunUniform:"LeCunUniform",ones:"Ones",orthogonal:"Orthogonal",randomNormal:"RandomNormal",randomUniform:"RandomUniform",truncatedNormal:"TruncatedNormal",varianceScaling:"VarianceScaling",zeros:"Zeros"};function W6(e,t={}){return Id(e,ae.SerializationMap.getMap().classNameMap,t,"initializer")}function kt(e){return R1(e)}function mt(e){if(typeof e=="string"){let t=e in L6?L6[e]:e;if(t==="GlorotNormal")return new zh;if(t==="GlorotUniform")return new Oh;if(t==="HeNormal")return new _h;if(t==="HeUniform")return new Ph;if(t==="LeCunNormal")return new Lh;if(t==="LeCunUniform")return new Wh;{let n={};return n.className=t,n.config={},W6(n)}}else return e instanceof da?e:W6(e)}function ite(){return new V1}function ote(){return new Dh}function lte(e){return new j1(e)}function ute(e){return new U1(e)}function dte(e){return new H1(e)}function pte(e){return new G1(e)}function cte(e){return new q1(e)}function hte(e){return new Nn(e)}function fte(e){return new Oh(e)}function mte(e){return new zh(e)}function Ate(e){return new _h(e)}function yte(e){return new Ph(e)}function gte(e){return new Lh(e)}function xte(e){return new Wh(e)}function bte(e){return new X1(e)}var B6={};Fe(B6,{Layer:()=>Ge,RNN:()=>Ua,RNNCell:()=>Md,activation:()=>ane,add:()=>cne,alphaDropout:()=>Kne,average:()=>hne,averagePooling1d:()=>K1,averagePooling2d:()=>Z1,averagePooling3d:()=>Y1,avgPool1d:()=>wne,avgPool2d:()=>Ine,avgPool3d:()=>Nne,avgPooling1d:()=>kne,avgPooling2d:()=>Sne,avgPooling3d:()=>Tne,batchNormalization:()=>xne,bidirectional:()=>Bne,concatenate:()=>fne,conv1d:()=>Xte,conv2d:()=>Kte,conv2dTranspose:()=>Zte,conv3d:()=>Yte,conv3dTranspose:()=>Jte,convLstm2d:()=>_ne,convLstm2dCell:()=>Pne,cropping2D:()=>ene,dense:()=>rne,depthwiseConv2d:()=>nne,dot:()=>gne,dropout:()=>sne,elu:()=>Vte,embedding:()=>pne,flatten:()=>one,gaussianDropout:()=>Xne,gaussianNoise:()=>qne,globalAveragePooling1d:()=>Ene,globalAveragePooling2d:()=>Cne,globalMaxPool1d:()=>jne,globalMaxPool2d:()=>Une,globalMaxPooling1d:()=>j6,globalMaxPooling2d:()=>U6,gru:()=>Mne,gruCell:()=>Fne,input:()=>V6,inputLayer:()=>Bte,layerNormalization:()=>bne,leakyReLU:()=>Ute,lstm:()=>$ne,lstmCell:()=>Dne,masking:()=>Zne,maxPool1d:()=>Hne,maxPool2d:()=>Gne,maxPooling1d:()=>H6,maxPooling2d:()=>G6,maxPooling3d:()=>Rne,maximum:()=>mne,minimum:()=>Ane,multiply:()=>yne,permute:()=>dne,prelu:()=>Hte,reLU:()=>jte,repeatVector:()=>lne,reshape:()=>une,rnn:()=>Lne,separableConv2d:()=>Qte,simpleRNN:()=>One,simpleRNNCell:()=>zne,softmax:()=>Gte,spatialDropout1d:()=>ine,stackedRNNCells:()=>Wne,thresholdedReLU:()=>qte,timeDistributed:()=>Vne,upSampling2d:()=>tne,zeroPadding2d:()=>vne});var Yne=0;function q6(){return Yne++}var Bh={};function Vh(e=""){return e in Bh||(Bh[e]=0),Bh[e]+=1,e+Bh[e].toString()}function J1(e){return Array.isArray(e)&&Array.isArray(e[0])}function jh(e){return e.length===0?[]:Array.isArray(e[0])?e:[e]}function _e(e){let t;if(Array.isArray(e)){if(e.length!==1)throw new B(`Expected Tensor length to be 1; got ${e.length}`);t=e[0]}else t=e;return t}function at(e){if(Array.isArray(e)&&Array.isArray(e[0])){if(e.length===1)return e=e,e[0];throw new B(`Expected exactly 1 Shape; got ${e.length}`)}else return e}function Uh(e){let t=0;for(let n of e)n.shape.length===0?t+=1:t+=n.shape.reduce((a,r)=>a*r);return t}var X6="Variable",K6=class{constructor(e,t="float32",n=X6,a=!0,r=null){this.dtype=t==null?"float32":t,this.shape=e.shape,this.id=q6(),n=n==null?X6:n,this.originalName=$6(n),this.name=D6(this.originalName),this.trainable_=a,this.constraint=r,this.val=Qb(e,this.trainable_,this.name,this.dtype)}read(){return this.assertNotDisposed(),this.val}write(e){return this.assertNotDisposed(),Jne(this.val,e),this.val.id!==e.id&&(this.val.assign(e),this.constraint!=null&&this.val.assign(this.constraint.apply(this.val))),this}dispose(){this.assertNotDisposed(),this.val.dispose()}assertNotDisposed(){if(this.val.isDisposed)throw new Error(`LayersVariable ${this.name} is already disposed.`)}get trainable(){return this.trainable_}set trainable(e){this.trainable_=e,this.val.trainable=e}};function Jne(e,t){if(e.shape.toString()!==t.shape.toString())throw new Error("Shape mismatch: "+JSON.stringify(e.shape)+" vs. "+JSON.stringify(t.shape))}function Q1(e){return e.map(t=>t.read())}function ey(e){e.forEach(t=>{t[0].write(t[1])})}var Mt=class{constructor(e){this.dtype=e.dtype,this.shape=e.shape,e.shape!=null?this.ndim=e.shape.length:this.ndim=e.ndim,this.maxNDim=e.maxNDim,this.minNDim=e.minNDim,this.axes=e.axes||{}}},Ia=class{constructor(e,t,n,a,r,s,i){this.dtype=e,this.shape=t,this.sourceLayer=n,this.inputs=a,this.callArgs=r,this.outputTensorIndex=i,this.id=q6(),s!=null&&(this.originalName=$6(s),this.name=D6(this.originalName)),this.rank=t.length}},Qne=0,Hh=class{constructor(e,t){this.callArgs=t,this.id=Qne++,this.outboundLayer=e.outboundLayer,this.inboundLayers=e.inboundLayers,this.nodeIndices=e.nodeIndices,this.tensorIndices=e.tensorIndices,this.inputTensors=e.inputTensors,this.outputTensors=e.outputTensors,this.inputMasks=e.inputMasks,this.outputMasks=e.outputMasks,this.inputShapes=e.inputShapes,this.outputShapes=e.outputShapes;for(let n of e.inboundLayers)n!=null&&n.outboundNodes.push(this);e.outboundLayer.inboundNodes.push(this)}getConfig(){let e=[];for(let t of this.inboundLayers)t!=null?e.push(t.name):e.push(null);return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inboundLayers:e,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}}},eae=0,Ge=class extends ae.Serializable{constructor(e={}){super();this._callHook=null,this._addedWeightNames=[],this._stateful=!1,this.id=eae++,this.activityRegularizer=null,this.inputSpec=null,this.supportsMasking=!1,this._trainableWeights=[],this._nonTrainableWeights=[],this._losses=[],this._updates=[],this._built=!1,this.inboundNodes=[],this.outboundNodes=[];let t=e.name;if(!t){let n=this.getClassName();t=ur(n)+"_"+Vh(n)}if(this.name=t,this.trainable_=e.trainable==null?!0:e.trainable,e.inputShape!=null||e.batchInputShape!=null){let n;if(e.batchInputShape!=null)n=e.batchInputShape;else if(e.inputShape!=null){let r=null;e.batchSize!=null&&(r=e.batchSize),n=[r].concat(e.inputShape)}this.batchInputShape=n;let a=e.dtype;a==null&&(a=e.inputDType),a==null&&(a="float32"),this.dtype=a}e.weights!=null?this.initialWeights=e.weights:this.initialWeights=null,this._refCount=null,this.fastWeightInitDuringBuild=!1}static nodeKey(e,t){return e.name+"_ib-"+t.toString()}getNodeAtIndex(e,t){if(this.inboundNodes.length===0)throw new va(`The layer has never been called and thus has no defined ${t}.`);if(this.inboundNodes.length<=e)throw new B(`Asked to get ${t} at node ${e}, but the layer has only ${this.inboundNodes.length} inbound nodes.`);return this.inboundNodes[e]}getInputAt(e){return Sn(this.getNodeAtIndex(e,"input").inputTensors)}getOutputAt(e){return Sn(this.getNodeAtIndex(e,"output").outputTensors)}get input(){if(this.inboundNodes.length>1)throw new lr(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer input" is ill-defined. Use \`getInputAt(nodeIndex)\` instead.`);if(this.inboundNodes.length===0)throw new lr(`Layer ${this.name} is not connected, no input to return.`);return Sn(this.getNodeAtIndex(0,"input").inputTensors)}get output(){if(this.inboundNodes.length===0)throw new lr(`Layer ${this.name} has no inbound nodes.`);if(this.inboundNodes.length>1)throw new lr(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use \`getOutputAt(nodeIndex)\` instead.`);return Sn(this.getNodeAtIndex(0,"output").outputTensors)}get losses(){return this._losses}calculateLosses(){return this.losses.map(e=>e())}get updates(){return this._updates}get built(){return this._built}set built(e){this._built=e}get trainable(){return this.trainable_}set trainable(e){this._trainableWeights.forEach(t=>t.trainable=e),this.trainable_=e}get trainableWeights(){return this.trainable_?this._trainableWeights.filter(e=>e.trainable):[]}set trainableWeights(e){this._trainableWeights=e}get nonTrainableWeights(){return this.trainable?this._trainableWeights.filter(e=>!e.trainable).concat(this._nonTrainableWeights):this._trainableWeights.concat(this._nonTrainableWeights)}set nonTrainableWeights(e){this._nonTrainableWeights=e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}get stateful(){return this._stateful}resetStates(){if(!this.stateful)throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.")}assertInputCompatibility(e){if(e=ht(e),this.inputSpec==null||this.inputSpec.length===0)return;let t=ht(this.inputSpec);if(e.length!==t.length)throw new B(`Layer ${this.name} expects ${t.length} inputs, but it received ${e.length} input tensors. Input received: ${e}`);for(let n=0;nr.maxNDim)throw new B(`Input ${n} is incompatible with layer ${this.name}: expected max_ndim=${r.maxNDim}, found ndim=${s}`);if(r.minNDim!=null&&s=0?i[l]:i[i.length+l];if(d!=null&&[d,null].indexOf(u)===-1)throw new B(`Input ${n} is incompatible with layer ${this.name}: expected axis ${l} of input shape to have value ${d} but got shape ${i}.`)}}if(r.shape!=null)for(let i=0;i{if(!this.built){this.assertInputCompatibility(e);let s=[];for(let i of ht(e))s.push(i.shape);this.build(Sn(s)),this.built=!0,this.initialWeights&&this.setWeights(this.initialWeights),this._refCount===null&&r&&(this._refCount=1)}if(this.assertInputCompatibility(e),r){let s=this.call(e,t),i=ht(s),o=[];for(let l of i)n.indexOf(l)!==-1&&(l=l.clone()),o.push(l);if(s=Sn(o),this.activityRegularizer!=null)throw new Oe("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return s}else{let s=tae(e),i=this.computeOutputShape(s),o,l=nae(e);if(this.warnOnIncompatibleInputShape(Array.isArray(e)?s[0]:s),i!=null&&i.length>0&&Array.isArray(i[0])?o=i.map((d,u)=>new Ia(l,d,this,ht(e),t,this.name,u)):o=new Ia(l,i,this,ht(e),t,this.name),this.addInboundNode(e,o,null,null,s,i,t),this._refCount++,this.activityRegularizer!=null)throw new Oe("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return o}})}warnOnIncompatibleInputShape(e){if(this.batchInputShape!=null)if(e.length!==this.batchInputShape.length)console.warn(`The rank of the input tensor provided (shape: ${JSON.stringify(e)}) does not match that of the batchInputShape (${JSON.stringify(this.batchInputShape)}) of the layer ${this.name}`);else{let t=!1;this.batchInputShape.forEach((n,a)=>{n!=null&&e[a]!=null&&e[a]!==n&&(t=!0)}),t&&console.warn(`The shape of the input tensor (${JSON.stringify(e)}) does not match the expectation of layer ${this.name}: ${JSON.stringify(this.batchInputShape)}`)}}get outputShape(){if(this.inboundNodes==null||this.inboundNodes.length===0)throw new lr(`The layer ${this.name} has never been called and thus has no defined output shape.`);let e=[];for(let t of this.inboundNodes){let n=JSON.stringify(t.outputShapes);e.indexOf(n)===-1&&e.push(n)}if(e.length===1){let t=this.inboundNodes[0].outputShapes;return Array.isArray(t)&&Array.isArray(t[0])&&t.length===1?t[0]:t}else throw new lr(`The layer ${this.name} has multiple inbound nodes with different output shapes. Hence the notion of "output shape" is ill-defined for the layer.`)}countParams(){if(!this.built)throw new va(`You tried to call countParams() on ${this.name}, but the layer is not built yet. Build it first by calling build(batchInputShape).`);return Uh(this.weights)}build(e){this.built=!0}getWeights(e=!1){return Q1(e?this.trainableWeights:this.weights)}setWeights(e){W(()=>{let t=this.weights;if(t.length!==e.length)throw new B(`You called setWeights(weights) on layer "${this.name}" with a weight list of length ${e.length}, but the layer was expecting ${t.length} weights. Provided weights: ${e}...`);if(t.length===0)return;let n=[],a=Q1(t);for(let r=0;rr.apply(l.read())),s==null&&(s=!0),s?this._trainableWeights.push(l):this._nonTrainableWeights.push(l),l}setFastWeightInitDuringBuild(e){this.fastWeightInitDuringBuild=e}addLoss(e){e==null||Array.isArray(e)&&e.length===0||(e=ht(e),this._losses!==void 0&&this._losses!==null&&this.losses.push(...e))}computeOutputShape(e){return e}computeMask(e,t){if(!this.supportsMasking){if(t!=null)if(Array.isArray(t))t.forEach(n=>{if(n!=null)throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`)});else throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`);return null}return t}addInboundNode(e,t,n,a,r,s,i=null){let o=ht(e);t=ht(t),n=ht(n),a=ht(a),r=jh(r),s=jh(s);let l=[],d=[],u=[];for(let p of o)l.push(p.sourceLayer),d.push(p.nodeIndex),u.push(p.tensorIndex);new Hh({outboundLayer:this,inboundLayers:l,nodeIndices:d,tensorIndices:u,inputTensors:o,outputTensors:t,inputMasks:n,outputMasks:a,inputShapes:r,outputShapes:s},i);for(let p=0;pe.dispose()),this.weights.length}assertNotDisposed(){if(this._refCount===0)throw new Error(`Layer '${this.name}' is already disposed.`)}dispose(){if(!this.built)throw new Error(`Cannot dispose Layer ${this.name} because it has not been built yet.`);if(this._refCount===null)throw new Error(`Cannot dispose Layer ${this.name} because it has not been used yet.`);this.assertNotDisposed();let e=0;return--this._refCount==0&&(e=this.disposeWeights()),{refCountAfterDispose:this._refCount,numDisposedVariables:e}}};function tae(e){e=ht(e);let t=[];for(let n of e)t.push(n.shape);return Sn(t)}function nae(e){return"float32"}function Z6(e,t,n){if((t==null||n!=null&&n>0)&&(t=e.sourceLayer,n=e.nodeIndex),t.inboundNodes.length===0)return[e];{let a=t.inboundNodes[n];if(a.inboundLayers.length===0)return a.inputTensors;{let r=[];for(let s=0;s0){let r=await Promise.all(t);for(let s=0;sse(this.totals[a],_(r,n)));this.totals[a]=i,s!=null&&s.dispose()}}}async onEpochEnd(e,t){if(t!=null)for(let n of this.params.metrics)this.totals[n]!=null&&(typeof this.totals[n]=="number"?t[n]=this.totals[n]/this.seen:W(()=>{let a=_(me(1,this.seen),this.totals[n]);t[n]=a,this.totals[n].dispose(),jt(t[n])}))}},t4=class extends Vl{async onTrainBegin(e){this.epoch=[],this.history={}}async onEpochEnd(e,t){t==null&&(t={}),this.epoch.push(e);for(let n in t)this.history[n]==null&&(this.history[n]=[]),this.history[n].push(t[n])}async syncData(){let e=[],t=[],n=[];for(let r in this.history){let s=this.history[r];for(let i=0;inew n4(n,t))}var pa=class{constructor(){}static registerCallbackConstructor(e,t){k.assert(e>=0&&Number.isInteger(e),()=>`Verbosity level is expected to be an integer >= 0, but got ${e}`),pa.checkForDuplicate(t),pa.constructors[e]==null&&(pa.constructors[e]=[]),pa.constructors[e].push(t)}static checkForDuplicate(e){for(let t in pa.constructors)pa.constructors[+t].forEach(n=>{if(n===e)throw new B("Duplicate callback constructor.")})}static clear(){pa.constructors={}}static createCallbacks(e){let t=[];for(let n in pa.constructors){let a=+n;e>=a&&t.push(...pa.constructors[a])}return t.map(n=>new n)}};pa.constructors={};function r4(e,t,n,a,r,s,i,o,l){let d=new t4,u=[new rae,...pa.createCallbacks(t)];e!=null&&u.push(...e),u.push(d);let p=new e4(u);return p.setParams({epochs:n,initialEpoch:a,samples:r,steps:s,batchSize:i,verbose:t,doValidation:o,metrics:l}),{callbackList:p,history:d}}function Sa(e,t={},n=!1){return Id(e,ae.SerializationMap.getMap().classNameMap,t,"layer",n)}function Gh(e,t){return W(()=>{e.dtype!=="float32"&&(e=e.asType("float32"));let n=ke(Cd(e),t,!0),a=ml(n.shape,_t()),r=Jt(_a(n,a));return me(e,r)})}function Mi(e,t){return W(()=>wt(Cd(ge(t,e)),-1))}function qh(e,t){return W(()=>wt(Ot(ge(t,e)),-1))}function jl(e,t){return W(()=>{let n=ge(e,t),a=kn(Ot(e),_t(),Number.MAX_VALUE),r=Ot(me(n,a));return _(100,wt(r,-1))})}function sae(e,t){return W(()=>{let n=kn(t,_t(),Number.MAX_VALUE),a=Fn(se(1,n)),r=kn(e,_t(),Number.MAX_VALUE),s=Fn(se(1,r));return wt(Cd(ge(a,s)),-1)})}function iae(e,t){return W(()=>{let n=_a(0,ge(1,_(e,t)));return wt(Cd(n),-1)})}function oae(e,t){return W(()=>{let n=_a(0,ge(1,_(e,t)));return wt(n,-1)})}function lae(e,t){return W(()=>{let n=ke(_(e,t),-1),a=Xn(_(ge(1,e),t),-1);return _a(0,se(1,ge(a,n)))})}function uae(e,t){return W(()=>{let n=Math.log(2),a=ge(t,e),r=ge(se(a,hi(_(-2,a))),n);return wt(r,-1)})}function Fd(e,t,n=!1){return W(()=>{if(n)t=nd(t);else{let a=ke(t,t.shape.length-1,!0);t=me(t,a)}return t=kn(t,_t(),1-_t()),vt(ke(_(e.toFloat(),Fn(t)),t.shape.length-1))})}function Xh(e,t,n=!1){return W(()=>{let a=Al(Mte(e)).toInt();t=kn(t,_t(),1-_t());let r=t.shape,s=ol(a,r[r.length-1]).reshape(r);return Fd(s,t,n)})}function dae(e,t){if(!k.arraysEqual(e.shape,t.shape))throw new B(`logits and labels must have the same shape, but got shapes ${JSON.stringify(e.shape)} and ${JSON.stringify(t.shape)}`);return W(()=>{let n=t.relu(),a=t.abs().neg();return n.sub(t.mul(e)).add(a.exp().log1p())})}function Kh(e,t){return W(()=>{let n;return n=kn(t,_t(),1-_t()),n=Fn(me(n,ge(1,n))),wt(dae(e,n),-1)})}function pae(e,t){return W(()=>{let n=kn(e,_t(),1),a=kn(t,_t(),1);return ke(_(e,Fn(me(n,a))),-1)})}function cae(e,t){return W(()=>{let n=Fn(se(_t(),t));return wt(ge(t,_(e,n)),-1)})}function ty(e,t){return W(()=>{let n=Gh(e,-1),a=Gh(t,-1),r=_(n,a);return vt(ke(r,-1))})}var Zh={meanSquaredError:Mi,meanAbsoluteError:qh,meanAbsolutePercentageError:jl,meanSquaredLogarithmicError:sae,squaredHinge:iae,hinge:oae,categoricalHinge:lae,logcosh:uae,categoricalCrossentropy:Fd,sparseCategoricalCrossentropy:Xh,binaryCrossentropy:Kh,kullbackLeiblerDivergence:pae,poisson:cae,cosineProximity:ty};function ny(e){if(typeof e=="string"){if(e in Zh)return Zh[e];let t=`Unknown loss ${e}`;throw e.toLowerCase().includes("softmaxcrossentropy")&&(t=`Unknown loss ${e}. Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy`),new B(t)}else return e}function ay(e,t){return W(()=>{let n=_(.5,Dn(t)),a=Td(Mn(t,n),e.dtype);return wt(Mr(e,a),-1)})}function ry(e,t){return W(()=>Td(Mr(Uu(e,-1),Uu(t,-1)),"float32"))}function s4(e,t){return W(()=>oa(e.equal(1),t.equal(1)).sum().cast("float32"))}function hae(e,t){return W(()=>oa(e.equal(1),t.equal(0)).sum().cast("float32"))}function fae(e,t){return W(()=>oa(e.equal(0),t.equal(1)).sum().cast("float32"))}function i4(e,t){return W(()=>{let n=s4(e,t),a=fae(e,t),r=n.add(a);return nn(Mn(r,0),n.div(r),0).cast("float32")})}function mae(e,t){return W(()=>{let n=s4(e,t),a=hae(e,t),r=n.add(a);return nn(Mn(r,0),n.div(r),0).cast("float32")})}function o4(e,t){return Kh(e,t)}function l4(e,t){return e.rank===t.rank&&(e=e.squeeze([e.rank-1])),t=t.argMax(-1),t.dtype!==e.dtype&&(t=t.asType(e.dtype)),Mr(e,t).asType("float32")}var Aae=Mi,yae=Mi,gae=qh,xae=qh,bae=jl,vae=jl,sy=Fd,wae=ty,u4=Xh,Yh={binaryAccuracy:ay,categoricalAccuracy:ry,precision:i4,categoricalCrossentropy:sy,sparseCategoricalCrossentropy:u4,mse:Aae,MSE:yae,mae:gae,MAE:xae,mape:bae,MAPE:vae,cosine:wae};function kae(e){if(typeof e=="string"&&e in Yh)return Yh[e];if(typeof e!="string"&&e!=null)return e;throw new B(`Unknown metric ${e}`)}function Jh(e){if(Va(e!==null,`Unknown LossOrMetricFn ${e}`),typeof e=="string")return e;{let t;for(let n of Object.keys(Zh))if(Zh[n]===e){t=n;break}if(t!==void 0)return t;for(let n of Object.keys(Yh))if(Yh[n]===e){t=n;break}return t!==void 0?t:e.name}}function Iae(e){let t={Adagrad:()=>yi.adagrad(.01),Adadelta:()=>yi.adadelta(1,.95,_t()),Adam:()=>yi.adam(.001,.9,.999,_t()),Adamax:()=>yi.adamax(.002,.9,.999,_t(),0),RMSProp:()=>yi.rmsprop(.001,.9,0,_t()),SGD:()=>yi.sgd(.01)};if(t.adagrad=t.Adagrad,t.adadelta=t.Adadelta,t.adam=t.Adam,t.adamax=t.Adamax,t.rmsprop=t.RMSProp,t.sgd=t.SGD,e in t)return t[e]();throw new B(`Unknown Optimizer ${e}`)}var d4=1*1024*1024;function p4(e,t,n=!1){if(e==null||typeof e!="object"||Object.getPrototypeOf(e)!==Object.prototype||!iy(e))throw new Error("User-defined metadata is expected to be a JSON object, but is not.");if(n){let a=JSON.stringify(e);a.length>d4&&console.warn(`User-defined metadata of model "${t}" is too large in size (length=${a.length} when serialized). It is not recommended to store such large objects in user-defined metadata. Please make sure its serialized length is <= ${d4}.`)}}function iy(e){if(e===null)return!0;if(typeof e=="object")if(Object.getPrototypeOf(e)===Object.prototype){let t=Object.keys(e);for(let n of t)if(typeof n!="string"||!iy(e[n]))return!1;return!0}else if(Array.isArray(e)){for(let t of e)if(!iy(t))return!1;return!0}else return!1;else{let t=typeof e;return t==="string"||t==="number"||t==="boolean"}}function Cae(e,t,n,a=console.log){let r=Nae(e),s=["Layer (type)","Output shape","Param #"];r?(t=t||65,n=n||[.45,.85,1]):(t=t||98,n=n||[.33,.55,.67,1]),n[n.length-1]<=1&&(n=n.map(u=>Math.floor(t*u)));let i;if(!r){s.push("Receives inputs"),i=[];for(let u in e.nodesByDepth)i.push(...e.nodesByDepth[u])}a("_".repeat(t)),Qh(s,n,a),a("=".repeat(t));let o=e.layers;for(let u=0;u1||r.length===1&&r[0].inboundLayers.length>1){t=!1;break}a.push(...r)}if(t)for(let r of e.layers){let s=!1;for(let i of r.inboundNodes)if(a.indexOf(i)!==-1)if(s){t=!1;break}else s=!0;if(!t)break}return t}function Qh(e,t,n=console.log){let a="";for(let r=0;r0&&(a=a.slice(0,a.length-1)+" "),a+=e[r],a=a.slice(0,t[r]),a+=" ".repeat(t[r]-a.length);n(a)}function Tae(e,t,n){let a;try{a=JSON.stringify(e.outputShape)}catch(o){a="multiple"}let r=e.name,s=e.getClassName(),i=[`${r} (${s})`,a,e.countParams().toString()];Qh(i,t,n)}function Eae(e,t,n,a){let r;try{r=JSON.stringify(e.outputShape)}catch(u){r="multiple"}let s=[];for(let u of e.inboundNodes)if(!(n!=null&&n.length>0&&n.indexOf(u)===-1))for(let p=0;pm.name),l=[],d=t.names();for(let m of o)d.indexOf(m)!==-1?l.push(t.getValue(m)):l.push(null);a!=null&&(a.maxNumTensors=-Infinity,a.minNumTensors=Infinity);let u=o.join(",")+"|"+t.names().join(","),p,c;if(uy[u]==null){let m=Mae(i,t);p=m.sorted,c=m.recipientCounts,uy[u]=p,h4[u]=c}p=uy[u],c={},r||Object.assign(c,h4[u]);let h=new Fi(t);for(let m=0;ma.maxNumTensors&&(a.maxNumTensors=R),R0,()=>"Expected at least one fetch, got none");let n=[],a={};if(e.length===1){let r=f4(e[0],t);n=r.sorted,a=r.recipientMap}else{let r=new Set;for(let s of e){let{sorted:i,recipientMap:o}=f4(s,t);for(let l of i)r.has(l.name)||(n.push(l),r.add(l.name));for(let l in o)a[l]==null&&(a[l]=new Set),o[l].forEach(d=>a[l].add(d))}}return{sorted:n,recipientCounts:$ae(a)}}function $ae(e){let t={};for(let n in e)t[n]=e[n].size;return t}function f4(e,t){let n=new Set,a=[],r={};for(let o of t.names())n.add(o);let s=[],i=[];for(s.push(e);s.length>0;){let o=s[s.length-1];if(n.has(o.name)){s.pop();continue}let l=i[i.length-1]===s.length-1;if(o.inputs.length===0||l)s.pop(),a.push(o),n.add(o.name),l&&i.pop();else{i.push(s.length-1);for(let d of o.inputs)r[d.name]==null&&(r[d.name]=new Set),r[d.name].add(o.name),!n.has(d.name)&&s.push(d)}}return{sorted:a,recipientMap:r}}function Fae(e){let t;if(e.sourceLayer.inboundNodes.length===1)t=e.sourceLayer.output;else{let n=null;for(let a=0;ay.name)}`);Br(this.outputs).length!==this.outputs.length&&console.warn(`The list of outputs passed to the model is redundant. All outputs should only appear once. Found: ${this.outputs.map(y=>y.name)}`),this.inputLayers=[],this.inputLayersNodeIndices=[],this.inputLayersTensorIndices=[],this.outputLayers=[],this.outputLayersNodeIndices=[],this.outputLayersTensorIndices=[],this.layers=[],this.internalContainerRefs=[];for(let y of this.outputs){let g=y.sourceLayer,x=y.nodeIndex,w=y.tensorIndex;this.outputLayers.push(g),this.outputLayersNodeIndices.push(x),this.outputLayersTensorIndices.push(w)}for(let y of this.inputs){let g=y.sourceLayer,x=y.nodeIndex,w=y.tensorIndex;Va(x===0,"input layer has >1 nodes"),Va(w===0,"input layer has >1 tensors"),this.inputLayers.push(g),this.inputLayersNodeIndices.push(x),this.inputLayersTensorIndices.push(w)}this.inputNames=[],this.outputNames=[],this.feedInputShapes=[],this.feedInputNames=[],this.feedOutputNames=[];for(let y=0;yy.shape),this.internalOutputShapes=this.outputs.map(y=>y.shape);let t={},n={},a={},r={},s={},i=[],o=(y,g,x,w,b,v)=>{(w==null||b==null||v==null)&&(w=y.sourceLayer,b=y.nodeIndex,v=y.tensorIndex);let N=w.inboundNodes[b];if(x.indexOf(N)!==-1)throw new va(`The tensor ${y.name} at layer "${w.name}" is part of a cycle.`);if(g.indexOf(N)!==-1)return;this.containerNodes.add(Ha.nodeKey(w,b)),w.id in s||(s[w.id]=Object.keys(s).length),x.indexOf(N)===-1&&x.push(N);let T=N.inboundLayers.length;for(let R=0;R=0;)x.splice(x.indexOf(N),1);i.push(N)},l=[],d=[];for(let y of this.outputs)o(y,l,d);let u=i.slice().reverse();for(let y of u){n[y.id]=y,y.id in t||(t[y.id]=0);let g=t[y.id],x=a[y.outboundLayer.id]==null?0:a[y.outboundLayer.id];g=Math.max(g,x),a[y.outboundLayer.id]=g,r[y.outboundLayer.id]=y.outboundLayer,t[y.id]=g;for(let w=0;wparseInt(y,10)).sort(Mh);this.layers=[];for(let y of h){let g=c[y];g.sort((x,w)=>{let b=s[x.id],v=s[w.id];return bv?1:0});for(let x of g)x instanceof Ha&&this.internalContainerRefs.push(x),this.layers.push(x)}this.layersByDepth=c,h=Object.keys(p).map(y=>parseInt(y,10)).sort(Mh);let m=this.inputs.slice(),f=[];for(let y of h)for(let g of p[y]){let x=g.outboundLayer;if(x!=null){for(let w of g.inputTensors)if(m.indexOf(w)===-1)throw new va(`Graph disconnected: cannot obtain value for tensor ${w} at layer "${x.name}". The following previous layers were accessed without issue: ${f}`);for(let w of g.outputTensors)m.push(w);f.push(x.name)}}this.nodesByDepth=p;let A=this.layers.map(y=>y.name);for(let y of A){let g=A.filter(x=>x===y).length;if(g!==1)throw new va(`The name "${y}" is used ${g} times in the model. All layer names should be unique. Layer names: `+JSON.stringify(A))}this.outboundNodes=[],this.inboundNodes=[],new Hh({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:this.inputs.map(y=>null),outputMasks:this.outputs.map(y=>null),inputShapes:this.inputs.map(y=>y.shape),outputShapes:this.outputs.map(y=>y.shape)}),this.built=!0,this._refCount=1}assertNotDisposed(){if(this._refCount===0)throw new Error(`Container '${this.name}' is already disposed.`)}dispose(){this.assertNotDisposed();let e={refCountAfterDispose:null,numDisposedVariables:0};if(--this._refCount==0){for(let t of this.layers)e.numDisposedVariables+=t.dispose().numDisposedVariables;for(let t of this.internalContainerRefs)e.numDisposedVariables+=t.dispose().numDisposedVariables}return e.refCountAfterDispose=this._refCount,e}get trainable(){return this.trainable_}set trainable(e){this.layers.forEach(t=>{t._trainableWeights.forEach(n=>n.trainable=e)}),this.trainable_=e}get trainableWeights(){if(this._trainableWeights.length>0)throw new B("Container instance unexpectedly contains _trainableWeights.The trainable weights of a Container are a union of the trainable weights of its consituent Layers. Its own _trainableWeights must remain an empty Array.");if(!this.trainable)return[];let e=[];for(let t of this.layers)e=e.concat(t.trainableWeights);return e}get nonTrainableWeights(){let e=[];for(let t of this.layers)e.push(...t.nonTrainableWeights);if(!this.trainable){let t=[];for(let n of this.layers)t.push(...n.trainableWeights);return t.concat(e)}return e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}loadWeights(e,t=!0){let n={},a=0;for(let s of this.layers)for(let i of s.weights){if(n[i.originalName]!=null)throw new B(`Duplicate weight name: ${i.originalName}`);n[i.originalName]=i,a++}let r=[];for(let s in e){let i=s;if(n[s]==null){let o=s.split("/");i=o.slice(0,-2).concat([o[o.length-1]]).join("/")}if(n[i]!=null)r.push([n[i],e[s]]);else if(t)throw new B(`Provided weight data has no target variable: ${s}`);delete n[i]}if(t){let s=[];for(let i in n)s.push(i);if(s.length>0)throw new B(`${s.length} of ${a} weights are not set: ${s}`)}ey(r)}updatedConfig(){let e=this.getConfig(),t={};return t.className=this.getClassName(),t.config=e,t.kerasVersion=`tfjs-layers ${ly}`,t.backend="TensorFlow.js",t}toJSON(e,t=!0){let n=oy(this.updatedConfig());return t?JSON.stringify(n):n}call(e,t){return W(()=>{e=ht(e);let n=new Fi;for(let a=0;a{e=ht(e);let n;return t==null?n=Ni(null,e.length):n=ht(t),this.runInternalGraph(e,n)[1]})}computeOutputShape(e){let t=jh(e);if(t.length!==this.inputLayers.length)throw new B(`Invalid inputShape argument ${e}: model has ${this.inputLayers.length} tensor inputs.`);let n={};for(let i=0;iparseInt(i,10)).sort(Mh);if(a.length>1)for(let i of a){let o=this.nodesByDepth[i];for(let l of o){let d=l.outboundLayer;if(this.inputLayers.map(m=>m.id).indexOf(d.id)!==-1)continue;let u=[];for(let m=0;mparseInt(o,10)).sort(Mh);for(let o of a){let l=this.nodesByDepth[o];for(let d of l){let u=d.outboundLayer,p=d.inputTensors,c=d.outputTensors,h=new Array;for(let m of p)m.id in n&&h.push(n[m.id]);if(h.length===p.length){let m={},f,A,y,g;if(d.callArgs!=null&&(m=d.callArgs),h.length===1){let[x,w]=h[0];m.mask==null&&(m.mask=w),y=ht(u.call(x,m)),g=ht(u.computeMask(x,w)),f=[x],A=[w]}else f=h.map(x=>x[0]),A=h.map(x=>x[1]),m.mask==null&&(m.mask=A),y=ht(u.call(f,m)),g=ht(u.computeMask(f,A));if(u.activityRegularizer)throw new Oe("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(let x=0;x{let e=[];for(let t of this.layers)for(let n=0;n0){let m=[];for(let f=0;f0&&f.apply(Sn(y),g)}function l(f){let A=f.name,y=Sa(f,t.customObjects!=null?t.customObjects:{});y.setFastWeightInitDuringBuild(a),r[A]=y,f.inboundNodes.forEach(g=>{if(!(g instanceof Array))throw new B(`Corrupted configuration, expected array for nodeData: ${g}`);i(y,g)})}let d=t.name,u=t.layers;for(let f of u)l(f);for(;!rte(s);)for(let f of u){let A=r[f.name];if(A.name in s){let y=s[A.name];delete s[A.name];for(let g of y)o(A,g)}}let p=[],c=[],h=t.inputLayers;for(let f of h){let A=f[0],y=f[1],g=f[2];Va(A in r);let x=r[A].inboundNodes[y].outputTensors;p.push(x[g])}let m=t.outputLayers;for(let f of m){let A=f[0],y=f[1],g=f[2];Va(A in r);let x=r[A].inboundNodes[y].outputTensors;c.push(x[g])}return new e({inputs:p,outputs:c,name:d})}get stateful(){if(this._stateful)throw new B("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");for(let e of this.layers)if(e.stateful)return!0;return!1}resetStates(){W(()=>{this.layers.forEach(e=>{e.stateful&&e.resetStates()})})}};function Dae(e,t,n){let a=t.length;if(e==null||Array.isArray(e)&&e.length===0)return t.map(r=>null);if(a===1)return Array.isArray(e)&&e.length===1?e:typeof e=="object"&&t[0]in e?[e[t[0]]]:[e];if(Array.isArray(e)){if(e.length!==a)throw new Error(`Provided ${n} is an array of ${e.length} element(s), but the model has ${a} outputs. Make sure a set of weights is provided for each model output.`);return e}else if(typeof e=="object"&&Object.keys(e).length>0&&typeof e[Object.keys(e)[0]]=="object"){let r=[];return t.forEach(s=>{s in e?r.push(e[s]):r.push(null)}),r}else throw new Error(`The model has multiple (${a}) outputs, so ${n} must be either an array with ${a} elements or an object with ${t} keys. Provided ${n} not understood: ${JSON.stringify(e)}`)}function m4(e,t){return Dae(e,t,"classWeight")}async function A4(e,t,n,a){if(t!=null||a!=null)throw new Error("Support sampleWeight is not implemented yet");if(n!=null){let r=W(()=>{if(e.shape.length===1)return e.clone();if(e.shape.length===2)if(e.shape[1]>1){let o=1;return e.argMax(o)}else{if(e.shape[1]===1)return e.reshape([e.shape[0]]);throw new Error(`Encountered unexpected last-dimension size (${e.shape[1]}) during handling of class weights. The size is expected to be >= 1.`)}else throw new Error(`Unexpected rank of target (y) tensor (${e.rank}) during handling of class weights. The rank is expected to be 1 or 2.`)}),s=Array.from(await r.data());Ee(r);let i=[];return s.forEach(o=>{if(n[o]==null)throw new Error(`classWeight must contain all classes in the training data. The class ${o} exists in the data but not in classWeight`);i.push(n[o])}),Tt(i,"float32")}else return null}function Oae(e,t){return _(e,t)}var zae=32;function g4(e,t){let n,a,r=t;n=r.xs,a=r.ys,k.assert(n!=null&&a!=null,()=>`A Dataset iterator for fitDataset() is expected to generate objects of the form \`{xs: xVal, ys: yVal}\`, where the two values may be \`tf.Tensor\`, an array of Tensors, or a map of string to Tensor. The provided Dataset instead generates ${t}`);let s=y4("input",e.inputNames,n),i=y4("output",e.outputNames,a),o=s[0].shape[0];k.assert(s.length===e.inputs.length,()=>`LayersModel has ${e.inputs.length} inputs, but the dataset provides ${s.length} inputs. (Expected input keys: ${JSON.stringify(e.inputNames)})`),k.assert(i.length===e.outputs.length,()=>`LayersModel has ${e.outputs.length} outputs, but the dataset provides ${i.length} outputs. (Expected output keys: ${JSON.stringify(e.outputNames)})`);for(let l=0;l`Batch size mismatch: input ${e.inputNames[l]} has ${s[l].shape[0]}; expected ${o} based on input ${e.inputNames[0]}.`);for(let l=0;l`Batch size mismatch: output ${e.outputNames[l]} has ${i[l].shape[0]}; expected ${o} based on input ${e.inputNames[0]}.`);return{xs:s,ys:i}}function y4(e,t,n){if(n instanceof Le)return[n];if(Array.isArray(n))return k.assert(n.length===t.length,()=>`Received an array of ${n.length} Tensors, but expected ${t.length} to match the ${e} keys ${t}.`),n;{let a=[];for(let r of t){if(n[r]==null)throw new B(`The feature data generated by the dataset lacks the required ${e} key '${r}'.`);a.push(n[r])}return a}}function _ae(e){if(e.length===3)throw new Oe("Validation with sample weights is not implemented yet.");return{xs:e[0],ys:e[1]}}async function Lae(e,t,n){let a=n.batchesPerEpoch!=null;if(k.assert(e.optimizer!=null,()=>"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig)."),k.assert(n!=null,()=>"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call."),k.assert(n.epochs!=null&&n.epochs>0&&Number.isInteger(n.epochs),()=>`For fitDataset(), config.epochs is expected to be a positive integer, but got ${n.epochs}`),k.assert(!a||n.batchesPerEpoch>0&&Number.isInteger(n.batchesPerEpoch),()=>`For fitDataset(), config.batchesPerEpoch is expected to be a positive integer if specified, but got ${n.batchesPerEpoch}`),k.assert(n.validationSplit==null,()=>"`validationSplit` is not supported by `fitDataset()`. Use validationData instead."),e.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");e.isTraining=!0;try{let r=n.validationData!=null,s,i;if(r)if(x4(n.validationData))k.assert(n.validationBatches==null||n.validationBatches>0&&Number.isInteger(n.validationBatches),()=>`For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, but got ${n.validationBatches}`);else{let A=_ae(n.validationData);s=A.xs,i=A.ys}let o=e.makeTrainFunction(),l=e.getDedupedMetricsNames(),d;r?d=l.slice().concat(l.map(A=>"val_"+A)):d=l.slice();let u=a4(n.callbacks,n.yieldEvery),p=n.verbose==null?1:n.verbose,{callbackList:c,history:h}=r4(u,p,n.epochs,null,null,Pae(t,n),null,r,d);c.setModel(e),e.history=h,await c.onTrainBegin(),e.stopTraining_=!1;let m=n.initialEpoch==null?0:n.initialEpoch,f=await t.iterator();for(;m=n.batchesPerEpoch:x.done){if(r){let w;x4(n.validationData)?w=ht(await e.evaluateDataset(n.validationData,{batches:n.validationBatches})):w=ht(e.evaluate(s,i,{batchSize:n.validationBatchSize==null?zae:n.validationBatchSize,verbose:0}));for(let b=0;b0)throw new Oe("Verbose mode is not implemented yet.");k.assert(!a||n.batches>0&&Number.isInteger(n.batches),()=>`Test loop expects \`batches\` to be a positive integer, but received ${JSON.stringify(n.batches)}`);let i=Wae(t)?t:await t.iterator(),o=0,l=0;for(;a?l{if(d.value){let{xs:u,ys:p}=g4(e,d.value),c=u.concat(p),h=W(()=>r(c));if(Ee(c),l===0)for(let f=0;fse(s[f],_(m,A))),l>0&&Ee(y)}Ee(h),o+=m,++l}return s}),d.done){a&&console.warn(`Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least \`batches\` batches (in this case, ${n.batches} batches). You may need to use the repeat() function when building your dataset.`);break}}for(let d=0;d0&&Number.isInteger(e),()=>`batchSize is required to be a positive integer, but got ${e}`)}function Od(e,t,n){return e==null?[null]:Array.isArray(e)?e.map(a=>Ri(a,t,n-t)):Ri(e,t,n-t)}function py(e,t){return W(()=>e==null?null:Array.isArray(e)?e.map(n=>py(n,t)):_6(e,t.dtype==="int32"?t:t.toInt()))}function cy(e,t){let n=[],a=0,r=null;for(;a=e&&(r=e),n.push([a,r]),a=r;return n}async function Vae(e,t,n,a,r,s,i,o,l,d,u,p,c,h,m){r==null&&(r=32),s==null&&(s=1),u==null&&(u=!0),c==null&&(c=0);let f=!1;if(l!=null&&d!=null&&(f=!0),m!=null&&(f=!0,h==null))throw new B("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");let A=e.checkNumSamples(n,r,h,"steps_per_epoch"),y;A!=null&&(y=wa(0,A)),i==null&&(i=1);let{callbackList:g,history:x}=r4(o,i,s,c,A,h,r,f,p);g.setModel(e),e.history=x,await g.onTrainBegin(),e.stopTraining_=!1;for(let w=c;w{let $=N[T][0],z=N[T][1],P=Ri(v,$,z-$);R.batch=T,R.size=z-$;let V=py(n,P),j=t(V);for(let U=0;U0){if(m=!0,a.validationData.length===2)i=a.validationData[0],o=a.validationData[1];else throw a.validationData.length===3?new Oe("validationData including sample weights is not supported yet."):new B(`When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; ${a.validationData} is invalid.`);let v=!0,N=await e.standardizeUserData(i,o,null,null,v,p);l=N[0],d=N[1],f=l.concat(d)}else if(a.validationSplit!=null&&a.validationSplit>0&&a.validationSplit<1){m=!0;let v=Math.floor(r[0].shape[0]*(1-a.validationSplit)),N=r[0].shape[0];l=Od(r,v,N),r=Od(r,0,v),d=Od(s,v,N),s=Od(s,0,v),f=l.concat(d)}else a.validationSteps!=null&&(m=!0);let A=r.concat(s).concat(u);e.checkTrainableWeightsConsistency();let y=e.makeTrainFunction(),g=e.getDedupedMetricsNames(),x,w;m?(e.makeTestFunction(),x=e.testFunction,w=g.slice().concat(g.map(v=>"val_"+v))):(x=null,f=[],w=g.slice());let b=a4(a.callbacks,a.yieldEvery);return await Vae(e,y,A,g,p,a.epochs,a.verbose,b,x,f,a.shuffle,w,a.initialEpoch,null,null)}finally{e.isTraining=!1,$i(r,t),$i(s,n),$i(l,i),$i(d,o),u!=null&&Ee(u)}}function b4(e){let t=[];e instanceof Le&&(e=[e]);for(let n=0;nn.push(r.id));else if(t!=null)for(let r in t){let s=t[r];n.push(s.id)}let a=[];if(e instanceof Le)n.indexOf(e.id)===-1&&a.push(e);else if(Array.isArray(e))e.forEach(r=>{n.indexOf(r.id)===-1&&a.push(r)});else if(e!=null)for(let r in e){let s=e[r];n.indexOf(s.id)===-1&&a.push(s)}a.forEach(r=>{r.isDisposed||r.dispose()})}function Uae(e){return e instanceof Le}function hy(e){return Array.isArray(e)}function v4(e){return!Uae(e)&&!hy(e)}function w4(e,t,n,a=!0,r=""){if(t==null||t.length===0){if(e!=null){let i=!1;if(hy(e)&&e.length>0)i=!0;else if(v4(e)){for(let o in e)if(e.hasOwnProperty(o)){i=!0;break}}else i=!0;if(i)throw new B(`Error when checking model ${r} expected no data, but got ${e}`)}return[]}if(e==null)return t.map(i=>null);let s;if(v4(e)){e=e,s=[];for(let i of t){if(e[i]==null)throw new B(`No data provided for "${i}". Need data for each key in: ${t}`);s.push(e[i])}}else if(hy(e)){if(e=e,e.length!==t.length)throw new B(`Error when checking model ${r}: the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see ${t.length} Tensor(s), but instead got the following list of Tensor(s): ${e}`);s=e}else{if(e=e,t.length>1)throw new B(`The model ${r} expects ${t.length} Tensor(s), but only received one Tensor. Found: Tensor with shape ${e.shape}`);s=[e]}if(s=b4(s),n!=null)for(let i=0;i=0&&d!==u)throw new B(`Error when checking ${r}: expected ${t[i]} to have shape [${n[i]}], but got array with shape [${o.shape}].`)}}return s}function Hae(e,t,n){let a=Br(e.map(s=>s.shape[0]));a.sort();let r=Br(t.map(s=>s.shape[0]));if(r.sort(),a.length>1)throw new B(`All input Tensors (x) should have the same number of samples. Got array shapes: ${JSON.stringify(e.map(s=>s.shape))}`);if(r.length>1)throw new B(`All target Tensors (y) should have the same number of samples. Got array shapes: ${JSON.stringify(t.map(s=>s.shape))}`);if(a.length>0&&r.length>0&&!k.arraysEqual(a,r))throw new B(`Input Tensors should have the same number of samples as target Tensors. Found ${a[0]} input sample(s) and ${r[0]} target sample(s).`)}function Gae(e,t,n){let a=[Mi,Kh,Fd];for(let r=0;r1)throw new B(`The model expects ${t.length} ${r} Tensors, but only received one Tensor. Found: array with shape ${JSON.stringify(e.shape)}.`);s=[e]}if(n!=null)for(let i=0;i[]);let n;if(typeof e=="string"||typeof e=="function")n=[e];else if(Array.isArray(e)||typeof e=="object")n=e;else throw new TypeError(`Type of metrics argument not understood. Expected an string,function, Array, or Object, found: ${e}`);if(Array.isArray(n))return t.map(a=>n);{let a=[];for(let r of t){let s=n.hasOwnProperty(r)?n[r]:[];Array.isArray(s)||(s=[s]),a.push(s)}return a}}var Xae="layers-model",dr=class extends Ha{constructor(e){super(e);this.isTraining=!1}summary(e,t,n=console.log){if(!this.built)throw new B("This model has never been called, thus its weights have not been created yet. So no summary can be displayed. Build the model first (e.g., by calling it on some test data).");Cae(this,e,t,n)}compile(e){if(e.loss==null&&(e.loss=[]),this.loss=e.loss,typeof e.optimizer=="string")this.optimizer_=Iae(e.optimizer),this.isOptimizerOwned=!0;else{if(!(e.optimizer instanceof ir))throw new B("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer_=e.optimizer,this.isOptimizerOwned=!1}let t=[];if(!Array.isArray(e.loss)&&typeof e.loss!="string"&&typeof e.loss!="function"){e.loss=e.loss;for(let s in e.loss)if(this.outputNames.indexOf(s)===-1)throw new B(`Unknown entry in loss dictionary: "${s}". Only expected the following keys: ${this.outputNames}`);for(let s of this.outputNames)e.loss[s]==null&&console.warn(`Output "${s}" is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data to be passed to ${s} during training`),t.push(ny(e.loss[s]))}else if(Array.isArray(e.loss)){if(e.loss.length!==this.outputs.length)throw new B(`When passing an Array as loss, it should have one entry per model output. The model has ${this.outputs.length} output(s), but you passed loss=${e.loss}.`);t=e.loss.map(s=>ny(s))}else{let s=ny(e.loss);this.outputs.forEach(i=>{t.push(s)})}this.lossFunctions=t,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(let s=0;s{for(let s=0;s1&&(this.metricsTensors.push([i,s]),this.metricsNames.push(this.outputNames[s]+"_loss"))}});let a=qae(e.metrics,this.outputNames),r=(s,i,o)=>{this.outputNames.length>1&&(i=this.outputNames[s]+"_"+i),this.metricsNames.push(i),this.metricsTensors.push([o,s])};Ci("metric",()=>{for(let s=0;s{let l="",d,u,p;for(let c of o){if(typeof c=="string"&&["accuracy","acc","crossentropy","ce"].indexOf(c)!==-1){let m=this.internalOutputShapes[s];m[m.length-1]===1||this.lossFunctions[s]===Kh?["accuracy","acc"].indexOf(c)!==-1?u=ay:["crossentropy","ce"].indexOf(c)!==-1&&(u=o4):this.lossFunctions[s]===Xh?["accuracy","acc"].indexOf(c)!==-1?u=l4:["crossentropy","ce"].indexOf(c)!==-1&&(u=u4):["accuracy","acc"].indexOf(c)!==-1?u=ry:["crossentropy","ce"].indexOf(c)!==-1&&(u=sy);let f;["accuracy","acc"].indexOf(c)!==-1?f="acc":["crossentropy","ce"].indexOf(c)!==-1&&(f="ce"),p=u,d=l+f}else p=kae(c),d=l+Jh(c);let h;Ci(d,()=>{h=p}),r(s,d,h)}})(i)}}),this.collectedTrainableWeights=this.trainableWeights}checkTrainableWeightsConsistency(){this.collectedTrainableWeights!=null&&this.trainableWeights.length!==this.collectedTrainableWeights.length&&console.warn("Discrepancy between trainableweights and collected trainable weights. Did you set `model.trainable` without calling `model.compile()` afterwards?")}evaluate(e,t,n={}){let a=n.batchSize==null?32:n.batchSize;dy(a);let r=!0,s=this.standardizeUserDataXY(e,t,r,a);try{let i=s[0].concat(s[1]);this.makeTestFunction();let o=this.testFunction,l=this.testLoop(o,i,a,n.verbose,n.steps);return Sn(l)}finally{$i(s[0],e),$i(s[1],t)}}async evaluateDataset(e,t){return this.makeTestFunction(),Bae(this,e,t)}checkNumSamples(e,t,n,a="steps"){let r;if(n!=null){if(r=null,t!=null)throw new B(`If ${a} is set, batchSize must be null or undefined.Got batchSize = ${t}`)}else if(e!=null)Array.isArray(e)?r=e[0].shape[0]:r=e.shape[0];else throw new B(`Either the input data should have a defined shape, or ${a} shoud be specified.`);return r}execute(e,t){if(Array.isArray(t)&&t.length===0)throw new B("`outputs` is an empty Array, which is not allowed.");let n=Array.isArray(t),a=n?t:[t],r=this.retrieveSymbolicTensors(a),s=new Fi;if(e instanceof Le&&(e=[e]),Array.isArray(e)){if(e.length!==this.inputs.length)throw new B(`The number of inputs provided (${e.length}) does not match the number of inputs of this model (${this.inputs.length}).`);for(let o=0;oi.name);for(let i=0;i0){let a=[];throw t.forEach((r,s)=>{r==null&&a.push(e[s])}),new B(`Cannot find SymbolicTensors for output name(s): ${JSON.stringify(a)}`)}return t}predictLoop(e,t=32,n=!1){return W(()=>{let a=this.checkNumSamples(e);if(n)throw new Oe("Verbose predictLoop() is not implemented yet.");let r=cy(a,t),s=this.outputs.map(i=>[]);for(let i=0;i{let o=r[i][0],l=r[i][1],d=Od(e,o,l),u=[];if(Array.isArray(d))for(let c=0;cs[l].push(o));return Sn(s.map(i=>ot(i,0)))})}predict(e,t={}){let n=b4(e);k4(n,this.inputNames,this.feedInputShapes,!1);try{let a=t.batchSize==null?32:t.batchSize;return dy(a),this.predictLoop(n,a)}finally{$i(n,e)}}predictOnBatch(e){k4(e,this.inputNames,this.feedInputShapes,!0);let t=(Array.isArray(e)?e[0]:e).shape[0];return this.predictLoop(e,t)}standardizeUserDataXY(e,t,n=!0,a){if(this.optimizer_==null)throw new va("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");let r=[];for(let s=0;s0&&e[0].shape[0]%a!=0)throw new B(`In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size ${a}. Found: ${e[0].shape[0]} sample(s).`);return[e,t]}async standardizeUserData(e,t,n,a,r=!0,s){let[i,o]=this.standardizeUserDataXY(e,t,r,s);if(n!=null)throw new Error("sample weight is not supported yet.");let l=null;if(a!=null){let d=m4(a,this.outputNames);l=[];for(let u=0;u{let s=this.checkNumSamples(t,n,r,"steps"),i=[];if(a>0)throw new Oe("Verbose mode is not implemented yet.");if(r!=null)throw new Oe("steps mode in testLoop() is not implemented yet");{let o=cy(s,n),l=Tt(wa(0,s));for(let d=0;d1&&(r+=`_${I6(e.slice(0,n),a)}`),t.push(r)}return t}makeTrainFunction(){return e=>{let t=[],n=e.slice(0,this.inputs.length),a=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),r=e.slice(this.inputs.length+this.outputs.length,this.inputs.length+this.outputs.length*2),s=[],i=()=>{let d=[];for(let h=0;h1&&h{c=se(c,h)}),c},o=this.collectedTrainableWeights.map(d=>d.read()),l=!0;return[this.optimizer_.minimize(i,l,o)].concat(s)}}makeTestFunction(){this.testFunction=e=>W(()=>{let t=[],n,a=e.slice(0,this.inputs.length),r=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),s=[];for(let l=0;lur(t))}else{let t=Object.keys(this.loss);e={};let n=this.loss;for(let a of t)if(typeof n[a]=="string")e[a]=ur(n[a]);else throw new Error("Serialization of non-string loss is not supported.")}return e}getMetricIdentifiers(){if(typeof this.metrics=="string"||typeof this.metrics=="function")return[ur(Jh(this.metrics))];if(Array.isArray(this.metrics))return this.metrics.map(e=>ur(Jh(e)));{let e={};for(let t in this.metrics)e[t]=ur(Jh(this.metrics[t]));return e}}getTrainingConfig(){return{loss:this.getLossIdentifiers(),metrics:this.getMetricIdentifiers(),optimizer_config:{class_name:this.optimizer.getClassName(),config:this.optimizer.getConfig()}}}loadTrainingConfig(e){if(e.weighted_metrics!=null)throw new Error("Loading weight_metrics is not supported yet.");if(e.loss_weights!=null)throw new Error("Loading loss_weights is not supported yet.");if(e.sample_weight_mode!=null)throw new Error("Loading sample_weight_mode is not supported yet.");let t=$d(e.optimizer_config),n=Sa(t),a;if(typeof e.loss=="string")a=Ti(e.loss);else if(Array.isArray(e.loss))a=e.loss.map(s=>Ti(s));else if(e.loss!=null){a={};for(let s in e.loss)a[s]=Ti(e.loss[s])}let r;if(Array.isArray(e.metrics))r=e.metrics.map(s=>Ti(s));else if(e.metrics!=null){r={};for(let s in e.metrics)r[s]=Ti(e.metrics[s])}this.compile({loss:a,metrics:r,optimizer:n})}async save(e,t){if(typeof e=="string"){let i=vn.getSaveHandlers(e);if(i.length===0)throw new B(`Cannot find any save handlers for URL '${e}'`);if(i.length>1)throw new B(`Found more than one (${i.length}) save handlers for URL '${e}'`);e=i[0]}if(e.save==null)throw new B("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");let n=await vn.encodeWeights(this.getNamedWeights(t)),a=!1,r=null,s={modelTopology:this.toJSON(r,a),format:Xae,generatedBy:`TensorFlow.js tfjs-layers v${ly}`,convertedBy:null};if((t==null?!1:t.includeOptimizer)&&this.optimizer!=null){s.trainingConfig=this.getTrainingConfig();let i="optimizer",{data:o,specs:l}=await vn.encodeWeights(await this.optimizer.getWeights(),i);n.specs.push(...l),n.data=vn.concatenateArrayBuffers([n.data,o])}if(this.userDefinedMetadata!=null){let i=!0;p4(this.userDefinedMetadata,this.name,i),s.userDefinedMetadata=this.userDefinedMetadata}return s.weightData=n.data,s.weightSpecs=n.specs,e.save(s)}setUserDefinedMetadata(e){p4(e,this.name),this.userDefinedMetadata=e}getUserDefinedMetadata(){return this.userDefinedMetadata}};dr.className="Model";ae.registerClass(dr);var I4=class extends dr{};I4.className="Functional";ae.registerClass(I4);async function Kae(e,t){"modelTopology"in e||(e={modelTopology:e}),e=e;let n=e.modelTopology;n.model_config!=null&&(n=n.model_config);let a=$d(n),r=Sa(a,t);if(e.weightsManifest!=null){let s=await vn.loadWeights(e.weightsManifest,e.pathPrefix,r.weights.map(o=>o.originalName)),i={};for(let o of r.weights)i[o.originalName]=s[o.originalName];r.loadWeights(i),Ee(s)}return r}async function Yae(e,t){if(t==null&&(t={}),typeof e=="string"){let n=vn.getLoadHandlers(e,t);if(n.length===0)n.push(vn.browserHTTPRequest(e,t));else if(n.length>1)throw new B(`Found more than one (${n.length}) load handlers for URL '${e}'`);e=n[0]}return Zae(e,void 0,t)}async function Zae(e,t,n){if(n==null&&(n={}),e.load==null)throw new B("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");let a=await e.load(),r=a.modelTopology;r.model_config!=null&&(r=r.model_config);let s=n.strict==null?!0:n.strict,i=a.weightData!=null&&a.weightSpecs!=null&&s,o=Sa($d(r),t,i),l=a.trainingConfig;if(l!=null&&o.loadTrainingConfig(l),a.userDefinedMetadata!=null&&o.setUserDefinedMetadata(a.userDefinedMetadata),a.weightData!=null){if(a.weightSpecs==null)throw new B("LayersModel artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");let{modelWeights:d,optimizerWeights:u}=Jae(a.weightData,a.weightSpecs);o.loadWeights(d,s),o.optimizer!=null&&u.length>0&&await o.optimizer.setWeights(u),Ee(d),Ee(u.map(p=>p.tensor))}return o}function Jae(e,t){let n=vn.decodeWeights(e,t),a={},r=[];return t.forEach(s=>{s.group==="optimizer"?r.push({name:s.name,tensor:n[s.name]}):a[s.name]=n[s.name]}),{modelWeights:a,optimizerWeights:r}}var Ul=class extends dr{constructor(e){super({inputs:[],outputs:[]});if(e=e||{},this.trainable=!0,this.built=!1,this.name=e.name!=null?e.name:Vh("sequential_"),e.layers!=null)for(let t of e.layers)this.add(t)}checkShape(e){if(e.inboundNodes[0].outputTensors[0].shape.some(t=>t<0))throw new B(`Negative dimension size caused by adding layer ${e.name} with input shape [${e.inboundNodes[0].inputTensors[0].shape}]`)}add(e){let t=e instanceof Ul||e instanceof dr,n;if(t){if(n=e,n.outputs.length!==1)throw new B("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");if(n.inputs.length!==1)throw new B("All layers in a Sequential model should have a single input tensor. For multi-input layers, use the functional API.")}if(this.outputs.length===0){if(e.inboundNodes.length===0){if(e.batchInputShape==null)throw new B("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");let a=Y6({batchShape:e.batchInputShape,dtype:e.dtype,name:e.name+"_input"});e.apply(a)}if(t)this.outputs=n.outputs,this.inputs=n.inputs;else{if(e.inboundNodes.length!==1)throw new B(`A layer added to a Sequential model must not already be connected somewhere else. LayersModel received layer ${e.name} which has ${e.inboundNodes.length} pre-existing inbound connections.`);if(e.inboundNodes[0].outputTensors.length!==1)throw new B("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[e.inboundNodes[0].outputTensors[0]],this.inputs=Z6(this.outputs[0])}this.inboundNodes=[],new Hh({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:Ni(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map(a=>a.shape),outputShapes:this.outputs[0].shape})}else{let a=e.apply(this.outputs[0]);if(Array.isArray(a))throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[a],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(e),this.built=!1}pop(){if(this.layers.length===0)throw new TypeError("There are no layers in the model.");if(this.layers.pop(),this.layers.length===0)this.outputs=[],this.inboundNodes=[],this.outboundNodes=[];else{let e=this.layers.length-1;this.layers[e].outboundNodes=[],this.outputs=[this.layers[e].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}}call(e,t){return this.model==null&&this.build(),this.model.call(e,t)}build(e){if(at(e),this.inputs.length===0||this.outputs.length===0)throw new TypeError("Sequential model cannot be built: model is empty. Add some layers first.");this.model=new dr({inputs:this.inputs,outputs:this.outputs[0],name:this.name+"_model"}),this.model.trainable=this.trainable,this.supportsMasking=this.model.supportsMasking,this.inputLayers=this.model.inputLayers,this.inputLayersNodeIndices=this.model.inputLayersNodeIndices,this.inputLayersTensorIndices=this.model.inputLayersTensorIndices,this.outputLayers=this.model.outputLayers,this.outputLayersNodeIndices=this.model.outputLayersNodeIndices,this.outputLayersTensorIndices=this.model.outputLayersTensorIndices,this.nodesByDepth=this.model.nodesByDepth,this.containerNodes=this.model.containerNodes,this.outputNames=this.model.outputNames,this.inputNames=this.model.inputNames,this.built=!0}countParams(){return this.built||this.build(),super.countParams()}summary(e,t,n=console.log){this.built||this.build(),super.summary(e,t,n)}setWeights(e){this.model==null&&this.build(),this.model.setWeights(e)}evaluate(e,t,n={}){if(!this.built)throw new va("The model needs to be compiled before being used.");return this.model.evaluate(e,t,n)}async evaluateDataset(e,t){if(!this.built)throw new va("The model needs to be compiled before being used.");return this.model.evaluateDataset(e,t)}predict(e,t={}){return this.model==null&&this.build(),this.model.predict(e,t)}predictOnBatch(e){return this.model==null&&this.build(),this.model.predictOnBatch(e)}compile(e){this.build(),this.model.compile(e),this.optimizer_=this.model.optimizer,this.isOptimizerOwned=this.model.isOptimizerOwned,this.loss=this.model.loss,this.metrics=this.model.metrics,this.metricsTensors=this.model.metricsTensors,this.metricsNames=this.model.metricsNames}get optimizer(){return this.model==null?void 0:this.model.optimizer}set optimizer(e){this.model.optimizer=e}async fit(e,t,n={}){if(!this.built)throw new va("The model needs to be compiled before being used.");return this.model.fit(e,t,n)}async fitDataset(e,t){if(!this.built)throw new va("The model needs to be compiled before being used.");return this.model.fitDataset(e,t)}async trainOnBatch(e,t){return this.model.trainOnBatch(e,t)}static fromConfig(e,t,n={},a=!1){let r,s={};if(t instanceof Array){if(t[0].className==null||t[0].className==="Merge")throw new B("Legacy serialization format not supported yet.");r=t}else k.assert(t.layers!=null,()=>"When the config data for a Sequential model is not an Array, it must be an Object that contains the 'layers' field."),r=t.layers,delete t.layers,s=t;let i=new e(s);if(!(i instanceof Ul))throw new Oe(`Sequential.fromConfig called on non-Sequential input: ${i}`);for(let o of r){let l=Sa(o,void 0,a);a&&l.setFastWeightInitDuringBuild(!0),i.add(l)}return i}set stopTraining(e){if(this.model==null)throw new B("Cannot set the stopTraining property of a sequential model before it is compiled.");this.model.stopTraining=e}get stopTraining(){if(this.model==null)throw new B("Cannot get the stopTraining property of a sequential model before it is compiled.");return this.model.stopTraining}getConfig(){let e=[];for(let t of this.layers){let n={};n.className=t.getClassName(),n.config=t.getConfig(),e.push(n)}return{name:this.name,layers:e}}};Ul.className="Sequential";ae.registerClass(Ul);function Qae(e){return new dr(e)}function ere(e){return new Ul(e)}function tre(e,t){return t==null&&(t={}),Yae(e,t)}function V6(e){return Y6(e)}function nre(e,t){pa.registerCallbackConstructor(e,t)}var Tn=class extends ae.Serializable{getConfig(){return{}}},S4=class extends Tn{apply(e,t=1){return $te(e,t)}};S4.className="elu";ae.registerClass(S4);var N4=class extends Tn{apply(e){return Oc(e)}};N4.className="selu";ae.registerClass(N4);var T4=class extends Tn{apply(e){return Pa(e)}};T4.className="relu";ae.registerClass(T4);var E4=class extends Tn{apply(e){return W(()=>gl(6,Pa(e)))}};E4.className="relu6";ae.registerClass(E4);var C4=class extends Tn{apply(e){return e}};C4.className="linear";ae.registerClass(C4);var R4=class extends Tn{apply(e){return wn(e)}};R4.className="sigmoid";ae.registerClass(R4);var M4=class extends Tn{apply(e){return Ote(e)}};M4.className="hardSigmoid";ae.registerClass(M4);var F4=class extends Tn{apply(e){return hi(e)}};F4.className="softplus";ae.registerClass(F4);var $4=class extends Tn{apply(e){return Dte(e)}};$4.className="softsign";ae.registerClass($4);var D4=class extends Tn{apply(e){return di(e)}};D4.className="tanh";ae.registerClass(D4);var fy=class extends Tn{apply(e,t=-1){return nd(e,t)}};fy.className="softmax";ae.registerClass(fy);var O4=class extends Tn{apply(e,t=-1){return Ec(e,t)}};O4.className="logSoftmax";ae.registerClass(O4);var z4=class extends Tn{apply(e,t=1){return W(()=>wn(e.mul(t)).mul(e))}};z4.className="swish";ae.registerClass(z4);var _4=class extends Tn{apply(e){return W(()=>_(e,di(hi(e))))}};_4.className="mish";ae.registerClass(_4);function Hr(e){return e.getClassName()}function my(e,t={}){return Id(e,ae.SerializationMap.getMap().classNameMap,t,"activation")}function Gr(e){if(e==null){let t={};return t.className="linear",t.config={},my(t)}if(typeof e=="string"){let t={};return t.className=e,t.config={},my(t)}else return e instanceof Tn?e:my(e)}function Ay(e){if(e!=null&&typeof e!="object")throw new Error(`Argument to L1L2 regularizer's constructor is expected to be an object, but received: ${e}`)}var P4=class extends ae.Serializable{},zd=class extends P4{constructor(e){super();Ay(e),this.l1=e==null||e.l1==null?.01:e.l1,this.l2=e==null||e.l2==null?.01:e.l2,this.hasL1=this.l1!==0,this.hasL2=this.l2!==0}apply(e){return W(()=>{let t=Ct([1]);return this.hasL1&&(t=se(t,ke(_(this.l1,Ot(e))))),this.hasL2&&(t=se(t,ke(_(this.l2,Cd(e))))),t.asScalar()})}getConfig(){return{l1:this.l1,l2:this.l2}}static fromConfig(e,t){return new e({l1:t.l1,l2:t.l2})}};zd.className="L1L2";ae.registerClass(zd);function are(e){return Ay(e),new zd({l1:e!=null?e.l1:null,l2:0})}function rre(e){return Ay(e),new zd({l2:e!=null?e.l2:null,l1:0})}var L4={l1l2:"L1L2"};function ut(e){return R1(e)}function W4(e,t={}){return Id(e,ae.SerializationMap.getMap().classNameMap,t,"regularizer")}function At(e){if(e==null)return null;if(typeof e=="string"){let t={className:e in L4?L4[e]:e,config:{}};return W4(t)}else return e instanceof P4?e:W4(e)}var yy=class extends Ge{constructor(e){super(e==null?{}:e);this.supportsMasking=!0,e!=null&&(this.maxValue=e.maxValue)}call(e,t){e=_e(e);let n=Pa(e);return this.maxValue!=null&&(n=kn(n,0,this.maxValue)),n}computeOutputShape(e){return e}getConfig(){let e={maxValue:this.maxValue},t=super.getConfig();return Object.assign(e,t),e}};yy.className="ReLU";ae.registerClass(yy);var gy=class extends Ge{constructor(e){super(e==null?{}:e);this.DEFAULT_ALPHA=.3,e==null&&(e={}),this.alpha=e.alpha==null?this.DEFAULT_ALPHA:e.alpha}call(e,t){let n=_e(e);return Ku(n,this.alpha)}computeOutputShape(e){return e}getConfig(){let e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}};gy.className="LeakyReLU";ae.registerClass(gy);var xy=class extends Ge{constructor(e){super(e==null?{}:e);if(this.DEFAULT_ALPHA_INITIALIZER="zeros",e==null&&(e={}),this.supportsMasking=!0,this.alphaInitializer=mt(e.alphaInitializer||this.DEFAULT_ALPHA_INITIALIZER),this.alphaRegularizer=At(e.alphaRegularizer),this.alphaConstraint=Lt(e.alphaConstraint),e.sharedAxes==null)this.sharedAxes=null;else if(Array.isArray(e.sharedAxes))this.sharedAxes=e.sharedAxes;else if(typeof e.sharedAxes=="number")this.sharedAxes=[e.sharedAxes];else throw new B(`Expected sharedAxes to be a number or an array of numbers, but got ${e.sharedAxes}`)}build(e){e=at(e);let t=e.slice(1);if(this.sharedAxes!=null)for(let a of this.sharedAxes)t[a-1]=1;this.alpha=this.addWeight("alpha",t,"float32",this.alphaInitializer,this.alphaRegularizer,!0,this.alphaConstraint);let n={};if(this.sharedAxes!=null)for(let a=1;a(Et(t),t==="channelsFirst"?Ze(e,[0,2,3,1]):e))}function B4(e,t){return W(()=>(Et(t),t==="channelsFirst"?Ze(e,[0,2,3,4,1]):e))}function sre(e,t,n,a=1,r="valid",s,i=1){return W(()=>{if(s==null&&(s=ba()),Et(s),e.shape.length!==3)throw new B(`The input of a conv1dWithBias operation should be 3, but is ${e.shape.length} instead.`);if(t.shape.length!==3)throw new B(`The kernel for a conv1dWithBias operation should be 3, but is ${t.shape.length} instead`);if(n!=null&&n.shape.length!==1)throw new B(`The bias for a conv1dWithBias operation should be 1, but is ${t.shape.length} instead`);if(s==="channelsFirst"&&(e=Ze(e,[0,2,1])),r==="causal")throw new Oe("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");let o=bc(e,t,a,r==="same"?"same":"valid","NWC",i);return n!=null&&(o=ka(o,n)),o})}function V4(e,t,n,a=[1,1],r="valid",s,i,o=null){return W(()=>{if(s==null&&(s=ba()),Et(s),e.rank!==3&&e.rank!==4)throw new B(`conv2dWithBiasActivation expects input to be of rank 3 or 4, but received ${e.rank}.`);if(t.rank!==3&&t.rank!==4)throw new B(`conv2dWithBiasActivation expects kernel to be of rank 3 or 4, but received ${e.rank}.`);let l=ky(e,s);if(r==="causal")throw new Oe("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return l=zr.conv2d({x:l,filter:t,strides:a,pad:r==="same"?"same":"valid",dilations:i,dataFormat:"NHWC",bias:n,activation:o}),s==="channelsFirst"&&(l=Ze(l,[0,3,1,2])),l})}function ire(e,t,n,a=[1,1,1],r="valid",s,i){return W(()=>{if(s==null&&(s=ba()),Et(s),e.rank!==4&&e.rank!==5)throw new B(`conv3dWithBias expects input to be of rank 4 or 5, but received ${e.rank}.`);if(t.rank!==4&&t.rank!==5)throw new B(`conv3dWithBias expects kernel to be of rank 4 or 5, but received ${e.rank}.`);let o=B4(e,s);if(r==="causal")throw new Oe("The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.");return o=pA(o,t,a,r==="same"?"same":"valid","NDHWC",i),n!=null&&(o=ka(o,n)),s==="channelsFirst"&&(o=Ze(o,[0,4,1,2,3])),o})}var Iy=class extends Ge{constructor(e,t){super(t);if(this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",Iy.verifyArgs(t),this.rank=e,Ht(this.rank,"rank"),this.rank!==1&&this.rank!==2&&this.rank!==3)throw new Oe(`Convolution layer for rank other than 1, 2, or 3 (${this.rank}) is not implemented yet.`);if(this.kernelSize=Hl(t.kernelSize,e,"kernelSize"),this.strides=Hl(t.strides==null?1:t.strides,e,"strides"),this.padding=t.padding==null?"valid":t.padding,Jn(this.padding),this.dataFormat=t.dataFormat==null?"channelsLast":t.dataFormat,Et(this.dataFormat),this.activation=Gr(t.activation),this.useBias=t.useBias==null?!0:t.useBias,this.biasInitializer=mt(t.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.biasConstraint=Lt(t.biasConstraint),this.biasRegularizer=At(t.biasRegularizer),this.activityRegularizer=At(t.activityRegularizer),this.dilationRate=Hl(t.dilationRate==null?1:t.dilationRate,e,"dilationRate"),this.rank===1&&Array.isArray(this.dilationRate)&&this.dilationRate.length!==1)throw new B(`dilationRate must be a number or an array of a single number for 1D convolution, but received ${JSON.stringify(this.dilationRate)}`);if(this.rank===2){if(typeof this.dilationRate=="number")this.dilationRate=[this.dilationRate,this.dilationRate];else if(this.dilationRate.length!==2)throw new B(`dilationRate must be a number or array of two numbers for 2D convolution, but received ${JSON.stringify(this.dilationRate)}`)}else if(this.rank===3){if(typeof this.dilationRate=="number")this.dilationRate=[this.dilationRate,this.dilationRate,this.dilationRate];else if(this.dilationRate.length!==3)throw new B(`dilationRate must be a number or array of three numbers for 3D convolution, but received ${JSON.stringify(this.dilationRate)}`)}}static verifyArgs(e){if(Va("kernelSize"in e,"required key 'kernelSize' not in config"),typeof e.kernelSize!="number"&&!F1(e.kernelSize,"number",1,3))throw new B(`BaseConv expects config.kernelSize to be number or number[] with length 1, 2, or 3, but received ${JSON.stringify(e.kernelSize)}.`)}getConfig(){let e={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:Hr(this.activation),useBias:this.useBias,biasInitializer:kt(this.biasInitializer),biasRegularizer:ut(this.biasRegularizer),activityRegularizer:ut(this.activityRegularizer),biasConstraint:Pt(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}},_d=class extends Iy{constructor(e,t){super(e,t);this.kernel=null,_d.verifyArgs(t),this.filters=t.filters,Ht(this.filters,"filters"),this.kernelInitializer=mt(t.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.kernelConstraint=Lt(t.kernelConstraint),this.kernelRegularizer=At(t.kernelRegularizer)}build(e){e=at(e);let t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new B(`The channel dimension of the input should be defined. Found ${e[t]}`);let n=e[t],a=this.kernelSize.concat([n,this.filters]);this.kernel=this.addWeight("kernel",a,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[{ndim:this.rank+2,axes:{[t]:n}}],this.built=!0}call(e,t){return W(()=>{e=_e(e);let n,a=this.bias==null?null:this.bias.read(),r=N6(this.activation.getClassName());if(r!=null&&this.rank===2)n=V4(e,this.kernel.read(),a,this.strides,this.padding,this.dataFormat,this.dilationRate,r);else{if(this.rank===1)n=sre(e,this.kernel.read(),a,this.strides[0],this.padding,this.dataFormat,this.dilationRate[0]);else if(this.rank===2)n=V4(e,this.kernel.read(),a,this.strides,this.padding,this.dataFormat,this.dilationRate);else if(this.rank===3)n=ire(e,this.kernel.read(),a,this.strides,this.padding,this.dataFormat,this.dilationRate);else throw new Oe("convolutions greater than 3D are not implemented yet.");this.activation!=null&&(n=this.activation.apply(n))}return n})}computeOutputShape(e){e=at(e);let t=[],n=this.dataFormat==="channelsLast"?e.slice(1,e.length-1):e.slice(2);for(let r=0;r 0 but got ${JSON.stringify(e.filters)}`)}},Pd=class extends _d{constructor(e){super(2,e);Pd.verifyArgs(e)}getConfig(){let e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!F1(e.kernelSize,"number",1,2))throw new B(`Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received ${JSON.stringify(e.kernelSize)}.`)}};Pd.className="Conv2D";ae.registerClass(Pd);var Ld=class extends _d{constructor(e){super(3,e);Ld.verifyArgs(e)}getConfig(){let e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!(Array.isArray(e.kernelSize)&&(e.kernelSize.length===1||e.kernelSize.length===3)))throw new B(`Conv3D expects config.kernelSize to be number or [number, number, number], but received ${JSON.stringify(e.kernelSize)}.`)}};Ld.className="Conv3D";ae.registerClass(Ld);var Sy=class extends Pd{constructor(e){super(e);if(this.inputSpec=[new Mt({ndim:4})],this.padding!=="same"&&this.padding!=="valid")throw new B(`Conv2DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(e=at(e),e.length!==4)throw new B("Input should have rank 4; Received input shape: "+JSON.stringify(e));let t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new B("The channel dimension of the inputs should be defined. Found `None`.");let n=e[t],a=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",a,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new Mt({ndim:4,axes:{[t]:n}})],this.built=!0}call(e,t){return W(()=>{let n=_e(e);if(n.shape.length!==4)throw new B(`Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${n.shape.length}`);let a=n.shape,r=a[0],s,i;this.dataFormat==="channelsFirst"?(s=2,i=3):(s=1,i=2);let o=a[s],l=a[i],d=this.kernelSize[0],u=this.kernelSize[1],p=this.strides[0],c=this.strides[1],h=Ga(o,p,d,this.padding),m=Ga(l,c,u,this.padding),f=[r,h,m,this.filters];this.dataFormat!=="channelsLast"&&(n=Ze(n,[0,2,3,1]));let A=vc(n,this.kernel.read(),f,this.strides,this.padding);return this.dataFormat!=="channelsLast"&&(A=Ze(A,[0,3,1,2])),this.bias!=null&&(A=ka(A,this.bias.read(),this.dataFormat)),this.activation!=null&&(A=this.activation.apply(A)),A})}computeOutputShape(e){e=at(e);let t=e.slice(),n,a,r;this.dataFormat==="channelsFirst"?(n=1,a=2,r=3):(n=3,a=1,r=2);let s=this.kernelSize[0],i=this.kernelSize[1],o=this.strides[0],l=this.strides[1];return t[n]=this.filters,t[a]=Ga(t[a],o,s,this.padding),t[r]=Ga(t[r],l,i,this.padding),t}getConfig(){let e=super.getConfig();return delete e.dilationRate,e}};Sy.className="Conv2DTranspose";ae.registerClass(Sy);var Ny=class extends Ld{constructor(e){super(e);if(this.inputSpec=[new Mt({ndim:5})],this.padding!=="same"&&this.padding!=="valid")throw new B(`Conv3DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(e=at(e),e.length!==5)throw new B("Input should have rank 5; Received input shape: "+JSON.stringify(e));let t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new B("The channel dimension of the inputs should be defined. Found `None`.");let n=e[t],a=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",a,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new Mt({ndim:5,axes:{[t]:n}})],this.built=!0}call(e,t){return W(()=>{let n=_e(e);if(n.shape.length!==5)throw new B(`Conv3DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${n.shape.length}`);let a=n.shape,r=a[0],s,i,o;this.dataFormat==="channelsFirst"?(o=2,s=3,i=4):(o=1,s=2,i=3);let l=a[o],d=a[s],u=a[i],p=this.kernelSize[0],c=this.kernelSize[1],h=this.kernelSize[2],m=this.strides[0],f=this.strides[1],A=this.strides[2],y=Ga(l,m,p,this.padding),g=Ga(d,f,c,this.padding),x=Ga(u,A,h,this.padding),w=[r,y,g,x,this.filters];this.dataFormat!=="channelsLast"&&(n=Ze(n,[0,2,3,4,1]));let b=Ob(n,this.kernel.read(),w,this.strides,this.padding);return this.dataFormat!=="channelsLast"&&(b=Ze(b,[0,4,1,2,3])),this.bias!==null&&(b=ka(b,this.bias.read(),this.dataFormat)),this.activation!==null&&(b=this.activation.apply(b)),b})}computeOutputShape(e){e=at(e);let t=e.slice(),n,a,r,s;this.dataFormat==="channelsFirst"?(n=1,a=2,r=3,s=4):(n=4,a=1,r=2,s=3);let i=this.kernelSize[0],o=this.kernelSize[1],l=this.kernelSize[2],d=this.strides[0],u=this.strides[1],p=this.strides[2];return t[n]=this.filters,t[a]=Ga(t[a],d,i,this.padding),t[r]=Ga(t[r],u,o,this.padding),t[s]=Ga(t[s],p,l,this.padding),t}getConfig(){let e=super.getConfig();return delete e.dilationRate,e}};Ny.className="Conv3DTranspose";ae.registerClass(Ny);var j4=class extends _d{constructor(e,t){super(e,t);if(this.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",this.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",this.depthwiseKernel=null,this.pointwiseKernel=null,t.filters==null)throw new B("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(t.kernelInitializer!=null||t.kernelRegularizer!=null||t.kernelConstraint!=null)throw new B("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(t.padding!=null&&t.padding!=="same"&&t.padding!=="valid")throw new B(`SeparableConv${this.rank}D supports only padding modes: 'same' and 'valid', but received ${JSON.stringify(t.padding)}`);this.depthMultiplier=t.depthMultiplier==null?1:t.depthMultiplier,this.depthwiseInitializer=mt(t.depthwiseInitializer||this.DEFAULT_DEPTHWISE_INITIALIZER),this.depthwiseRegularizer=At(t.depthwiseRegularizer),this.depthwiseConstraint=Lt(t.depthwiseConstraint),this.pointwiseInitializer=mt(t.depthwiseInitializer||this.DEFAULT_POINTWISE_INITIALIZER),this.pointwiseRegularizer=At(t.pointwiseRegularizer),this.pointwiseConstraint=Lt(t.pointwiseConstraint)}build(e){if(e=at(e),e.length{e=_e(e);let n;if(this.rank===1)throw new Oe("1D separable convolution is not implemented yet.");return this.rank===2&&(this.dataFormat==="channelsFirst"&&(e=Ze(e,[0,2,3,1])),n=CA(e,this.depthwiseKernel.read(),this.pointwiseKernel.read(),this.strides,this.padding,this.dilationRate,"NHWC")),this.useBias&&(n=ka(n,this.bias.read(),this.dataFormat)),this.activation!=null&&(n=this.activation.apply(n)),this.dataFormat==="channelsFirst"&&(n=Ze(n,[0,3,1,2])),n})}getConfig(){let e=super.getConfig();return delete e.rank,delete e.kernelInitializer,delete e.kernelRegularizer,delete e.kernelConstraint,e.depthwiseInitializer=kt(this.depthwiseInitializer),e.pointwiseInitializer=kt(this.pointwiseInitializer),e.depthwiseRegularizer=ut(this.depthwiseRegularizer),e.pointwiseRegularizer=ut(this.pointwiseRegularizer),e.depthwiseConstraint=Pt(this.depthwiseConstraint),e.pointwiseConstraint=Pt(this.pointwiseConstraint),e}};j4.className="SeparableConv";var Ty=class extends j4{constructor(e){super(2,e)}};Ty.className="SeparableConv2D";ae.registerClass(Ty);var e0=class extends _d{constructor(e){super(1,e);e0.verifyArgs(e),this.inputSpec=[{ndim:3}]}getConfig(){let e=super.getConfig();return delete e.rank,delete e.dataFormat,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!F1(e.kernelSize,"number",1,1))throw new B(`Conv1D expects config.kernelSize to be number or number[] with length 1, but received ${JSON.stringify(e.kernelSize)}.`)}};e0.className="Conv1D";ae.registerClass(e0);var Ey=class extends Ge{constructor(e){super(e);typeof e.cropping=="number"?this.cropping=[[e.cropping,e.cropping],[e.cropping,e.cropping]]:typeof e.cropping[0]=="number"?this.cropping=[[e.cropping[0],e.cropping[0]],[e.cropping[1],e.cropping[1]]]:this.cropping=e.cropping,this.dataFormat=e.dataFormat===void 0?"channelsLast":e.dataFormat,this.inputSpec=[{ndim:4}]}computeOutputShape(e){return this.dataFormat==="channelsFirst"?[e[0],e[1],e[2]-this.cropping[0][0]-this.cropping[0][1],e[3]-this.cropping[1][0]-this.cropping[1][1]]:[e[0],e[1]-this.cropping[0][0]-this.cropping[0][1],e[2]-this.cropping[1][0]-this.cropping[1][1],e[3]]}call(e,t){return W(()=>{if(e=_e(e),this.dataFormat==="channelsLast"){let n=Fh(e,this.cropping[0][0],e.shape[1]-this.cropping[0][0]-this.cropping[0][1],2);return Fh(n,this.cropping[1][0],e.shape[2]-this.cropping[1][1]-this.cropping[1][0],3)}else{let n=Fh(e,this.cropping[0][0],e.shape[2]-this.cropping[0][0]-this.cropping[0][1],3);return Fh(n,this.cropping[1][0],e.shape[3]-this.cropping[1][1]-this.cropping[1][0],4)}})}getConfig(){let e={cropping:this.cropping,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}};Ey.className="Cropping2D";ae.registerClass(Ey);var Cy=class extends Ge{constructor(e){super(e);this.DEFAULT_SIZE=[2,2],this.inputSpec=[{ndim:4}],this.size=e.size==null?this.DEFAULT_SIZE:e.size,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Et(this.dataFormat),this.interpolation=e.interpolation==null?"nearest":e.interpolation,Nte(this.interpolation)}computeOutputShape(e){if(this.dataFormat==="channelsFirst"){let t=e[2]==null?null:this.size[0]*e[2],n=e[3]==null?null:this.size[1]*e[3];return[e[0],e[1],t,n]}else{let t=e[1]==null?null:this.size[0]*e[1],n=e[2]==null?null:this.size[1]*e[2];return[e[0],t,n,e[3]]}}call(e,t){return W(()=>{let n=_e(e),a=n.shape;if(this.dataFormat==="channelsFirst"){n=Ze(n,[0,2,3,1]);let r=this.size[0]*a[2],s=this.size[1]*a[3],i=this.interpolation==="nearest"?n.resizeNearestNeighbor([r,s]):n.resizeBilinear([r,s]);return Ze(i,[0,3,1,2])}else{let r=this.size[0]*a[1],s=this.size[1]*a[2];return this.interpolation==="nearest"?n.resizeNearestNeighbor([r,s]):n.resizeBilinear([r,s])}})}getConfig(){let e={size:this.size,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}};Cy.className="UpSampling2D";ae.registerClass(Cy);function ore(e,t,n=[1,1],a="valid",r,s){return W(()=>{r==null&&(r=ba()),Et(r);let i=ky(e,r);if(e.rank!==4)throw new B(`Input for depthwiseConv2d is required to be 4-D, but is instead ${e.rank}-D`);if(t.rank!==4)throw new B(`depthwiseKernel is required to be 4-D, but is instead ${t.rank}-D`);return i=hl(i,t,n,a==="same"?"same":"valid","NHWC",s),r==="channelsFirst"&&(i=Ze(i,[0,3,1,2])),i})}var Ry=class extends Iy{constructor(e){super(2,e);this.depthwiseKernel=null,this.depthMultiplier=e.depthMultiplier==null?1:e.depthMultiplier,this.depthwiseInitializer=mt(e.depthwiseInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.depthwiseConstraint=Lt(e.depthwiseConstraint),this.depthwiseRegularizer=At(e.depthwiseRegularizer)}build(e){if(e=at(e),e.length<4)throw new B(`Inputs to DepthwiseConv2D should have rank 4. Received input shape: ${JSON.stringify(e)}.`);let t=this.dataFormat==="channelsFirst"?1:3;if(e[t]==null||e[t]<0)throw new B(`The channel dimension of the inputs to DepthwiseConv2D should be defined, but is not (${e[t]}).`);let n=e[t],a=[this.kernelSize[0],this.kernelSize[1],n,this.depthMultiplier];this.depthwiseKernel=this.addWeight("depthwise_kernel",a,null,this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[n*this.depthMultiplier],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return W(()=>{e=_e(e);let n=ore(e,this.depthwiseKernel.read(),this.strides,this.padding,this.dataFormat,null);return this.useBias&&(n=ka(n,this.bias.read(),this.dataFormat)),this.activation!=null&&(n=this.activation.apply(n)),n})}computeOutputShape(e){e=at(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],n=this.dataFormat==="channelsFirst"?e[3]:e[2],a=this.dataFormat==="channelsFirst"?e[1]*this.depthMultiplier:e[3]*this.depthMultiplier,r=Na(t,this.kernelSize[0],this.padding,this.strides[0]),s=Na(n,this.kernelSize[1],this.padding,this.strides[1]);return this.dataFormat==="channelsFirst"?[e[0],a,r,s]:[e[0],r,s,a]}getConfig(){let e=super.getConfig();return e.depthMultiplier=this.depthMultiplier,e.depthwiseInitializer=kt(this.depthwiseInitializer),e.depthwiseRegularizer=ut(this.depthwiseRegularizer),e.depthwiseConstraint=Pt(this.depthwiseRegularizer),e}};Ry.className="DepthwiseConv2D";ae.registerClass(Ry);function U4(e,t,n,a){if(Array.isArray(e)){if(t!=null||n!=null)throw new B("When inputs is an array, neither initialState or constants should be provided");a!=null&&(n=e.slice(e.length-a,e.length),e=e.slice(0,e.length-a)),e.length>1&&(t=e.slice(1,e.length)),e=e[0]}function r(s){return s==null||Array.isArray(s)?s:[s]}return t=r(t),n=r(n),{inputs:e,initialState:t,constants:n}}function H4(e,t,n,a=!1,r,s,i=!1,o=!1){return W(()=>{let l=t.shape.length;if(l<3)throw new B(`Input should be at least 3D, but is ${l}D.`);let d=[1,0].concat(wa(2,l));if(t=Ze(t,d),s!=null)throw new Oe("The rnn() functoin of the deeplearn.js backend does not support constants yet.");i&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),r!=null&&(r=r.asType("bool").asType("float32"),r.rank===l-1&&(r=ln(r,-1)),r=Ze(r,d)),a&&(t=On(t,0),r!=null&&(r=On(r,0)));let u=[],p,c=n,h=t.shape[0],m=la(t),f;r!=null&&(f=la(r));for(let y=0;ye(g,c));if(r==null)p=x[0],c=x[1];else{let w=W(()=>{let b=f[y],v=Dn(b).sub(b),N=x[0].mul(b).add(c[0].mul(v)),T=c.map((R,$)=>x[1][$].mul(b).add(R.mul(v)));return{output:N,newStates:T}});p=w.output,c=w.newStates}o&&u.push(p)}let A;return o&&(A=zn(u,1)),[p,A,c]})}var Ua=class extends Ge{constructor(e){super(e);let t;if(e.cell==null)throw new B("cell property is missing for the constructor of RNN.");if(Array.isArray(e.cell)?t=new t0({cells:e.cell}):t=e.cell,t.stateSize==null)throw new B("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");this.cell=t,this.returnSequences=e.returnSequences==null?!1:e.returnSequences,this.returnState=e.returnState==null?!1:e.returnState,this.goBackwards=e.goBackwards==null?!1:e.goBackwards,this._stateful=e.stateful==null?!1:e.stateful,this.unroll=e.unroll==null?!1:e.unroll,this.supportsMasking=!0,this.inputSpec=[new Mt({ndim:3})],this.stateSpec=null,this.states_=null,this.numConstants=null,this.keptStates=[]}getStates(){if(this.states_==null){let e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;return wa(0,e).map(t=>null)}else return this.states_}setStates(e){this.states_=e}computeOutputShape(e){J1(e)&&(e=e[0]),e=e;let t=this.cell.stateSize;Array.isArray(t)||(t=[t]);let n=t[0],a;if(this.returnSequences?a=[e[0],e[1],n]:a=[e[0],n],this.returnState){let r=[];for(let s of t)r.push([e[0],s]);return[a].concat(r)}else return a}computeMask(e,t){return W(()=>{Array.isArray(t)&&(t=t[0]);let n=this.returnSequences?t:null;if(this.returnState){let a=this.states.map(r=>null);return[n].concat(a)}else return n})}get states(){if(this.states_==null){let e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,t=[];for(let n=0;ni.shape[i.shape.length-1]),s))throw new B(`An initialState was passed that is not compatible with cell.stateSize. Received stateSpec=${this.stateSpec}; However cell.stateSize is ${this.cell.stateSize}`)}else this.stateSpec=s.map(i=>new Mt({shape:[null,i]}));this.stateful&&this.resetStates()}resetStates(e,t=!1){W(()=>{if(!this.stateful)throw new lr("Cannot call resetStates() on an RNN Layer that is not stateful.");let n=this.inputSpec[0].shape[0];if(n==null)throw new B("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.states_==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(a=>Ct([n,a])):this.states_=[Ct([n,this.cell.stateSize])];else if(e==null)Ee(this.states_),this.keptStates!=null&&(Ee(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(a=>Ct([n,a])):this.states_[0]=Ct([n,this.cell.stateSize]);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new B(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);t===!0?this.keptStates.push(this.states_.slice()):Ee(this.states_);for(let a=0;ajt(a.clone()))})}apply(e,t){let n=t==null?null:t.initialState,a=t==null?null:t.constants;t==null&&(t={});let r=U4(e,n,a,this.numConstants);e=r.inputs,n=r.initialState,a=r.constants;let s=[],i=[];if(n!=null){t.initialState=n,s=s.concat(n),this.stateSpec=[];for(let o of n)this.stateSpec.push(new Mt({shape:o.shape}));i=i.concat(this.stateSpec)}if(a!=null&&(t.constants=a,s=s.concat(a),this.numConstants=a.length),s[0]instanceof Ia){let o=[e].concat(s),l=this.inputSpec.concat(i),d=this.inputSpec;this.inputSpec=l;let u=super.apply(o,t);return this.inputSpec=d,u}else return super.apply(e,t)}call(e,t){return W(()=>{let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;e=_e(e),r==null&&(this.stateful?r=this.states_:r=this.getInitialState(e));let s=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;if(r.length!==s)throw new B(`RNN Layer has ${s} state(s) but was passed ${r.length} initial state(s).`);this.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");let i={training:a},o=H4((c,h)=>{let m=this.cell.call([c].concat(h),i);return[m[0],m.slice(1)]},e,r,this.goBackwards,n,null,this.unroll,this.returnSequences),l=o[0],d=o[1],u=o[2];this.stateful&&this.resetStates(u,a);let p=this.returnSequences?d:l;return this.returnState?[p].concat(u):p})}getInitialState(e){return W(()=>{let t=Ct(e.shape);return t=ke(t,[1,2]),t=Ed(t),Array.isArray(this.cell.stateSize)?this.cell.stateSize.map(n=>n>1?P1(t,[1,n]):t):this.cell.stateSize>1?[P1(t,[1,this.cell.stateSize])]:[t]})}get trainableWeights(){return this.trainable?this.cell.trainableWeights:[]}get nonTrainableWeights(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.cell!=null&&this.cell.setFastWeightInitDuringBuild(e)}getConfig(){let e=super.getConfig(),t={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};this.numConstants!=null&&(t.numConstants=this.numConstants);let n=this.cell.getConfig();return this.getClassName()===Ua.className&&(t.cell={className:this.cell.getClassName(),config:n}),Object.assign({},n,e,t)}static fromConfig(e,t,n={}){let a=t.cell,r=Sa(a,n);return new e(Object.assign(t,{cell:r}))}};Ua.className="RNN";ae.registerClass(Ua);var Md=class extends Ge{},n0=class extends Md{constructor(e){super(e);this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,Ht(this.units,"units"),this.activation=Gr(e.activation==null?this.DEFAULT_ACTIVATION:e.activation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=mt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=mt(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=mt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=At(e.kernelRegularizer),this.recurrentRegularizer=At(e.recurrentRegularizer),this.biasRegularizer=At(e.biasRegularizer),this.kernelConstraint=Lt(e.kernelConstraint),this.recurrentConstraint=Lt(e.recurrentConstraint),this.biasConstraint=Lt(e.biasConstraint),this.dropout=Wl([1,jr([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=Wl([1,jr([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=at(e),this.kernel=this.addWeight("kernel",[e[e.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return W(()=>{if(e=e,e.length!==2)throw new B(`SimpleRNNCell expects 2 input Tensors, got ${e.length}.`);let n=e[1];e=e[0];let a=t.training==null?!1:t.training;0Dn(e),rate:this.dropout,training:a})),0Dn(n),rate:this.recurrentDropout,training:a}));let r,s=this.dropoutMask,i=this.recurrentDropoutMask;s!=null?r=ja(_(e,s),this.kernel.read()):r=ja(e,this.kernel.read()),this.bias!=null&&(r=ka(r,this.bias.read())),i!=null&&(n=_(n,i));let o=se(r,ja(n,this.recurrentKernel.read()));return this.activation!=null&&(o=this.activation.apply(o)),[o,o]})}getConfig(){let e=super.getConfig(),t={units:this.units,activation:Hr(this.activation),useBias:this.useBias,kernelInitializer:kt(this.kernelInitializer),recurrentInitializer:kt(this.recurrentInitializer),biasInitializer:kt(this.biasInitializer),kernelRegularizer:ut(this.kernelRegularizer),recurrentRegularizer:ut(this.recurrentRegularizer),biasRegularizer:ut(this.biasRegularizer),activityRegularizer:ut(this.activityRegularizer),kernelConstraint:Pt(this.kernelConstraint),recurrentConstraint:Pt(this.recurrentConstraint),biasConstraint:Pt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout};return Object.assign({},e,t)}};n0.className="SimpleRNNCell";ae.registerClass(n0);var My=class extends Ua{constructor(e){e.cell=new n0(e),super(e)}call(e,t){return W(()=>{this.cell.dropoutMask!=null&&(Ee(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Ee(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}static fromConfig(e,t){return new e(t)}};My.className="SimpleRNN";ae.registerClass(My);var a0=class extends Md{constructor(e){super(e);if(this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.resetAfter)throw new B("GRUCell does not support reset_after parameter set to true.");this.units=e.units,Ht(this.units,"units"),this.activation=Gr(e.activation===void 0?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=Gr(e.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=mt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=mt(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=mt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=At(e.kernelRegularizer),this.recurrentRegularizer=At(e.recurrentRegularizer),this.biasRegularizer=At(e.biasRegularizer),this.kernelConstraint=Lt(e.kernelConstraint),this.recurrentConstraint=Lt(e.recurrentConstraint),this.biasConstraint=Lt(e.biasConstraint),this.dropout=Wl([1,jr([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=Wl([1,jr([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.implementation=e.implementation,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=at(e);let t=e[e.length-1];this.kernel=this.addWeight("kernel",[t,this.units*3],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*3],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units*3],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return W(()=>{if(e=e,e.length!==2)throw new B(`GRUCell expects 2 input Tensors (inputs, h, c), got ${e.length}.`);let n=t.training==null?!1:t.training,a=e[1];e=e[0],0Dn(e),rate:this.dropout,training:n,count:3})),0Dn(a),rate:this.recurrentDropout,training:n,count:3}));let r=this.dropoutMask,s=this.recurrentDropoutMask,i,o,l;0{this.cell.dropoutMask!=null&&(Ee(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Ee(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}static fromConfig(e,t){return t.implmentation===0&&(t.implementation=1),new e(t)}};Fy.className="GRU";ae.registerClass(Fy);var Wd=class extends Md{constructor(e){super(e);this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,Ht(this.units,"units"),this.activation=Gr(e.activation===void 0?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=Gr(e.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=mt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=mt(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=mt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.unitForgetBias=e.unitForgetBias,this.kernelRegularizer=At(e.kernelRegularizer),this.recurrentRegularizer=At(e.recurrentRegularizer),this.biasRegularizer=At(e.biasRegularizer),this.kernelConstraint=Lt(e.kernelConstraint),this.recurrentConstraint=Lt(e.recurrentConstraint),this.biasConstraint=Lt(e.biasConstraint),this.dropout=Wl([1,jr([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=Wl([1,jr([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.implementation=e.implementation,this.stateSize=[this.units,this.units],this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){var t;e=at(e);let n=e[e.length-1];this.kernel=this.addWeight("kernel",[n,this.units*4],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*4],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint);let a;if(this.useBias){if(this.unitForgetBias){let r=this.biasInitializer,s=this.units;a=new(t=class extends da{apply(i,o){let l=r.apply([s]),d=new Dh().apply([s]),u=r.apply([s*2]);return z6(z6(l,d),u)}},t.className="CustomInit",t)}else a=this.biasInitializer;this.bias=this.addWeight("bias",[this.units*4],null,a,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0}call(e,t){return W(()=>{let n=t.training==null?!1:t.training;if(e=e,e.length!==3)throw new B(`LSTMCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);let a=e[1],r=e[2];e=e[0],0Dn(e),rate:this.dropout,training:n,count:4})),0Dn(a),rate:this.recurrentDropout,training:n,count:4}));let s=this.dropoutMask,i=this.recurrentDropoutMask,o,l,d,u;0{this.cell.dropoutMask!=null&&(Ee(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Ee(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}static fromConfig(e,t){return t.implmentation===0&&(t.implementation=1),new e(t)}};$y.className="LSTM";ae.registerClass($y);var t0=class extends Md{constructor(e){super(e);this.cells=e.cells}get stateSize(){let e=[];for(let t of this.cells.slice().reverse())Array.isArray(t.stateSize)?e.push(...t.stateSize):e.push(t.stateSize);return e}call(e,t){return W(()=>{e=e;let n=e.slice(1),a=[];for(let i of this.cells.slice().reverse())Array.isArray(i.stateSize)?a.push(n.splice(0,i.stateSize.length)):a.push(n.splice(0,1));a.reverse();let r=[],s;for(let i=0;i{Ci(`RNNCell_${a}`,()=>{n.build(e),Array.isArray(n.stateSize)?t=n.stateSize[0]:t=n.stateSize,e=[e[0],t]})}),this.built=!0}getConfig(){let e=super.getConfig(),t=a=>({className:a.getClassName(),config:a.getConfig()}),n={cells:this.cells.map(t)};return Object.assign({},e,n)}static fromConfig(e,t,n={}){let a=[];for(let r of t.cells)a.push(Sa(r,n));return new e({cells:a})}get trainableWeights(){if(!this.trainable)return[];let e=[];for(let t of this.cells)e.push(...t.trainableWeights);return e}get nonTrainableWeights(){let e=[];for(let t of this.cells)e.push(...t.nonTrainableWeights);if(!this.trainable){let t=[];for(let n of this.cells)t.push(...n.trainableWeights);return t.concat(e)}return e}getWeights(){let e=[];for(let t of this.cells)e.push(...t.weights);return Q1(e)}setWeights(e){let t=[];for(let n of this.cells){let a=n.weights.length,r=e.splice(a);for(let s=0;sP6(t(),n),i=()=>Rd(s,t,a);return!r||r<=1?jt(i().clone()):Array(r).fill(void 0).map(i).map(o=>jt(o.clone()))}var lre=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(e);r{if(this.cell.dropoutMask!=null&&(Ee(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Ee(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null),t&&t.constants)throw new B("ConvRNN2D cell does not support constants");let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}computeOutputShape(e){let t=this.computeSingleOutputShape(e);return this.returnSequences||(t=[t[0],...t.slice(2)]),this.returnState&&(t=[t,...Array(2).fill([e[0],...t.slice(-3)])]),t}getInitialState(e){return W(()=>{let{stateSize:t}=this.cell,n=e.shape,a=this.computeSingleOutputShape(n),r=[a[0],...a.slice(2)],s=Ct(r);return Array.isArray(t)?Array(t.length).fill(s):[s]})}resetStates(e,t=!1){W(()=>{if(!this.stateful)throw new lr("Cannot call resetStates() on an RNN Layer that is not stateful.");let n=this.inputSpec[0].shape,a=this.computeSingleOutputShape(n),r=[a[0],...a.slice(2)];if(n[0]==null)throw new B("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.getStates()==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>Ct(r)):this.states_=[Ct(r)];else if(e==null)Ee(this.states_),this.keptStates!=null&&(Ee(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>Ct(r)):this.states_[0]=Ct(r);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new B(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);t?this.keptStates.push(this.states_.slice()):Ee(this.states_);for(let s=0;sjt(s.clone()))})}computeSingleOutputShape(e){let{dataFormat:t,filters:n,kernelSize:a,padding:r,strides:s,dilationRate:i}=this.cell,o=t==="channelsFirst",l=e[o?3:2],d=e[o?4:3],u=Na(l,a[0],r,s[0],i[0]),p=Na(d,a[1],r,s[1],i[1]);return[...e.slice(0,2),...o?[n,u,p]:[u,p,n]]}};G4.className="ConvRNN2D";var r0=class extends Wd{constructor(e){let{filters:t,kernelSize:n,strides:a,padding:r,dataFormat:s,dilationRate:i}=e;super(Object.assign({},e,{units:t}));this.filters=t,Ht(this.filters,"filters"),this.kernelSize=Hl(n,2,"kernelSize"),this.kernelSize.forEach(o=>Ht(o,"kernelSize")),this.strides=Hl(a||1,2,"strides"),this.strides.forEach(o=>Ht(o,"strides")),this.padding=r||"valid",Jn(this.padding),this.dataFormat=s||"channelsLast",Et(this.dataFormat),this.dilationRate=Hl(i||1,2,"dilationRate"),this.dilationRate.forEach(o=>Ht(o,"dilationRate"))}build(e){var t;e=at(e);let n=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[n]==null)throw new B(`The channel dimension of the input should be defined. Found ${e[n]}`);let a=e[n],r=4,s=this.kernelSize.concat([a,this.filters*r]);this.kernel=this.addWeight("kernel",s,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint);let i=this.kernelSize.concat([this.filters,this.filters*r]);if(this.recurrentKernel=this.addWeight("recurrent_kernel",i,null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){let o;if(this.unitForgetBias){let l=this.biasInitializer,d=this.filters;o=new(t=class extends da{apply(u,p){let c=l.apply([d]),h=$n([d]),m=l.apply([d*2]);return W1([c,h,m])}},t.className="CustomInit",t)}else o=this.biasInitializer;this.bias=this.addWeight("bias",[this.filters*r],null,o,this.biasRegularizer,!0,this.biasConstraint)}this.built=!0}call(e,t){return W(()=>{if(e.length!==3)throw new B(`ConvLSTM2DCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);let n=t.training||!1,a=e[0],r=e[1],s=e[2],i=4;0Dn(a),rate:this.dropout,training:n,count:i}));let o=this.dropoutMask,l=(Y,re,ne)=>!re||!re[ne]?Y:_(re[ne],Y),d=l(a,o,0),u=l(a,o,1),p=l(a,o,2),c=l(a,o,3);0Dn(r),rate:this.recurrentDropout,training:n,count:i}));let h=this.recurrentDropoutMask,m=l(r,h,0),f=l(r,h,1),A=l(r,h,2),y=l(r,h,3),g=3,[x,w,b,v]=an(this.kernel.read(),i,g),[N,T,R,$]=this.useBias?an(this.bias.read(),i):[null,null,null,null];d=this.inputConv(d,x,N,this.padding),u=this.inputConv(u,w,T,this.padding),p=this.inputConv(p,b,R,this.padding),c=this.inputConv(c,v,$,this.padding);let[z,P,V,j]=an(this.recurrentKernel.read(),i,g);m=this.recurrentConv(m,z),f=this.recurrentConv(f,P),A=this.recurrentConv(A,V),y=this.recurrentConv(y,j);let U=this.recurrentActivation.apply(se(d,m)),X=this.recurrentActivation.apply(se(u,f)),G=se(_(X,s),_(U,this.activation.apply(se(p,A)))),ee=_(this.recurrentActivation.apply(se(c,y)),this.activation.apply(G));return[ee,ee,G]})}getConfig(){let e=super.getConfig(),{units:t}=e,n=lre(e,["units"]),a={filters:this.filters,kernelSize:this.kernelSize,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,strides:this.strides};return Object.assign({},n,a)}inputConv(e,t,n,a){let r=nr(e,t,this.strides,a||"valid",this.dataFormat==="channelsFirst"?"NCHW":"NHWC",this.dilationRate);return n?ka(r,n,this.dataFormat):r}recurrentConv(e,t){return nr(e,t,1,"same",this.dataFormat==="channelsFirst"?"NCHW":"NHWC")}};r0.className="ConvLSTM2DCell";ae.registerClass(r0);var Dy=class extends G4{constructor(e){let t=new r0(e);super(Object.assign({},e,{cell:t}))}static fromConfig(e,t){return new e(t)}};Dy.className="ConvLSTM2D";ae.registerClass(Dy);var s0=class extends Ge{constructor(e){super(e);this.rate=Math.max(Math.min(e.rate,1),0),this.noiseShape=e.noiseShape,this.seed=e.seed,this.supportsMasking=!0}getNoiseShape(e){if(this.noiseShape==null)return this.noiseShape;let t=e.shape,n=[];for(let a=0;a{this.invokeCallHook(e,t);let n=_e(e);if(0P6(n,this.rate,r,this.seed),()=>n,a)}return e})}getConfig(){let e={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},t=super.getConfig();return Object.assign(e,t),e}dispose(){return super.dispose()}};s0.className="Dropout";ae.registerClass(s0);var Oy=class extends s0{constructor(e){super(e);this.inputSpec=[{ndim:3}]}getNoiseShape(e){let t=e.shape;return[t[0],1,t[2]]}};Oy.className="SpatialDropout1D";ae.registerClass(Oy);var zy=class extends Ge{constructor(e){super(e);if(this.activation=null,this.useBias=!0,this.kernel=null,this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.batchInputShape==null&&e.inputShape==null&&e.inputDim!=null){let t=null;e.batchSize!=null&&(t=e.batchSize),this.batchInputShape=[t,e.inputDim]}this.units=e.units,Ht(this.units,"units"),this.activation=Gr(e.activation),e.useBias!=null&&(this.useBias=e.useBias),this.kernelInitializer=mt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.biasInitializer=mt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelConstraint=Lt(e.kernelConstraint),this.biasConstraint=Lt(e.biasConstraint),this.kernelRegularizer=At(e.kernelRegularizer),this.biasRegularizer=At(e.biasRegularizer),this.activityRegularizer=At(e.activityRegularizer),this.supportsMasking=!0,this.inputSpec=[{minNDim:2}]}build(e){e=at(e);let t=e[e.length-1];this.kernel==null&&(this.kernel=this.addWeight("kernel",[t,this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint))),this.inputSpec=[{minNDim:2,axes:{[-1]:t}}],this.built=!0}computeOutputShape(e){e=at(e);let t=e.slice();return t[t.length-1]=this.units,t}call(e,t){return W(()=>{this.invokeCallHook(e,t);let n=_e(e),a=N6(this.activation.getClassName()),r;return a!=null?r=ja(n,this.kernel.read(),a,this.bias?this.bias.read():null):(r=ja(n,this.kernel.read()),this.bias!=null&&(r=ka(r,this.bias.read())),this.activation!=null&&(r=this.activation.apply(r))),r})}getConfig(){let e={units:this.units,activation:Hr(this.activation),useBias:this.useBias,kernelInitializer:kt(this.kernelInitializer),biasInitializer:kt(this.biasInitializer),kernelRegularizer:ut(this.kernelRegularizer),biasRegularizer:ut(this.biasRegularizer),activityRegularizer:ut(this.activityRegularizer),kernelConstraint:Pt(this.kernelConstraint),biasConstraint:Pt(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}};zy.className="Dense";ae.registerClass(zy);var _y=class extends Ge{constructor(e){e=e||{},super(e),this.inputSpec=[{minNDim:3}],this.dataFormat=e.dataFormat}computeOutputShape(e){e=at(e);for(let t of e.slice(1))if(t==null)throw new B(`The shape of the input to "Flatten" is not fully defined (got ${e.slice(1)}). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.`);return[e[0],Vr(e,1)]}call(e,t){return W(()=>{this.invokeCallHook(e,t);let n=_e(e);if(this.dataFormat==="channelsFirst"&&n.rank>1){let a=[0];for(let r=2;r{this.invokeCallHook(e,t);let n=_e(e);return this.activation.apply(n)})}getConfig(){let e={activation:Hr(this.activation)},t=super.getConfig();return Object.assign(e,t),e}};Py.className="Activation";ae.registerClass(Py);var Ly=class extends Ge{constructor(e){super(e);this.n=e.n,this.inputSpec=[{ndim:2}]}computeOutputShape(e){return[e[0],this.n,e[1]]}call(e,t){return W(()=>(e=_e(e),Rte(e,this.n)))}getConfig(){let e={n:this.n},t=super.getConfig();return Object.assign(e,t),e}};Ly.className="RepeatVector";ae.registerClass(Ly);var Wy=class extends Ge{constructor(e){super(e);this.targetShape=e.targetShape;for(let t=0;t{this.invokeCallHook(e,t);let n=_e(e),a=n.shape,r=a.slice(0,1).concat(this.fixUnknownDimension(a.slice(1),this.targetShape));return n.reshape(r)})}getConfig(){let e={targetShape:this.targetShape},t=super.getConfig();return Object.assign(e,t),e}};Wy.className="Reshape";ae.registerClass(Wy);var By=class extends Ge{constructor(e){super(e);if(e.dims==null)throw new Error("Required configuration field `dims` is missing during Permute constructor call.");if(!Array.isArray(e.dims))throw new Error(`Permute constructor requires \`dims\` to be an Array, but received ${e.dims} instead.`);let t=wa(1,e.dims.length+1);if(!k.arraysEqual(e.dims.slice().sort(),t))throw new Error("Invalid permutation `dims`: "+JSON.stringify(e.dims)+" `dims` must contain consecutive integers starting from 1.");this.dims=e.dims,this.dimsIncludingBatch=[0].concat(this.dims),this.inputSpec=[new Mt({ndim:this.dims.length+1})]}computeOutputShape(e){e=at(e);let t=e.slice();return this.dims.forEach((n,a)=>{t[a+1]=e[n]}),t}call(e,t){return Ze(_e(e),this.dimsIncludingBatch)}getConfig(){let e={dims:this.dims},t=super.getConfig();return Object.assign(e,t),e}};By.className="Permute";ae.registerClass(By);var Vy=class extends Ge{constructor(e){super(e==null?{}:e);this.supportsMasking=!0,e!=null?this.maskValue=e.maskValue==null?0:e.maskValue:this.maskValue=0}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={maskValue:this.maskValue};return Object.assign(t,e),t}computeMask(e,t){let n=_e(e),a=-1;return ju(mi(n,this.maskValue),a)}call(e,t){return W(()=>{this.invokeCallHook(e,t);let n=_e(e),a=-1,r=!0,s=ju(mi(n,this.maskValue),a,r);return n.mul(s.asType(n.dtype))})}};Vy.className="Masking";ae.registerClass(Vy);var jy=class extends Ge{constructor(e){super(e);if(this.embeddings=null,this.DEFAULT_EMBEDDINGS_INITIALIZER="randomUniform",e.batchInputShape==null&&e.inputShape==null){let t=null;e.batchSize!=null&&(t=e.batchSize),e.inputLength==null?this.batchInputShape=[t,null]:this.batchInputShape=[t].concat(ht(e.inputLength))}this.inputDim=e.inputDim,Ht(this.inputDim,"inputDim"),this.outputDim=e.outputDim,Ht(this.outputDim,"outputDim"),this.embeddingsInitializer=mt(e.embeddingsInitializer||this.DEFAULT_EMBEDDINGS_INITIALIZER),this.embeddingsRegularizer=At(e.embeddingsRegularizer),this.activityRegularizer=At(e.activityRegularizer),this.embeddingsConstraint=Lt(e.embeddingsConstraint),this.maskZero=e.maskZero,this.supportsMasking=e.maskZero,this.inputLength=e.inputLength}build(e){this.embeddings=this.addWeight("embeddings",[this.inputDim,this.outputDim],this.dtype,this.embeddingsInitializer,this.embeddingsRegularizer,!0,this.embeddingsConstraint),this.built=!0}warnOnIncompatibleInputShape(e){}computeMask(e,t){return W(()=>this.maskZero?(e=_e(e),mi(e,Ue(e))):null)}computeOutputShape(e){if(e=at(e),this.inputLength==null)return[...e,this.outputDim];let t=ht(this.inputLength);if(t.length!==e.length-1)throw new B(`"inputLength" is ${this.inputLength}, but received input shape has shape ${e}`);{let n=0;for(let a=0;a{this.invokeCallHook(e,t);let n=_e(e);return n.dtype!=="int32"&&(n=Td(n,"int32")),_6(this.embeddings.read(),n.as1D()).reshape(at(this.computeOutputShape(n.shape)))})}getConfig(){let e={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:kt(this.embeddingsInitializer),embeddingsRegularizer:ut(this.embeddingsRegularizer),activityRegularizer:ut(this.activityRegularizer),embeddingsConstraint:Pt(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},t=super.getConfig();return Object.assign(e,t),e}};jy.className="Embedding";ae.registerClass(jy);var Di=class extends Ge{constructor(e){super(e||{});this.supportsMasking=!0}mergeFunction(e){throw new Oe}computeElementwiseOpOutputShape(e,t){if(e==null||t==null)return null;if(e.length1)throw new B(`Can not merge tensors with different batch sizes. Got tensors with shapes: ${JSON.stringify(e)}.`);let n=e[0]==null?null:e[0].slice(1);for(let r=1;rr.length);e.indexOf(null)===-1&&Br(a).length===1?this.reshapeRequired=!1:this.reshapeRequired=!0}call(e,t){return W(()=>{if(e=e,this.reshapeRequired){let n=[],a=e.map(r=>r.rank);if(a.indexOf(null)===-1){let r=jr(a);for(let s of e){let i=s.rank;for(let o=0;o1){let d=wa(1,l).concat([0]);n.push(Ze(o,d)),r=!0}else n.push(o)}let s=this.mergeFunction(n),i=s.rank;if(r){if(i==null){let o=s.shape,l=o.length,d=o[l-1],u=[d].concat(o.slice(0,o.length-1));s=Ze(s.reshape([-1,d]),[1,0]).reshape(u)}else if(i>1){let o=[i-1].concat(wa(0,i-1));s=Ze(s,o)}}return s}}else return this.mergeFunction(e)})}computeOutputShape(e){e=e;let t;e[0]==null?t=null:t=e[0].slice(1);for(let a=1;a{if(t==null)return null;if(!Array.isArray(t))throw new B("`mask` should be an Array");if(!Array.isArray(e))throw new B("`inputs` should be an Array");if(t.length!==e.length)throw new B(`The Array 'inputs' and 'mask' are expected to have the same length, but have different lengths (${e.length} vs ${t.length})`);if(t.every(a=>a==null))return null;t=t.map(a=>a==null?a:ln(a,0));let n=t[0];for(let a=1;a{let t=e[0].clone();for(let n=1;n{let t=e[0].clone();for(let n=1;n{let t=e[0].clone();for(let n=1;n{let t=e[0];for(let n=1;n{let t=e[0];for(let n=1;n1)throw new B("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(e))}mergeFunction(e){return W(()=>W1(e,this.axis))}computeOutputShape(e){if(!(Array.isArray(e)&&Array.isArray(e[0])))throw new B("A `Concatenate` layer should be called on a list of inputs.");let t=e,n=t[0].slice(),a=this.axis<0?n.length+this.axis:this.axis;for(let r of t.slice(1)){if(n[a]==null||r[a]==null){n[a]=null;break}n[a]+=r[a]}return n}computeMask(e,t){if(t==null)return null;if(!Array.isArray(t))throw new B("`mask` should be an array for Concatenate");if(!Array.isArray(e))throw new B("`inputs` should be an array for Concatenate");if(t.length!==e.length)throw new B(`Mismatch in the length of mask (${t.length}) and the legnth of inputs (${e.length})`);return W(()=>{let n=!0;if(t.forEach(s=>{if(s!=null){n=!1;return}}),n)return null;let a=[];for(let s=0;s3||t.shape.length>3)throw new Oe("batchDot is not implemented for tensors of 4D or higher rank yet");if(k.assert(e.shape.length>=2,()=>`batchDot requires the rank of x to be >= 2, but got ${e.shape.length}`),k.assert(e.shape.length>=2,()=>`batchDot requires the rank of y to be >= 2, but got ${t.shape.length}`),typeof n=="number"&&(n=[n,n]),e.dtype==="complex64"||t.dtype==="complex64")throw new Oe("batchDot is not implemented for complex64-type Tensors yet.");let a=e.shape.length,r=t.shape.length;n==null&&(n=[a-1,r-2]);let s=n;return W(()=>{let i;if(a>r){i=a-r;let l=[];for(let d=0;da){i=r-a;let l=[];for(let d=0;d0){let l;a>r?l=a+r-3:l=a-1;let d=[];for(let u=l;u"A `Dot` layer should be called on a list of exactly 2 inputs.");let t=e[0],n=e[1];if(t.length>3||n.length>3)throw new Oe("Dot layer does not support tensors of 4D or higher rank yet.");let a=this.interpretAxes(t,n);if(t[a[0]]!==n[a[1]])throw new B(`Dimension incompatibility: ${t[a[0]]} !== ${n[a[1]]}`)}mergeFunction(e){if(e.length!==2)throw new B(`A \`Dot\` layer must be called on exactly 2 inputs, but received ${e.length} input(s).`);let t=e[0],n=e[1],a;return Array.isArray(this.axes)?a=this.axes.map((r,s)=>Bd(r,e[s].shape.length)):a=[Bd(this.axes,t.shape.length),Bd(this.axes,n.shape.length)],this.normalize&&(t=Gh(t,a[0]),n=Gh(n,a[1])),ure(t,n,a)}interpretAxes(e,t){let n;return Array.isArray(this.axes)?n=this.axes:n=[Bd(this.axes,e.length),Bd(this.axes,t.length)],n}computeOutputShape(e){k.assert(Array.isArray(e)&&e.length===2&&Array.isArray(e[0])&&Array.isArray(e[1]),()=>"A `Dot` layer should be called on a list of exactly 2 inputs.");let t=e[0].slice(),n=e[1].slice();if(t.length>3||n.length>3)throw new Oe("Dot layer does not support tensors of 4D or higher rank yet.");let a=this.interpretAxes(t,n);t.splice(a[0],1),n.splice(a[1],1),n.splice(0,1);let r=t.concat(n);return r.length===1&&r.push(1),r}computeMask(e,t){return null}getConfig(){let e={axes:this.axes,normalize:this.normalize},t=super.getConfig();return Object.assign(e,t),e}};Zy.className="Dot";ae.registerClass(Zy);var Yy=class extends Ge{constructor(e){super(e);this.supportsMasking=!0,this.stddev=e.stddev}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={stddev:this.stddev};return Object.assign(t,e),t}call(e,t){return W(()=>{this.invokeCallHook(e,t);let n=_e(e);return Rd(()=>$h(n.shape,0,this.stddev).add(n),()=>n,t.training||!1)})}};Yy.className="GaussianNoise";ae.registerClass(Yy);var Jy=class extends Ge{constructor(e){super(e);this.supportsMasking=!0,this.rate=e.rate}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return W(()=>{this.invokeCallHook(e,t);let n=_e(e);return this.rate>0&&this.rate<1?Rd(()=>{let a=Math.sqrt(this.rate/(1-this.rate));return n.mul($h(n.shape,1,a))},()=>n,t.training||!1):n})}};Jy.className="GaussianDropout";ae.registerClass(Jy);var Qy=class extends Ge{constructor(e){super(e);this.supportsMasking=!0,this.rate=e.rate,this.noiseShape=e.noiseShape}_getNoiseShape(e){return this.noiseShape||_e(e).shape}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return W(()=>{if(this.rate<1&&this.rate>0){let n=this._getNoiseShape(e);return Rd(()=>{let a=_e(e),r=1.6732632423543772,s=1.0507009873554805,i=-r*s,o=$r(xl(n),this.rate);o=Td(o,"float32");let l=((1-this.rate)*(1+this.rate*i**2))**-.5,d=-l*i*this.rate;return a.mul(o).add(o.add(-1).mul(i)).mul(l).add(d)},()=>_e(e),t.training||!1)}return e})}};Qy.className="AlphaDropout";ae.registerClass(Qy);function Vd(e,t,n,a,r,s=.001){let i;if(e.rank===2)i=Eb(e,t,n,a,r,s);else if(e.rank===3)i=Cb(e,t,n,a,r,s);else if(e.rank===4)i=Rb(e,t,n,a,r,s);else throw new Oe(`batchNormalization is not implemented for array of rank ${e.rank} yet`);return i}function dre(e,t,n,a,r=.001){return W(()=>{let s=Rc(e,a),i=s.mean,o=s.variance;return[Vd(e,i,o,n,t,r),i,o]})}function pre(e,t,n,a,r=.001){return W(()=>{let s=Rc(e,a),i=s.mean,o=s.variance,l=[];for(let h of wa(0,e.rank))a.indexOf(h)!==-1?l.push(1):l.push(e.shape[h]);let d=i.reshape(l),u=o.reshape(l),p=t==null?null:t.reshape(l),c=n==null?null:n.reshape(l);return[Vd(e,d,u,c,p,r),i,o]})}function cre(e,t,n,a,r=.001){return k.arraysEqual(a.slice().sort(),wa(0,e.rank-1))?dre(e,t,n,a,r):pre(e,t,n,a,r)}var e2=class extends Ge{constructor(e){e==null&&(e={}),super(e),this.supportsMasking=!0,this.axis=e.axis==null?-1:e.axis,this.momentum=e.momentum==null?.99:e.momentum,this.epsilon=e.epsilon==null?.001:e.epsilon,this.center=e.center==null?!0:e.center,this.scale=e.scale==null?!0:e.scale,this.betaInitializer=mt(e.betaInitializer||"zeros"),this.gammaInitializer=mt(e.gammaInitializer||"ones"),this.movingMeanInitializer=mt(e.movingMeanInitializer||"zeros"),this.movingVarianceInitializer=mt(e.movingVarianceInitializer||"ones"),this.betaConstraint=Lt(e.betaConstraint),this.gammaConstraint=Lt(e.gammaConstraint),this.betaRegularizer=At(e.betaRegularizer),this.gammaRegularizer=At(e.gammaRegularizer)}build(e){e=at(e);let t=this.axis>=0?this.axis:this.axis+e.length,n=e[t];if(n==null)throw new B(`Axis ${t} of input tensor should have a defined dimension but the layer received an input with shape ${JSON.stringify(e)}.`);this.inputSpec=[new Mt({ndim:e.length,axes:{[t]:n}})];let a=[n];this.scale&&(this.gamma=this.addWeight("gamma",a,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&&(this.beta=this.addWeight("beta",a,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight("moving_mean",a,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight("moving_variance",a,null,this.movingVarianceInitializer,null,!1),this.built=!0}call(e,t){return W(()=>{let n=t.training==null?!1:t.training,a=_e(e),r=a.shape,s=r.length,i=wa(0,s),o=this.axis>=0?this.axis:this.axis+s;i.splice(o,1);let l=Ni(1,s);l[o]=r[o];let d=i.slice();d.sort();let u=!k.arraysEqual(d,wa(0,s).slice(0,s-1)),p=()=>{if(u){let A=this.movingMean.read().reshape(l),y=this.movingVariance.read().reshape(l),g=this.center?this.beta.read().reshape(l):null,x=this.scale?this.gamma.read().reshape(l):null;return Vd(a,A,y,g,x,this.epsilon)}else return Vd(a,this.movingMean.read(),this.movingVariance.read(),this.beta==null?null:this.beta.read(),this.gamma==null?null:this.gamma.read(),this.epsilon)};if(!n)return p();let[c,h,m]=cre(a,this.gamma.read(),this.beta.read(),i,this.epsilon),f=(A,y,g)=>{W(()=>{let x=1-g,w=A.read(),b=w.sub(y).mul(x);A.write(w.sub(b))})};return(()=>{f(this.movingMean,h,this.momentum),f(this.movingVariance,m,this.momentum)})(),c})}getConfig(){let e={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:kt(this.betaInitializer),gammaInitializer:kt(this.gammaInitializer),movingMeanInitializer:kt(this.movingMeanInitializer),movingVarianceInitializer:kt(this.movingVarianceInitializer),betaRegularizer:ut(this.betaRegularizer),gammaRegularizer:ut(this.gammaRegularizer),betaConstraint:Pt(this.betaConstraint),gammaConstraint:Pt(this.gammaConstraint)},t=super.getConfig();return Object.assign(e,t),e}};e2.className="BatchNormalization";ae.registerClass(e2);var t2=class extends Ge{constructor(e){if(e==null&&(e={}),super(e),this.axis=e.axis==null?-1:e.axis,typeof this.axis=="number"){if(!Number.isInteger(this.axis))throw new Error(`Expected axis to be an integer, but received ${this.axis}`)}else if(Array.isArray(this.axis)){for(let t of this.axis)if(!Number.isInteger(t))throw new Error(`Expected axis to be an array of integers, but received ${JSON.stringify(this.axis)}`)}else throw new Error(`Expected axis to be an integer or an array of integers, but received ${JSON.stringify(this.axis)}`);this.epsilon=e.epsilon==null?.001:e.epsilon,this.center=e.center==null?!0:e.center,this.scale=e.scale==null?!0:e.scale,this.betaInitializer=mt(e.betaInitializer||"zeros"),this.gammaInitializer=mt(e.gammaInitializer||"ones"),this.betaRegularizer=At(e.betaRegularizer),this.gammaRegularizer=At(e.gammaRegularizer),this.supportsMasking=!0}build(e){e=at(e);let t=e.length;typeof this.axis=="number"&&(this.axis=[this.axis]);for(let r=0;r=t)throw new Error(`Invalid axis: ${r}`);if(this.axis.length!==Br(this.axis).length)throw new Error(`Found duplicate axes in: ${this.axis}`);let n=this.axis.map(r=>e[r]),a=!0;this.scale?this.gamma=this.addWeight("gamma",n,"float32",this.gammaInitializer,this.gammaRegularizer,a):this.gamma=null,this.center?this.beta=this.addWeight("beta",n,"float32",this.betaInitializer,this.betaRegularizer,a):this.beta=null,this.built=!0}call(e,t){let n=_e(e),a=n.shape,r=a.length;return W(()=>{let s=!0,{mean:i,variance:o}=Rc(n,this.axis,s),l=Ni(1,r);for(let m of this.axis)l[m]=a[m];let d=m=>m!=null&&m.shape.length!==r&&this.axis!==[r-1]?m.reshape(l):m,u=d(this.gamma.read()),p=d(this.beta.read()),c=[],h=[];for(let m=0;m{if(e.rank!==4)throw new B(`temporalPadding expects input tensor to be 4-D, but received a ${e.rank}-D tensor.`);if(t==null&&(t=[[1,1],[1,1]]),t.length!==2||t[0].length!==2||t[1].length!==2)throw new B("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(n==null&&(n=ba()),n!=="channelsLast"&&n!=="channelsFirst")throw new B(`Unknown data format: ${n}. Supported data formats are 'channelsLast' and 'channelsFirst.`);let a;return n==="channelsFirst"?a=[[0,0],[0,0],t[0],t[1]]:a=[[0,0],t[0],t[1],[0,0]],ar(e,a)})}var n2=class extends Ge{constructor(e){if(e==null&&(e={}),super(e),this.dataFormat=e.dataFormat==null?ba():e.dataFormat,e.padding==null)this.padding=[[1,1],[1,1]];else if(typeof e.padding=="number")this.padding=[[e.padding,e.padding],[e.padding,e.padding]];else{if(e.padding=e.padding,e.padding.length!==2)throw new B(`ZeroPadding2D expects padding to be a length-2 array, but received a length-${e.padding.length} array.`);let t,n;if(typeof e.padding[0]=="number")t=[e.padding[0],e.padding[0]],n=[e.padding[1],e.padding[1]];else{if(e.padding=e.padding,e.padding[0].length!==2)throw new B(`ZeroPadding2D expects height padding to be a length-2 array, but received a length-${e.padding[0].length} array.`);if(t=e.padding[0],e.padding[1].length!==2)throw new B(`ZeroPadding2D expects width padding to be a length-2 array, but received a length-${e.padding[1].length} array.`);n=e.padding[1]}this.padding=[t,n]}this.inputSpec=[new Mt({ndim:4})]}computeOutputShape(e){e=at(e);let t,n;return this.dataFormat==="channelsFirst"?(e[2]!=null&&e[2]>=0?t=e[2]+this.padding[0][0]+this.padding[0][1]:t=null,e[3]!=null&&e[3]>=0?n=e[3]+this.padding[1][0]+this.padding[1][1]:n=null,[e[0],e[1],t,n]):(e[1]!=null&&e[1]>=0?t=e[1]+this.padding[0][0]+this.padding[0][1]:t=null,e[2]!=null&&e[2]>=0?n=e[2]+this.padding[1][0]+this.padding[1][1]:n=null,[e[0],t,n,e[3]])}call(e,t){return W(()=>hre(_e(e),this.padding,this.dataFormat))}getConfig(){let e={padding:this.padding,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}};n2.className="ZeroPadding2D";ae.registerClass(n2);function i0(e,t,n,a,r,s){return W(()=>{Et(r),R6(s),Jn(a),n==null&&(n=[1,1]),a==null&&(a="valid"),r==null&&(r=ba()),s==null&&(s="max"),e=ky(e,r);let i,o=a==="same"?"same":"valid";return s==="max"?i=Yu(e,t,n,o):i=Gu(e,t,n,o),r==="channelsFirst"&&(i=Ze(i,[0,3,1,2])),i})}function q4(e,t,n,a,r,s){return W(()=>{Et(r),R6(s),Jn(a),n==null&&(n=[1,1,1]),a==null&&(a="valid"),r==null&&(r=ba()),s==null&&(s="max"),e=B4(e,r);let i,o=a==="same"?"same":"valid";return s==="max"?i=kA(e,t,n,o):i=oA(e,t,n,o),r==="channelsFirst"&&(i=Ze(i,[0,4,1,2,3])),i})}var X4=class extends Ge{constructor(e){if(e.poolSize==null&&(e.poolSize=2),super(e),typeof e.poolSize=="number")this.poolSize=[e.poolSize];else if(Array.isArray(e.poolSize)&&e.poolSize.length===1&&typeof e.poolSize[0]=="number")this.poolSize=e.poolSize;else throw new B(`poolSize for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.poolSize)}`);if(Ht(this.poolSize,"poolSize"),e.strides==null)this.strides=this.poolSize;else if(typeof e.strides=="number")this.strides=[e.strides];else if(Array.isArray(e.strides)&&e.strides.length===1&&typeof e.strides[0]=="number")this.strides=e.strides;else throw new B(`strides for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.strides)}`);Ht(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,Jn(this.padding),this.inputSpec=[new Mt({ndim:3})]}computeOutputShape(e){e=at(e);let t=Na(e[1],this.poolSize[0],this.padding,this.strides[0]);return[e[0],t,e[2]]}call(e,t){return W(()=>{this.invokeCallHook(e,t),e=Ed(_e(e),2);let n=this.poolingFunction(_e(e),[this.poolSize[0],1],[this.strides[0],1],this.padding,"channelsLast");return Or(n,[2])})}getConfig(){let e={poolSize:this.poolSize,padding:this.padding,strides:this.strides},t=super.getConfig();return Object.assign(e,t),e}},a2=class extends X4{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Et(r),Jn(a),i0(e,t,n,a,r,"max")}};a2.className="MaxPooling1D";ae.registerClass(a2);var r2=class extends X4{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Et(r),Jn(a),i0(e,t,n,a,r,"avg")}};r2.className="AveragePooling1D";ae.registerClass(r2);var K4=class extends Ge{constructor(e){if(e.poolSize==null&&(e.poolSize=[2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize],e.strides==null)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(e.strides.length!==2)throw new B(`If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides];Ht(this.poolSize,"poolSize"),Ht(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Et(this.dataFormat),Jn(this.padding),this.inputSpec=[new Mt({ndim:4})]}computeOutputShape(e){e=at(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],n=this.dataFormat==="channelsFirst"?e[3]:e[2];return t=Na(t,this.poolSize[0],this.padding,this.strides[0]),n=Na(n,this.poolSize[1],this.padding,this.strides[1]),this.dataFormat==="channelsFirst"?[e[0],e[1],t,n]:[e[0],t,n,e[3]]}call(e,t){return W(()=>(this.invokeCallHook(e,t),this.poolingFunction(_e(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){let e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}},s2=class extends K4{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Et(r),Jn(a),i0(e,t,n,a,r,"max")}};s2.className="MaxPooling2D";ae.registerClass(s2);var i2=class extends K4{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Et(r),Jn(a),i0(e,t,n,a,r,"avg")}};i2.className="AveragePooling2D";ae.registerClass(i2);var Z4=class extends Ge{constructor(e){if(e.poolSize==null&&(e.poolSize=[2,2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize,e.poolSize],e.strides==null)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(e.strides.length!==3)throw new B(`If the strides property of a 3D pooling layer is an Array, it is expected to have a length of 3, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides,e.strides];Ht(this.poolSize,"poolSize"),Ht(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Et(this.dataFormat),Jn(this.padding),this.inputSpec=[new Mt({ndim:5})]}computeOutputShape(e){e=at(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],n=this.dataFormat==="channelsFirst"?e[3]:e[2],a=this.dataFormat==="channelsFirst"?e[4]:e[3];return t=Na(t,this.poolSize[0],this.padding,this.strides[0]),n=Na(n,this.poolSize[1],this.padding,this.strides[1]),a=Na(a,this.poolSize[2],this.padding,this.strides[2]),this.dataFormat==="channelsFirst"?[e[0],e[1],t,n,a]:[e[0],t,n,a,e[4]]}call(e,t){return W(()=>(this.invokeCallHook(e,t),this.poolingFunction(_e(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){let e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}},o2=class extends Z4{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Et(r),Jn(a),q4(e,t,n,a,r,"max")}};o2.className="MaxPooling3D";ae.registerClass(o2);var l2=class extends Z4{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Et(r),Jn(a),q4(e,t,n,a,r,"avg")}};l2.className="AveragePooling3D";ae.registerClass(l2);var Y4=class extends Ge{constructor(e){super(e);this.inputSpec=[new Mt({ndim:3})]}computeOutputShape(e){return[e[0],e[2]]}call(e,t){throw new Oe}},u2=class extends Y4{constructor(e){super(e||{})}call(e,t){return W(()=>{let n=_e(e);return wt(n,1)})}};u2.className="GlobalAveragePooling1D";ae.registerClass(u2);var d2=class extends Y4{constructor(e){super(e||{})}call(e,t){return W(()=>{let n=_e(e);return Xn(n,1)})}};d2.className="GlobalMaxPooling1D";ae.registerClass(d2);var J4=class extends Ge{constructor(e){super(e);this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Et(this.dataFormat),this.inputSpec=[new Mt({ndim:4})]}computeOutputShape(e){return e=e,this.dataFormat==="channelsLast"?[e[0],e[3]]:[e[0],e[1]]}call(e,t){throw new Oe}getConfig(){let e={dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}},p2=class extends J4{call(e,t){return W(()=>{let n=_e(e);return this.dataFormat==="channelsLast"?wt(n,[1,2]):wt(n,[2,3])})}};p2.className="GlobalAveragePooling2D";ae.registerClass(p2);var c2=class extends J4{call(e,t){return W(()=>{let n=_e(e);return this.dataFormat==="channelsLast"?Xn(n,[1,2]):Xn(n,[2,3])})}};c2.className="GlobalMaxPooling2D";ae.registerClass(c2);var Q4=class extends Ge{constructor(e){super(e);this.layer=e.layer}build(e){this.built=!0}get trainable(){return this.layer!=null?this.layer.trainable:!1}set trainable(e){this.layer!=null&&(this.layer.trainable=e)}get trainableWeights(){return this.layer.trainableWeights}get nonTrainableWeights(){return this.layer.nonTrainableWeights}get updates(){return this.layer._updates}get losses(){return this.layer.losses}getWeights(){return this.layer.getWeights()}setWeights(e){this.layer.setWeights(e)}getConfig(){let e={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},t=super.getConfig();return Object.assign(e,t),e}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.layer!=null&&this.layer.setFastWeightInitDuringBuild(e)}static fromConfig(e,t,n={}){let a=t.layer,r=Sa(a,n);delete t.layer;let s={layer:r};return Object.assign(s,t),new e(s)}},h2=class extends Q4{constructor(e){super(e);this.supportsMasking=!0}build(e){if(e=at(e),e.length<3)throw new B(`TimeDistributed layer expects an input shape >= 3D, but received input shape ${JSON.stringify(e)}`);this.inputSpec=[{shape:e}];let t=[e[0]].concat(e.slice(2));this.layer.built||(this.layer.build(t),this.layer.built=!0),super.build(e)}computeOutputShape(e){e=at(e);let t=[e[0]].concat(e.slice(2)),n=this.layer.computeOutputShape(t),a=e[1];return[n[0],a].concat(n.slice(1))}call(e,t){return W(()=>(e=_e(e),H4((n,a)=>[_e(this.layer.call(n,t)),[]],e,[],!1,null,null,!1,!0)[1]))}};h2.className="TimeDistributed";ae.registerClass(h2);function fre(e){Ei(Ste,"BidirectionalMergeMode",e)}var mre="concat",f2=class extends Q4{constructor(e){super(e);let t=e.layer.getConfig(),n={};n.className=e.layer.getClassName(),n.config=t,this.forwardLayer=Sa(n),t.goBackwards=t.goBackwards!==!0;let a={};if(a.className=e.layer.getClassName(),a.config=t,this.backwardLayer=Sa(a),this.forwardLayer.name="forward_"+this.forwardLayer.name,this.backwardLayer.name="backward_"+this.backwardLayer.name,this.mergeMode=e.mergeMode===void 0?mre:e.mergeMode,fre(this.mergeMode),e.weights)throw new Oe("weights support is not implemented for Bidirectional layer yet.");this._stateful=e.layer.stateful,this.returnSequences=e.layer.returnSequences,this.returnState=e.layer.returnState,this.supportsMasking=!0,this._trainable=!0,this.inputSpec=e.layer.inputSpec,this.numConstants=null}get trainable(){return this._trainable}set trainable(e){this._trainable=e,this.forwardLayer!=null&&(this.forwardLayer.trainable=e),this.backwardLayer!=null&&(this.backwardLayer.trainable=e)}getWeights(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())}setWeights(e){let t=e.length,n=Math.floor(t/2);this.forwardLayer.setWeights(e.slice(0,n)),this.backwardLayer.setWeights(e.slice(n))}computeOutputShape(e){let t=this.forwardLayer.computeOutputShape(e);Array.isArray(t)&&Array.isArray(t[0])||(t=[t]),t=t;let n,a,r;return this.returnState&&(r=t.slice(1)),n=t[0],n=n,this.mergeMode==="concat"?(n[n.length-1]*=2,a=[n]):this.mergeMode==null?a=[n,n.slice()]:a=[n],this.returnState?this.mergeMode==null?a.concat(r).concat(r.slice()):[n].concat(r).concat(r.slice()):Sn(a)}apply(e,t){let n=t==null?null:t.initialState,a=t==null?null:t.constants;t==null&&(t={});let r=U4(e,n,a,this.numConstants);if(e=r.inputs,n=r.initialState,a=r.constants,Array.isArray(e)&&(n=e.slice(1),e=e[0]),(n==null||n.length===0)&&a==null)return super.apply(e,t);let s=[],i=[];if(n!=null){let l=n.length;if(l%2>0)throw new B("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");t.initialState=n,s.push(...n);let d=n.map(u=>new Mt({shape:u.shape}));this.forwardLayer.stateSpec=d.slice(0,l/2),this.backwardLayer.stateSpec=d.slice(l/2),i.push(...d)}if(a!=null)throw new Oe("Support for constants in Bidirectional layers is not implemented yet.");let o=s[0]instanceof Ia;for(let l of s)if(l instanceof Ia!==o)throw new B("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors");if(o){let l=[e].concat(s),d=this.inputSpec.concat(i),u=this.inputSpec;this.inputSpec=d;let p=super.apply(l,t);return this.inputSpec=u,p}else return super.apply(e,t)}call(e,t){return W(()=>{let n=t.initialState,a,r;if(n==null)a=this.forwardLayer.call(e,t),r=this.backwardLayer.call(e,t);else{let o=n.slice(0,n.length/2),l=n.slice(n.length/2);a=this.forwardLayer.call(e,Object.assign(t,{initialState:o})),r=this.backwardLayer.call(e,Object.assign(t,{initialState:l}))}let s;this.returnState&&(Array.isArray(a)&&(s=a.slice(1).concat(r.slice(1))),a=a[0],r=r[0]),this.returnSequences&&(r=On(r,1));let i;return this.mergeMode==="concat"?i=W1([a,r]):this.mergeMode==="sum"?i=se(a,r):this.mergeMode==="ave"?i=_(.5,se(a,r)):this.mergeMode==="mul"?i=_(a,r):this.mergeMode==null&&(i=[a,r]),this.returnState?this.mergeMode==null?i.concat(s):[i].concat(s):i})}resetStates(e){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()}build(e){Ci(this.forwardLayer.name,()=>{this.forwardLayer.build(e)}),Ci(this.backwardLayer.name,()=>{this.backwardLayer.build(e)}),this.built=!0}computeMask(e,t){Array.isArray(t)&&(t=t[0]);let n;if(this.returnSequences?this.mergeMode==null?n=[t,t]:n=t:this.mergeMode==null?n=[null,null]:n=null,this.returnState){let a=this.forwardLayer.states.map(r=>null);return Array.isArray(n)?n.concat(a).concat(a):[n].concat(a).concat(a)}else return n}get trainableWeights(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)}get nonTrainableWeights(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.forwardLayer!=null&&this.forwardLayer.setFastWeightInitDuringBuild(e),this.backwardLayer!=null&&this.backwardLayer.setFastWeightInitDuringBuild(e)}getConfig(){let e={mergeMode:this.mergeMode},t=super.getConfig();return Object.assign(e,t),e}static fromConfig(e,t){let n=Sa(t.layer);if(delete t.layer,t.numConstants!=null)throw new Oe("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");let a=t;return a.layer=n,new e(a)}};f2.className="Bidirectional";ae.registerClass(f2);function Bte(e){return new Bl(e)}function Vte(e){return new by(e)}function jte(e){return new yy(e)}function Ute(e){return new gy(e)}function Hte(e){return new xy(e)}function Gte(e){return new wy(e)}function qte(e){return new vy(e)}function Xte(e){return new e0(e)}function Kte(e){return new Pd(e)}function Zte(e){return new Sy(e)}function Yte(e){return new Ld(e)}function Jte(e){return new Ny(e)}function Qte(e){return new Ty(e)}function ene(e){return new Ey(e)}function tne(e){return new Cy(e)}function nne(e){return new Ry(e)}function ane(e){return new Py(e)}function rne(e){return new zy(e)}function sne(e){return new s0(e)}function ine(e){return new Oy(e)}function one(e){return new _y(e)}function lne(e){return new Ly(e)}function une(e){return new Wy(e)}function dne(e){return new By(e)}function pne(e){return new jy(e)}function cne(e){return new Uy(e)}function hne(e){return new Gy(e)}function fne(e){return new Ky(e)}function mne(e){return new qy(e)}function Ane(e){return new Xy(e)}function yne(e){return new Hy(e)}function gne(e){return new Zy(e)}function xne(e){return new e2(e)}function bne(e){return new t2(e)}function vne(e){return new n2(e)}function K1(e){return new r2(e)}function wne(e){return K1(e)}function kne(e){return K1(e)}function Z1(e){return new i2(e)}function Ine(e){return Z1(e)}function Sne(e){return Z1(e)}function Y1(e){return new l2(e)}function Nne(e){return Y1(e)}function Tne(e){return Y1(e)}function Ene(e){return new u2(e)}function Cne(e){return new p2(e)}function j6(e){return new d2(e)}function U6(e){return new c2(e)}function H6(e){return new a2(e)}function G6(e){return new s2(e)}function Rne(e){return new o2(e)}function Mne(e){return new Fy(e)}function Fne(e){return new a0(e)}function $ne(e){return new $y(e)}function Dne(e){return new Wd(e)}function One(e){return new My(e)}function zne(e){return new n0(e)}function _ne(e){return new Dy(e)}function Pne(e){return new r0(e)}function Lne(e){return new Ua(e)}function Wne(e){return new t0(e)}function Bne(e){return new f2(e)}function Vne(e){return new h2(e)}var jne=j6,Une=U6,Hne=H6,Gne=G6;function qne(e){return new Yy(e)}function Xne(e){return new Jy(e)}function Kne(e){return new Qy(e)}function Zne(e){return new Vy(e)}var e8={};Fe(e8,{MAPE:()=>Nre,MSE:()=>Cre,binaryAccuracy:()=>Are,binaryCrossentropy:()=>yre,categoricalAccuracy:()=>xre,categoricalCrossentropy:()=>bre,cosineProximity:()=>kre,mape:()=>Tre,meanAbsoluteError:()=>Ire,meanAbsolutePercentageError:()=>Sre,meanSquaredError:()=>Ere,mse:()=>Rre,precision:()=>vre,recall:()=>wre,sparseCategoricalAccuracy:()=>gre});function Are(e,t){return ay(e,t)}function yre(e,t){return o4(e,t)}function gre(e,t){return l4(e,t)}function xre(e,t){return ry(e,t)}function bre(e,t){return sy(e,t)}function vre(e,t){return i4(e,t)}function wre(e,t){return mae(e,t)}function kre(e,t){return ty(e,t)}function Ire(e,t){return qh(e,t)}function Sre(e,t){return jl(e,t)}function Nre(e,t){return jl(e,t)}function Tre(e,t){return jl(e,t)}function Ere(e,t){return Mi(e,t)}function Cre(e,t){return Mi(e,t)}function Rre(e,t){return Mi(e,t)}var t8={};Fe(t8,{modelFromJSON:()=>Kae});var n8={};Fe(n8,{l1:()=>Fre,l1l2:()=>Mre,l2:()=>$re});function Mre(e){return new zd(e)}function Fre(e){return are(e)}function $re(e){return rre(e)}var a8=class extends Vl{constructor(){super(...arguments);this.model=null}setModel(e){if(!(e instanceof dr))throw new Error("model must be a LayersModel, not some other Container");this.model=e}};function o0(e,t){return et}var s8=class extends a8{constructor(e){super();if(e==null&&(e={}),e.restoreBestWeights)throw new Oe("restoreBestWeights = True is not implemented in EarlyStopping yet.");this.monitor=e.monitor||"val_loss",this.minDelta=Math.abs(e.minDelta||0),this.patience=e.patience||0,this.verbose=e.verbose||0,this.mode=e.mode||"auto",this.baseline=e.baseline,["auto","min","max"].indexOf(this.mode)===-1&&(console.warn(`EarlyStopping mode '${this.mode}' is invalid. Falling back to mode 'auto'.`),this.mode="auto"),this.mode==="min"?this.monitorFunc=o0:this.mode==="max"?this.monitorFunc=r8:this.monitor.indexOf("acc")!==-1?this.monitorFunc=r8:this.monitorFunc=o0,this.monitorFunc===o0&&(this.minDelta*=-1)}async onTrainBegin(e){this.wait=0,this.stoppedEpoch=0,this.baseline!=null?this.best=this.baseline:this.best=this.monitorFunc===o0?Infinity:-Infinity}async onEpochEnd(e,t){await Ur(t);let n=this.getMonitorValue(t);n!=null&&(this.monitorFunc(n-this.minDelta,this.best)?(this.best=n,this.wait=0):(this.wait++,this.wait>=this.patience&&(this.stoppedEpoch=e,this.model.stopTraining=!0)))}async onTrainEnd(e){this.stoppedEpoch>0&&this.verbose&&console.log(`Epoch ${this.stoppedEpoch}: early stopping.`)}getMonitorValue(e){e==null&&(e={});let t=e[this.monitor];return t==null&&console.warn(`Metric for EarlyStopping ${this.monitor} is not available. Available metrics are: ${Object.keys(e)}`),t}};function Dre(e){return new s8(e)}var Ore={earlyStopping:Dre},Ta;(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_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"})(Ta||(Ta={}));var i8;(function(e){let t;(function(n){n[n.LEGACY=0]="LEGACY",n[n.V1=1]="V1",n[n.V2=2]="V2"})(t=e.CheckpointFormatVersion||(e.CheckpointFormatVersion={}))})(i8||(i8={}));var m2={};function zre(e,t){let n={tfOpName:e,category:"custom",inputs:[],attrs:[],customExecutor:t};m2[e]=n}function o8(e){return m2[e]}function _re(e){delete m2[e]}function I(e,t,n,a,r){let s=t.inputParams[e];if(s&&s.inputIndexStart!==void 0){let o=s.inputIndexStart,l=s.inputIndexEnd===0?void 0:s.inputIndexEnd===void 0?o+1:s.inputIndexEnd;if(s.type==="tensor")return mn(t.inputNames[s.inputIndexStart],n,a,r);if(s.type==="tensors")return t.inputNames.slice(o,l).map(p=>mn(p,n,a,r));let d=mn(t.inputNames.slice(o)[0],n,a,r),u=d.dataSync();return s.type==="number"?u[0]:k.toNestedArray(d.shape,u)}let i=t.attrParams[e];return i&&i.value}function mn(e,t,n,a){let[r,s]=Ln(e);if(a!=null){let o=a.getHashTableHandleByName(r);if(o!=null)return o}let i=n.currentContextIds.find(o=>!!t[l0(r,o)]);return i!==void 0?t[l0(r,i)][s]:void 0}function Pre(e,t,n){return t[l0(e,n.currentContextId)]}function pr(e,t){let[n,a]=Ln(e);return[l0(n,t&&t.currentContextId),a]}function l0(e,t){return t?`${e}-${t}`:e}function Ln(e){let t=e.split(":");return t.length===1?[e,0]:[t[0],Number(t[t.length-1])]}function u0(e,t,n){let a=I("pad",e,t,n);if(a==="explicit"){a=I("explicitPaddings",e,t,n);let r=[[0,0],[0,0],[0,0],[0,0]];for(let s=0;s<4;s++)r[s][0]=a[s*2],r[s][1]=a[s*2+1];return r}return a}function cr(e){return e.kept?e:Da(e)}var l8={};Fe(l8,{json:()=>Lre});var Lre=[{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}]}],u8={};Fe(u8,{json:()=>Wre});var Wre=[{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}]}],d8={};Fe(d8,{json:()=>Bre});var Bre=[{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:"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"}]}],p8={};Fe(p8,{json:()=>Vre});var Vre=[{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"}]},{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"}]}],c8={};Fe(c8,{json:()=>jre});var jre=[{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",notSupported:!0}]},{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:"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"}]}],h8={};Fe(h8,{json:()=>Ure});var Ure=[{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}]}],f8={};Fe(f8,{json:()=>Hre});var Hre=[{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:"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"}]}],m8={};Fe(m8,{json:()=>Gre});var Gre=[{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"}]}],A8={};Fe(A8,{json:()=>qre});var qre=[{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"}]}],y8={};Fe(y8,{json:()=>Xre});var Xre=[{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"}]}],g8={};Fe(g8,{json:()=>Kre});var Kre=[{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}]}],x8={};Fe(x8,{json:()=>Zre});var Zre=[{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:"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"}]}],b8={};Fe(b8,{json:()=>Yre});var Yre=[{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}]}],v8={};Fe(v8,{json:()=>Jre});var Jre=[{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:"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"}]}],w8={};Fe(w8,{json:()=>Qre});var Qre=[{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}]}],k8={};Fe(k8,{json:()=>ese});var ese=[{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}]}],I8={};Fe(I8,{json:()=>tse});var tse=[{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:[]}],N8=class{static get Instance(){return this._instance||(this._instance=new this)}constructor(){let e=[l8,u8,d8,p8,c8,h8,f8,g8,y8,m8,x8,b8,v8,w8,k8,I8,A8],t=[].concat(...e.map(n=>n.json));this.opMappers=t.reduce((n,a)=>(n[a.tfOpName]=a,n),{})}transformGraph(e,t={}){let n=e.node,a=[],r=[],s=[],i=n.reduce((m,f)=>(m[f.name]=this.mapNode(f),f.op.startsWith("Placeholder")?a.push(m[f.name]):f.op==="Const"?r.push(m[f.name]):(f.input==null||f.input.length===0)&&s.push(m[f.name]),m),{}),o=[],l=[],d={},u={};t!=null&&(d=this.mapSignatureEntries(t.inputs),u=this.mapSignatureEntries(t.outputs));let p=Object.keys(i);p.forEach(m=>{let f=i[m];f.inputNames.forEach(A=>{let[y]=pr(A);f.inputs.push(i[y]),i[y].children.push(f)})}),Object.keys(u).length===0?p.forEach(m=>{let f=i[m];f.children.length===0&&l.push(f)}):Object.keys(u).forEach(m=>{let[f]=pr(m),A=i[f];A!=null&&(A.signatureKey=u[m],l.push(A))}),Object.keys(d).length>0?Object.keys(d).forEach(m=>{let[f]=pr(m),A=i[f];A&&(A.signatureKey=d[m],o.push(A))}):o=a;let c={};e.library!=null&&e.library.function!=null&&(c=e.library.function.reduce((m,f)=>(m[f.signature.name]=this.mapFunction(f),m),{}));let h={nodes:i,inputs:o,outputs:l,weights:r,placeholders:a,signature:t,functions:c};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){let t=o8(e.op)||this.opMappers[e.op]||{};e.attr==null&&(e.attr={});let n={name:e.name,op:e.op,category:t.category,inputNames:(e.input||[]).map(a=>a.startsWith("^")?a.substr(1):a),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:e.attr};return t.inputs!=null&&(n.inputParams=t.inputs.reduce((a,r)=>(a[r.name]={type:r.type,inputIndexStart:r.start,inputIndexEnd:r.end},a),{})),t.attrs!=null&&(n.attrParams=t.attrs.reduce((a,r)=>{let s=r.type,i;switch(r.type){case"string":i=A2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=A2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"string[]":i=I2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=I2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"number":i=g2(e.attr,r.tfName,r.defaultValue||0),i===void 0&&!!r.tfDeprecatedName&&(i=g2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"number[]":i=k2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=k2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"bool":i=y2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=y2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"bool[]":i=N2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=N2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"shape":i=w2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=w2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"shape[]":i=S2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=S2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"dtype":i=b2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=b2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"dtype[]":i=v2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=v2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"func":i=S8(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=S8(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error(`Unsupported param type: ${r.type} for op: ${e.op}`)}return a[r.name]={value:i,type:s},a},{})),n}mapFunction(e){let t=e.nodeDef,n=[],a=[],r={};t!=null&&(r=t.reduce((d,u)=>(d[u.name]=this.mapNode(u),u.op==="Const"&&a.push(d[u.name]),d),{}));let s=[],i=[];e.signature.inputArg.forEach(d=>{let[u]=pr(d.name),p={name:u,op:"Placeholder",inputs:[],inputNames:[],category:"graph",inputParams:{},attrParams:{dtype:{value:x2(d.type),type:"dtype"}},children:[]};p.signatureKey=d.name,s.push(p),r[u]=p}),Object.keys(r).forEach(d=>{let u=r[d];u.inputNames.forEach(p=>{let[c]=pr(p);u.inputs.push(r[c]),r[c].children.push(u)})});let o=e.ret;e.signature.outputArg.forEach(d=>{let[u,p]=pr(o[d.name]),c=r[u];c!=null&&(c.defaultOutput=p,i.push(c))});let l=this.mapArgsToSignature(e);return{nodes:r,inputs:s,outputs:i,weights:a,placeholders:n,signature:l}}mapArgsToSignature(e){return{methodName:e.signature.name,inputs:e.signature.inputArg.reduce((t,n)=>(t[n.name]=this.mapArgToTensorInfo(n),t),{}),outputs:e.signature.outputArg.reduce((t,n)=>(t[n.name]=this.mapArgToTensorInfo(n,e.ret),t),{})}}mapArgToTensorInfo(e,t){let n=e.name;return t!=null&&(n=t[n]),{name:n,dtype:e.type}}};function nse(e){let t=J().global;if(typeof t.atob!="undefined")return t.atob(e);if(typeof Buffer!="undefined")return new Buffer(e,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}function T8(e,t){let n=Array.isArray(e)?String.fromCharCode.apply(null,e):nse(e);return t?n:n.toLowerCase()}function A2(e,t,n,a=!1){let r=e[t];return r!=null?T8(r.s,a):n}function y2(e,t,n){let a=e[t];return a?a.b:n}function g2(e,t,n){let a=e[t]||{},r=a.i!=null?a.i:a.f!=null?a.f:n;return typeof r=="number"?r:parseInt(r,10)}function x2(e){switch(typeof e=="string"&&(e=Ta[e]),e){case Ta.DT_FLOAT:return"float32";case Ta.DT_INT32:case Ta.DT_INT64:case Ta.DT_INT8:case Ta.DT_UINT8:return"int32";case Ta.DT_BOOL:return"bool";case Ta.DT_DOUBLE:return"float32";case Ta.DT_STRING:return"string";default:return null}}function S8(e,t,n){let a=e[t];return a&&a.func?a.func.name:n}function b2(e,t,n){let a=e[t];return a&&a.type?x2(a.type):n}function v2(e,t,n){let a=e[t];return a&&a.list&&a.list.type?a.list.type.map(r=>x2(r)):n}function E8(e){if(!e.unknownRank)return e.dim!=null?e.dim.map(t=>typeof t.size=="number"?t.size:parseInt(t.size,10)):[]}function w2(e,t,n){let a=e[t];return a&&a.shape?E8(a.shape):n}function k2(e,t,n){let a=e[t];return a?((a.list.f&&a.list.f.length?a.list.f:a.list.i)||[]).map(r=>typeof r=="number"?r:parseInt(r,10)):n}function I2(e,t,n,a=!1){let r=e[t];return r&&r.list&&r.list.s?r.list.s.map(s=>T8(s,a)):n}function S2(e,t,n){let a=e[t];return a&&a.list&&a.list.shape?a.list.shape.map(r=>E8(r)):n}function N2(e,t,n){let a=e[t];return a&&a.list&&a.list.b?a.list.b:n}var ase=class{constructor(e,t,n){this.node=e,this.tensorMap=t,this.context=n,this.inputs=[],this.attrs={},this.inputs=e.inputNames.map(a=>this.getInput(a)),e.rawAttrs!=null&&(this.attrs=Object.keys(e.rawAttrs).reduce((a,r)=>(a[r]=this.getAttr(r),a),{}))}getInput(e){return mn(e,this.tensorMap,this.context)}getAttr(e,t){let n=this.node.rawAttrs[e];if(n.tensor!=null)return mn(e,this.tensorMap,this.context);if(n.i!=null||n.f!=null)return g2(this.node.rawAttrs,e,t);if(n.s!=null)return A2(this.node.rawAttrs,e,t);if(n.b!=null)return y2(this.node.rawAttrs,e,t);if(n.shape!=null)return w2(this.node.rawAttrs,e,t);if(n.type!=null)return b2(this.node.rawAttrs,e,t);if(n.list!=null){if(n.list.i!=null||n.list.f!=null)return k2(this.node.rawAttrs,e,t);if(n.list.s!=null)return I2(this.node.rawAttrs,e,t);if(n.list.shape!=null)return S2(this.node.rawAttrs,e,t);if(n.list.b!=null)return N2(this.node.rawAttrs,e,t);if(n.list.type!=null)return v2(this.node.rawAttrs,e,t)}return t}},rse=(e,t,n)=>{switch(e.op){case"BiasAdd":case"AddV2":case"Add":return[se(I("a",e,t,n),I("b",e,t,n))];case"AddN":return[yc(I("tensors",e,t,n))];case"FloorMod":case"Mod":return[SA(I("a",e,t,n),I("b",e,t,n))];case"Mul":return[_(I("a",e,t,n),I("b",e,t,n))];case"RealDiv":case"Div":return[me(I("a",e,t,n),I("b",e,t,n))];case"DivNoNan":return[fA(I("a",e,t,n),I("b",e,t,n))];case"FloorDiv":return[Ac(I("a",e,t,n),I("b",e,t,n))];case"Sub":return[ge(I("a",e,t,n),I("b",e,t,n))];case"Minimum":return[gl(I("a",e,t,n),I("b",e,t,n))];case"Maximum":return[_a(I("a",e,t,n),I("b",e,t,n))];case"Pow":return[rr(I("a",e,t,n),I("b",e,t,n))];case"SquaredDifference":return[Bc(I("a",e,t,n),I("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},sse=(e,t,n)=>{switch(e.op){case"Abs":case"ComplexAbs":return[Ot(I("x",e,t,n))];case"Acos":return[Ym(I("x",e,t,n))];case"Acosh":return[Jm(I("x",e,t,n))];case"Asin":return[eA(I("x",e,t,n))];case"Asinh":return[tA(I("x",e,t,n))];case"Atan":return[nA(I("x",e,t,n))];case"Atan2":return[aA(I("x",e,t,n),I("y",e,t,n))];case"Atanh":return[rA(I("x",e,t,n))];case"Ceil":return[uA(I("x",e,t,n))];case"Complex":return[Nr(I("real",e,t,n),I("imag",e,t,n))];case"Cos":return[Xu(I("x",e,t,n))];case"Cosh":return[wc(I("x",e,t,n))];case"Elu":return[fl(I("x",e,t,n))];case"Erf":return[mA(I("x",e,t,n))];case"Exp":return[qn(I("x",e,t,n))];case"Expm1":return[AA(I("x",e,t,n))];case"Floor":return[Al(I("x",e,t,n))];case"Log":return[Fn(I("x",e,t,n))];case"Log1p":return[Nc(I("x",e,t,n))];case"Imag":return[Ic(I("x",e,t,n))];case"Neg":return[vt(I("x",e,t,n))];case"Reciprocal":return[EA(I("x",e,t,n))];case"Real":return[ed(I("x",e,t,n))];case"Relu":return[Pa(I("x",e,t,n))];case"Round":return[$c(I("x",e,t,n))];case"Selu":return[Oc(I("x",e,t,n))];case"Sigmoid":return[wn(I("x",e,t,n))];case"Sin":return[zc(I("x",e,t,n))];case"Sign":return[RA(I("x",e,t,n))];case"Sinh":return[_c(I("x",e,t,n))];case"Softplus":return[hi(I("x",e,t,n))];case"Sqrt":return[Jt(I("x",e,t,n))];case"Square":return[st(I("x",e,t,n))];case"Tanh":return[di(I("x",e,t,n))];case"Tan":return[$A(I("x",e,t,n))];case"ClipByValue":return[kn(I("x",e,t,n),I("clipValueMin",e,t,n),I("clipValueMax",e,t,n))];case"Relu6":return[Fc(I("x",e,t,n))];case"Rsqrt":return[Dc(mn(e.inputNames[0],t,n))];case"Prod":return[Mc(I("x",e,t,n),I("axes",e,t,n))];case"LeakyRelu":return[Ku(I("x",e,t,n),I("alpha",e,t,n))];case"Prelu":return[Qu(I("x",e,t,n),I("alpha",e,t,n))];case"IsNan":return[gA(mn(e.inputNames[0],t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function ca(e,t,n=""){if(!(typeof e=="number"||typeof t=="number")){k.assert(e.length===t.length,()=>n+` Shapes ${e} and ${t} must match`);for(let a=0;an+` Shapes ${e} and ${t} must match`)}}}function C8(e){return!(typeof e=="number"||e.some(t=>t<0))}function jd(e,t,n){let a=T2(e,n),r=!C8(a);if(r&&t.length===0)throw new Error(`Tried to calculate elements of an empty list with non-fully-defined elementShape: ${a}`);if(r&&t.forEach(s=>{a=T2(s.shape,a)}),!C8(a))throw new Error(`Non-fully-defined elementShape: ${a}`);return a}function T2(e,t){if(typeof e=="number")return t;if(typeof t=="number")return e;if(e.length!==t.length)throw new Error(`Incompatible ranks during merge: ${e} vs. ${t}`);let n=[];for(let a=0;a=0&&s>=0&&r!==s)throw new Error(`Incompatible shape during merge: ${e} vs. ${t}`);n[a]=r>=0?r:s}return n}var ise=class{constructor(e,t,n,a,r,s,i){this.name=e,this.dtype=t,this.maxSize=n,this.elementShape=a,this.identicalElementShapes=r,this.dynamicSize=s,this.clearAfterRead=i,this.tensors=[],this.closed_=!1,this.idTensor=Se(0),jt(this.idTensor)}get id(){return this.idTensor.id}get closed(){return this.closed_}clearAndClose(e){this.tensors.forEach(t=>{(e==null||!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()}`);let 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(t=>this.read(t))}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}`);let n=this.tensors[e]||{};if(t.dtype!==this.dtype)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, +2. The custom ${a} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);if(l!=null){let d={};for(let h of Object.keys(ua))d[h]=ua[h];for(let h of Object.keys(n))d[h]=n[h];let u=s.config;u.customObjects=d;let p=Object.assign({},ua);for(let h of Object.keys(n))ua[h]=n[h];F1(s.config);let c=l(o,s.config,n,r);return ua=Object.assign({},p),c}else{let d=Object.assign({},ua);for(let p of Object.keys(n))ua[p]=n[p];let u=new o(s.config);return ua=Object.assign({},d),u}}}function rte(e,t){return et?1:0}function Fh(e,t){return-1*rte(e,t)}function Vr(e){if(e==null)return e;let t=[];for(let n of e)t.indexOf(n)===-1&&t.push(n);return t}function ste(e){if(e==null)throw new B(`Invalid value in obj: ${JSON.stringify(e)}`);for(let t in e)if(e.hasOwnProperty(t))return!1;return!0}function Ci(e,t,n){if(n!=null&&e.indexOf(n)<0)throw new B(`${n} is not a valid ${t}. Valid values are ${e} or null/undefined.`)}function $1(e,t,n=0,a=Infinity){return ja(n>=0),ja(a>=n),Array.isArray(e)&&e.length>=n&&e.length<=a&&e.every(r=>typeof r===t)}function Ht(e,t){Array.isArray(e)?(k.assert(e.length>0,()=>`${t} is unexpectedly an empty array.`),e.forEach((n,a)=>Ht(n,`element ${a+1} of ${t}`))):k.assert(Number.isInteger(e)&&e>0,()=>`Expected ${t} to be a positive integer, but got ${N6(e)}.`)}function N6(e){return e===null?"null":Array.isArray(e)?"["+e.map(t=>N6(t)).join(",")+"]":typeof e=="string"?`"${e}"`:`${e}`}function ite(e,t){let n=k.now(),a;return(...r)=>{let s=k.now();return s-nJt(ke(_(e,e),t,!0)))}var Nd=class extends ae.Serializable{getConfig(){return{}}},O1=class extends Nd{constructor(e){super();this.defaultMaxValue=2,this.defaultAxis=0,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return W(()=>{let t=D1(e,this.axis),n=kn(t,0,this.maxValue);return _(e,me(n,se(_t(),t)))})}getConfig(){return{maxValue:this.maxValue,axis:this.axis}}};O1.className="MaxNorm";ae.registerClass(O1);var z1=class extends Nd{constructor(e){super();this.defaultAxis=0,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return W(()=>me(e,se(_t(),D1(e,this.axis))))}getConfig(){return{axis:this.axis}}};z1.className="UnitNorm";ae.registerClass(z1);var _1=class extends Nd{apply(e){return La(e)}};_1.className="NonNeg";ae.registerClass(_1);var P1=class extends Nd{constructor(e){super();this.defaultMinValue=0,this.defaultMaxValue=1,this.defaultRate=1,this.defaultAxis=0,this.minValue=e.minValue!=null?e.minValue:this.defaultMinValue,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.rate=e.rate!=null?e.rate:this.defaultRate,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return W(()=>{let t=D1(e,this.axis),n=se(_(this.rate,kn(t,this.minValue,this.maxValue)),_(1-this.rate,t));return _(e,me(n,se(_t(),t)))})}getConfig(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}}};P1.className="MinMaxNorm";ae.registerClass(P1);var E6={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function Pt(e){return M1(e)}function C6(e,t={}){return Sd(e,ae.SerializationMap.getMap().classNameMap,t,"constraint")}function Lt(e){if(e==null)return null;if(typeof e=="string"){let t={className:e in E6?E6[e]:e,config:{}};return C6(t)}else return e instanceof Nd?e:C6(e)}function ete(e){return new O1(e)}function tte(e){return new z1(e)}function nte(){return new _1}function ate(e){return new P1(e)}var R6={};Fe(R6,{constant:()=>ute,glorotNormal:()=>Ate,glorotUniform:()=>mte,heNormal:()=>yte,heUniform:()=>gte,identity:()=>hte,leCunNormal:()=>xte,leCunUniform:()=>bte,ones:()=>lte,orthogonal:()=>vte,randomNormal:()=>pte,randomUniform:()=>dte,truncatedNormal:()=>cte,varianceScaling:()=>fte,zeros:()=>ote});var wte=["channelsFirst","channelsLast"],kte=["nearest","bilinear"],Ite=["valid","same","causal"],Ste=["max","avg"],Nte=["sum","mul","concat","ave"],Wl=new Map;function Et(e){Ci(wte,"DataFormat",e)}function Tte(e){Ci(kte,"InterpolationFormat",e)}function Jn(e){Ci(Ite,"PaddingMode",e)}function M6(e){Ci(Ste,"PoolMode",e)}var Td=[],F6="/";function Ri(e,t){Td.push(e);try{let n=t();return Td.pop(),n}catch(n){throw Td.pop(),n}}function Ete(){return Td.length===0?"":Td.join(F6)+F6}function D6(e){if(!$6(e))throw new Error("Not a valid tensor name: '"+e+"'");return Ete()+e}function O6(e){if(!$6(e))throw new Error("Not a valid tensor name: '"+e+"'");Wl.has(e)||Wl.set(e,0);let t=Wl.get(e);if(Wl.set(e,Wl.get(e)+1),t>0){let n=`${e}_${t}`;return Wl.set(n,1),n}else return e}var Cte=new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);function $6(e){return!!e.match(Cte)}function Rte(e){return e===parseInt(e.toString(),10)}function jr(e,t,n){t==null&&(t=0),n==null&&(n=e.length);let a=1;for(let r=t;r{if(e.shape.length!==2)throw new B(`repeat() expects a rank-2 tensor, but received a rank-${e.shape.length} tensor.`);let n=Cd(e,1);return L1(n,[1,t,1])})}function Fte(e){let t=[jr(e.shape)];return e.reshape(t)}function $te(e){if(e.rank<=1)throw new B(`batchFlatten requires a minimum rank of 2. Got rank: ${e.rank}.`);let t=[e.shape[0],jr(e.shape,1)];return e.reshape(t)}function Mi(e,t,n){return W(()=>{switch(e.rank){case 1:return Lc(e,t,n);case 2:return FA(e,[t,0],[n,e.shape[1]]);case 3:return Wc(e,[t,0,0],[n,e.shape[1],e.shape[2]]);case 4:return nd(e,[t,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3]]);case 5:return Re(e,[t,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4]]);case 6:return Re(e,[t,0,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4],e.shape[5]]);default:throw new B(`sliceAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}})}function W1(e,t,n){return W(()=>{switch(e.rank){case 1:return Lc(e,t,n);case 2:return FA(e,[0,t],[e.shape[0],n]);case 3:return Wc(e,[0,0,t],[e.shape[0],e.shape[1],n]);case 4:return nd(e,[0,0,0,t],[e.shape[0],e.shape[1],e.shape[2],n]);default:throw new B(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}})}function $h(e,t,n,a){return W(()=>{switch(e.rank){case 1:return Lc(e,t,n);case 2:switch(a){case 1:return Mi(e,t,n);case 2:return W1(e,t,n);default:throw new B(`The axis is not within the rank of the tensor ${a}`)}case 3:switch(a){case 1:return Mi(e,t,n);case 2:return Wc(e,[0,t,0],[e.shape[0],n,e.shape[2]]);case 3:return W1(e,t,n);default:throw new B(`The axis is not within the rank of the tensor ${a}`)}case 4:switch(a){case 1:return Mi(e,t,n);case 2:return nd(e,[0,t,0,0],[e.shape[0],n,e.shape[2],e.shape[3]]);case 3:return nd(e,[0,0,t,0],[e.shape[0],e.shape[1],n,e.shape[3]]);case 4:return W1(e,t,n);default:throw new B(`The axis is not within the rank of the tensor ${a}`)}default:throw new B(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}})}function B1(e,t=-1){let n;return t<0&&(n=e[0].rank,n!==0?t=n:t=0),t===e[0].rank&&(t=-1),ot(e,t)}function _6(e,t){switch(e.rank){case 1:return Fb([e,t]);case 2:return hl([e,t],0);case 3:return $b([e,t],0);case 4:return Db([e,t],0);default:throw new B(`concatAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}}function L1(e,t){if(Array.isArray(t)||(t=[t]),e.rank!==t.length)throw new B(`The length of input n (${t.length}) does not match the number of dimensions in input x (${e.rank})`);return $r(e,t)}function Dh(e,t=0,n=1,a,r){return Jb(e,t,n,a,r)}function Ua(e,t,n,a){if(e.rank<2||t.rank<2)throw new Oe(`dot requires both inputs to be rank >= 2 but got x shape = ${e.shape} and y shape = ${t.shape}`);if(t.rank>=3){let r=e.shape.slice(-1)[0],s=t.shape.slice(-2)[0];if(r!==s)throw new Oe(`If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = ${e.shape} and y shape = ${t.shape}`)}if(e.rank===2&&t.rank===2){let r=!1,s=!1;return _r.matMul({a:e,b:t,transposeA:r,transposeB:s,bias:a?V1(e.rank,a,ba()):null,activation:n})}else{let r=e.shape.slice(),s=r.pop();e=e.reshape([-1,s]);let i=t.shape.slice(),o=i.pop(),l=i.pop(),d=[...i,o],u=Array.from({length:t.rank},(m,f)=>f===0?t.rank-2:f<=t.rank-2?f-1:f);t=t.transpose(u).reshape([l,-1]);let p=[...r,...d],c=!1,h=!1;return _r.matMul({a:e,b:t,transposeA:c,transposeB:h,bias:a?V1(e.rank,a,ba()):null,activation:n}).reshape(p)}}function P6(e,t,n){return W(()=>(Array.isArray(t)?t=Tt(t,"int32"):t=t.toInt(),hi(e,t,n)))}function Rd(e){return _(e,e)}function V1(e,t,n){let a=t.shape;if(t.rank!==1&&t.rank!==e)throw new B(`Unexpected bias dimensions: ${t.rank}; expected it to be 1 or ${e}`);if(e===5){if(n==="channelsFirst")return a.length===1?t.reshape([1,a[0],1,1,1]):t.reshape([1,a[3],a[0],a[1],a[2]]);if(n==="channelsLast")return a.length===1?t.reshape([1,1,1,1,a[0]]):t.reshape([1].concat(a))}else if(e===4){if(n==="channelsFirst")return a.length===1?t.reshape([1,a[0],1,1]):t.reshape([1,a[2],a[0],a[1]]);if(n==="channelsLast")return a.length===1?t.reshape([1,1,1,a[0]]):t.reshape([1].concat(a))}else if(e===3){if(n==="channelsFirst")return a.length===1?t.reshape([1,a[0],1]):t.reshape([1,a[1],a[0]]);if(n==="channelsLast")return a.length===1?t.reshape([1,1,a[0]]):t.reshape([1].concat(a))}else if(e<3)return t;throw new B(`Unsupported input rank by biasAdd: ${t.rank}`)}function ka(e,t,n){return W(()=>(n==null&&(n=ba()),Et(n),e.add(V1(e.rank,t,n))))}function Dte(e,t=1){if(t!==1)throw new Oe(`Support for alpha values other than 1 (${t}) is not implemented yet.`);return ml(e)}function Ote(e){return W(()=>me(e,Ot(e).add(1)))}function L6(e,t,n,a){return W(()=>s3(e,t,n,a))}function zte(e){return W(()=>{let t=se(.5,_(.2,e));return kn(t,0,1)})}function Md(e,t,n=!1){return n?e():t()}var _te=["fanIn","fanOut","fanAvg"],Pte=["normal","uniform","truncatedNormal"];function Lte(e){Ci(_te,"FanMode",e)}function Wte(e){Ci(Pte,"Distribution",e)}var da=class extends ae.Serializable{fromConfigUsesCustomObjects(){return!1}getConfig(){return{}}},j1=class extends da{apply(e,t){return Ct(e,t)}};j1.className="Zeros";ae.registerClass(j1);var Oh=class extends da{apply(e,t){return $n(e,t)}};Oh.className="Ones";ae.registerClass(Oh);var U1=class extends da{constructor(e){super();if(typeof e!="object")throw new B(`Expected argument of type ConstantConfig but got ${e}`);if(e.value===void 0)throw new B(`config must have value set but got ${e}`);this.value=e.value}apply(e,t){return W(()=>_(Se(this.value),$n(e,t)))}getConfig(){return{value:this.value}}};U1.className="Constant";ae.registerClass(U1);var H1=class extends da{constructor(e){super();this.DEFAULT_MINVAL=-.05,this.DEFAULT_MAXVAL=.05,this.minval=e.minval||this.DEFAULT_MINVAL,this.maxval=e.maxval||this.DEFAULT_MAXVAL,this.seed=e.seed}apply(e,t){return bl(e,this.minval,this.maxval,t)}getConfig(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}}};H1.className="RandomUniform";ae.registerClass(H1);var G1=class extends da{constructor(e){super();this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if(t=t||"float32",t!=="float32"&&t!=="int32")throw new Oe(`randomNormal does not support dType ${t}.`);return Dh(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}};G1.className="RandomNormal";ae.registerClass(G1);var q1=class extends da{constructor(e){super();this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if(t=t||"float32",t!=="float32"&&t!=="int32")throw new Oe(`truncatedNormal does not support dType ${t}.`);return jc(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}};q1.className="TruncatedNormal";ae.registerClass(q1);var X1=class extends da{constructor(e){super();this.gain=e.gain!=null?e.gain:1}apply(e,t){return W(()=>{if(e.length!==2||e[0]!==e[1])throw new B("Identity matrix initializer can only be used for 2D square matrices.");return _(this.gain,gA(e[0]))})}getConfig(){return{gain:this.gain}}};X1.className="Identity";ae.registerClass(X1);function Bte(e,t="channelsLast"){let n,a;if(Et(t),e.length===2)n=e[0],a=e[1];else if([3,4,5].indexOf(e.length)!==-1){if(t==="channelsFirst"){let r=jr(e,2);n=e[1]*r,a=e[0]*r}else if(t==="channelsLast"){let r=jr(e,0,e.length-2);n=e[e.length-2]*r,a=e[e.length-1]*r}}else{let r=jr(e);n=Math.sqrt(r),a=Math.sqrt(r)}return[n,a]}var Nn=class extends da{constructor(e){super();if(e.scale<0)throw new B(`scale must be a positive float. Got: ${e.scale}`);this.scale=e.scale==null?1:e.scale,this.mode=e.mode==null?"fanIn":e.mode,Lte(this.mode),this.distribution=e.distribution==null?"normal":e.distribution,Wte(this.distribution),this.seed=e.seed}apply(e,t){let n=Bte(e),a=n[0],r=n[1],s=this.scale;if(this.mode==="fanIn"?s/=Math.max(1,a):this.mode==="fanOut"?s/=Math.max(1,r):s/=Math.max(1,(a+r)/2),this.distribution==="normal"){let i=Math.sqrt(s);if(t=t||"float32",t!=="float32"&&t!=="int32")throw new Oe(`${this.getClassName()} does not support dType ${t}.`);return jc(e,0,i,t,this.seed)}else{let i=Math.sqrt(3*s);return bl(e,-i,i,t)}}getConfig(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}}};Nn.className="VarianceScaling";ae.registerClass(Nn);var zh=class extends Nn{constructor(e){super({scale:1,mode:"fanAvg",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Nn.className}};zh.className="GlorotUniform";ae.registerClass(zh);var _h=class extends Nn{constructor(e){super({scale:1,mode:"fanAvg",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Nn.className}};_h.className="GlorotNormal";ae.registerClass(_h);var Ph=class extends Nn{constructor(e){super({scale:2,mode:"fanIn",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Nn.className}};Ph.className="HeNormal";ae.registerClass(Ph);var Lh=class extends Nn{constructor(e){super({scale:2,mode:"fanIn",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Nn.className}};Lh.className="HeUniform";ae.registerClass(Lh);var Wh=class extends Nn{constructor(e){super({scale:1,mode:"fanIn",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Nn.className}};Wh.className="LeCunNormal";ae.registerClass(Wh);var Bh=class extends Nn{constructor(e){super({scale:1,mode:"fanIn",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Nn.className}};Bh.className="LeCunNormal";ae.registerClass(Bh);var K1=class extends da{constructor(e){super();if(this.DEFAULT_GAIN=1,this.gain=e.gain==null?this.DEFAULT_GAIN:e.gain,this.seed=e.seed,this.seed!=null)throw new Oe("Random seed is not implemented for Orthogonal Initializer yet.")}apply(e,t){return W(()=>{if(e.length<2)throw new Oe("Shape must be at least 2D.");e[0]*e[1]>2e3&&console.warn(`Orthogonal initializer is being called on a matrix with more than 2000 (${e[0]*e[1]}) elements: Slowness may result.`);let n=e[0]>e[1]?[e[1],e[0]]:e,a=Dh(n,0,1,"float32"),r=g3.gramSchmidt(a);return e[0]>e[1]&&(r=r.transpose()),_(this.gain,r)})}getConfig(){return{gain:this.gain,seed:this.seed}}};K1.className="Orthogonal";ae.registerClass(K1);var W6={constant:"Constant",glorotNormal:"GlorotNormal",glorotUniform:"GlorotUniform",heNormal:"HeNormal",heUniform:"HeUniform",identity:"Identity",leCunNormal:"LeCunNormal",leCunUniform:"LeCunUniform",ones:"Ones",orthogonal:"Orthogonal",randomNormal:"RandomNormal",randomUniform:"RandomUniform",truncatedNormal:"TruncatedNormal",varianceScaling:"VarianceScaling",zeros:"Zeros"};function B6(e,t={}){return Sd(e,ae.SerializationMap.getMap().classNameMap,t,"initializer")}function kt(e){return M1(e)}function mt(e){if(typeof e=="string"){let t=e in W6?W6[e]:e;if(t==="GlorotNormal")return new _h;if(t==="GlorotUniform")return new zh;if(t==="HeNormal")return new Ph;if(t==="HeUniform")return new Lh;if(t==="LeCunNormal")return new Wh;if(t==="LeCunUniform")return new Bh;{let n={};return n.className=t,n.config={},B6(n)}}else return e instanceof da?e:B6(e)}function ote(){return new j1}function lte(){return new Oh}function ute(e){return new U1(e)}function dte(e){return new H1(e)}function pte(e){return new G1(e)}function cte(e){return new q1(e)}function hte(e){return new X1(e)}function fte(e){return new Nn(e)}function mte(e){return new zh(e)}function Ate(e){return new _h(e)}function yte(e){return new Ph(e)}function gte(e){return new Lh(e)}function xte(e){return new Wh(e)}function bte(e){return new Bh(e)}function vte(e){return new K1(e)}var V6={};Fe(V6,{Layer:()=>Ge,RNN:()=>Ha,RNNCell:()=>Fd,activation:()=>rne,add:()=>hne,alphaDropout:()=>Zne,average:()=>fne,averagePooling1d:()=>Z1,averagePooling2d:()=>Y1,averagePooling3d:()=>J1,avgPool1d:()=>kne,avgPool2d:()=>Sne,avgPool3d:()=>Tne,avgPooling1d:()=>Ine,avgPooling2d:()=>Nne,avgPooling3d:()=>Ene,batchNormalization:()=>bne,bidirectional:()=>Vne,concatenate:()=>mne,conv1d:()=>Kte,conv2d:()=>Zte,conv2dTranspose:()=>Yte,conv3d:()=>Jte,conv3dTranspose:()=>Qte,convLstm2d:()=>Pne,convLstm2dCell:()=>Lne,cropping2D:()=>tne,dense:()=>sne,depthwiseConv2d:()=>ane,dot:()=>xne,dropout:()=>ine,elu:()=>jte,embedding:()=>cne,flatten:()=>lne,gaussianDropout:()=>Kne,gaussianNoise:()=>Xne,globalAveragePooling1d:()=>Cne,globalAveragePooling2d:()=>Rne,globalMaxPool1d:()=>Une,globalMaxPool2d:()=>Hne,globalMaxPooling1d:()=>U6,globalMaxPooling2d:()=>H6,gru:()=>Fne,gruCell:()=>$ne,input:()=>j6,inputLayer:()=>Vte,layerNormalization:()=>vne,leakyReLU:()=>Hte,lstm:()=>Dne,lstmCell:()=>One,masking:()=>Yne,maxPool1d:()=>Gne,maxPool2d:()=>qne,maxPooling1d:()=>G6,maxPooling2d:()=>q6,maxPooling3d:()=>Mne,maximum:()=>Ane,minimum:()=>yne,multiply:()=>gne,permute:()=>pne,prelu:()=>Gte,reLU:()=>Ute,repeatVector:()=>une,reshape:()=>dne,rnn:()=>Wne,separableConv2d:()=>ene,simpleRNN:()=>zne,simpleRNNCell:()=>_ne,softmax:()=>qte,spatialDropout1d:()=>one,stackedRNNCells:()=>Bne,thresholdedReLU:()=>Xte,timeDistributed:()=>jne,upSampling2d:()=>nne,zeroPadding2d:()=>wne});var Jne=0;function X6(){return Jne++}var Vh={};function jh(e=""){return e in Vh||(Vh[e]=0),Vh[e]+=1,e+Vh[e].toString()}function Q1(e){return Array.isArray(e)&&Array.isArray(e[0])}function Uh(e){return e.length===0?[]:Array.isArray(e[0])?e:[e]}function _e(e){let t;if(Array.isArray(e)){if(e.length!==1)throw new B(`Expected Tensor length to be 1; got ${e.length}`);t=e[0]}else t=e;return t}function at(e){if(Array.isArray(e)&&Array.isArray(e[0])){if(e.length===1)return e=e,e[0];throw new B(`Expected exactly 1 Shape; got ${e.length}`)}else return e}function Hh(e){let t=0;for(let n of e)n.shape.length===0?t+=1:t+=n.shape.reduce((a,r)=>a*r);return t}var K6="Variable",Z6=class{constructor(e,t="float32",n=K6,a=!0,r=null){this.dtype=t==null?"float32":t,this.shape=e.shape,this.id=X6(),n=n==null?K6:n,this.originalName=D6(n),this.name=O6(this.originalName),this.trainable_=a,this.constraint=r,this.val=e3(e,this.trainable_,this.name,this.dtype)}read(){return this.assertNotDisposed(),this.val}write(e){return this.assertNotDisposed(),Qne(this.val,e),this.val.id!==e.id&&(this.val.assign(e),this.constraint!=null&&this.val.assign(this.constraint.apply(this.val))),this}dispose(){this.assertNotDisposed(),this.val.dispose()}assertNotDisposed(){if(this.val.isDisposed)throw new Error(`LayersVariable ${this.name} is already disposed.`)}get trainable(){return this.trainable_}set trainable(e){this.trainable_=e,this.val.trainable=e}};function Qne(e,t){if(e.shape.toString()!==t.shape.toString())throw new Error("Shape mismatch: "+JSON.stringify(e.shape)+" vs. "+JSON.stringify(t.shape))}function ey(e){return e.map(t=>t.read())}function ty(e){e.forEach(t=>{t[0].write(t[1])})}var Mt=class{constructor(e){this.dtype=e.dtype,this.shape=e.shape,e.shape!=null?this.ndim=e.shape.length:this.ndim=e.ndim,this.maxNDim=e.maxNDim,this.minNDim=e.minNDim,this.axes=e.axes||{}}},Ia=class{constructor(e,t,n,a,r,s,i){this.dtype=e,this.shape=t,this.sourceLayer=n,this.inputs=a,this.callArgs=r,this.outputTensorIndex=i,this.id=X6(),s!=null&&(this.originalName=D6(s),this.name=O6(this.originalName)),this.rank=t.length}},eae=0,Gh=class{constructor(e,t){this.callArgs=t,this.id=eae++,this.outboundLayer=e.outboundLayer,this.inboundLayers=e.inboundLayers,this.nodeIndices=e.nodeIndices,this.tensorIndices=e.tensorIndices,this.inputTensors=e.inputTensors,this.outputTensors=e.outputTensors,this.inputMasks=e.inputMasks,this.outputMasks=e.outputMasks,this.inputShapes=e.inputShapes,this.outputShapes=e.outputShapes;for(let n of e.inboundLayers)n!=null&&n.outboundNodes.push(this);e.outboundLayer.inboundNodes.push(this)}getConfig(){let e=[];for(let t of this.inboundLayers)t!=null?e.push(t.name):e.push(null);return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inboundLayers:e,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}}},tae=0,Ge=class extends ae.Serializable{constructor(e={}){super();this._callHook=null,this._addedWeightNames=[],this._stateful=!1,this.id=tae++,this.activityRegularizer=null,this.inputSpec=null,this.supportsMasking=!1,this._trainableWeights=[],this._nonTrainableWeights=[],this._losses=[],this._updates=[],this._built=!1,this.inboundNodes=[],this.outboundNodes=[];let t=e.name;if(!t){let n=this.getClassName();t=dr(n)+"_"+jh(n)}if(this.name=t,this.trainable_=e.trainable==null?!0:e.trainable,e.inputShape!=null||e.batchInputShape!=null){let n;if(e.batchInputShape!=null)n=e.batchInputShape;else if(e.inputShape!=null){let r=null;e.batchSize!=null&&(r=e.batchSize),n=[r].concat(e.inputShape)}this.batchInputShape=n;let a=e.dtype;a==null&&(a=e.inputDType),a==null&&(a="float32"),this.dtype=a}e.weights!=null?this.initialWeights=e.weights:this.initialWeights=null,this._refCount=null,this.fastWeightInitDuringBuild=!1}static nodeKey(e,t){return e.name+"_ib-"+t.toString()}getNodeAtIndex(e,t){if(this.inboundNodes.length===0)throw new va(`The layer has never been called and thus has no defined ${t}.`);if(this.inboundNodes.length<=e)throw new B(`Asked to get ${t} at node ${e}, but the layer has only ${this.inboundNodes.length} inbound nodes.`);return this.inboundNodes[e]}getInputAt(e){return Sn(this.getNodeAtIndex(e,"input").inputTensors)}getOutputAt(e){return Sn(this.getNodeAtIndex(e,"output").outputTensors)}get input(){if(this.inboundNodes.length>1)throw new ur(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer input" is ill-defined. Use \`getInputAt(nodeIndex)\` instead.`);if(this.inboundNodes.length===0)throw new ur(`Layer ${this.name} is not connected, no input to return.`);return Sn(this.getNodeAtIndex(0,"input").inputTensors)}get output(){if(this.inboundNodes.length===0)throw new ur(`Layer ${this.name} has no inbound nodes.`);if(this.inboundNodes.length>1)throw new ur(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use \`getOutputAt(nodeIndex)\` instead.`);return Sn(this.getNodeAtIndex(0,"output").outputTensors)}get losses(){return this._losses}calculateLosses(){return this.losses.map(e=>e())}get updates(){return this._updates}get built(){return this._built}set built(e){this._built=e}get trainable(){return this.trainable_}set trainable(e){this._trainableWeights.forEach(t=>t.trainable=e),this.trainable_=e}get trainableWeights(){return this.trainable_?this._trainableWeights.filter(e=>e.trainable):[]}set trainableWeights(e){this._trainableWeights=e}get nonTrainableWeights(){return this.trainable?this._trainableWeights.filter(e=>!e.trainable).concat(this._nonTrainableWeights):this._trainableWeights.concat(this._nonTrainableWeights)}set nonTrainableWeights(e){this._nonTrainableWeights=e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}get stateful(){return this._stateful}resetStates(){if(!this.stateful)throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.")}assertInputCompatibility(e){if(e=ht(e),this.inputSpec==null||this.inputSpec.length===0)return;let t=ht(this.inputSpec);if(e.length!==t.length)throw new B(`Layer ${this.name} expects ${t.length} inputs, but it received ${e.length} input tensors. Input received: ${e}`);for(let n=0;nr.maxNDim)throw new B(`Input ${n} is incompatible with layer ${this.name}: expected max_ndim=${r.maxNDim}, found ndim=${s}`);if(r.minNDim!=null&&s=0?i[l]:i[i.length+l];if(d!=null&&[d,null].indexOf(u)===-1)throw new B(`Input ${n} is incompatible with layer ${this.name}: expected axis ${l} of input shape to have value ${d} but got shape ${i}.`)}}if(r.shape!=null)for(let i=0;i{if(!this.built){this.assertInputCompatibility(e);let s=[];for(let i of ht(e))s.push(i.shape);this.build(Sn(s)),this.built=!0,this.initialWeights&&this.setWeights(this.initialWeights),this._refCount===null&&r&&(this._refCount=1)}if(this.assertInputCompatibility(e),r){let s=this.call(e,t),i=ht(s),o=[];for(let l of i)n.indexOf(l)!==-1&&(l=l.clone()),o.push(l);if(s=Sn(o),this.activityRegularizer!=null)throw new Oe("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return s}else{let s=nae(e),i=this.computeOutputShape(s),o,l=aae(e);if(this.warnOnIncompatibleInputShape(Array.isArray(e)?s[0]:s),i!=null&&i.length>0&&Array.isArray(i[0])?o=i.map((d,u)=>new Ia(l,d,this,ht(e),t,this.name,u)):o=new Ia(l,i,this,ht(e),t,this.name),this.addInboundNode(e,o,null,null,s,i,t),this._refCount++,this.activityRegularizer!=null)throw new Oe("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return o}})}warnOnIncompatibleInputShape(e){if(this.batchInputShape!=null)if(e.length!==this.batchInputShape.length)console.warn(`The rank of the input tensor provided (shape: ${JSON.stringify(e)}) does not match that of the batchInputShape (${JSON.stringify(this.batchInputShape)}) of the layer ${this.name}`);else{let t=!1;this.batchInputShape.forEach((n,a)=>{n!=null&&e[a]!=null&&e[a]!==n&&(t=!0)}),t&&console.warn(`The shape of the input tensor (${JSON.stringify(e)}) does not match the expectation of layer ${this.name}: ${JSON.stringify(this.batchInputShape)}`)}}get outputShape(){if(this.inboundNodes==null||this.inboundNodes.length===0)throw new ur(`The layer ${this.name} has never been called and thus has no defined output shape.`);let e=[];for(let t of this.inboundNodes){let n=JSON.stringify(t.outputShapes);e.indexOf(n)===-1&&e.push(n)}if(e.length===1){let t=this.inboundNodes[0].outputShapes;return Array.isArray(t)&&Array.isArray(t[0])&&t.length===1?t[0]:t}else throw new ur(`The layer ${this.name} has multiple inbound nodes with different output shapes. Hence the notion of "output shape" is ill-defined for the layer.`)}countParams(){if(!this.built)throw new va(`You tried to call countParams() on ${this.name}, but the layer is not built yet. Build it first by calling build(batchInputShape).`);return Hh(this.weights)}build(e){this.built=!0}getWeights(e=!1){return ey(e?this.trainableWeights:this.weights)}setWeights(e){W(()=>{let t=this.weights;if(t.length!==e.length)throw new B(`You called setWeights(weights) on layer "${this.name}" with a weight list of length ${e.length}, but the layer was expecting ${t.length} weights. Provided weights: ${e}...`);if(t.length===0)return;let n=[],a=ey(t);for(let r=0;rr.apply(l.read())),s==null&&(s=!0),s?this._trainableWeights.push(l):this._nonTrainableWeights.push(l),l}setFastWeightInitDuringBuild(e){this.fastWeightInitDuringBuild=e}addLoss(e){e==null||Array.isArray(e)&&e.length===0||(e=ht(e),this._losses!==void 0&&this._losses!==null&&this.losses.push(...e))}computeOutputShape(e){return e}computeMask(e,t){if(!this.supportsMasking){if(t!=null)if(Array.isArray(t))t.forEach(n=>{if(n!=null)throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`)});else throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`);return null}return t}addInboundNode(e,t,n,a,r,s,i=null){let o=ht(e);t=ht(t),n=ht(n),a=ht(a),r=Uh(r),s=Uh(s);let l=[],d=[],u=[];for(let p of o)l.push(p.sourceLayer),d.push(p.nodeIndex),u.push(p.tensorIndex);new Gh({outboundLayer:this,inboundLayers:l,nodeIndices:d,tensorIndices:u,inputTensors:o,outputTensors:t,inputMasks:n,outputMasks:a,inputShapes:r,outputShapes:s},i);for(let p=0;pe.dispose()),this.weights.length}assertNotDisposed(){if(this._refCount===0)throw new Error(`Layer '${this.name}' is already disposed.`)}dispose(){if(!this.built)throw new Error(`Cannot dispose Layer ${this.name} because it has not been built yet.`);if(this._refCount===null)throw new Error(`Cannot dispose Layer ${this.name} because it has not been used yet.`);this.assertNotDisposed();let e=0;return--this._refCount==0&&(e=this.disposeWeights()),{refCountAfterDispose:this._refCount,numDisposedVariables:e}}};function nae(e){e=ht(e);let t=[];for(let n of e)t.push(n.shape);return Sn(t)}function aae(e){return"float32"}function Y6(e,t,n){if((t==null||n!=null&&n>0)&&(t=e.sourceLayer,n=e.nodeIndex),t.inboundNodes.length===0)return[e];{let a=t.inboundNodes[n];if(a.inboundLayers.length===0)return a.inputTensors;{let r=[];for(let s=0;s0){let r=await Promise.all(t);for(let s=0;sse(this.totals[a],_(r,n)));this.totals[a]=i,s!=null&&s.dispose()}}}async onEpochEnd(e,t){if(t!=null)for(let n of this.params.metrics)this.totals[n]!=null&&(typeof this.totals[n]=="number"?t[n]=this.totals[n]/this.seen:W(()=>{let a=_(me(1,this.seen),this.totals[n]);t[n]=a,this.totals[n].dispose(),jt(t[n])}))}},n4=class extends jl{async onTrainBegin(e){this.epoch=[],this.history={}}async onEpochEnd(e,t){t==null&&(t={}),this.epoch.push(e);for(let n in t)this.history[n]==null&&(this.history[n]=[]),this.history[n].push(t[n])}async syncData(){let e=[],t=[],n=[];for(let r in this.history){let s=this.history[r];for(let i=0;inew a4(n,t))}var pa=class{constructor(){}static registerCallbackConstructor(e,t){k.assert(e>=0&&Number.isInteger(e),()=>`Verbosity level is expected to be an integer >= 0, but got ${e}`),pa.checkForDuplicate(t),pa.constructors[e]==null&&(pa.constructors[e]=[]),pa.constructors[e].push(t)}static checkForDuplicate(e){for(let t in pa.constructors)pa.constructors[+t].forEach(n=>{if(n===e)throw new B("Duplicate callback constructor.")})}static clear(){pa.constructors={}}static createCallbacks(e){let t=[];for(let n in pa.constructors){let a=+n;e>=a&&t.push(...pa.constructors[a])}return t.map(n=>new n)}};pa.constructors={};function s4(e,t,n,a,r,s,i,o,l){let d=new n4,u=[new sae,...pa.createCallbacks(t)];e!=null&&u.push(...e),u.push(d);let p=new t4(u);return p.setParams({epochs:n,initialEpoch:a,samples:r,steps:s,batchSize:i,verbose:t,doValidation:o,metrics:l}),{callbackList:p,history:d}}function Sa(e,t={},n=!1){return Sd(e,ae.SerializationMap.getMap().classNameMap,t,"layer",n)}function qh(e,t){return W(()=>{e.dtype!=="float32"&&(e=e.asType("float32"));let n=ke(Rd(e),t,!0),a=Al(n.shape,_t()),r=Jt(Pa(n,a));return me(e,r)})}function Fi(e,t){return W(()=>wt(Rd(ge(t,e)),-1))}function Xh(e,t){return W(()=>wt(Ot(ge(t,e)),-1))}function Ul(e,t){return W(()=>{let n=ge(e,t),a=kn(Ot(e),_t(),Number.MAX_VALUE),r=Ot(me(n,a));return _(100,wt(r,-1))})}function iae(e,t){return W(()=>{let n=kn(t,_t(),Number.MAX_VALUE),a=Fn(se(1,n)),r=kn(e,_t(),Number.MAX_VALUE),s=Fn(se(1,r));return wt(Rd(ge(a,s)),-1)})}function oae(e,t){return W(()=>{let n=Pa(0,ge(1,_(e,t)));return wt(Rd(n),-1)})}function lae(e,t){return W(()=>{let n=Pa(0,ge(1,_(e,t)));return wt(n,-1)})}function uae(e,t){return W(()=>{let n=ke(_(e,t),-1),a=Xn(_(ge(1,e),t),-1);return Pa(0,se(1,ge(a,n)))})}function dae(e,t){return W(()=>{let n=Math.log(2),a=ge(t,e),r=ge(se(a,fi(_(-2,a))),n);return wt(r,-1)})}function $d(e,t,n=!1){return W(()=>{if(n)t=ad(t);else{let a=ke(t,t.shape.length-1,!0);t=me(t,a)}return t=kn(t,_t(),1-_t()),vt(ke(_(e.toFloat(),Fn(t)),t.shape.length-1))})}function Kh(e,t,n=!1){return W(()=>{let a=yl(Fte(e)).toInt();t=kn(t,_t(),1-_t());let r=t.shape,s=ll(a,r[r.length-1]).reshape(r);return $d(s,t,n)})}function pae(e,t){if(!k.arraysEqual(e.shape,t.shape))throw new B(`logits and labels must have the same shape, but got shapes ${JSON.stringify(e.shape)} and ${JSON.stringify(t.shape)}`);return W(()=>{let n=t.relu(),a=t.abs().neg();return n.sub(t.mul(e)).add(a.exp().log1p())})}function Zh(e,t){return W(()=>{let n;return n=kn(t,_t(),1-_t()),n=Fn(me(n,ge(1,n))),wt(pae(e,n),-1)})}function cae(e,t){return W(()=>{let n=kn(e,_t(),1),a=kn(t,_t(),1);return ke(_(e,Fn(me(n,a))),-1)})}function hae(e,t){return W(()=>{let n=Fn(se(_t(),t));return wt(ge(t,_(e,n)),-1)})}function ny(e,t){return W(()=>{let n=qh(e,-1),a=qh(t,-1),r=_(n,a);return vt(ke(r,-1))})}var Yh={meanSquaredError:Fi,meanAbsoluteError:Xh,meanAbsolutePercentageError:Ul,meanSquaredLogarithmicError:iae,squaredHinge:oae,hinge:lae,categoricalHinge:uae,logcosh:dae,categoricalCrossentropy:$d,sparseCategoricalCrossentropy:Kh,binaryCrossentropy:Zh,kullbackLeiblerDivergence:cae,poisson:hae,cosineProximity:ny};function ay(e){if(typeof e=="string"){if(e in Yh)return Yh[e];let t=`Unknown loss ${e}`;throw e.toLowerCase().includes("softmaxcrossentropy")&&(t=`Unknown loss ${e}. Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy`),new B(t)}else return e}function ry(e,t){return W(()=>{let n=_(.5,Dn(t)),a=Ed(Mn(t,n),e.dtype);return wt(Fr(e,a),-1)})}function sy(e,t){return W(()=>Ed(Fr(Hu(e,-1),Hu(t,-1)),"float32"))}function i4(e,t){return W(()=>oa(e.equal(1),t.equal(1)).sum().cast("float32"))}function fae(e,t){return W(()=>oa(e.equal(1),t.equal(0)).sum().cast("float32"))}function mae(e,t){return W(()=>oa(e.equal(0),t.equal(1)).sum().cast("float32"))}function o4(e,t){return W(()=>{let n=i4(e,t),a=mae(e,t),r=n.add(a);return nn(Mn(r,0),n.div(r),0).cast("float32")})}function Aae(e,t){return W(()=>{let n=i4(e,t),a=fae(e,t),r=n.add(a);return nn(Mn(r,0),n.div(r),0).cast("float32")})}function l4(e,t){return Zh(e,t)}function u4(e,t){return e.rank===t.rank&&(e=e.squeeze([e.rank-1])),t=t.argMax(-1),t.dtype!==e.dtype&&(t=t.asType(e.dtype)),Fr(e,t).asType("float32")}var yae=Fi,gae=Fi,xae=Xh,bae=Xh,vae=Ul,wae=Ul,iy=$d,kae=ny,d4=Kh,Jh={binaryAccuracy:ry,categoricalAccuracy:sy,precision:o4,categoricalCrossentropy:iy,sparseCategoricalCrossentropy:d4,mse:yae,MSE:gae,mae:xae,MAE:bae,mape:vae,MAPE:wae,cosine:kae};function Iae(e){if(typeof e=="string"&&e in Jh)return Jh[e];if(typeof e!="string"&&e!=null)return e;throw new B(`Unknown metric ${e}`)}function Qh(e){if(ja(e!==null,`Unknown LossOrMetricFn ${e}`),typeof e=="string")return e;{let t;for(let n of Object.keys(Yh))if(Yh[n]===e){t=n;break}if(t!==void 0)return t;for(let n of Object.keys(Jh))if(Jh[n]===e){t=n;break}return t!==void 0?t:e.name}}function Sae(e){let t={Adagrad:()=>gi.adagrad(.01),Adadelta:()=>gi.adadelta(1,.95,_t()),Adam:()=>gi.adam(.001,.9,.999,_t()),Adamax:()=>gi.adamax(.002,.9,.999,_t(),0),RMSProp:()=>gi.rmsprop(.001,.9,0,_t()),SGD:()=>gi.sgd(.01)};if(t.adagrad=t.Adagrad,t.adadelta=t.Adadelta,t.adam=t.Adam,t.adamax=t.Adamax,t.rmsprop=t.RMSProp,t.sgd=t.SGD,e in t)return t[e]();throw new B(`Unknown Optimizer ${e}`)}var p4=1*1024*1024;function c4(e,t,n=!1){if(e==null||typeof e!="object"||Object.getPrototypeOf(e)!==Object.prototype||!oy(e))throw new Error("User-defined metadata is expected to be a JSON object, but is not.");if(n){let a=JSON.stringify(e);a.length>p4&&console.warn(`User-defined metadata of model "${t}" is too large in size (length=${a.length} when serialized). It is not recommended to store such large objects in user-defined metadata. Please make sure its serialized length is <= ${p4}.`)}}function oy(e){if(e===null)return!0;if(typeof e=="object")if(Object.getPrototypeOf(e)===Object.prototype){let t=Object.keys(e);for(let n of t)if(typeof n!="string"||!oy(e[n]))return!1;return!0}else if(Array.isArray(e)){for(let t of e)if(!oy(t))return!1;return!0}else return!1;else{let t=typeof e;return t==="string"||t==="number"||t==="boolean"}}function Rae(e,t,n,a=console.log){let r=Tae(e),s=["Layer (type)","Output shape","Param #"];r?(t=t||65,n=n||[.45,.85,1]):(t=t||98,n=n||[.33,.55,.67,1]),n[n.length-1]<=1&&(n=n.map(u=>Math.floor(t*u)));let i;if(!r){s.push("Receives inputs"),i=[];for(let u in e.nodesByDepth)i.push(...e.nodesByDepth[u])}a("_".repeat(t)),e0(s,n,a),a("=".repeat(t));let o=e.layers;for(let u=0;u1||r.length===1&&r[0].inboundLayers.length>1){t=!1;break}a.push(...r)}if(t)for(let r of e.layers){let s=!1;for(let i of r.inboundNodes)if(a.indexOf(i)!==-1)if(s){t=!1;break}else s=!0;if(!t)break}return t}function e0(e,t,n=console.log){let a="";for(let r=0;r0&&(a=a.slice(0,a.length-1)+" "),a+=e[r],a=a.slice(0,t[r]),a+=" ".repeat(t[r]-a.length);n(a)}function Eae(e,t,n){let a;try{a=JSON.stringify(e.outputShape)}catch(o){a="multiple"}let r=e.name,s=e.getClassName(),i=[`${r} (${s})`,a,e.countParams().toString()];e0(i,t,n)}function Cae(e,t,n,a){let r;try{r=JSON.stringify(e.outputShape)}catch(u){r="multiple"}let s=[];for(let u of e.inboundNodes)if(!(n!=null&&n.length>0&&n.indexOf(u)===-1))for(let p=0;pm.name),l=[],d=t.names();for(let m of o)d.indexOf(m)!==-1?l.push(t.getValue(m)):l.push(null);a!=null&&(a.maxNumTensors=-Infinity,a.minNumTensors=Infinity);let u=o.join(",")+"|"+t.names().join(","),p,c;if(dy[u]==null){let m=Fae(i,t);p=m.sorted,c=m.recipientCounts,dy[u]=p,f4[u]=c}p=dy[u],c={},r||Object.assign(c,f4[u]);let h=new $i(t);for(let m=0;ma.maxNumTensors&&(a.maxNumTensors=R),R0,()=>"Expected at least one fetch, got none");let n=[],a={};if(e.length===1){let r=m4(e[0],t);n=r.sorted,a=r.recipientMap}else{let r=new Set;for(let s of e){let{sorted:i,recipientMap:o}=m4(s,t);for(let l of i)r.has(l.name)||(n.push(l),r.add(l.name));for(let l in o)a[l]==null&&(a[l]=new Set),o[l].forEach(d=>a[l].add(d))}}return{sorted:n,recipientCounts:Dae(a)}}function Dae(e){let t={};for(let n in e)t[n]=e[n].size;return t}function m4(e,t){let n=new Set,a=[],r={};for(let o of t.names())n.add(o);let s=[],i=[];for(s.push(e);s.length>0;){let o=s[s.length-1];if(n.has(o.name)){s.pop();continue}let l=i[i.length-1]===s.length-1;if(o.inputs.length===0||l)s.pop(),a.push(o),n.add(o.name),l&&i.pop();else{i.push(s.length-1);for(let d of o.inputs)r[d.name]==null&&(r[d.name]=new Set),r[d.name].add(o.name),!n.has(d.name)&&s.push(d)}}return{sorted:a,recipientMap:r}}function $ae(e){let t;if(e.sourceLayer.inboundNodes.length===1)t=e.sourceLayer.output;else{let n=null;for(let a=0;ay.name)}`);Vr(this.outputs).length!==this.outputs.length&&console.warn(`The list of outputs passed to the model is redundant. All outputs should only appear once. Found: ${this.outputs.map(y=>y.name)}`),this.inputLayers=[],this.inputLayersNodeIndices=[],this.inputLayersTensorIndices=[],this.outputLayers=[],this.outputLayersNodeIndices=[],this.outputLayersTensorIndices=[],this.layers=[],this.internalContainerRefs=[];for(let y of this.outputs){let g=y.sourceLayer,x=y.nodeIndex,w=y.tensorIndex;this.outputLayers.push(g),this.outputLayersNodeIndices.push(x),this.outputLayersTensorIndices.push(w)}for(let y of this.inputs){let g=y.sourceLayer,x=y.nodeIndex,w=y.tensorIndex;ja(x===0,"input layer has >1 nodes"),ja(w===0,"input layer has >1 tensors"),this.inputLayers.push(g),this.inputLayersNodeIndices.push(x),this.inputLayersTensorIndices.push(w)}this.inputNames=[],this.outputNames=[],this.feedInputShapes=[],this.feedInputNames=[],this.feedOutputNames=[];for(let y=0;yy.shape),this.internalOutputShapes=this.outputs.map(y=>y.shape);let t={},n={},a={},r={},s={},i=[],o=(y,g,x,w,b,v)=>{(w==null||b==null||v==null)&&(w=y.sourceLayer,b=y.nodeIndex,v=y.tensorIndex);let N=w.inboundNodes[b];if(x.indexOf(N)!==-1)throw new va(`The tensor ${y.name} at layer "${w.name}" is part of a cycle.`);if(g.indexOf(N)!==-1)return;this.containerNodes.add(Ga.nodeKey(w,b)),w.id in s||(s[w.id]=Object.keys(s).length),x.indexOf(N)===-1&&x.push(N);let T=N.inboundLayers.length;for(let R=0;R=0;)x.splice(x.indexOf(N),1);i.push(N)},l=[],d=[];for(let y of this.outputs)o(y,l,d);let u=i.slice().reverse();for(let y of u){n[y.id]=y,y.id in t||(t[y.id]=0);let g=t[y.id],x=a[y.outboundLayer.id]==null?0:a[y.outboundLayer.id];g=Math.max(g,x),a[y.outboundLayer.id]=g,r[y.outboundLayer.id]=y.outboundLayer,t[y.id]=g;for(let w=0;wparseInt(y,10)).sort(Fh);this.layers=[];for(let y of h){let g=c[y];g.sort((x,w)=>{let b=s[x.id],v=s[w.id];return bv?1:0});for(let x of g)x instanceof Ga&&this.internalContainerRefs.push(x),this.layers.push(x)}this.layersByDepth=c,h=Object.keys(p).map(y=>parseInt(y,10)).sort(Fh);let m=this.inputs.slice(),f=[];for(let y of h)for(let g of p[y]){let x=g.outboundLayer;if(x!=null){for(let w of g.inputTensors)if(m.indexOf(w)===-1)throw new va(`Graph disconnected: cannot obtain value for tensor ${w} at layer "${x.name}". The following previous layers were accessed without issue: ${f}`);for(let w of g.outputTensors)m.push(w);f.push(x.name)}}this.nodesByDepth=p;let A=this.layers.map(y=>y.name);for(let y of A){let g=A.filter(x=>x===y).length;if(g!==1)throw new va(`The name "${y}" is used ${g} times in the model. All layer names should be unique. Layer names: `+JSON.stringify(A))}this.outboundNodes=[],this.inboundNodes=[],new Gh({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:this.inputs.map(y=>null),outputMasks:this.outputs.map(y=>null),inputShapes:this.inputs.map(y=>y.shape),outputShapes:this.outputs.map(y=>y.shape)}),this.built=!0,this._refCount=1}assertNotDisposed(){if(this._refCount===0)throw new Error(`Container '${this.name}' is already disposed.`)}dispose(){this.assertNotDisposed();let e={refCountAfterDispose:null,numDisposedVariables:0};if(--this._refCount==0){for(let t of this.layers)e.numDisposedVariables+=t.dispose().numDisposedVariables;for(let t of this.internalContainerRefs)e.numDisposedVariables+=t.dispose().numDisposedVariables}return e.refCountAfterDispose=this._refCount,e}get trainable(){return this.trainable_}set trainable(e){this.layers.forEach(t=>{t._trainableWeights.forEach(n=>n.trainable=e)}),this.trainable_=e}get trainableWeights(){if(this._trainableWeights.length>0)throw new B("Container instance unexpectedly contains _trainableWeights.The trainable weights of a Container are a union of the trainable weights of its consituent Layers. Its own _trainableWeights must remain an empty Array.");if(!this.trainable)return[];let e=[];for(let t of this.layers)e=e.concat(t.trainableWeights);return e}get nonTrainableWeights(){let e=[];for(let t of this.layers)e.push(...t.nonTrainableWeights);if(!this.trainable){let t=[];for(let n of this.layers)t.push(...n.trainableWeights);return t.concat(e)}return e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}loadWeights(e,t=!0){let n={},a=0;for(let s of this.layers)for(let i of s.weights){if(n[i.originalName]!=null)throw new B(`Duplicate weight name: ${i.originalName}`);n[i.originalName]=i,a++}let r=[];for(let s in e){let i=s;if(n[s]==null){let o=s.split("/");i=o.slice(0,-2).concat([o[o.length-1]]).join("/")}if(n[i]!=null)r.push([n[i],e[s]]);else if(t)throw new B(`Provided weight data has no target variable: ${s}`);delete n[i]}if(t){let s=[];for(let i in n)s.push(i);if(s.length>0)throw new B(`${s.length} of ${a} weights are not set: ${s}`)}ty(r)}updatedConfig(){let e=this.getConfig(),t={};return t.className=this.getClassName(),t.config=e,t.kerasVersion=`tfjs-layers ${uy}`,t.backend="TensorFlow.js",t}toJSON(e,t=!0){let n=ly(this.updatedConfig());return t?JSON.stringify(n):n}call(e,t){return W(()=>{e=ht(e);let n=new $i;for(let a=0;a{e=ht(e);let n;return t==null?n=Ti(null,e.length):n=ht(t),this.runInternalGraph(e,n)[1]})}computeOutputShape(e){let t=Uh(e);if(t.length!==this.inputLayers.length)throw new B(`Invalid inputShape argument ${e}: model has ${this.inputLayers.length} tensor inputs.`);let n={};for(let i=0;iparseInt(i,10)).sort(Fh);if(a.length>1)for(let i of a){let o=this.nodesByDepth[i];for(let l of o){let d=l.outboundLayer;if(this.inputLayers.map(m=>m.id).indexOf(d.id)!==-1)continue;let u=[];for(let m=0;mparseInt(o,10)).sort(Fh);for(let o of a){let l=this.nodesByDepth[o];for(let d of l){let u=d.outboundLayer,p=d.inputTensors,c=d.outputTensors,h=new Array;for(let m of p)m.id in n&&h.push(n[m.id]);if(h.length===p.length){let m={},f,A,y,g;if(d.callArgs!=null&&(m=d.callArgs),h.length===1){let[x,w]=h[0];m.mask==null&&(m.mask=w),y=ht(u.call(x,m)),g=ht(u.computeMask(x,w)),f=[x],A=[w]}else f=h.map(x=>x[0]),A=h.map(x=>x[1]),m.mask==null&&(m.mask=A),y=ht(u.call(f,m)),g=ht(u.computeMask(f,A));if(u.activityRegularizer)throw new Oe("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(let x=0;x{let e=[];for(let t of this.layers)for(let n=0;n0){let m=[];for(let f=0;f0&&f.apply(Sn(y),g)}function l(f){let A=f.name,y=Sa(f,t.customObjects!=null?t.customObjects:{});y.setFastWeightInitDuringBuild(a),r[A]=y,f.inboundNodes.forEach(g=>{if(!(g instanceof Array))throw new B(`Corrupted configuration, expected array for nodeData: ${g}`);i(y,g)})}let d=t.name,u=t.layers;for(let f of u)l(f);for(;!ste(s);)for(let f of u){let A=r[f.name];if(A.name in s){let y=s[A.name];delete s[A.name];for(let g of y)o(A,g)}}let p=[],c=[],h=t.inputLayers;for(let f of h){let A=f[0],y=f[1],g=f[2];ja(A in r);let x=r[A].inboundNodes[y].outputTensors;p.push(x[g])}let m=t.outputLayers;for(let f of m){let A=f[0],y=f[1],g=f[2];ja(A in r);let x=r[A].inboundNodes[y].outputTensors;c.push(x[g])}return new e({inputs:p,outputs:c,name:d})}get stateful(){if(this._stateful)throw new B("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");for(let e of this.layers)if(e.stateful)return!0;return!1}resetStates(){W(()=>{this.layers.forEach(e=>{e.stateful&&e.resetStates()})})}};function Oae(e,t,n){let a=t.length;if(e==null||Array.isArray(e)&&e.length===0)return t.map(r=>null);if(a===1)return Array.isArray(e)&&e.length===1?e:typeof e=="object"&&t[0]in e?[e[t[0]]]:[e];if(Array.isArray(e)){if(e.length!==a)throw new Error(`Provided ${n} is an array of ${e.length} element(s), but the model has ${a} outputs. Make sure a set of weights is provided for each model output.`);return e}else if(typeof e=="object"&&Object.keys(e).length>0&&typeof e[Object.keys(e)[0]]=="object"){let r=[];return t.forEach(s=>{s in e?r.push(e[s]):r.push(null)}),r}else throw new Error(`The model has multiple (${a}) outputs, so ${n} must be either an array with ${a} elements or an object with ${t} keys. Provided ${n} not understood: ${JSON.stringify(e)}`)}function A4(e,t){return Oae(e,t,"classWeight")}async function y4(e,t,n,a){if(t!=null||a!=null)throw new Error("Support sampleWeight is not implemented yet");if(n!=null){let r=W(()=>{if(e.shape.length===1)return e.clone();if(e.shape.length===2)if(e.shape[1]>1){let o=1;return e.argMax(o)}else{if(e.shape[1]===1)return e.reshape([e.shape[0]]);throw new Error(`Encountered unexpected last-dimension size (${e.shape[1]}) during handling of class weights. The size is expected to be >= 1.`)}else throw new Error(`Unexpected rank of target (y) tensor (${e.rank}) during handling of class weights. The rank is expected to be 1 or 2.`)}),s=Array.from(await r.data());Ee(r);let i=[];return s.forEach(o=>{if(n[o]==null)throw new Error(`classWeight must contain all classes in the training data. The class ${o} exists in the data but not in classWeight`);i.push(n[o])}),Tt(i,"float32")}else return null}function zae(e,t){return _(e,t)}var _ae=32;function x4(e,t){let n,a,r=t;n=r.xs,a=r.ys,k.assert(n!=null&&a!=null,()=>`A Dataset iterator for fitDataset() is expected to generate objects of the form \`{xs: xVal, ys: yVal}\`, where the two values may be \`tf.Tensor\`, an array of Tensors, or a map of string to Tensor. The provided Dataset instead generates ${t}`);let s=g4("input",e.inputNames,n),i=g4("output",e.outputNames,a),o=s[0].shape[0];k.assert(s.length===e.inputs.length,()=>`LayersModel has ${e.inputs.length} inputs, but the dataset provides ${s.length} inputs. (Expected input keys: ${JSON.stringify(e.inputNames)})`),k.assert(i.length===e.outputs.length,()=>`LayersModel has ${e.outputs.length} outputs, but the dataset provides ${i.length} outputs. (Expected output keys: ${JSON.stringify(e.outputNames)})`);for(let l=0;l`Batch size mismatch: input ${e.inputNames[l]} has ${s[l].shape[0]}; expected ${o} based on input ${e.inputNames[0]}.`);for(let l=0;l`Batch size mismatch: output ${e.outputNames[l]} has ${i[l].shape[0]}; expected ${o} based on input ${e.inputNames[0]}.`);return{xs:s,ys:i}}function g4(e,t,n){if(n instanceof Le)return[n];if(Array.isArray(n))return k.assert(n.length===t.length,()=>`Received an array of ${n.length} Tensors, but expected ${t.length} to match the ${e} keys ${t}.`),n;{let a=[];for(let r of t){if(n[r]==null)throw new B(`The feature data generated by the dataset lacks the required ${e} key '${r}'.`);a.push(n[r])}return a}}function Pae(e){if(e.length===3)throw new Oe("Validation with sample weights is not implemented yet.");return{xs:e[0],ys:e[1]}}async function Wae(e,t,n){let a=n.batchesPerEpoch!=null;if(k.assert(e.optimizer!=null,()=>"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig)."),k.assert(n!=null,()=>"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call."),k.assert(n.epochs!=null&&n.epochs>0&&Number.isInteger(n.epochs),()=>`For fitDataset(), config.epochs is expected to be a positive integer, but got ${n.epochs}`),k.assert(!a||n.batchesPerEpoch>0&&Number.isInteger(n.batchesPerEpoch),()=>`For fitDataset(), config.batchesPerEpoch is expected to be a positive integer if specified, but got ${n.batchesPerEpoch}`),k.assert(n.validationSplit==null,()=>"`validationSplit` is not supported by `fitDataset()`. Use validationData instead."),e.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");e.isTraining=!0;try{let r=n.validationData!=null,s,i;if(r)if(b4(n.validationData))k.assert(n.validationBatches==null||n.validationBatches>0&&Number.isInteger(n.validationBatches),()=>`For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, but got ${n.validationBatches}`);else{let A=Pae(n.validationData);s=A.xs,i=A.ys}let o=e.makeTrainFunction(),l=e.getDedupedMetricsNames(),d;r?d=l.slice().concat(l.map(A=>"val_"+A)):d=l.slice();let u=r4(n.callbacks,n.yieldEvery),p=n.verbose==null?1:n.verbose,{callbackList:c,history:h}=s4(u,p,n.epochs,null,null,Lae(t,n),null,r,d);c.setModel(e),e.history=h,await c.onTrainBegin(),e.stopTraining_=!1;let m=n.initialEpoch==null?0:n.initialEpoch,f=await t.iterator();for(;m=n.batchesPerEpoch:x.done){if(r){let w;b4(n.validationData)?w=ht(await e.evaluateDataset(n.validationData,{batches:n.validationBatches})):w=ht(e.evaluate(s,i,{batchSize:n.validationBatchSize==null?_ae:n.validationBatchSize,verbose:0}));for(let b=0;b0)throw new Oe("Verbose mode is not implemented yet.");k.assert(!a||n.batches>0&&Number.isInteger(n.batches),()=>`Test loop expects \`batches\` to be a positive integer, but received ${JSON.stringify(n.batches)}`);let i=Bae(t)?t:await t.iterator(),o=0,l=0;for(;a?l{if(d.value){let{xs:u,ys:p}=x4(e,d.value),c=u.concat(p),h=W(()=>r(c));if(Ee(c),l===0)for(let f=0;fse(s[f],_(m,A))),l>0&&Ee(y)}Ee(h),o+=m,++l}return s}),d.done){a&&console.warn(`Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least \`batches\` batches (in this case, ${n.batches} batches). You may need to use the repeat() function when building your dataset.`);break}}for(let d=0;d0&&Number.isInteger(e),()=>`batchSize is required to be a positive integer, but got ${e}`)}function zd(e,t,n){return e==null?[null]:Array.isArray(e)?e.map(a=>Mi(a,t,n-t)):Mi(e,t,n-t)}function cy(e,t){return W(()=>e==null?null:Array.isArray(e)?e.map(n=>cy(n,t)):P6(e,t.dtype==="int32"?t:t.toInt()))}function hy(e,t){let n=[],a=0,r=null;for(;a=e&&(r=e),n.push([a,r]),a=r;return n}async function jae(e,t,n,a,r,s,i,o,l,d,u,p,c,h,m){r==null&&(r=32),s==null&&(s=1),u==null&&(u=!0),c==null&&(c=0);let f=!1;if(l!=null&&d!=null&&(f=!0),m!=null&&(f=!0,h==null))throw new B("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");let A=e.checkNumSamples(n,r,h,"steps_per_epoch"),y;A!=null&&(y=wa(0,A)),i==null&&(i=1);let{callbackList:g,history:x}=s4(o,i,s,c,A,h,r,f,p);g.setModel(e),e.history=x,await g.onTrainBegin(),e.stopTraining_=!1;for(let w=c;w{let $=N[T][0],z=N[T][1],P=Mi(v,$,z-$);R.batch=T,R.size=z-$;let V=cy(n,P),j=t(V);for(let U=0;U0){if(m=!0,a.validationData.length===2)i=a.validationData[0],o=a.validationData[1];else throw a.validationData.length===3?new Oe("validationData including sample weights is not supported yet."):new B(`When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; ${a.validationData} is invalid.`);let v=!0,N=await e.standardizeUserData(i,o,null,null,v,p);l=N[0],d=N[1],f=l.concat(d)}else if(a.validationSplit!=null&&a.validationSplit>0&&a.validationSplit<1){m=!0;let v=Math.floor(r[0].shape[0]*(1-a.validationSplit)),N=r[0].shape[0];l=zd(r,v,N),r=zd(r,0,v),d=zd(s,v,N),s=zd(s,0,v),f=l.concat(d)}else a.validationSteps!=null&&(m=!0);let A=r.concat(s).concat(u);e.checkTrainableWeightsConsistency();let y=e.makeTrainFunction(),g=e.getDedupedMetricsNames(),x,w;m?(e.makeTestFunction(),x=e.testFunction,w=g.slice().concat(g.map(v=>"val_"+v))):(x=null,f=[],w=g.slice());let b=r4(a.callbacks,a.yieldEvery);return await jae(e,y,A,g,p,a.epochs,a.verbose,b,x,f,a.shuffle,w,a.initialEpoch,null,null)}finally{e.isTraining=!1,Di(r,t),Di(s,n),Di(l,i),Di(d,o),u!=null&&Ee(u)}}function v4(e){let t=[];e instanceof Le&&(e=[e]);for(let n=0;nn.push(r.id));else if(t!=null)for(let r in t){let s=t[r];n.push(s.id)}let a=[];if(e instanceof Le)n.indexOf(e.id)===-1&&a.push(e);else if(Array.isArray(e))e.forEach(r=>{n.indexOf(r.id)===-1&&a.push(r)});else if(e!=null)for(let r in e){let s=e[r];n.indexOf(s.id)===-1&&a.push(s)}a.forEach(r=>{r.isDisposed||r.dispose()})}function Hae(e){return e instanceof Le}function fy(e){return Array.isArray(e)}function w4(e){return!Hae(e)&&!fy(e)}function k4(e,t,n,a=!0,r=""){if(t==null||t.length===0){if(e!=null){let i=!1;if(fy(e)&&e.length>0)i=!0;else if(w4(e)){for(let o in e)if(e.hasOwnProperty(o)){i=!0;break}}else i=!0;if(i)throw new B(`Error when checking model ${r} expected no data, but got ${e}`)}return[]}if(e==null)return t.map(i=>null);let s;if(w4(e)){e=e,s=[];for(let i of t){if(e[i]==null)throw new B(`No data provided for "${i}". Need data for each key in: ${t}`);s.push(e[i])}}else if(fy(e)){if(e=e,e.length!==t.length)throw new B(`Error when checking model ${r}: the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see ${t.length} Tensor(s), but instead got the following list of Tensor(s): ${e}`);s=e}else{if(e=e,t.length>1)throw new B(`The model ${r} expects ${t.length} Tensor(s), but only received one Tensor. Found: Tensor with shape ${e.shape}`);s=[e]}if(s=v4(s),n!=null)for(let i=0;i=0&&d!==u)throw new B(`Error when checking ${r}: expected ${t[i]} to have shape [${n[i]}], but got array with shape [${o.shape}].`)}}return s}function Gae(e,t,n){let a=Vr(e.map(s=>s.shape[0]));a.sort();let r=Vr(t.map(s=>s.shape[0]));if(r.sort(),a.length>1)throw new B(`All input Tensors (x) should have the same number of samples. Got array shapes: ${JSON.stringify(e.map(s=>s.shape))}`);if(r.length>1)throw new B(`All target Tensors (y) should have the same number of samples. Got array shapes: ${JSON.stringify(t.map(s=>s.shape))}`);if(a.length>0&&r.length>0&&!k.arraysEqual(a,r))throw new B(`Input Tensors should have the same number of samples as target Tensors. Found ${a[0]} input sample(s) and ${r[0]} target sample(s).`)}function qae(e,t,n){let a=[Fi,Zh,$d];for(let r=0;r1)throw new B(`The model expects ${t.length} ${r} Tensors, but only received one Tensor. Found: array with shape ${JSON.stringify(e.shape)}.`);s=[e]}if(n!=null)for(let i=0;i[]);let n;if(typeof e=="string"||typeof e=="function")n=[e];else if(Array.isArray(e)||typeof e=="object")n=e;else throw new TypeError(`Type of metrics argument not understood. Expected an string,function, Array, or Object, found: ${e}`);if(Array.isArray(n))return t.map(a=>n);{let a=[];for(let r of t){let s=n.hasOwnProperty(r)?n[r]:[];Array.isArray(s)||(s=[s]),a.push(s)}return a}}var Kae="layers-model",pr=class extends Ga{constructor(e){super(e);this.isTraining=!1}summary(e,t,n=console.log){if(!this.built)throw new B("This model has never been called, thus its weights have not been created yet. So no summary can be displayed. Build the model first (e.g., by calling it on some test data).");Rae(this,e,t,n)}compile(e){if(e.loss==null&&(e.loss=[]),this.loss=e.loss,typeof e.optimizer=="string")this.optimizer_=Sae(e.optimizer),this.isOptimizerOwned=!0;else{if(!(e.optimizer instanceof or))throw new B("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer_=e.optimizer,this.isOptimizerOwned=!1}let t=[];if(!Array.isArray(e.loss)&&typeof e.loss!="string"&&typeof e.loss!="function"){e.loss=e.loss;for(let s in e.loss)if(this.outputNames.indexOf(s)===-1)throw new B(`Unknown entry in loss dictionary: "${s}". Only expected the following keys: ${this.outputNames}`);for(let s of this.outputNames)e.loss[s]==null&&console.warn(`Output "${s}" is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data to be passed to ${s} during training`),t.push(ay(e.loss[s]))}else if(Array.isArray(e.loss)){if(e.loss.length!==this.outputs.length)throw new B(`When passing an Array as loss, it should have one entry per model output. The model has ${this.outputs.length} output(s), but you passed loss=${e.loss}.`);t=e.loss.map(s=>ay(s))}else{let s=ay(e.loss);this.outputs.forEach(i=>{t.push(s)})}this.lossFunctions=t,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(let s=0;s{for(let s=0;s1&&(this.metricsTensors.push([i,s]),this.metricsNames.push(this.outputNames[s]+"_loss"))}});let a=Xae(e.metrics,this.outputNames),r=(s,i,o)=>{this.outputNames.length>1&&(i=this.outputNames[s]+"_"+i),this.metricsNames.push(i),this.metricsTensors.push([o,s])};Ri("metric",()=>{for(let s=0;s{let l="",d,u,p;for(let c of o){if(typeof c=="string"&&["accuracy","acc","crossentropy","ce"].indexOf(c)!==-1){let m=this.internalOutputShapes[s];m[m.length-1]===1||this.lossFunctions[s]===Zh?["accuracy","acc"].indexOf(c)!==-1?u=ry:["crossentropy","ce"].indexOf(c)!==-1&&(u=l4):this.lossFunctions[s]===Kh?["accuracy","acc"].indexOf(c)!==-1?u=u4:["crossentropy","ce"].indexOf(c)!==-1&&(u=d4):["accuracy","acc"].indexOf(c)!==-1?u=sy:["crossentropy","ce"].indexOf(c)!==-1&&(u=iy);let f;["accuracy","acc"].indexOf(c)!==-1?f="acc":["crossentropy","ce"].indexOf(c)!==-1&&(f="ce"),p=u,d=l+f}else p=Iae(c),d=l+Qh(c);let h;Ri(d,()=>{h=p}),r(s,d,h)}})(i)}}),this.collectedTrainableWeights=this.trainableWeights}checkTrainableWeightsConsistency(){this.collectedTrainableWeights!=null&&this.trainableWeights.length!==this.collectedTrainableWeights.length&&console.warn("Discrepancy between trainableweights and collected trainable weights. Did you set `model.trainable` without calling `model.compile()` afterwards?")}evaluate(e,t,n={}){let a=n.batchSize==null?32:n.batchSize;py(a);let r=!0,s=this.standardizeUserDataXY(e,t,r,a);try{let i=s[0].concat(s[1]);this.makeTestFunction();let o=this.testFunction,l=this.testLoop(o,i,a,n.verbose,n.steps);return Sn(l)}finally{Di(s[0],e),Di(s[1],t)}}async evaluateDataset(e,t){return this.makeTestFunction(),Vae(this,e,t)}checkNumSamples(e,t,n,a="steps"){let r;if(n!=null){if(r=null,t!=null)throw new B(`If ${a} is set, batchSize must be null or undefined.Got batchSize = ${t}`)}else if(e!=null)Array.isArray(e)?r=e[0].shape[0]:r=e.shape[0];else throw new B(`Either the input data should have a defined shape, or ${a} shoud be specified.`);return r}execute(e,t){if(Array.isArray(t)&&t.length===0)throw new B("`outputs` is an empty Array, which is not allowed.");let n=Array.isArray(t),a=n?t:[t],r=this.retrieveSymbolicTensors(a),s=new $i;if(e instanceof Le&&(e=[e]),Array.isArray(e)){if(e.length!==this.inputs.length)throw new B(`The number of inputs provided (${e.length}) does not match the number of inputs of this model (${this.inputs.length}).`);for(let o=0;oi.name);for(let i=0;i0){let a=[];throw t.forEach((r,s)=>{r==null&&a.push(e[s])}),new B(`Cannot find SymbolicTensors for output name(s): ${JSON.stringify(a)}`)}return t}predictLoop(e,t=32,n=!1){return W(()=>{let a=this.checkNumSamples(e);if(n)throw new Oe("Verbose predictLoop() is not implemented yet.");let r=hy(a,t),s=this.outputs.map(i=>[]);for(let i=0;i{let o=r[i][0],l=r[i][1],d=zd(e,o,l),u=[];if(Array.isArray(d))for(let c=0;cs[l].push(o));return Sn(s.map(i=>ot(i,0)))})}predict(e,t={}){let n=v4(e);I4(n,this.inputNames,this.feedInputShapes,!1);try{let a=t.batchSize==null?32:t.batchSize;return py(a),this.predictLoop(n,a)}finally{Di(n,e)}}predictOnBatch(e){I4(e,this.inputNames,this.feedInputShapes,!0);let t=(Array.isArray(e)?e[0]:e).shape[0];return this.predictLoop(e,t)}standardizeUserDataXY(e,t,n=!0,a){if(this.optimizer_==null)throw new va("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");let r=[];for(let s=0;s0&&e[0].shape[0]%a!=0)throw new B(`In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size ${a}. Found: ${e[0].shape[0]} sample(s).`);return[e,t]}async standardizeUserData(e,t,n,a,r=!0,s){let[i,o]=this.standardizeUserDataXY(e,t,r,s);if(n!=null)throw new Error("sample weight is not supported yet.");let l=null;if(a!=null){let d=A4(a,this.outputNames);l=[];for(let u=0;u{let s=this.checkNumSamples(t,n,r,"steps"),i=[];if(a>0)throw new Oe("Verbose mode is not implemented yet.");if(r!=null)throw new Oe("steps mode in testLoop() is not implemented yet");{let o=hy(s,n),l=Tt(wa(0,s));for(let d=0;d1&&(r+=`_${S6(e.slice(0,n),a)}`),t.push(r)}return t}makeTrainFunction(){return e=>{let t=[],n=e.slice(0,this.inputs.length),a=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),r=e.slice(this.inputs.length+this.outputs.length,this.inputs.length+this.outputs.length*2),s=[],i=()=>{let d=[];for(let h=0;h1&&h{c=se(c,h)}),c},o=this.collectedTrainableWeights.map(d=>d.read()),l=!0;return[this.optimizer_.minimize(i,l,o)].concat(s)}}makeTestFunction(){this.testFunction=e=>W(()=>{let t=[],n,a=e.slice(0,this.inputs.length),r=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),s=[];for(let l=0;ldr(t))}else{let t=Object.keys(this.loss);e={};let n=this.loss;for(let a of t)if(typeof n[a]=="string")e[a]=dr(n[a]);else throw new Error("Serialization of non-string loss is not supported.")}return e}getMetricIdentifiers(){if(typeof this.metrics=="string"||typeof this.metrics=="function")return[dr(Qh(this.metrics))];if(Array.isArray(this.metrics))return this.metrics.map(e=>dr(Qh(e)));{let e={};for(let t in this.metrics)e[t]=dr(Qh(this.metrics[t]));return e}}getTrainingConfig(){return{loss:this.getLossIdentifiers(),metrics:this.getMetricIdentifiers(),optimizer_config:{class_name:this.optimizer.getClassName(),config:this.optimizer.getConfig()}}}loadTrainingConfig(e){if(e.weighted_metrics!=null)throw new Error("Loading weight_metrics is not supported yet.");if(e.loss_weights!=null)throw new Error("Loading loss_weights is not supported yet.");if(e.sample_weight_mode!=null)throw new Error("Loading sample_weight_mode is not supported yet.");let t=Dd(e.optimizer_config),n=Sa(t),a;if(typeof e.loss=="string")a=Ei(e.loss);else if(Array.isArray(e.loss))a=e.loss.map(s=>Ei(s));else if(e.loss!=null){a={};for(let s in e.loss)a[s]=Ei(e.loss[s])}let r;if(Array.isArray(e.metrics))r=e.metrics.map(s=>Ei(s));else if(e.metrics!=null){r={};for(let s in e.metrics)r[s]=Ei(e.metrics[s])}this.compile({loss:a,metrics:r,optimizer:n})}async save(e,t){if(typeof e=="string"){let i=vn.getSaveHandlers(e);if(i.length===0)throw new B(`Cannot find any save handlers for URL '${e}'`);if(i.length>1)throw new B(`Found more than one (${i.length}) save handlers for URL '${e}'`);e=i[0]}if(e.save==null)throw new B("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");let n=await vn.encodeWeights(this.getNamedWeights(t)),a=!1,r=null,s={modelTopology:this.toJSON(r,a),format:Kae,generatedBy:`TensorFlow.js tfjs-layers v${uy}`,convertedBy:null};if((t==null?!1:t.includeOptimizer)&&this.optimizer!=null){s.trainingConfig=this.getTrainingConfig();let i="optimizer",{data:o,specs:l}=await vn.encodeWeights(await this.optimizer.getWeights(),i);n.specs.push(...l),n.data=vn.concatenateArrayBuffers([n.data,o])}if(this.userDefinedMetadata!=null){let i=!0;c4(this.userDefinedMetadata,this.name,i),s.userDefinedMetadata=this.userDefinedMetadata}return s.weightData=n.data,s.weightSpecs=n.specs,e.save(s)}setUserDefinedMetadata(e){c4(e,this.name),this.userDefinedMetadata=e}getUserDefinedMetadata(){return this.userDefinedMetadata}};pr.className="Model";ae.registerClass(pr);var S4=class extends pr{};S4.className="Functional";ae.registerClass(S4);async function Zae(e,t){"modelTopology"in e||(e={modelTopology:e}),e=e;let n=e.modelTopology;n.model_config!=null&&(n=n.model_config);let a=Dd(n),r=Sa(a,t);if(e.weightsManifest!=null){let s=await vn.loadWeights(e.weightsManifest,e.pathPrefix,r.weights.map(o=>o.originalName)),i={};for(let o of r.weights)i[o.originalName]=s[o.originalName];r.loadWeights(i),Ee(s)}return r}async function Jae(e,t){if(t==null&&(t={}),typeof e=="string"){let n=vn.getLoadHandlers(e,t);if(n.length===0)n.push(vn.browserHTTPRequest(e,t));else if(n.length>1)throw new B(`Found more than one (${n.length}) load handlers for URL '${e}'`);e=n[0]}return Yae(e,void 0,t)}async function Yae(e,t,n){if(n==null&&(n={}),e.load==null)throw new B("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");let a=await e.load(),r=a.modelTopology;r.model_config!=null&&(r=r.model_config);let s=n.strict==null?!0:n.strict,i=a.weightData!=null&&a.weightSpecs!=null&&s,o=Sa(Dd(r),t,i),l=a.trainingConfig;if(l!=null&&o.loadTrainingConfig(l),a.userDefinedMetadata!=null&&o.setUserDefinedMetadata(a.userDefinedMetadata),a.weightData!=null){if(a.weightSpecs==null)throw new B("LayersModel artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");let{modelWeights:d,optimizerWeights:u}=Qae(a.weightData,a.weightSpecs);o.loadWeights(d,s),o.optimizer!=null&&u.length>0&&await o.optimizer.setWeights(u),Ee(d),Ee(u.map(p=>p.tensor))}return o}function Qae(e,t){let n=vn.decodeWeights(e,t),a={},r=[];return t.forEach(s=>{s.group==="optimizer"?r.push({name:s.name,tensor:n[s.name]}):a[s.name]=n[s.name]}),{modelWeights:a,optimizerWeights:r}}var Hl=class extends pr{constructor(e){super({inputs:[],outputs:[]});if(e=e||{},this.trainable=!0,this.built=!1,this.name=e.name!=null?e.name:jh("sequential_"),e.layers!=null)for(let t of e.layers)this.add(t)}checkShape(e){if(e.inboundNodes[0].outputTensors[0].shape.some(t=>t<0))throw new B(`Negative dimension size caused by adding layer ${e.name} with input shape [${e.inboundNodes[0].inputTensors[0].shape}]`)}add(e){let t=e instanceof Hl||e instanceof pr,n;if(t){if(n=e,n.outputs.length!==1)throw new B("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");if(n.inputs.length!==1)throw new B("All layers in a Sequential model should have a single input tensor. For multi-input layers, use the functional API.")}if(this.outputs.length===0){if(e.inboundNodes.length===0){if(e.batchInputShape==null)throw new B("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");let a=J6({batchShape:e.batchInputShape,dtype:e.dtype,name:e.name+"_input"});e.apply(a)}if(t)this.outputs=n.outputs,this.inputs=n.inputs;else{if(e.inboundNodes.length!==1)throw new B(`A layer added to a Sequential model must not already be connected somewhere else. LayersModel received layer ${e.name} which has ${e.inboundNodes.length} pre-existing inbound connections.`);if(e.inboundNodes[0].outputTensors.length!==1)throw new B("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[e.inboundNodes[0].outputTensors[0]],this.inputs=Y6(this.outputs[0])}this.inboundNodes=[],new Gh({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:Ti(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map(a=>a.shape),outputShapes:this.outputs[0].shape})}else{let a=e.apply(this.outputs[0]);if(Array.isArray(a))throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[a],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(e),this.built=!1}pop(){if(this.layers.length===0)throw new TypeError("There are no layers in the model.");if(this.layers.pop(),this.layers.length===0)this.outputs=[],this.inboundNodes=[],this.outboundNodes=[];else{let e=this.layers.length-1;this.layers[e].outboundNodes=[],this.outputs=[this.layers[e].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}}call(e,t){return this.model==null&&this.build(),this.model.call(e,t)}build(e){if(at(e),this.inputs.length===0||this.outputs.length===0)throw new TypeError("Sequential model cannot be built: model is empty. Add some layers first.");this.model=new pr({inputs:this.inputs,outputs:this.outputs[0],name:this.name+"_model"}),this.model.trainable=this.trainable,this.supportsMasking=this.model.supportsMasking,this.inputLayers=this.model.inputLayers,this.inputLayersNodeIndices=this.model.inputLayersNodeIndices,this.inputLayersTensorIndices=this.model.inputLayersTensorIndices,this.outputLayers=this.model.outputLayers,this.outputLayersNodeIndices=this.model.outputLayersNodeIndices,this.outputLayersTensorIndices=this.model.outputLayersTensorIndices,this.nodesByDepth=this.model.nodesByDepth,this.containerNodes=this.model.containerNodes,this.outputNames=this.model.outputNames,this.inputNames=this.model.inputNames,this.built=!0}countParams(){return this.built||this.build(),super.countParams()}summary(e,t,n=console.log){this.built||this.build(),super.summary(e,t,n)}setWeights(e){this.model==null&&this.build(),this.model.setWeights(e)}evaluate(e,t,n={}){if(!this.built)throw new va("The model needs to be compiled before being used.");return this.model.evaluate(e,t,n)}async evaluateDataset(e,t){if(!this.built)throw new va("The model needs to be compiled before being used.");return this.model.evaluateDataset(e,t)}predict(e,t={}){return this.model==null&&this.build(),this.model.predict(e,t)}predictOnBatch(e){return this.model==null&&this.build(),this.model.predictOnBatch(e)}compile(e){this.build(),this.model.compile(e),this.optimizer_=this.model.optimizer,this.isOptimizerOwned=this.model.isOptimizerOwned,this.loss=this.model.loss,this.metrics=this.model.metrics,this.metricsTensors=this.model.metricsTensors,this.metricsNames=this.model.metricsNames}get optimizer(){return this.model==null?void 0:this.model.optimizer}set optimizer(e){this.model.optimizer=e}async fit(e,t,n={}){if(!this.built)throw new va("The model needs to be compiled before being used.");return this.model.fit(e,t,n)}async fitDataset(e,t){if(!this.built)throw new va("The model needs to be compiled before being used.");return this.model.fitDataset(e,t)}async trainOnBatch(e,t){return this.model.trainOnBatch(e,t)}static fromConfig(e,t,n={},a=!1){let r,s={};if(t instanceof Array){if(t[0].className==null||t[0].className==="Merge")throw new B("Legacy serialization format not supported yet.");r=t}else k.assert(t.layers!=null,()=>"When the config data for a Sequential model is not an Array, it must be an Object that contains the 'layers' field."),r=t.layers,delete t.layers,s=t;let i=new e(s);if(!(i instanceof Hl))throw new Oe(`Sequential.fromConfig called on non-Sequential input: ${i}`);for(let o of r){let l=Sa(o,void 0,a);a&&l.setFastWeightInitDuringBuild(!0),i.add(l)}return i}set stopTraining(e){if(this.model==null)throw new B("Cannot set the stopTraining property of a sequential model before it is compiled.");this.model.stopTraining=e}get stopTraining(){if(this.model==null)throw new B("Cannot get the stopTraining property of a sequential model before it is compiled.");return this.model.stopTraining}getConfig(){let e=[];for(let t of this.layers){let n={};n.className=t.getClassName(),n.config=t.getConfig(),e.push(n)}return{name:this.name,layers:e}}};Hl.className="Sequential";ae.registerClass(Hl);function ere(e){return new pr(e)}function tre(e){return new Hl(e)}function nre(e,t){return t==null&&(t={}),Jae(e,t)}function j6(e){return J6(e)}function are(e,t){pa.registerCallbackConstructor(e,t)}var Tn=class extends ae.Serializable{getConfig(){return{}}},N4=class extends Tn{apply(e,t=1){return Dte(e,t)}};N4.className="elu";ae.registerClass(N4);var T4=class extends Tn{apply(e){return zc(e)}};T4.className="selu";ae.registerClass(T4);var E4=class extends Tn{apply(e){return La(e)}};E4.className="relu";ae.registerClass(E4);var C4=class extends Tn{apply(e){return W(()=>xl(6,La(e)))}};C4.className="relu6";ae.registerClass(C4);var R4=class extends Tn{apply(e){return e}};R4.className="linear";ae.registerClass(R4);var M4=class extends Tn{apply(e){return wn(e)}};M4.className="sigmoid";ae.registerClass(M4);var F4=class extends Tn{apply(e){return zte(e)}};F4.className="hardSigmoid";ae.registerClass(F4);var $4=class extends Tn{apply(e){return fi(e)}};$4.className="softplus";ae.registerClass($4);var D4=class extends Tn{apply(e){return Ote(e)}};D4.className="softsign";ae.registerClass(D4);var O4=class extends Tn{apply(e){return pi(e)}};O4.className="tanh";ae.registerClass(O4);var my=class extends Tn{apply(e,t=-1){return ad(e,t)}};my.className="softmax";ae.registerClass(my);var z4=class extends Tn{apply(e,t=-1){return Cc(e,t)}};z4.className="logSoftmax";ae.registerClass(z4);var _4=class extends Tn{apply(e,t=1){return W(()=>wn(e.mul(t)).mul(e))}};_4.className="swish";ae.registerClass(_4);var P4=class extends Tn{apply(e){return W(()=>_(e,pi(fi(e))))}};P4.className="mish";ae.registerClass(P4);function Gr(e){return e.getClassName()}function Ay(e,t={}){return Sd(e,ae.SerializationMap.getMap().classNameMap,t,"activation")}function qr(e){if(e==null){let t={};return t.className="linear",t.config={},Ay(t)}if(typeof e=="string"){let t={};return t.className=e,t.config={},Ay(t)}else return e instanceof Tn?e:Ay(e)}function yy(e){if(e!=null&&typeof e!="object")throw new Error(`Argument to L1L2 regularizer's constructor is expected to be an object, but received: ${e}`)}var L4=class extends ae.Serializable{},_d=class extends L4{constructor(e){super();yy(e),this.l1=e==null||e.l1==null?.01:e.l1,this.l2=e==null||e.l2==null?.01:e.l2,this.hasL1=this.l1!==0,this.hasL2=this.l2!==0}apply(e){return W(()=>{let t=Ct([1]);return this.hasL1&&(t=se(t,ke(_(this.l1,Ot(e))))),this.hasL2&&(t=se(t,ke(_(this.l2,Rd(e))))),t.asScalar()})}getConfig(){return{l1:this.l1,l2:this.l2}}static fromConfig(e,t){return new e({l1:t.l1,l2:t.l2})}};_d.className="L1L2";ae.registerClass(_d);function rre(e){return yy(e),new _d({l1:e!=null?e.l1:null,l2:0})}function sre(e){return yy(e),new _d({l2:e!=null?e.l2:null,l1:0})}var W4={l1l2:"L1L2"};function ut(e){return M1(e)}function B4(e,t={}){return Sd(e,ae.SerializationMap.getMap().classNameMap,t,"regularizer")}function At(e){if(e==null)return null;if(typeof e=="string"){let t={className:e in W4?W4[e]:e,config:{}};return B4(t)}else return e instanceof L4?e:B4(e)}var gy=class extends Ge{constructor(e){super(e==null?{}:e);this.supportsMasking=!0,e!=null&&(this.maxValue=e.maxValue)}call(e,t){e=_e(e);let n=La(e);return this.maxValue!=null&&(n=kn(n,0,this.maxValue)),n}computeOutputShape(e){return e}getConfig(){let e={maxValue:this.maxValue},t=super.getConfig();return Object.assign(e,t),e}};gy.className="ReLU";ae.registerClass(gy);var xy=class extends Ge{constructor(e){super(e==null?{}:e);this.DEFAULT_ALPHA=.3,e==null&&(e={}),this.alpha=e.alpha==null?this.DEFAULT_ALPHA:e.alpha}call(e,t){let n=_e(e);return Zu(n,this.alpha)}computeOutputShape(e){return e}getConfig(){let e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}};xy.className="LeakyReLU";ae.registerClass(xy);var by=class extends Ge{constructor(e){super(e==null?{}:e);if(this.DEFAULT_ALPHA_INITIALIZER="zeros",e==null&&(e={}),this.supportsMasking=!0,this.alphaInitializer=mt(e.alphaInitializer||this.DEFAULT_ALPHA_INITIALIZER),this.alphaRegularizer=At(e.alphaRegularizer),this.alphaConstraint=Lt(e.alphaConstraint),e.sharedAxes==null)this.sharedAxes=null;else if(Array.isArray(e.sharedAxes))this.sharedAxes=e.sharedAxes;else if(typeof e.sharedAxes=="number")this.sharedAxes=[e.sharedAxes];else throw new B(`Expected sharedAxes to be a number or an array of numbers, but got ${e.sharedAxes}`)}build(e){e=at(e);let t=e.slice(1);if(this.sharedAxes!=null)for(let a of this.sharedAxes)t[a-1]=1;this.alpha=this.addWeight("alpha",t,"float32",this.alphaInitializer,this.alphaRegularizer,!0,this.alphaConstraint);let n={};if(this.sharedAxes!=null)for(let a=1;a(Et(t),t==="channelsFirst"?Ze(e,[0,2,3,1]):e))}function V4(e,t){return W(()=>(Et(t),t==="channelsFirst"?Ze(e,[0,2,3,4,1]):e))}function ire(e,t,n,a=1,r="valid",s,i=1){return W(()=>{if(s==null&&(s=ba()),Et(s),e.shape.length!==3)throw new B(`The input of a conv1dWithBias operation should be 3, but is ${e.shape.length} instead.`);if(t.shape.length!==3)throw new B(`The kernel for a conv1dWithBias operation should be 3, but is ${t.shape.length} instead`);if(n!=null&&n.shape.length!==1)throw new B(`The bias for a conv1dWithBias operation should be 1, but is ${t.shape.length} instead`);if(s==="channelsFirst"&&(e=Ze(e,[0,2,1])),r==="causal")throw new Oe("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");let o=vc(e,t,a,r==="same"?"same":"valid","NWC",i);return n!=null&&(o=ka(o,n)),o})}function j4(e,t,n,a=[1,1],r="valid",s,i,o=null){return W(()=>{if(s==null&&(s=ba()),Et(s),e.rank!==3&&e.rank!==4)throw new B(`conv2dWithBiasActivation expects input to be of rank 3 or 4, but received ${e.rank}.`);if(t.rank!==3&&t.rank!==4)throw new B(`conv2dWithBiasActivation expects kernel to be of rank 3 or 4, but received ${e.rank}.`);let l=Iy(e,s);if(r==="causal")throw new Oe("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return l=_r.conv2d({x:l,filter:t,strides:a,pad:r==="same"?"same":"valid",dilations:i,dataFormat:"NHWC",bias:n,activation:o}),s==="channelsFirst"&&(l=Ze(l,[0,3,1,2])),l})}function ore(e,t,n,a=[1,1,1],r="valid",s,i){return W(()=>{if(s==null&&(s=ba()),Et(s),e.rank!==4&&e.rank!==5)throw new B(`conv3dWithBias expects input to be of rank 4 or 5, but received ${e.rank}.`);if(t.rank!==4&&t.rank!==5)throw new B(`conv3dWithBias expects kernel to be of rank 4 or 5, but received ${e.rank}.`);let o=V4(e,s);if(r==="causal")throw new Oe("The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.");return o=cA(o,t,a,r==="same"?"same":"valid","NDHWC",i),n!=null&&(o=ka(o,n)),s==="channelsFirst"&&(o=Ze(o,[0,4,1,2,3])),o})}var Sy=class extends Ge{constructor(e,t){super(t);if(this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",Sy.verifyArgs(t),this.rank=e,Ht(this.rank,"rank"),this.rank!==1&&this.rank!==2&&this.rank!==3)throw new Oe(`Convolution layer for rank other than 1, 2, or 3 (${this.rank}) is not implemented yet.`);if(this.kernelSize=Gl(t.kernelSize,e,"kernelSize"),this.strides=Gl(t.strides==null?1:t.strides,e,"strides"),this.padding=t.padding==null?"valid":t.padding,Jn(this.padding),this.dataFormat=t.dataFormat==null?"channelsLast":t.dataFormat,Et(this.dataFormat),this.activation=qr(t.activation),this.useBias=t.useBias==null?!0:t.useBias,this.biasInitializer=mt(t.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.biasConstraint=Lt(t.biasConstraint),this.biasRegularizer=At(t.biasRegularizer),this.activityRegularizer=At(t.activityRegularizer),this.dilationRate=Gl(t.dilationRate==null?1:t.dilationRate,e,"dilationRate"),this.rank===1&&Array.isArray(this.dilationRate)&&this.dilationRate.length!==1)throw new B(`dilationRate must be a number or an array of a single number for 1D convolution, but received ${JSON.stringify(this.dilationRate)}`);if(this.rank===2){if(typeof this.dilationRate=="number")this.dilationRate=[this.dilationRate,this.dilationRate];else if(this.dilationRate.length!==2)throw new B(`dilationRate must be a number or array of two numbers for 2D convolution, but received ${JSON.stringify(this.dilationRate)}`)}else if(this.rank===3){if(typeof this.dilationRate=="number")this.dilationRate=[this.dilationRate,this.dilationRate,this.dilationRate];else if(this.dilationRate.length!==3)throw new B(`dilationRate must be a number or array of three numbers for 3D convolution, but received ${JSON.stringify(this.dilationRate)}`)}}static verifyArgs(e){if(ja("kernelSize"in e,"required key 'kernelSize' not in config"),typeof e.kernelSize!="number"&&!$1(e.kernelSize,"number",1,3))throw new B(`BaseConv expects config.kernelSize to be number or number[] with length 1, 2, or 3, but received ${JSON.stringify(e.kernelSize)}.`)}getConfig(){let e={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:Gr(this.activation),useBias:this.useBias,biasInitializer:kt(this.biasInitializer),biasRegularizer:ut(this.biasRegularizer),activityRegularizer:ut(this.activityRegularizer),biasConstraint:Pt(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}},Pd=class extends Sy{constructor(e,t){super(e,t);this.kernel=null,Pd.verifyArgs(t),this.filters=t.filters,Ht(this.filters,"filters"),this.kernelInitializer=mt(t.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.kernelConstraint=Lt(t.kernelConstraint),this.kernelRegularizer=At(t.kernelRegularizer)}build(e){e=at(e);let t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new B(`The channel dimension of the input should be defined. Found ${e[t]}`);let n=e[t],a=this.kernelSize.concat([n,this.filters]);this.kernel=this.addWeight("kernel",a,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[{ndim:this.rank+2,axes:{[t]:n}}],this.built=!0}call(e,t){return W(()=>{e=_e(e);let n,a=this.bias==null?null:this.bias.read(),r=T6(this.activation.getClassName());if(r!=null&&this.rank===2)n=j4(e,this.kernel.read(),a,this.strides,this.padding,this.dataFormat,this.dilationRate,r);else{if(this.rank===1)n=ire(e,this.kernel.read(),a,this.strides[0],this.padding,this.dataFormat,this.dilationRate[0]);else if(this.rank===2)n=j4(e,this.kernel.read(),a,this.strides,this.padding,this.dataFormat,this.dilationRate);else if(this.rank===3)n=ore(e,this.kernel.read(),a,this.strides,this.padding,this.dataFormat,this.dilationRate);else throw new Oe("convolutions greater than 3D are not implemented yet.");this.activation!=null&&(n=this.activation.apply(n))}return n})}computeOutputShape(e){e=at(e);let t=[],n=this.dataFormat==="channelsLast"?e.slice(1,e.length-1):e.slice(2);for(let r=0;r 0 but got ${JSON.stringify(e.filters)}`)}},Ld=class extends Pd{constructor(e){super(2,e);Ld.verifyArgs(e)}getConfig(){let e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!$1(e.kernelSize,"number",1,2))throw new B(`Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received ${JSON.stringify(e.kernelSize)}.`)}};Ld.className="Conv2D";ae.registerClass(Ld);var Wd=class extends Pd{constructor(e){super(3,e);Wd.verifyArgs(e)}getConfig(){let e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!(Array.isArray(e.kernelSize)&&(e.kernelSize.length===1||e.kernelSize.length===3)))throw new B(`Conv3D expects config.kernelSize to be number or [number, number, number], but received ${JSON.stringify(e.kernelSize)}.`)}};Wd.className="Conv3D";ae.registerClass(Wd);var Ny=class extends Ld{constructor(e){super(e);if(this.inputSpec=[new Mt({ndim:4})],this.padding!=="same"&&this.padding!=="valid")throw new B(`Conv2DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(e=at(e),e.length!==4)throw new B("Input should have rank 4; Received input shape: "+JSON.stringify(e));let t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new B("The channel dimension of the inputs should be defined. Found `None`.");let n=e[t],a=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",a,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new Mt({ndim:4,axes:{[t]:n}})],this.built=!0}call(e,t){return W(()=>{let n=_e(e);if(n.shape.length!==4)throw new B(`Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${n.shape.length}`);let a=n.shape,r=a[0],s,i;this.dataFormat==="channelsFirst"?(s=2,i=3):(s=1,i=2);let o=a[s],l=a[i],d=this.kernelSize[0],u=this.kernelSize[1],p=this.strides[0],c=this.strides[1],h=qa(o,p,d,this.padding),m=qa(l,c,u,this.padding),f=[r,h,m,this.filters];this.dataFormat!=="channelsLast"&&(n=Ze(n,[0,2,3,1]));let A=wc(n,this.kernel.read(),f,this.strides,this.padding);return this.dataFormat!=="channelsLast"&&(A=Ze(A,[0,3,1,2])),this.bias!=null&&(A=ka(A,this.bias.read(),this.dataFormat)),this.activation!=null&&(A=this.activation.apply(A)),A})}computeOutputShape(e){e=at(e);let t=e.slice(),n,a,r;this.dataFormat==="channelsFirst"?(n=1,a=2,r=3):(n=3,a=1,r=2);let s=this.kernelSize[0],i=this.kernelSize[1],o=this.strides[0],l=this.strides[1];return t[n]=this.filters,t[a]=qa(t[a],o,s,this.padding),t[r]=qa(t[r],l,i,this.padding),t}getConfig(){let e=super.getConfig();return delete e.dilationRate,e}};Ny.className="Conv2DTranspose";ae.registerClass(Ny);var Ty=class extends Wd{constructor(e){super(e);if(this.inputSpec=[new Mt({ndim:5})],this.padding!=="same"&&this.padding!=="valid")throw new B(`Conv3DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(e=at(e),e.length!==5)throw new B("Input should have rank 5; Received input shape: "+JSON.stringify(e));let t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new B("The channel dimension of the inputs should be defined. Found `None`.");let n=e[t],a=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",a,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new Mt({ndim:5,axes:{[t]:n}})],this.built=!0}call(e,t){return W(()=>{let n=_e(e);if(n.shape.length!==5)throw new B(`Conv3DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${n.shape.length}`);let a=n.shape,r=a[0],s,i,o;this.dataFormat==="channelsFirst"?(o=2,s=3,i=4):(o=1,s=2,i=3);let l=a[o],d=a[s],u=a[i],p=this.kernelSize[0],c=this.kernelSize[1],h=this.kernelSize[2],m=this.strides[0],f=this.strides[1],A=this.strides[2],y=qa(l,m,p,this.padding),g=qa(d,f,c,this.padding),x=qa(u,A,h,this.padding),w=[r,y,g,x,this.filters];this.dataFormat!=="channelsLast"&&(n=Ze(n,[0,2,3,4,1]));let b=zb(n,this.kernel.read(),w,this.strides,this.padding);return this.dataFormat!=="channelsLast"&&(b=Ze(b,[0,4,1,2,3])),this.bias!==null&&(b=ka(b,this.bias.read(),this.dataFormat)),this.activation!==null&&(b=this.activation.apply(b)),b})}computeOutputShape(e){e=at(e);let t=e.slice(),n,a,r,s;this.dataFormat==="channelsFirst"?(n=1,a=2,r=3,s=4):(n=4,a=1,r=2,s=3);let i=this.kernelSize[0],o=this.kernelSize[1],l=this.kernelSize[2],d=this.strides[0],u=this.strides[1],p=this.strides[2];return t[n]=this.filters,t[a]=qa(t[a],d,i,this.padding),t[r]=qa(t[r],u,o,this.padding),t[s]=qa(t[s],p,l,this.padding),t}getConfig(){let e=super.getConfig();return delete e.dilationRate,e}};Ty.className="Conv3DTranspose";ae.registerClass(Ty);var U4=class extends Pd{constructor(e,t){super(e,t);if(this.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",this.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",this.depthwiseKernel=null,this.pointwiseKernel=null,t.filters==null)throw new B("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(t.kernelInitializer!=null||t.kernelRegularizer!=null||t.kernelConstraint!=null)throw new B("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(t.padding!=null&&t.padding!=="same"&&t.padding!=="valid")throw new B(`SeparableConv${this.rank}D supports only padding modes: 'same' and 'valid', but received ${JSON.stringify(t.padding)}`);this.depthMultiplier=t.depthMultiplier==null?1:t.depthMultiplier,this.depthwiseInitializer=mt(t.depthwiseInitializer||this.DEFAULT_DEPTHWISE_INITIALIZER),this.depthwiseRegularizer=At(t.depthwiseRegularizer),this.depthwiseConstraint=Lt(t.depthwiseConstraint),this.pointwiseInitializer=mt(t.depthwiseInitializer||this.DEFAULT_POINTWISE_INITIALIZER),this.pointwiseRegularizer=At(t.pointwiseRegularizer),this.pointwiseConstraint=Lt(t.pointwiseConstraint)}build(e){if(e=at(e),e.length{e=_e(e);let n;if(this.rank===1)throw new Oe("1D separable convolution is not implemented yet.");return this.rank===2&&(this.dataFormat==="channelsFirst"&&(e=Ze(e,[0,2,3,1])),n=RA(e,this.depthwiseKernel.read(),this.pointwiseKernel.read(),this.strides,this.padding,this.dilationRate,"NHWC")),this.useBias&&(n=ka(n,this.bias.read(),this.dataFormat)),this.activation!=null&&(n=this.activation.apply(n)),this.dataFormat==="channelsFirst"&&(n=Ze(n,[0,3,1,2])),n})}getConfig(){let e=super.getConfig();return delete e.rank,delete e.kernelInitializer,delete e.kernelRegularizer,delete e.kernelConstraint,e.depthwiseInitializer=kt(this.depthwiseInitializer),e.pointwiseInitializer=kt(this.pointwiseInitializer),e.depthwiseRegularizer=ut(this.depthwiseRegularizer),e.pointwiseRegularizer=ut(this.pointwiseRegularizer),e.depthwiseConstraint=Pt(this.depthwiseConstraint),e.pointwiseConstraint=Pt(this.pointwiseConstraint),e}};U4.className="SeparableConv";var Ey=class extends U4{constructor(e){super(2,e)}};Ey.className="SeparableConv2D";ae.registerClass(Ey);var t0=class extends Pd{constructor(e){super(1,e);t0.verifyArgs(e),this.inputSpec=[{ndim:3}]}getConfig(){let e=super.getConfig();return delete e.rank,delete e.dataFormat,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!$1(e.kernelSize,"number",1,1))throw new B(`Conv1D expects config.kernelSize to be number or number[] with length 1, but received ${JSON.stringify(e.kernelSize)}.`)}};t0.className="Conv1D";ae.registerClass(t0);var Cy=class extends Ge{constructor(e){super(e);typeof e.cropping=="number"?this.cropping=[[e.cropping,e.cropping],[e.cropping,e.cropping]]:typeof e.cropping[0]=="number"?this.cropping=[[e.cropping[0],e.cropping[0]],[e.cropping[1],e.cropping[1]]]:this.cropping=e.cropping,this.dataFormat=e.dataFormat===void 0?"channelsLast":e.dataFormat,this.inputSpec=[{ndim:4}]}computeOutputShape(e){return this.dataFormat==="channelsFirst"?[e[0],e[1],e[2]-this.cropping[0][0]-this.cropping[0][1],e[3]-this.cropping[1][0]-this.cropping[1][1]]:[e[0],e[1]-this.cropping[0][0]-this.cropping[0][1],e[2]-this.cropping[1][0]-this.cropping[1][1],e[3]]}call(e,t){return W(()=>{if(e=_e(e),this.dataFormat==="channelsLast"){let n=$h(e,this.cropping[0][0],e.shape[1]-this.cropping[0][0]-this.cropping[0][1],2);return $h(n,this.cropping[1][0],e.shape[2]-this.cropping[1][1]-this.cropping[1][0],3)}else{let n=$h(e,this.cropping[0][0],e.shape[2]-this.cropping[0][0]-this.cropping[0][1],3);return $h(n,this.cropping[1][0],e.shape[3]-this.cropping[1][1]-this.cropping[1][0],4)}})}getConfig(){let e={cropping:this.cropping,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}};Cy.className="Cropping2D";ae.registerClass(Cy);var Ry=class extends Ge{constructor(e){super(e);this.DEFAULT_SIZE=[2,2],this.inputSpec=[{ndim:4}],this.size=e.size==null?this.DEFAULT_SIZE:e.size,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Et(this.dataFormat),this.interpolation=e.interpolation==null?"nearest":e.interpolation,Tte(this.interpolation)}computeOutputShape(e){if(this.dataFormat==="channelsFirst"){let t=e[2]==null?null:this.size[0]*e[2],n=e[3]==null?null:this.size[1]*e[3];return[e[0],e[1],t,n]}else{let t=e[1]==null?null:this.size[0]*e[1],n=e[2]==null?null:this.size[1]*e[2];return[e[0],t,n,e[3]]}}call(e,t){return W(()=>{let n=_e(e),a=n.shape;if(this.dataFormat==="channelsFirst"){n=Ze(n,[0,2,3,1]);let r=this.size[0]*a[2],s=this.size[1]*a[3],i=this.interpolation==="nearest"?n.resizeNearestNeighbor([r,s]):n.resizeBilinear([r,s]);return Ze(i,[0,3,1,2])}else{let r=this.size[0]*a[1],s=this.size[1]*a[2];return this.interpolation==="nearest"?n.resizeNearestNeighbor([r,s]):n.resizeBilinear([r,s])}})}getConfig(){let e={size:this.size,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}};Ry.className="UpSampling2D";ae.registerClass(Ry);function lre(e,t,n=[1,1],a="valid",r,s){return W(()=>{r==null&&(r=ba()),Et(r);let i=Iy(e,r);if(e.rank!==4)throw new B(`Input for depthwiseConv2d is required to be 4-D, but is instead ${e.rank}-D`);if(t.rank!==4)throw new B(`depthwiseKernel is required to be 4-D, but is instead ${t.rank}-D`);return i=fl(i,t,n,a==="same"?"same":"valid","NHWC",s),r==="channelsFirst"&&(i=Ze(i,[0,3,1,2])),i})}var My=class extends Sy{constructor(e){super(2,e);this.depthwiseKernel=null,this.depthMultiplier=e.depthMultiplier==null?1:e.depthMultiplier,this.depthwiseInitializer=mt(e.depthwiseInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.depthwiseConstraint=Lt(e.depthwiseConstraint),this.depthwiseRegularizer=At(e.depthwiseRegularizer)}build(e){if(e=at(e),e.length<4)throw new B(`Inputs to DepthwiseConv2D should have rank 4. Received input shape: ${JSON.stringify(e)}.`);let t=this.dataFormat==="channelsFirst"?1:3;if(e[t]==null||e[t]<0)throw new B(`The channel dimension of the inputs to DepthwiseConv2D should be defined, but is not (${e[t]}).`);let n=e[t],a=[this.kernelSize[0],this.kernelSize[1],n,this.depthMultiplier];this.depthwiseKernel=this.addWeight("depthwise_kernel",a,null,this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[n*this.depthMultiplier],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return W(()=>{e=_e(e);let n=lre(e,this.depthwiseKernel.read(),this.strides,this.padding,this.dataFormat,null);return this.useBias&&(n=ka(n,this.bias.read(),this.dataFormat)),this.activation!=null&&(n=this.activation.apply(n)),n})}computeOutputShape(e){e=at(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],n=this.dataFormat==="channelsFirst"?e[3]:e[2],a=this.dataFormat==="channelsFirst"?e[1]*this.depthMultiplier:e[3]*this.depthMultiplier,r=Na(t,this.kernelSize[0],this.padding,this.strides[0]),s=Na(n,this.kernelSize[1],this.padding,this.strides[1]);return this.dataFormat==="channelsFirst"?[e[0],a,r,s]:[e[0],r,s,a]}getConfig(){let e=super.getConfig();return e.depthMultiplier=this.depthMultiplier,e.depthwiseInitializer=kt(this.depthwiseInitializer),e.depthwiseRegularizer=ut(this.depthwiseRegularizer),e.depthwiseConstraint=Pt(this.depthwiseRegularizer),e}};My.className="DepthwiseConv2D";ae.registerClass(My);function H4(e,t,n,a){if(Array.isArray(e)){if(t!=null||n!=null)throw new B("When inputs is an array, neither initialState or constants should be provided");a!=null&&(n=e.slice(e.length-a,e.length),e=e.slice(0,e.length-a)),e.length>1&&(t=e.slice(1,e.length)),e=e[0]}function r(s){return s==null||Array.isArray(s)?s:[s]}return t=r(t),n=r(n),{inputs:e,initialState:t,constants:n}}function G4(e,t,n,a=!1,r,s,i=!1,o=!1){return W(()=>{let l=t.shape.length;if(l<3)throw new B(`Input should be at least 3D, but is ${l}D.`);let d=[1,0].concat(wa(2,l));if(t=Ze(t,d),s!=null)throw new Oe("The rnn() functoin of the deeplearn.js backend does not support constants yet.");i&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),r!=null&&(r=r.asType("bool").asType("float32"),r.rank===l-1&&(r=ln(r,-1)),r=Ze(r,d)),a&&(t=On(t,0),r!=null&&(r=On(r,0)));let u=[],p,c=n,h=t.shape[0],m=la(t),f;r!=null&&(f=la(r));for(let y=0;ye(g,c));if(r==null)p=x[0],c=x[1];else{let w=W(()=>{let b=f[y],v=Dn(b).sub(b),N=x[0].mul(b).add(c[0].mul(v)),T=c.map((R,$)=>x[1][$].mul(b).add(R.mul(v)));return{output:N,newStates:T}});p=w.output,c=w.newStates}o&&u.push(p)}let A;return o&&(A=zn(u,1)),[p,A,c]})}var Ha=class extends Ge{constructor(e){super(e);let t;if(e.cell==null)throw new B("cell property is missing for the constructor of RNN.");if(Array.isArray(e.cell)?t=new n0({cells:e.cell}):t=e.cell,t.stateSize==null)throw new B("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");this.cell=t,this.returnSequences=e.returnSequences==null?!1:e.returnSequences,this.returnState=e.returnState==null?!1:e.returnState,this.goBackwards=e.goBackwards==null?!1:e.goBackwards,this._stateful=e.stateful==null?!1:e.stateful,this.unroll=e.unroll==null?!1:e.unroll,this.supportsMasking=!0,this.inputSpec=[new Mt({ndim:3})],this.stateSpec=null,this.states_=null,this.numConstants=null,this.keptStates=[]}getStates(){if(this.states_==null){let e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;return wa(0,e).map(t=>null)}else return this.states_}setStates(e){this.states_=e}computeOutputShape(e){Q1(e)&&(e=e[0]),e=e;let t=this.cell.stateSize;Array.isArray(t)||(t=[t]);let n=t[0],a;if(this.returnSequences?a=[e[0],e[1],n]:a=[e[0],n],this.returnState){let r=[];for(let s of t)r.push([e[0],s]);return[a].concat(r)}else return a}computeMask(e,t){return W(()=>{Array.isArray(t)&&(t=t[0]);let n=this.returnSequences?t:null;if(this.returnState){let a=this.states.map(r=>null);return[n].concat(a)}else return n})}get states(){if(this.states_==null){let e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,t=[];for(let n=0;ni.shape[i.shape.length-1]),s))throw new B(`An initialState was passed that is not compatible with cell.stateSize. Received stateSpec=${this.stateSpec}; However cell.stateSize is ${this.cell.stateSize}`)}else this.stateSpec=s.map(i=>new Mt({shape:[null,i]}));this.stateful&&this.resetStates()}resetStates(e,t=!1){W(()=>{if(!this.stateful)throw new ur("Cannot call resetStates() on an RNN Layer that is not stateful.");let n=this.inputSpec[0].shape[0];if(n==null)throw new B("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.states_==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(a=>Ct([n,a])):this.states_=[Ct([n,this.cell.stateSize])];else if(e==null)Ee(this.states_),this.keptStates!=null&&(Ee(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(a=>Ct([n,a])):this.states_[0]=Ct([n,this.cell.stateSize]);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new B(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);t===!0?this.keptStates.push(this.states_.slice()):Ee(this.states_);for(let a=0;ajt(a.clone()))})}apply(e,t){let n=t==null?null:t.initialState,a=t==null?null:t.constants;t==null&&(t={});let r=H4(e,n,a,this.numConstants);e=r.inputs,n=r.initialState,a=r.constants;let s=[],i=[];if(n!=null){t.initialState=n,s=s.concat(n),this.stateSpec=[];for(let o of n)this.stateSpec.push(new Mt({shape:o.shape}));i=i.concat(this.stateSpec)}if(a!=null&&(t.constants=a,s=s.concat(a),this.numConstants=a.length),s[0]instanceof Ia){let o=[e].concat(s),l=this.inputSpec.concat(i),d=this.inputSpec;this.inputSpec=l;let u=super.apply(o,t);return this.inputSpec=d,u}else return super.apply(e,t)}call(e,t){return W(()=>{let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;e=_e(e),r==null&&(this.stateful?r=this.states_:r=this.getInitialState(e));let s=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;if(r.length!==s)throw new B(`RNN Layer has ${s} state(s) but was passed ${r.length} initial state(s).`);this.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");let i={training:a},o=G4((c,h)=>{let m=this.cell.call([c].concat(h),i);return[m[0],m.slice(1)]},e,r,this.goBackwards,n,null,this.unroll,this.returnSequences),l=o[0],d=o[1],u=o[2];this.stateful&&this.resetStates(u,a);let p=this.returnSequences?d:l;return this.returnState?[p].concat(u):p})}getInitialState(e){return W(()=>{let t=Ct(e.shape);return t=ke(t,[1,2]),t=Cd(t),Array.isArray(this.cell.stateSize)?this.cell.stateSize.map(n=>n>1?L1(t,[1,n]):t):this.cell.stateSize>1?[L1(t,[1,this.cell.stateSize])]:[t]})}get trainableWeights(){return this.trainable?this.cell.trainableWeights:[]}get nonTrainableWeights(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.cell!=null&&this.cell.setFastWeightInitDuringBuild(e)}getConfig(){let e=super.getConfig(),t={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};this.numConstants!=null&&(t.numConstants=this.numConstants);let n=this.cell.getConfig();return this.getClassName()===Ha.className&&(t.cell={className:this.cell.getClassName(),config:n}),Object.assign({},n,e,t)}static fromConfig(e,t,n={}){let a=t.cell,r=Sa(a,n);return new e(Object.assign(t,{cell:r}))}};Ha.className="RNN";ae.registerClass(Ha);var Fd=class extends Ge{},a0=class extends Fd{constructor(e){super(e);this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,Ht(this.units,"units"),this.activation=qr(e.activation==null?this.DEFAULT_ACTIVATION:e.activation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=mt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=mt(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=mt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=At(e.kernelRegularizer),this.recurrentRegularizer=At(e.recurrentRegularizer),this.biasRegularizer=At(e.biasRegularizer),this.kernelConstraint=Lt(e.kernelConstraint),this.recurrentConstraint=Lt(e.recurrentConstraint),this.biasConstraint=Lt(e.biasConstraint),this.dropout=Bl([1,Ur([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=Bl([1,Ur([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=at(e),this.kernel=this.addWeight("kernel",[e[e.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return W(()=>{if(e=e,e.length!==2)throw new B(`SimpleRNNCell expects 2 input Tensors, got ${e.length}.`);let n=e[1];e=e[0];let a=t.training==null?!1:t.training;0Dn(e),rate:this.dropout,training:a})),0Dn(n),rate:this.recurrentDropout,training:a}));let r,s=this.dropoutMask,i=this.recurrentDropoutMask;s!=null?r=Ua(_(e,s),this.kernel.read()):r=Ua(e,this.kernel.read()),this.bias!=null&&(r=ka(r,this.bias.read())),i!=null&&(n=_(n,i));let o=se(r,Ua(n,this.recurrentKernel.read()));return this.activation!=null&&(o=this.activation.apply(o)),[o,o]})}getConfig(){let e=super.getConfig(),t={units:this.units,activation:Gr(this.activation),useBias:this.useBias,kernelInitializer:kt(this.kernelInitializer),recurrentInitializer:kt(this.recurrentInitializer),biasInitializer:kt(this.biasInitializer),kernelRegularizer:ut(this.kernelRegularizer),recurrentRegularizer:ut(this.recurrentRegularizer),biasRegularizer:ut(this.biasRegularizer),activityRegularizer:ut(this.activityRegularizer),kernelConstraint:Pt(this.kernelConstraint),recurrentConstraint:Pt(this.recurrentConstraint),biasConstraint:Pt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout};return Object.assign({},e,t)}};a0.className="SimpleRNNCell";ae.registerClass(a0);var Fy=class extends Ha{constructor(e){e.cell=new a0(e),super(e)}call(e,t){return W(()=>{this.cell.dropoutMask!=null&&(Ee(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Ee(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}static fromConfig(e,t){return new e(t)}};Fy.className="SimpleRNN";ae.registerClass(Fy);var r0=class extends Fd{constructor(e){super(e);if(this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.resetAfter)throw new B("GRUCell does not support reset_after parameter set to true.");this.units=e.units,Ht(this.units,"units"),this.activation=qr(e.activation===void 0?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=qr(e.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=mt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=mt(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=mt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=At(e.kernelRegularizer),this.recurrentRegularizer=At(e.recurrentRegularizer),this.biasRegularizer=At(e.biasRegularizer),this.kernelConstraint=Lt(e.kernelConstraint),this.recurrentConstraint=Lt(e.recurrentConstraint),this.biasConstraint=Lt(e.biasConstraint),this.dropout=Bl([1,Ur([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=Bl([1,Ur([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.implementation=e.implementation,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=at(e);let t=e[e.length-1];this.kernel=this.addWeight("kernel",[t,this.units*3],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*3],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units*3],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return W(()=>{if(e=e,e.length!==2)throw new B(`GRUCell expects 2 input Tensors (inputs, h, c), got ${e.length}.`);let n=t.training==null?!1:t.training,a=e[1];e=e[0],0Dn(e),rate:this.dropout,training:n,count:3})),0Dn(a),rate:this.recurrentDropout,training:n,count:3}));let r=this.dropoutMask,s=this.recurrentDropoutMask,i,o,l;0{this.cell.dropoutMask!=null&&(Ee(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Ee(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}static fromConfig(e,t){return t.implmentation===0&&(t.implementation=1),new e(t)}};$y.className="GRU";ae.registerClass($y);var Bd=class extends Fd{constructor(e){super(e);this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,Ht(this.units,"units"),this.activation=qr(e.activation===void 0?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=qr(e.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=mt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=mt(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=mt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.unitForgetBias=e.unitForgetBias,this.kernelRegularizer=At(e.kernelRegularizer),this.recurrentRegularizer=At(e.recurrentRegularizer),this.biasRegularizer=At(e.biasRegularizer),this.kernelConstraint=Lt(e.kernelConstraint),this.recurrentConstraint=Lt(e.recurrentConstraint),this.biasConstraint=Lt(e.biasConstraint),this.dropout=Bl([1,Ur([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=Bl([1,Ur([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.implementation=e.implementation,this.stateSize=[this.units,this.units],this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){var t;e=at(e);let n=e[e.length-1];this.kernel=this.addWeight("kernel",[n,this.units*4],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*4],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint);let a;if(this.useBias){if(this.unitForgetBias){let r=this.biasInitializer,s=this.units;a=new(t=class extends da{apply(i,o){let l=r.apply([s]),d=new Oh().apply([s]),u=r.apply([s*2]);return _6(_6(l,d),u)}},t.className="CustomInit",t)}else a=this.biasInitializer;this.bias=this.addWeight("bias",[this.units*4],null,a,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0}call(e,t){return W(()=>{let n=t.training==null?!1:t.training;if(e=e,e.length!==3)throw new B(`LSTMCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);let a=e[1],r=e[2];e=e[0],0Dn(e),rate:this.dropout,training:n,count:4})),0Dn(a),rate:this.recurrentDropout,training:n,count:4}));let s=this.dropoutMask,i=this.recurrentDropoutMask,o,l,d,u;0{this.cell.dropoutMask!=null&&(Ee(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Ee(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}static fromConfig(e,t){return t.implmentation===0&&(t.implementation=1),new e(t)}};Dy.className="LSTM";ae.registerClass(Dy);var n0=class extends Fd{constructor(e){super(e);this.cells=e.cells}get stateSize(){let e=[];for(let t of this.cells.slice().reverse())Array.isArray(t.stateSize)?e.push(...t.stateSize):e.push(t.stateSize);return e}call(e,t){return W(()=>{e=e;let n=e.slice(1),a=[];for(let i of this.cells.slice().reverse())Array.isArray(i.stateSize)?a.push(n.splice(0,i.stateSize.length)):a.push(n.splice(0,1));a.reverse();let r=[],s;for(let i=0;i{Ri(`RNNCell_${a}`,()=>{n.build(e),Array.isArray(n.stateSize)?t=n.stateSize[0]:t=n.stateSize,e=[e[0],t]})}),this.built=!0}getConfig(){let e=super.getConfig(),t=a=>({className:a.getClassName(),config:a.getConfig()}),n={cells:this.cells.map(t)};return Object.assign({},e,n)}static fromConfig(e,t,n={}){let a=[];for(let r of t.cells)a.push(Sa(r,n));return new e({cells:a})}get trainableWeights(){if(!this.trainable)return[];let e=[];for(let t of this.cells)e.push(...t.trainableWeights);return e}get nonTrainableWeights(){let e=[];for(let t of this.cells)e.push(...t.nonTrainableWeights);if(!this.trainable){let t=[];for(let n of this.cells)t.push(...n.trainableWeights);return t.concat(e)}return e}getWeights(){let e=[];for(let t of this.cells)e.push(...t.weights);return ey(e)}setWeights(e){let t=[];for(let n of this.cells){let a=n.weights.length,r=e.splice(a);for(let s=0;sL6(t(),n),i=()=>Md(s,t,a);return!r||r<=1?jt(i().clone()):Array(r).fill(void 0).map(i).map(o=>jt(o.clone()))}var ure=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(e);r{if(this.cell.dropoutMask!=null&&(Ee(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(Ee(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null),t&&t.constants)throw new B("ConvRNN2D cell does not support constants");let n=t==null?null:t.mask,a=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:n,training:a,initialState:r})})}computeOutputShape(e){let t=this.computeSingleOutputShape(e);return this.returnSequences||(t=[t[0],...t.slice(2)]),this.returnState&&(t=[t,...Array(2).fill([e[0],...t.slice(-3)])]),t}getInitialState(e){return W(()=>{let{stateSize:t}=this.cell,n=e.shape,a=this.computeSingleOutputShape(n),r=[a[0],...a.slice(2)],s=Ct(r);return Array.isArray(t)?Array(t.length).fill(s):[s]})}resetStates(e,t=!1){W(()=>{if(!this.stateful)throw new ur("Cannot call resetStates() on an RNN Layer that is not stateful.");let n=this.inputSpec[0].shape,a=this.computeSingleOutputShape(n),r=[a[0],...a.slice(2)];if(n[0]==null)throw new B("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.getStates()==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>Ct(r)):this.states_=[Ct(r)];else if(e==null)Ee(this.states_),this.keptStates!=null&&(Ee(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>Ct(r)):this.states_[0]=Ct(r);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new B(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);t?this.keptStates.push(this.states_.slice()):Ee(this.states_);for(let s=0;sjt(s.clone()))})}computeSingleOutputShape(e){let{dataFormat:t,filters:n,kernelSize:a,padding:r,strides:s,dilationRate:i}=this.cell,o=t==="channelsFirst",l=e[o?3:2],d=e[o?4:3],u=Na(l,a[0],r,s[0],i[0]),p=Na(d,a[1],r,s[1],i[1]);return[...e.slice(0,2),...o?[n,u,p]:[u,p,n]]}};q4.className="ConvRNN2D";var s0=class extends Bd{constructor(e){let{filters:t,kernelSize:n,strides:a,padding:r,dataFormat:s,dilationRate:i}=e;super(Object.assign({},e,{units:t}));this.filters=t,Ht(this.filters,"filters"),this.kernelSize=Gl(n,2,"kernelSize"),this.kernelSize.forEach(o=>Ht(o,"kernelSize")),this.strides=Gl(a||1,2,"strides"),this.strides.forEach(o=>Ht(o,"strides")),this.padding=r||"valid",Jn(this.padding),this.dataFormat=s||"channelsLast",Et(this.dataFormat),this.dilationRate=Gl(i||1,2,"dilationRate"),this.dilationRate.forEach(o=>Ht(o,"dilationRate"))}build(e){var t;e=at(e);let n=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[n]==null)throw new B(`The channel dimension of the input should be defined. Found ${e[n]}`);let a=e[n],r=4,s=this.kernelSize.concat([a,this.filters*r]);this.kernel=this.addWeight("kernel",s,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint);let i=this.kernelSize.concat([this.filters,this.filters*r]);if(this.recurrentKernel=this.addWeight("recurrent_kernel",i,null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){let o;if(this.unitForgetBias){let l=this.biasInitializer,d=this.filters;o=new(t=class extends da{apply(u,p){let c=l.apply([d]),h=$n([d]),m=l.apply([d*2]);return B1([c,h,m])}},t.className="CustomInit",t)}else o=this.biasInitializer;this.bias=this.addWeight("bias",[this.filters*r],null,o,this.biasRegularizer,!0,this.biasConstraint)}this.built=!0}call(e,t){return W(()=>{if(e.length!==3)throw new B(`ConvLSTM2DCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);let n=t.training||!1,a=e[0],r=e[1],s=e[2],i=4;0Dn(a),rate:this.dropout,training:n,count:i}));let o=this.dropoutMask,l=(Y,re,ne)=>!re||!re[ne]?Y:_(re[ne],Y),d=l(a,o,0),u=l(a,o,1),p=l(a,o,2),c=l(a,o,3);0Dn(r),rate:this.recurrentDropout,training:n,count:i}));let h=this.recurrentDropoutMask,m=l(r,h,0),f=l(r,h,1),A=l(r,h,2),y=l(r,h,3),g=3,[x,w,b,v]=an(this.kernel.read(),i,g),[N,T,R,$]=this.useBias?an(this.bias.read(),i):[null,null,null,null];d=this.inputConv(d,x,N,this.padding),u=this.inputConv(u,w,T,this.padding),p=this.inputConv(p,b,R,this.padding),c=this.inputConv(c,v,$,this.padding);let[z,P,V,j]=an(this.recurrentKernel.read(),i,g);m=this.recurrentConv(m,z),f=this.recurrentConv(f,P),A=this.recurrentConv(A,V),y=this.recurrentConv(y,j);let U=this.recurrentActivation.apply(se(d,m)),X=this.recurrentActivation.apply(se(u,f)),G=se(_(X,s),_(U,this.activation.apply(se(p,A)))),ee=_(this.recurrentActivation.apply(se(c,y)),this.activation.apply(G));return[ee,ee,G]})}getConfig(){let e=super.getConfig(),{units:t}=e,n=ure(e,["units"]),a={filters:this.filters,kernelSize:this.kernelSize,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,strides:this.strides};return Object.assign({},n,a)}inputConv(e,t,n,a){let r=ar(e,t,this.strides,a||"valid",this.dataFormat==="channelsFirst"?"NCHW":"NHWC",this.dilationRate);return n?ka(r,n,this.dataFormat):r}recurrentConv(e,t){return ar(e,t,1,"same",this.dataFormat==="channelsFirst"?"NCHW":"NHWC")}};s0.className="ConvLSTM2DCell";ae.registerClass(s0);var Oy=class extends q4{constructor(e){let t=new s0(e);super(Object.assign({},e,{cell:t}))}static fromConfig(e,t){return new e(t)}};Oy.className="ConvLSTM2D";ae.registerClass(Oy);var i0=class extends Ge{constructor(e){super(e);this.rate=Math.max(Math.min(e.rate,1),0),this.noiseShape=e.noiseShape,this.seed=e.seed,this.supportsMasking=!0}getNoiseShape(e){if(this.noiseShape==null)return this.noiseShape;let t=e.shape,n=[];for(let a=0;a{this.invokeCallHook(e,t);let n=_e(e);if(0L6(n,this.rate,r,this.seed),()=>n,a)}return e})}getConfig(){let e={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},t=super.getConfig();return Object.assign(e,t),e}dispose(){return super.dispose()}};i0.className="Dropout";ae.registerClass(i0);var zy=class extends i0{constructor(e){super(e);this.inputSpec=[{ndim:3}]}getNoiseShape(e){let t=e.shape;return[t[0],1,t[2]]}};zy.className="SpatialDropout1D";ae.registerClass(zy);var _y=class extends Ge{constructor(e){super(e);if(this.activation=null,this.useBias=!0,this.kernel=null,this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.batchInputShape==null&&e.inputShape==null&&e.inputDim!=null){let t=null;e.batchSize!=null&&(t=e.batchSize),this.batchInputShape=[t,e.inputDim]}this.units=e.units,Ht(this.units,"units"),this.activation=qr(e.activation),e.useBias!=null&&(this.useBias=e.useBias),this.kernelInitializer=mt(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.biasInitializer=mt(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelConstraint=Lt(e.kernelConstraint),this.biasConstraint=Lt(e.biasConstraint),this.kernelRegularizer=At(e.kernelRegularizer),this.biasRegularizer=At(e.biasRegularizer),this.activityRegularizer=At(e.activityRegularizer),this.supportsMasking=!0,this.inputSpec=[{minNDim:2}]}build(e){e=at(e);let t=e[e.length-1];this.kernel==null&&(this.kernel=this.addWeight("kernel",[t,this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint))),this.inputSpec=[{minNDim:2,axes:{[-1]:t}}],this.built=!0}computeOutputShape(e){e=at(e);let t=e.slice();return t[t.length-1]=this.units,t}call(e,t){return W(()=>{this.invokeCallHook(e,t);let n=_e(e),a=T6(this.activation.getClassName()),r;return a!=null?r=Ua(n,this.kernel.read(),a,this.bias?this.bias.read():null):(r=Ua(n,this.kernel.read()),this.bias!=null&&(r=ka(r,this.bias.read())),this.activation!=null&&(r=this.activation.apply(r))),r})}getConfig(){let e={units:this.units,activation:Gr(this.activation),useBias:this.useBias,kernelInitializer:kt(this.kernelInitializer),biasInitializer:kt(this.biasInitializer),kernelRegularizer:ut(this.kernelRegularizer),biasRegularizer:ut(this.biasRegularizer),activityRegularizer:ut(this.activityRegularizer),kernelConstraint:Pt(this.kernelConstraint),biasConstraint:Pt(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}};_y.className="Dense";ae.registerClass(_y);var Py=class extends Ge{constructor(e){e=e||{},super(e),this.inputSpec=[{minNDim:3}],this.dataFormat=e.dataFormat}computeOutputShape(e){e=at(e);for(let t of e.slice(1))if(t==null)throw new B(`The shape of the input to "Flatten" is not fully defined (got ${e.slice(1)}). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.`);return[e[0],jr(e,1)]}call(e,t){return W(()=>{this.invokeCallHook(e,t);let n=_e(e);if(this.dataFormat==="channelsFirst"&&n.rank>1){let a=[0];for(let r=2;r{this.invokeCallHook(e,t);let n=_e(e);return this.activation.apply(n)})}getConfig(){let e={activation:Gr(this.activation)},t=super.getConfig();return Object.assign(e,t),e}};Ly.className="Activation";ae.registerClass(Ly);var Wy=class extends Ge{constructor(e){super(e);this.n=e.n,this.inputSpec=[{ndim:2}]}computeOutputShape(e){return[e[0],this.n,e[1]]}call(e,t){return W(()=>(e=_e(e),Mte(e,this.n)))}getConfig(){let e={n:this.n},t=super.getConfig();return Object.assign(e,t),e}};Wy.className="RepeatVector";ae.registerClass(Wy);var By=class extends Ge{constructor(e){super(e);this.targetShape=e.targetShape;for(let t=0;t{this.invokeCallHook(e,t);let n=_e(e),a=n.shape,r=a.slice(0,1).concat(this.fixUnknownDimension(a.slice(1),this.targetShape));return n.reshape(r)})}getConfig(){let e={targetShape:this.targetShape},t=super.getConfig();return Object.assign(e,t),e}};By.className="Reshape";ae.registerClass(By);var Vy=class extends Ge{constructor(e){super(e);if(e.dims==null)throw new Error("Required configuration field `dims` is missing during Permute constructor call.");if(!Array.isArray(e.dims))throw new Error(`Permute constructor requires \`dims\` to be an Array, but received ${e.dims} instead.`);let t=wa(1,e.dims.length+1);if(!k.arraysEqual(e.dims.slice().sort(),t))throw new Error("Invalid permutation `dims`: "+JSON.stringify(e.dims)+" `dims` must contain consecutive integers starting from 1.");this.dims=e.dims,this.dimsIncludingBatch=[0].concat(this.dims),this.inputSpec=[new Mt({ndim:this.dims.length+1})]}computeOutputShape(e){e=at(e);let t=e.slice();return this.dims.forEach((n,a)=>{t[a+1]=e[n]}),t}call(e,t){return Ze(_e(e),this.dimsIncludingBatch)}getConfig(){let e={dims:this.dims},t=super.getConfig();return Object.assign(e,t),e}};Vy.className="Permute";ae.registerClass(Vy);var jy=class extends Ge{constructor(e){super(e==null?{}:e);this.supportsMasking=!0,e!=null?this.maskValue=e.maskValue==null?0:e.maskValue:this.maskValue=0}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={maskValue:this.maskValue};return Object.assign(t,e),t}computeMask(e,t){let n=_e(e),a=-1;return Uu(Ai(n,this.maskValue),a)}call(e,t){return W(()=>{this.invokeCallHook(e,t);let n=_e(e),a=-1,r=!0,s=Uu(Ai(n,this.maskValue),a,r);return n.mul(s.asType(n.dtype))})}};jy.className="Masking";ae.registerClass(jy);var Uy=class extends Ge{constructor(e){super(e);if(this.embeddings=null,this.DEFAULT_EMBEDDINGS_INITIALIZER="randomUniform",e.batchInputShape==null&&e.inputShape==null){let t=null;e.batchSize!=null&&(t=e.batchSize),e.inputLength==null?this.batchInputShape=[t,null]:this.batchInputShape=[t].concat(ht(e.inputLength))}this.inputDim=e.inputDim,Ht(this.inputDim,"inputDim"),this.outputDim=e.outputDim,Ht(this.outputDim,"outputDim"),this.embeddingsInitializer=mt(e.embeddingsInitializer||this.DEFAULT_EMBEDDINGS_INITIALIZER),this.embeddingsRegularizer=At(e.embeddingsRegularizer),this.activityRegularizer=At(e.activityRegularizer),this.embeddingsConstraint=Lt(e.embeddingsConstraint),this.maskZero=e.maskZero,this.supportsMasking=e.maskZero,this.inputLength=e.inputLength}build(e){this.embeddings=this.addWeight("embeddings",[this.inputDim,this.outputDim],this.dtype,this.embeddingsInitializer,this.embeddingsRegularizer,!0,this.embeddingsConstraint),this.built=!0}warnOnIncompatibleInputShape(e){}computeMask(e,t){return W(()=>this.maskZero?(e=_e(e),Ai(e,Ue(e))):null)}computeOutputShape(e){if(e=at(e),this.inputLength==null)return[...e,this.outputDim];let t=ht(this.inputLength);if(t.length!==e.length-1)throw new B(`"inputLength" is ${this.inputLength}, but received input shape has shape ${e}`);{let n=0;for(let a=0;a{this.invokeCallHook(e,t);let n=_e(e);return n.dtype!=="int32"&&(n=Ed(n,"int32")),P6(this.embeddings.read(),n.as1D()).reshape(at(this.computeOutputShape(n.shape)))})}getConfig(){let e={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:kt(this.embeddingsInitializer),embeddingsRegularizer:ut(this.embeddingsRegularizer),activityRegularizer:ut(this.activityRegularizer),embeddingsConstraint:Pt(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},t=super.getConfig();return Object.assign(e,t),e}};Uy.className="Embedding";ae.registerClass(Uy);var Oi=class extends Ge{constructor(e){super(e||{});this.supportsMasking=!0}mergeFunction(e){throw new Oe}computeElementwiseOpOutputShape(e,t){if(e==null||t==null)return null;if(e.length1)throw new B(`Can not merge tensors with different batch sizes. Got tensors with shapes: ${JSON.stringify(e)}.`);let n=e[0]==null?null:e[0].slice(1);for(let r=1;rr.length);e.indexOf(null)===-1&&Vr(a).length===1?this.reshapeRequired=!1:this.reshapeRequired=!0}call(e,t){return W(()=>{if(e=e,this.reshapeRequired){let n=[],a=e.map(r=>r.rank);if(a.indexOf(null)===-1){let r=Ur(a);for(let s of e){let i=s.rank;for(let o=0;o1){let d=wa(1,l).concat([0]);n.push(Ze(o,d)),r=!0}else n.push(o)}let s=this.mergeFunction(n),i=s.rank;if(r){if(i==null){let o=s.shape,l=o.length,d=o[l-1],u=[d].concat(o.slice(0,o.length-1));s=Ze(s.reshape([-1,d]),[1,0]).reshape(u)}else if(i>1){let o=[i-1].concat(wa(0,i-1));s=Ze(s,o)}}return s}}else return this.mergeFunction(e)})}computeOutputShape(e){e=e;let t;e[0]==null?t=null:t=e[0].slice(1);for(let a=1;a{if(t==null)return null;if(!Array.isArray(t))throw new B("`mask` should be an Array");if(!Array.isArray(e))throw new B("`inputs` should be an Array");if(t.length!==e.length)throw new B(`The Array 'inputs' and 'mask' are expected to have the same length, but have different lengths (${e.length} vs ${t.length})`);if(t.every(a=>a==null))return null;t=t.map(a=>a==null?a:ln(a,0));let n=t[0];for(let a=1;a{let t=e[0].clone();for(let n=1;n{let t=e[0].clone();for(let n=1;n{let t=e[0].clone();for(let n=1;n{let t=e[0];for(let n=1;n{let t=e[0];for(let n=1;n1)throw new B("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(e))}mergeFunction(e){return W(()=>B1(e,this.axis))}computeOutputShape(e){if(!(Array.isArray(e)&&Array.isArray(e[0])))throw new B("A `Concatenate` layer should be called on a list of inputs.");let t=e,n=t[0].slice(),a=this.axis<0?n.length+this.axis:this.axis;for(let r of t.slice(1)){if(n[a]==null||r[a]==null){n[a]=null;break}n[a]+=r[a]}return n}computeMask(e,t){if(t==null)return null;if(!Array.isArray(t))throw new B("`mask` should be an array for Concatenate");if(!Array.isArray(e))throw new B("`inputs` should be an array for Concatenate");if(t.length!==e.length)throw new B(`Mismatch in the length of mask (${t.length}) and the legnth of inputs (${e.length})`);return W(()=>{let n=!0;if(t.forEach(s=>{if(s!=null){n=!1;return}}),n)return null;let a=[];for(let s=0;s3||t.shape.length>3)throw new Oe("batchDot is not implemented for tensors of 4D or higher rank yet");if(k.assert(e.shape.length>=2,()=>`batchDot requires the rank of x to be >= 2, but got ${e.shape.length}`),k.assert(e.shape.length>=2,()=>`batchDot requires the rank of y to be >= 2, but got ${t.shape.length}`),typeof n=="number"&&(n=[n,n]),e.dtype==="complex64"||t.dtype==="complex64")throw new Oe("batchDot is not implemented for complex64-type Tensors yet.");let a=e.shape.length,r=t.shape.length;n==null&&(n=[a-1,r-2]);let s=n;return W(()=>{let i;if(a>r){i=a-r;let l=[];for(let d=0;da){i=r-a;let l=[];for(let d=0;d0){let l;a>r?l=a+r-3:l=a-1;let d=[];for(let u=l;u"A `Dot` layer should be called on a list of exactly 2 inputs.");let t=e[0],n=e[1];if(t.length>3||n.length>3)throw new Oe("Dot layer does not support tensors of 4D or higher rank yet.");let a=this.interpretAxes(t,n);if(t[a[0]]!==n[a[1]])throw new B(`Dimension incompatibility: ${t[a[0]]} !== ${n[a[1]]}`)}mergeFunction(e){if(e.length!==2)throw new B(`A \`Dot\` layer must be called on exactly 2 inputs, but received ${e.length} input(s).`);let t=e[0],n=e[1],a;return Array.isArray(this.axes)?a=this.axes.map((r,s)=>Vd(r,e[s].shape.length)):a=[Vd(this.axes,t.shape.length),Vd(this.axes,n.shape.length)],this.normalize&&(t=qh(t,a[0]),n=qh(n,a[1])),dre(t,n,a)}interpretAxes(e,t){let n;return Array.isArray(this.axes)?n=this.axes:n=[Vd(this.axes,e.length),Vd(this.axes,t.length)],n}computeOutputShape(e){k.assert(Array.isArray(e)&&e.length===2&&Array.isArray(e[0])&&Array.isArray(e[1]),()=>"A `Dot` layer should be called on a list of exactly 2 inputs.");let t=e[0].slice(),n=e[1].slice();if(t.length>3||n.length>3)throw new Oe("Dot layer does not support tensors of 4D or higher rank yet.");let a=this.interpretAxes(t,n);t.splice(a[0],1),n.splice(a[1],1),n.splice(0,1);let r=t.concat(n);return r.length===1&&r.push(1),r}computeMask(e,t){return null}getConfig(){let e={axes:this.axes,normalize:this.normalize},t=super.getConfig();return Object.assign(e,t),e}};Yy.className="Dot";ae.registerClass(Yy);var Jy=class extends Ge{constructor(e){super(e);this.supportsMasking=!0,this.stddev=e.stddev}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={stddev:this.stddev};return Object.assign(t,e),t}call(e,t){return W(()=>{this.invokeCallHook(e,t);let n=_e(e);return Md(()=>Dh(n.shape,0,this.stddev).add(n),()=>n,t.training||!1)})}};Jy.className="GaussianNoise";ae.registerClass(Jy);var Qy=class extends Ge{constructor(e){super(e);this.supportsMasking=!0,this.rate=e.rate}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return W(()=>{this.invokeCallHook(e,t);let n=_e(e);return this.rate>0&&this.rate<1?Md(()=>{let a=Math.sqrt(this.rate/(1-this.rate));return n.mul(Dh(n.shape,1,a))},()=>n,t.training||!1):n})}};Qy.className="GaussianDropout";ae.registerClass(Qy);var e2=class extends Ge{constructor(e){super(e);this.supportsMasking=!0,this.rate=e.rate,this.noiseShape=e.noiseShape}_getNoiseShape(e){return this.noiseShape||_e(e).shape}computeOutputShape(e){return e}getConfig(){let e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return W(()=>{if(this.rate<1&&this.rate>0){let n=this._getNoiseShape(e);return Md(()=>{let a=_e(e),r=1.6732632423543772,s=1.0507009873554805,i=-r*s,o=Dr(bl(n),this.rate);o=Ed(o,"float32");let l=((1-this.rate)*(1+this.rate*i**2))**-.5,d=-l*i*this.rate;return a.mul(o).add(o.add(-1).mul(i)).mul(l).add(d)},()=>_e(e),t.training||!1)}return e})}};e2.className="AlphaDropout";ae.registerClass(e2);function jd(e,t,n,a,r,s=.001){let i;if(e.rank===2)i=Cb(e,t,n,a,r,s);else if(e.rank===3)i=Rb(e,t,n,a,r,s);else if(e.rank===4)i=Mb(e,t,n,a,r,s);else throw new Oe(`batchNormalization is not implemented for array of rank ${e.rank} yet`);return i}function pre(e,t,n,a,r=.001){return W(()=>{let s=Mc(e,a),i=s.mean,o=s.variance;return[jd(e,i,o,n,t,r),i,o]})}function cre(e,t,n,a,r=.001){return W(()=>{let s=Mc(e,a),i=s.mean,o=s.variance,l=[];for(let h of wa(0,e.rank))a.indexOf(h)!==-1?l.push(1):l.push(e.shape[h]);let d=i.reshape(l),u=o.reshape(l),p=t==null?null:t.reshape(l),c=n==null?null:n.reshape(l);return[jd(e,d,u,c,p,r),i,o]})}function hre(e,t,n,a,r=.001){return k.arraysEqual(a.slice().sort(),wa(0,e.rank-1))?pre(e,t,n,a,r):cre(e,t,n,a,r)}var t2=class extends Ge{constructor(e){e==null&&(e={}),super(e),this.supportsMasking=!0,this.axis=e.axis==null?-1:e.axis,this.momentum=e.momentum==null?.99:e.momentum,this.epsilon=e.epsilon==null?.001:e.epsilon,this.center=e.center==null?!0:e.center,this.scale=e.scale==null?!0:e.scale,this.betaInitializer=mt(e.betaInitializer||"zeros"),this.gammaInitializer=mt(e.gammaInitializer||"ones"),this.movingMeanInitializer=mt(e.movingMeanInitializer||"zeros"),this.movingVarianceInitializer=mt(e.movingVarianceInitializer||"ones"),this.betaConstraint=Lt(e.betaConstraint),this.gammaConstraint=Lt(e.gammaConstraint),this.betaRegularizer=At(e.betaRegularizer),this.gammaRegularizer=At(e.gammaRegularizer)}build(e){e=at(e);let t=this.axis>=0?this.axis:this.axis+e.length,n=e[t];if(n==null)throw new B(`Axis ${t} of input tensor should have a defined dimension but the layer received an input with shape ${JSON.stringify(e)}.`);this.inputSpec=[new Mt({ndim:e.length,axes:{[t]:n}})];let a=[n];this.scale&&(this.gamma=this.addWeight("gamma",a,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&&(this.beta=this.addWeight("beta",a,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight("moving_mean",a,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight("moving_variance",a,null,this.movingVarianceInitializer,null,!1),this.built=!0}call(e,t){return W(()=>{let n=t.training==null?!1:t.training,a=_e(e),r=a.shape,s=r.length,i=wa(0,s),o=this.axis>=0?this.axis:this.axis+s;i.splice(o,1);let l=Ti(1,s);l[o]=r[o];let d=i.slice();d.sort();let u=!k.arraysEqual(d,wa(0,s).slice(0,s-1)),p=()=>{if(u){let A=this.movingMean.read().reshape(l),y=this.movingVariance.read().reshape(l),g=this.center?this.beta.read().reshape(l):null,x=this.scale?this.gamma.read().reshape(l):null;return jd(a,A,y,g,x,this.epsilon)}else return jd(a,this.movingMean.read(),this.movingVariance.read(),this.beta==null?null:this.beta.read(),this.gamma==null?null:this.gamma.read(),this.epsilon)};if(!n)return p();let[c,h,m]=hre(a,this.gamma.read(),this.beta.read(),i,this.epsilon),f=(A,y,g)=>{W(()=>{let x=1-g,w=A.read(),b=w.sub(y).mul(x);A.write(w.sub(b))})};return(()=>{f(this.movingMean,h,this.momentum),f(this.movingVariance,m,this.momentum)})(),c})}getConfig(){let e={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:kt(this.betaInitializer),gammaInitializer:kt(this.gammaInitializer),movingMeanInitializer:kt(this.movingMeanInitializer),movingVarianceInitializer:kt(this.movingVarianceInitializer),betaRegularizer:ut(this.betaRegularizer),gammaRegularizer:ut(this.gammaRegularizer),betaConstraint:Pt(this.betaConstraint),gammaConstraint:Pt(this.gammaConstraint)},t=super.getConfig();return Object.assign(e,t),e}};t2.className="BatchNormalization";ae.registerClass(t2);var n2=class extends Ge{constructor(e){if(e==null&&(e={}),super(e),this.axis=e.axis==null?-1:e.axis,typeof this.axis=="number"){if(!Number.isInteger(this.axis))throw new Error(`Expected axis to be an integer, but received ${this.axis}`)}else if(Array.isArray(this.axis)){for(let t of this.axis)if(!Number.isInteger(t))throw new Error(`Expected axis to be an array of integers, but received ${JSON.stringify(this.axis)}`)}else throw new Error(`Expected axis to be an integer or an array of integers, but received ${JSON.stringify(this.axis)}`);this.epsilon=e.epsilon==null?.001:e.epsilon,this.center=e.center==null?!0:e.center,this.scale=e.scale==null?!0:e.scale,this.betaInitializer=mt(e.betaInitializer||"zeros"),this.gammaInitializer=mt(e.gammaInitializer||"ones"),this.betaRegularizer=At(e.betaRegularizer),this.gammaRegularizer=At(e.gammaRegularizer),this.supportsMasking=!0}build(e){e=at(e);let t=e.length;typeof this.axis=="number"&&(this.axis=[this.axis]);for(let r=0;r=t)throw new Error(`Invalid axis: ${r}`);if(this.axis.length!==Vr(this.axis).length)throw new Error(`Found duplicate axes in: ${this.axis}`);let n=this.axis.map(r=>e[r]),a=!0;this.scale?this.gamma=this.addWeight("gamma",n,"float32",this.gammaInitializer,this.gammaRegularizer,a):this.gamma=null,this.center?this.beta=this.addWeight("beta",n,"float32",this.betaInitializer,this.betaRegularizer,a):this.beta=null,this.built=!0}call(e,t){let n=_e(e),a=n.shape,r=a.length;return W(()=>{let s=!0,{mean:i,variance:o}=Mc(n,this.axis,s),l=Ti(1,r);for(let m of this.axis)l[m]=a[m];let d=m=>m!=null&&m.shape.length!==r&&this.axis!==[r-1]?m.reshape(l):m,u=d(this.gamma.read()),p=d(this.beta.read()),c=[],h=[];for(let m=0;m{if(e.rank!==4)throw new B(`temporalPadding expects input tensor to be 4-D, but received a ${e.rank}-D tensor.`);if(t==null&&(t=[[1,1],[1,1]]),t.length!==2||t[0].length!==2||t[1].length!==2)throw new B("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(n==null&&(n=ba()),n!=="channelsLast"&&n!=="channelsFirst")throw new B(`Unknown data format: ${n}. Supported data formats are 'channelsLast' and 'channelsFirst.`);let a;return n==="channelsFirst"?a=[[0,0],[0,0],t[0],t[1]]:a=[[0,0],t[0],t[1],[0,0]],rr(e,a)})}var a2=class extends Ge{constructor(e){if(e==null&&(e={}),super(e),this.dataFormat=e.dataFormat==null?ba():e.dataFormat,e.padding==null)this.padding=[[1,1],[1,1]];else if(typeof e.padding=="number")this.padding=[[e.padding,e.padding],[e.padding,e.padding]];else{if(e.padding=e.padding,e.padding.length!==2)throw new B(`ZeroPadding2D expects padding to be a length-2 array, but received a length-${e.padding.length} array.`);let t,n;if(typeof e.padding[0]=="number")t=[e.padding[0],e.padding[0]],n=[e.padding[1],e.padding[1]];else{if(e.padding=e.padding,e.padding[0].length!==2)throw new B(`ZeroPadding2D expects height padding to be a length-2 array, but received a length-${e.padding[0].length} array.`);if(t=e.padding[0],e.padding[1].length!==2)throw new B(`ZeroPadding2D expects width padding to be a length-2 array, but received a length-${e.padding[1].length} array.`);n=e.padding[1]}this.padding=[t,n]}this.inputSpec=[new Mt({ndim:4})]}computeOutputShape(e){e=at(e);let t,n;return this.dataFormat==="channelsFirst"?(e[2]!=null&&e[2]>=0?t=e[2]+this.padding[0][0]+this.padding[0][1]:t=null,e[3]!=null&&e[3]>=0?n=e[3]+this.padding[1][0]+this.padding[1][1]:n=null,[e[0],e[1],t,n]):(e[1]!=null&&e[1]>=0?t=e[1]+this.padding[0][0]+this.padding[0][1]:t=null,e[2]!=null&&e[2]>=0?n=e[2]+this.padding[1][0]+this.padding[1][1]:n=null,[e[0],t,n,e[3]])}call(e,t){return W(()=>fre(_e(e),this.padding,this.dataFormat))}getConfig(){let e={padding:this.padding,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}};a2.className="ZeroPadding2D";ae.registerClass(a2);function o0(e,t,n,a,r,s){return W(()=>{Et(r),M6(s),Jn(a),n==null&&(n=[1,1]),a==null&&(a="valid"),r==null&&(r=ba()),s==null&&(s="max"),e=Iy(e,r);let i,o=a==="same"?"same":"valid";return s==="max"?i=Ju(e,t,n,o):i=qu(e,t,n,o),r==="channelsFirst"&&(i=Ze(i,[0,3,1,2])),i})}function X4(e,t,n,a,r,s){return W(()=>{Et(r),M6(s),Jn(a),n==null&&(n=[1,1,1]),a==null&&(a="valid"),r==null&&(r=ba()),s==null&&(s="max"),e=V4(e,r);let i,o=a==="same"?"same":"valid";return s==="max"?i=IA(e,t,n,o):i=lA(e,t,n,o),r==="channelsFirst"&&(i=Ze(i,[0,4,1,2,3])),i})}var K4=class extends Ge{constructor(e){if(e.poolSize==null&&(e.poolSize=2),super(e),typeof e.poolSize=="number")this.poolSize=[e.poolSize];else if(Array.isArray(e.poolSize)&&e.poolSize.length===1&&typeof e.poolSize[0]=="number")this.poolSize=e.poolSize;else throw new B(`poolSize for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.poolSize)}`);if(Ht(this.poolSize,"poolSize"),e.strides==null)this.strides=this.poolSize;else if(typeof e.strides=="number")this.strides=[e.strides];else if(Array.isArray(e.strides)&&e.strides.length===1&&typeof e.strides[0]=="number")this.strides=e.strides;else throw new B(`strides for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.strides)}`);Ht(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,Jn(this.padding),this.inputSpec=[new Mt({ndim:3})]}computeOutputShape(e){e=at(e);let t=Na(e[1],this.poolSize[0],this.padding,this.strides[0]);return[e[0],t,e[2]]}call(e,t){return W(()=>{this.invokeCallHook(e,t),e=Cd(_e(e),2);let n=this.poolingFunction(_e(e),[this.poolSize[0],1],[this.strides[0],1],this.padding,"channelsLast");return zr(n,[2])})}getConfig(){let e={poolSize:this.poolSize,padding:this.padding,strides:this.strides},t=super.getConfig();return Object.assign(e,t),e}},r2=class extends K4{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Et(r),Jn(a),o0(e,t,n,a,r,"max")}};r2.className="MaxPooling1D";ae.registerClass(r2);var s2=class extends K4{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Et(r),Jn(a),o0(e,t,n,a,r,"avg")}};s2.className="AveragePooling1D";ae.registerClass(s2);var Z4=class extends Ge{constructor(e){if(e.poolSize==null&&(e.poolSize=[2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize],e.strides==null)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(e.strides.length!==2)throw new B(`If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides];Ht(this.poolSize,"poolSize"),Ht(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Et(this.dataFormat),Jn(this.padding),this.inputSpec=[new Mt({ndim:4})]}computeOutputShape(e){e=at(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],n=this.dataFormat==="channelsFirst"?e[3]:e[2];return t=Na(t,this.poolSize[0],this.padding,this.strides[0]),n=Na(n,this.poolSize[1],this.padding,this.strides[1]),this.dataFormat==="channelsFirst"?[e[0],e[1],t,n]:[e[0],t,n,e[3]]}call(e,t){return W(()=>(this.invokeCallHook(e,t),this.poolingFunction(_e(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){let e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}},i2=class extends Z4{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Et(r),Jn(a),o0(e,t,n,a,r,"max")}};i2.className="MaxPooling2D";ae.registerClass(i2);var o2=class extends Z4{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Et(r),Jn(a),o0(e,t,n,a,r,"avg")}};o2.className="AveragePooling2D";ae.registerClass(o2);var Y4=class extends Ge{constructor(e){if(e.poolSize==null&&(e.poolSize=[2,2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize,e.poolSize],e.strides==null)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(e.strides.length!==3)throw new B(`If the strides property of a 3D pooling layer is an Array, it is expected to have a length of 3, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides,e.strides];Ht(this.poolSize,"poolSize"),Ht(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Et(this.dataFormat),Jn(this.padding),this.inputSpec=[new Mt({ndim:5})]}computeOutputShape(e){e=at(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],n=this.dataFormat==="channelsFirst"?e[3]:e[2],a=this.dataFormat==="channelsFirst"?e[4]:e[3];return t=Na(t,this.poolSize[0],this.padding,this.strides[0]),n=Na(n,this.poolSize[1],this.padding,this.strides[1]),a=Na(a,this.poolSize[2],this.padding,this.strides[2]),this.dataFormat==="channelsFirst"?[e[0],e[1],t,n,a]:[e[0],t,n,a,e[4]]}call(e,t){return W(()=>(this.invokeCallHook(e,t),this.poolingFunction(_e(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){let e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}},l2=class extends Y4{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Et(r),Jn(a),X4(e,t,n,a,r,"max")}};l2.className="MaxPooling3D";ae.registerClass(l2);var u2=class extends Y4{constructor(e){super(e)}poolingFunction(e,t,n,a,r){return Et(r),Jn(a),X4(e,t,n,a,r,"avg")}};u2.className="AveragePooling3D";ae.registerClass(u2);var J4=class extends Ge{constructor(e){super(e);this.inputSpec=[new Mt({ndim:3})]}computeOutputShape(e){return[e[0],e[2]]}call(e,t){throw new Oe}},d2=class extends J4{constructor(e){super(e||{})}call(e,t){return W(()=>{let n=_e(e);return wt(n,1)})}};d2.className="GlobalAveragePooling1D";ae.registerClass(d2);var p2=class extends J4{constructor(e){super(e||{})}call(e,t){return W(()=>{let n=_e(e);return Xn(n,1)})}};p2.className="GlobalMaxPooling1D";ae.registerClass(p2);var Q4=class extends Ge{constructor(e){super(e);this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,Et(this.dataFormat),this.inputSpec=[new Mt({ndim:4})]}computeOutputShape(e){return e=e,this.dataFormat==="channelsLast"?[e[0],e[3]]:[e[0],e[1]]}call(e,t){throw new Oe}getConfig(){let e={dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}},c2=class extends Q4{call(e,t){return W(()=>{let n=_e(e);return this.dataFormat==="channelsLast"?wt(n,[1,2]):wt(n,[2,3])})}};c2.className="GlobalAveragePooling2D";ae.registerClass(c2);var h2=class extends Q4{call(e,t){return W(()=>{let n=_e(e);return this.dataFormat==="channelsLast"?Xn(n,[1,2]):Xn(n,[2,3])})}};h2.className="GlobalMaxPooling2D";ae.registerClass(h2);var e8=class extends Ge{constructor(e){super(e);this.layer=e.layer}build(e){this.built=!0}get trainable(){return this.layer!=null?this.layer.trainable:!1}set trainable(e){this.layer!=null&&(this.layer.trainable=e)}get trainableWeights(){return this.layer.trainableWeights}get nonTrainableWeights(){return this.layer.nonTrainableWeights}get updates(){return this.layer._updates}get losses(){return this.layer.losses}getWeights(){return this.layer.getWeights()}setWeights(e){this.layer.setWeights(e)}getConfig(){let e={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},t=super.getConfig();return Object.assign(e,t),e}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.layer!=null&&this.layer.setFastWeightInitDuringBuild(e)}static fromConfig(e,t,n={}){let a=t.layer,r=Sa(a,n);delete t.layer;let s={layer:r};return Object.assign(s,t),new e(s)}},f2=class extends e8{constructor(e){super(e);this.supportsMasking=!0}build(e){if(e=at(e),e.length<3)throw new B(`TimeDistributed layer expects an input shape >= 3D, but received input shape ${JSON.stringify(e)}`);this.inputSpec=[{shape:e}];let t=[e[0]].concat(e.slice(2));this.layer.built||(this.layer.build(t),this.layer.built=!0),super.build(e)}computeOutputShape(e){e=at(e);let t=[e[0]].concat(e.slice(2)),n=this.layer.computeOutputShape(t),a=e[1];return[n[0],a].concat(n.slice(1))}call(e,t){return W(()=>(e=_e(e),G4((n,a)=>[_e(this.layer.call(n,t)),[]],e,[],!1,null,null,!1,!0)[1]))}};f2.className="TimeDistributed";ae.registerClass(f2);function mre(e){Ci(Nte,"BidirectionalMergeMode",e)}var Are="concat",m2=class extends e8{constructor(e){super(e);let t=e.layer.getConfig(),n={};n.className=e.layer.getClassName(),n.config=t,this.forwardLayer=Sa(n),t.goBackwards=t.goBackwards!==!0;let a={};if(a.className=e.layer.getClassName(),a.config=t,this.backwardLayer=Sa(a),this.forwardLayer.name="forward_"+this.forwardLayer.name,this.backwardLayer.name="backward_"+this.backwardLayer.name,this.mergeMode=e.mergeMode===void 0?Are:e.mergeMode,mre(this.mergeMode),e.weights)throw new Oe("weights support is not implemented for Bidirectional layer yet.");this._stateful=e.layer.stateful,this.returnSequences=e.layer.returnSequences,this.returnState=e.layer.returnState,this.supportsMasking=!0,this._trainable=!0,this.inputSpec=e.layer.inputSpec,this.numConstants=null}get trainable(){return this._trainable}set trainable(e){this._trainable=e,this.forwardLayer!=null&&(this.forwardLayer.trainable=e),this.backwardLayer!=null&&(this.backwardLayer.trainable=e)}getWeights(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())}setWeights(e){let t=e.length,n=Math.floor(t/2);this.forwardLayer.setWeights(e.slice(0,n)),this.backwardLayer.setWeights(e.slice(n))}computeOutputShape(e){let t=this.forwardLayer.computeOutputShape(e);Array.isArray(t)&&Array.isArray(t[0])||(t=[t]),t=t;let n,a,r;return this.returnState&&(r=t.slice(1)),n=t[0],n=n,this.mergeMode==="concat"?(n[n.length-1]*=2,a=[n]):this.mergeMode==null?a=[n,n.slice()]:a=[n],this.returnState?this.mergeMode==null?a.concat(r).concat(r.slice()):[n].concat(r).concat(r.slice()):Sn(a)}apply(e,t){let n=t==null?null:t.initialState,a=t==null?null:t.constants;t==null&&(t={});let r=H4(e,n,a,this.numConstants);if(e=r.inputs,n=r.initialState,a=r.constants,Array.isArray(e)&&(n=e.slice(1),e=e[0]),(n==null||n.length===0)&&a==null)return super.apply(e,t);let s=[],i=[];if(n!=null){let l=n.length;if(l%2>0)throw new B("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");t.initialState=n,s.push(...n);let d=n.map(u=>new Mt({shape:u.shape}));this.forwardLayer.stateSpec=d.slice(0,l/2),this.backwardLayer.stateSpec=d.slice(l/2),i.push(...d)}if(a!=null)throw new Oe("Support for constants in Bidirectional layers is not implemented yet.");let o=s[0]instanceof Ia;for(let l of s)if(l instanceof Ia!==o)throw new B("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors");if(o){let l=[e].concat(s),d=this.inputSpec.concat(i),u=this.inputSpec;this.inputSpec=d;let p=super.apply(l,t);return this.inputSpec=u,p}else return super.apply(e,t)}call(e,t){return W(()=>{let n=t.initialState,a,r;if(n==null)a=this.forwardLayer.call(e,t),r=this.backwardLayer.call(e,t);else{let o=n.slice(0,n.length/2),l=n.slice(n.length/2);a=this.forwardLayer.call(e,Object.assign(t,{initialState:o})),r=this.backwardLayer.call(e,Object.assign(t,{initialState:l}))}let s;this.returnState&&(Array.isArray(a)&&(s=a.slice(1).concat(r.slice(1))),a=a[0],r=r[0]),this.returnSequences&&(r=On(r,1));let i;return this.mergeMode==="concat"?i=B1([a,r]):this.mergeMode==="sum"?i=se(a,r):this.mergeMode==="ave"?i=_(.5,se(a,r)):this.mergeMode==="mul"?i=_(a,r):this.mergeMode==null&&(i=[a,r]),this.returnState?this.mergeMode==null?i.concat(s):[i].concat(s):i})}resetStates(e){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()}build(e){Ri(this.forwardLayer.name,()=>{this.forwardLayer.build(e)}),Ri(this.backwardLayer.name,()=>{this.backwardLayer.build(e)}),this.built=!0}computeMask(e,t){Array.isArray(t)&&(t=t[0]);let n;if(this.returnSequences?this.mergeMode==null?n=[t,t]:n=t:this.mergeMode==null?n=[null,null]:n=null,this.returnState){let a=this.forwardLayer.states.map(r=>null);return Array.isArray(n)?n.concat(a).concat(a):[n].concat(a).concat(a)}else return n}get trainableWeights(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)}get nonTrainableWeights(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.forwardLayer!=null&&this.forwardLayer.setFastWeightInitDuringBuild(e),this.backwardLayer!=null&&this.backwardLayer.setFastWeightInitDuringBuild(e)}getConfig(){let e={mergeMode:this.mergeMode},t=super.getConfig();return Object.assign(e,t),e}static fromConfig(e,t){let n=Sa(t.layer);if(delete t.layer,t.numConstants!=null)throw new Oe("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");let a=t;return a.layer=n,new e(a)}};m2.className="Bidirectional";ae.registerClass(m2);function Vte(e){return new Vl(e)}function jte(e){return new vy(e)}function Ute(e){return new gy(e)}function Hte(e){return new xy(e)}function Gte(e){return new by(e)}function qte(e){return new ky(e)}function Xte(e){return new wy(e)}function Kte(e){return new t0(e)}function Zte(e){return new Ld(e)}function Yte(e){return new Ny(e)}function Jte(e){return new Wd(e)}function Qte(e){return new Ty(e)}function ene(e){return new Ey(e)}function tne(e){return new Cy(e)}function nne(e){return new Ry(e)}function ane(e){return new My(e)}function rne(e){return new Ly(e)}function sne(e){return new _y(e)}function ine(e){return new i0(e)}function one(e){return new zy(e)}function lne(e){return new Py(e)}function une(e){return new Wy(e)}function dne(e){return new By(e)}function pne(e){return new Vy(e)}function cne(e){return new Uy(e)}function hne(e){return new Hy(e)}function fne(e){return new qy(e)}function mne(e){return new Zy(e)}function Ane(e){return new Xy(e)}function yne(e){return new Ky(e)}function gne(e){return new Gy(e)}function xne(e){return new Yy(e)}function bne(e){return new t2(e)}function vne(e){return new n2(e)}function wne(e){return new a2(e)}function Z1(e){return new s2(e)}function kne(e){return Z1(e)}function Ine(e){return Z1(e)}function Y1(e){return new o2(e)}function Sne(e){return Y1(e)}function Nne(e){return Y1(e)}function J1(e){return new u2(e)}function Tne(e){return J1(e)}function Ene(e){return J1(e)}function Cne(e){return new d2(e)}function Rne(e){return new c2(e)}function U6(e){return new p2(e)}function H6(e){return new h2(e)}function G6(e){return new r2(e)}function q6(e){return new i2(e)}function Mne(e){return new l2(e)}function Fne(e){return new $y(e)}function $ne(e){return new r0(e)}function Dne(e){return new Dy(e)}function One(e){return new Bd(e)}function zne(e){return new Fy(e)}function _ne(e){return new a0(e)}function Pne(e){return new Oy(e)}function Lne(e){return new s0(e)}function Wne(e){return new Ha(e)}function Bne(e){return new n0(e)}function Vne(e){return new m2(e)}function jne(e){return new f2(e)}var Une=U6,Hne=H6,Gne=G6,qne=q6;function Xne(e){return new Jy(e)}function Kne(e){return new Qy(e)}function Zne(e){return new e2(e)}function Yne(e){return new jy(e)}var t8={};Fe(t8,{MAPE:()=>Tre,MSE:()=>Rre,binaryAccuracy:()=>yre,binaryCrossentropy:()=>gre,categoricalAccuracy:()=>bre,categoricalCrossentropy:()=>vre,cosineProximity:()=>Ire,mape:()=>Ere,meanAbsoluteError:()=>Sre,meanAbsolutePercentageError:()=>Nre,meanSquaredError:()=>Cre,mse:()=>Mre,precision:()=>wre,recall:()=>kre,sparseCategoricalAccuracy:()=>xre});function yre(e,t){return ry(e,t)}function gre(e,t){return l4(e,t)}function xre(e,t){return u4(e,t)}function bre(e,t){return sy(e,t)}function vre(e,t){return iy(e,t)}function wre(e,t){return o4(e,t)}function kre(e,t){return Aae(e,t)}function Ire(e,t){return ny(e,t)}function Sre(e,t){return Xh(e,t)}function Nre(e,t){return Ul(e,t)}function Tre(e,t){return Ul(e,t)}function Ere(e,t){return Ul(e,t)}function Cre(e,t){return Fi(e,t)}function Rre(e,t){return Fi(e,t)}function Mre(e,t){return Fi(e,t)}var n8={};Fe(n8,{modelFromJSON:()=>Zae});var a8={};Fe(a8,{l1:()=>$re,l1l2:()=>Fre,l2:()=>Dre});function Fre(e){return new _d(e)}function $re(e){return rre(e)}function Dre(e){return sre(e)}var r8=class extends jl{constructor(){super(...arguments);this.model=null}setModel(e){if(!(e instanceof pr))throw new Error("model must be a LayersModel, not some other Container");this.model=e}};function l0(e,t){return et}var i8=class extends r8{constructor(e){super();if(e==null&&(e={}),e.restoreBestWeights)throw new Oe("restoreBestWeights = True is not implemented in EarlyStopping yet.");this.monitor=e.monitor||"val_loss",this.minDelta=Math.abs(e.minDelta||0),this.patience=e.patience||0,this.verbose=e.verbose||0,this.mode=e.mode||"auto",this.baseline=e.baseline,["auto","min","max"].indexOf(this.mode)===-1&&(console.warn(`EarlyStopping mode '${this.mode}' is invalid. Falling back to mode 'auto'.`),this.mode="auto"),this.mode==="min"?this.monitorFunc=l0:this.mode==="max"?this.monitorFunc=s8:this.monitor.indexOf("acc")!==-1?this.monitorFunc=s8:this.monitorFunc=l0,this.monitorFunc===l0&&(this.minDelta*=-1)}async onTrainBegin(e){this.wait=0,this.stoppedEpoch=0,this.baseline!=null?this.best=this.baseline:this.best=this.monitorFunc===l0?Infinity:-Infinity}async onEpochEnd(e,t){await Hr(t);let n=this.getMonitorValue(t);n!=null&&(this.monitorFunc(n-this.minDelta,this.best)?(this.best=n,this.wait=0):(this.wait++,this.wait>=this.patience&&(this.stoppedEpoch=e,this.model.stopTraining=!0)))}async onTrainEnd(e){this.stoppedEpoch>0&&this.verbose&&console.log(`Epoch ${this.stoppedEpoch}: early stopping.`)}getMonitorValue(e){e==null&&(e={});let t=e[this.monitor];return t==null&&console.warn(`Metric for EarlyStopping ${this.monitor} is not available. Available metrics are: ${Object.keys(e)}`),t}};function Ore(e){return new i8(e)}var zre={earlyStopping:Ore},Ta;(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_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"})(Ta||(Ta={}));var o8;(function(e){let t;(function(n){n[n.LEGACY=0]="LEGACY",n[n.V1=1]="V1",n[n.V2=2]="V2"})(t=e.CheckpointFormatVersion||(e.CheckpointFormatVersion={}))})(o8||(o8={}));var A2={};function _re(e,t){let n={tfOpName:e,category:"custom",inputs:[],attrs:[],customExecutor:t};A2[e]=n}function l8(e){return A2[e]}function Pre(e){delete A2[e]}function I(e,t,n,a,r){let s=t.inputParams[e];if(s&&s.inputIndexStart!==void 0){let o=s.inputIndexStart,l=s.inputIndexEnd===0?void 0:s.inputIndexEnd===void 0?o+1:s.inputIndexEnd;if(s.type==="tensor")return mn(t.inputNames[s.inputIndexStart],n,a,r);if(s.type==="tensors")return t.inputNames.slice(o,l).map(p=>mn(p,n,a,r));let d=mn(t.inputNames.slice(o)[0],n,a,r),u=d.dataSync();return s.type==="number"?u[0]:k.toNestedArray(d.shape,u)}let i=t.attrParams[e];return i&&i.value}function mn(e,t,n,a){let[r,s]=Ln(e);if(a!=null){let o=a.getHashTableHandleByName(r);if(o!=null)return o}let i=n.currentContextIds.find(o=>!!t[u0(r,o)]);return i!==void 0?t[u0(r,i)][s]:void 0}function Lre(e,t,n){return t[u0(e,n.currentContextId)]}function cr(e,t){let[n,a]=Ln(e);return[u0(n,t&&t.currentContextId),a]}function u0(e,t){return t?`${e}-${t}`:e}function Ln(e){let t=e.split(":");return t.length===1?[e,0]:[t[0],Number(t[t.length-1])]}function d0(e,t,n){let a=I("pad",e,t,n);if(a==="explicit"){a=I("explicitPaddings",e,t,n);let r=[[0,0],[0,0],[0,0],[0,0]];for(let s=0;s<4;s++)r[s][0]=a[s*2],r[s][1]=a[s*2+1];return r}return a}function hr(e){return e.kept?e:Oa(e)}var u8={};Fe(u8,{json:()=>Wre});var Wre=[{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}]}],d8={};Fe(d8,{json:()=>Bre});var Bre=[{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}]}],p8={};Fe(p8,{json:()=>Vre});var Vre=[{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:"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"}]}],c8={};Fe(c8,{json:()=>jre});var jre=[{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"}]},{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"}]}],h8={};Fe(h8,{json:()=>Ure});var Ure=[{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",notSupported:!0}]},{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:"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"}]}],f8={};Fe(f8,{json:()=>Hre});var Hre=[{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}]}],m8={};Fe(m8,{json:()=>Gre});var Gre=[{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:"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"}]}],A8={};Fe(A8,{json:()=>qre});var qre=[{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"}]}],y8={};Fe(y8,{json:()=>Xre});var Xre=[{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"}]}],g8={};Fe(g8,{json:()=>Kre});var Kre=[{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"}]}],x8={};Fe(x8,{json:()=>Zre});var Zre=[{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}]}],b8={};Fe(b8,{json:()=>Yre});var Yre=[{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:"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"}]}],v8={};Fe(v8,{json:()=>Jre});var Jre=[{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}]}],w8={};Fe(w8,{json:()=>Qre});var Qre=[{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:"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"}]}],k8={};Fe(k8,{json:()=>ese});var ese=[{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}]}],I8={};Fe(I8,{json:()=>tse});var tse=[{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}]}],S8={};Fe(S8,{json:()=>nse});var nse=[{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:[]}],T8=class{static get Instance(){return this._instance||(this._instance=new this)}constructor(){let e=[u8,d8,p8,c8,h8,f8,m8,x8,g8,A8,b8,v8,w8,k8,I8,S8,y8],t=[].concat(...e.map(n=>n.json));this.opMappers=t.reduce((n,a)=>(n[a.tfOpName]=a,n),{})}transformGraph(e,t={}){let n=e.node,a=[],r=[],s=[],i=n.reduce((m,f)=>(m[f.name]=this.mapNode(f),f.op.startsWith("Placeholder")?a.push(m[f.name]):f.op==="Const"?r.push(m[f.name]):(f.input==null||f.input.length===0)&&s.push(m[f.name]),m),{}),o=[],l=[],d={},u={};t!=null&&(d=this.mapSignatureEntries(t.inputs),u=this.mapSignatureEntries(t.outputs));let p=Object.keys(i);p.forEach(m=>{let f=i[m];f.inputNames.forEach(A=>{let[y]=cr(A);f.inputs.push(i[y]),i[y].children.push(f)})}),Object.keys(u).length===0?p.forEach(m=>{let f=i[m];f.children.length===0&&l.push(f)}):Object.keys(u).forEach(m=>{let[f]=cr(m),A=i[f];A!=null&&(A.signatureKey=u[m],l.push(A))}),Object.keys(d).length>0?Object.keys(d).forEach(m=>{let[f]=cr(m),A=i[f];A&&(A.signatureKey=d[m],o.push(A))}):o=a;let c={};e.library!=null&&e.library.function!=null&&(c=e.library.function.reduce((m,f)=>(m[f.signature.name]=this.mapFunction(f),m),{}));let h={nodes:i,inputs:o,outputs:l,weights:r,placeholders:a,signature:t,functions:c};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){let t=l8(e.op)||this.opMappers[e.op]||{};e.attr==null&&(e.attr={});let n={name:e.name,op:e.op,category:t.category,inputNames:(e.input||[]).map(a=>a.startsWith("^")?a.substr(1):a),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:e.attr};return t.inputs!=null&&(n.inputParams=t.inputs.reduce((a,r)=>(a[r.name]={type:r.type,inputIndexStart:r.start,inputIndexEnd:r.end},a),{})),t.attrs!=null&&(n.attrParams=t.attrs.reduce((a,r)=>{let s=r.type,i;switch(r.type){case"string":i=y2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=y2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"string[]":i=S2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=S2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"number":i=x2(e.attr,r.tfName,r.defaultValue||0),i===void 0&&!!r.tfDeprecatedName&&(i=x2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"number[]":i=I2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=I2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"bool":i=g2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=g2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"bool[]":i=T2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=T2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"shape":i=k2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=k2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"shape[]":i=N2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=N2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"dtype":i=v2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=v2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"dtype[]":i=w2(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=w2(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"func":i=N8(e.attr,r.tfName,r.defaultValue),i===void 0&&!!r.tfDeprecatedName&&(i=N8(e.attr,r.tfDeprecatedName,r.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error(`Unsupported param type: ${r.type} for op: ${e.op}`)}return a[r.name]={value:i,type:s},a},{})),n}mapFunction(e){let t=e.nodeDef,n=[],a=[],r={};t!=null&&(r=t.reduce((d,u)=>(d[u.name]=this.mapNode(u),u.op==="Const"&&a.push(d[u.name]),d),{}));let s=[],i=[];e.signature.inputArg.forEach(d=>{let[u]=cr(d.name),p={name:u,op:"Placeholder",inputs:[],inputNames:[],category:"graph",inputParams:{},attrParams:{dtype:{value:b2(d.type),type:"dtype"}},children:[]};p.signatureKey=d.name,s.push(p),r[u]=p}),Object.keys(r).forEach(d=>{let u=r[d];u.inputNames.forEach(p=>{let[c]=cr(p);u.inputs.push(r[c]),r[c].children.push(u)})});let o=e.ret;e.signature.outputArg.forEach(d=>{let[u,p]=cr(o[d.name]),c=r[u];c!=null&&(c.defaultOutput=p,i.push(c))});let l=this.mapArgsToSignature(e);return{nodes:r,inputs:s,outputs:i,weights:a,placeholders:n,signature:l}}mapArgsToSignature(e){return{methodName:e.signature.name,inputs:e.signature.inputArg.reduce((t,n)=>(t[n.name]=this.mapArgToTensorInfo(n),t),{}),outputs:e.signature.outputArg.reduce((t,n)=>(t[n.name]=this.mapArgToTensorInfo(n,e.ret),t),{})}}mapArgToTensorInfo(e,t){let n=e.name;return t!=null&&(n=t[n]),{name:n,dtype:e.type}}};function ase(e){let t=J().global;if(typeof t.atob!="undefined")return t.atob(e);if(typeof Buffer!="undefined")return new Buffer(e,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}function E8(e,t){let n=Array.isArray(e)?String.fromCharCode.apply(null,e):ase(e);return t?n:n.toLowerCase()}function y2(e,t,n,a=!1){let r=e[t];return r!=null?E8(r.s,a):n}function g2(e,t,n){let a=e[t];return a?a.b:n}function x2(e,t,n){let a=e[t]||{},r=a.i!=null?a.i:a.f!=null?a.f:n;return typeof r=="number"?r:parseInt(r,10)}function b2(e){switch(typeof e=="string"&&(e=Ta[e]),e){case Ta.DT_FLOAT:return"float32";case Ta.DT_INT32:case Ta.DT_INT64:case Ta.DT_INT8:case Ta.DT_UINT8:return"int32";case Ta.DT_BOOL:return"bool";case Ta.DT_DOUBLE:return"float32";case Ta.DT_STRING:return"string";default:return null}}function N8(e,t,n){let a=e[t];return a&&a.func?a.func.name:n}function v2(e,t,n){let a=e[t];return a&&a.type?b2(a.type):n}function w2(e,t,n){let a=e[t];return a&&a.list&&a.list.type?a.list.type.map(r=>b2(r)):n}function C8(e){if(!e.unknownRank)return e.dim!=null?e.dim.map(t=>typeof t.size=="number"?t.size:parseInt(t.size,10)):[]}function k2(e,t,n){let a=e[t];return a&&a.shape?C8(a.shape):n}function I2(e,t,n){let a=e[t];return a?((a.list.f&&a.list.f.length?a.list.f:a.list.i)||[]).map(r=>typeof r=="number"?r:parseInt(r,10)):n}function S2(e,t,n,a=!1){let r=e[t];return r&&r.list&&r.list.s?r.list.s.map(s=>E8(s,a)):n}function N2(e,t,n){let a=e[t];return a&&a.list&&a.list.shape?a.list.shape.map(r=>C8(r)):n}function T2(e,t,n){let a=e[t];return a&&a.list&&a.list.b?a.list.b:n}var rse=class{constructor(e,t,n){this.node=e,this.tensorMap=t,this.context=n,this.inputs=[],this.attrs={},this.inputs=e.inputNames.map(a=>this.getInput(a)),e.rawAttrs!=null&&(this.attrs=Object.keys(e.rawAttrs).reduce((a,r)=>(a[r]=this.getAttr(r),a),{}))}getInput(e){return mn(e,this.tensorMap,this.context)}getAttr(e,t){let n=this.node.rawAttrs[e];if(n.tensor!=null)return mn(e,this.tensorMap,this.context);if(n.i!=null||n.f!=null)return x2(this.node.rawAttrs,e,t);if(n.s!=null)return y2(this.node.rawAttrs,e,t);if(n.b!=null)return g2(this.node.rawAttrs,e,t);if(n.shape!=null)return k2(this.node.rawAttrs,e,t);if(n.type!=null)return v2(this.node.rawAttrs,e,t);if(n.list!=null){if(n.list.i!=null||n.list.f!=null)return I2(this.node.rawAttrs,e,t);if(n.list.s!=null)return S2(this.node.rawAttrs,e,t);if(n.list.shape!=null)return N2(this.node.rawAttrs,e,t);if(n.list.b!=null)return T2(this.node.rawAttrs,e,t);if(n.list.type!=null)return w2(this.node.rawAttrs,e,t)}return t}},sse=(e,t,n)=>{switch(e.op){case"BiasAdd":case"AddV2":case"Add":return[se(I("a",e,t,n),I("b",e,t,n))];case"AddN":return[gc(I("tensors",e,t,n))];case"FloorMod":case"Mod":return[NA(I("a",e,t,n),I("b",e,t,n))];case"Mul":return[_(I("a",e,t,n),I("b",e,t,n))];case"RealDiv":case"Div":return[me(I("a",e,t,n),I("b",e,t,n))];case"DivNoNan":return[mA(I("a",e,t,n),I("b",e,t,n))];case"FloorDiv":return[yc(I("a",e,t,n),I("b",e,t,n))];case"Sub":return[ge(I("a",e,t,n),I("b",e,t,n))];case"Minimum":return[xl(I("a",e,t,n),I("b",e,t,n))];case"Maximum":return[Pa(I("a",e,t,n),I("b",e,t,n))];case"Pow":return[sr(I("a",e,t,n),I("b",e,t,n))];case"SquaredDifference":return[Vc(I("a",e,t,n),I("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},ise=(e,t,n)=>{switch(e.op){case"Abs":case"ComplexAbs":return[Ot(I("x",e,t,n))];case"Acos":return[Jm(I("x",e,t,n))];case"Acosh":return[Qm(I("x",e,t,n))];case"Asin":return[tA(I("x",e,t,n))];case"Asinh":return[nA(I("x",e,t,n))];case"Atan":return[aA(I("x",e,t,n))];case"Atan2":return[rA(I("x",e,t,n),I("y",e,t,n))];case"Atanh":return[sA(I("x",e,t,n))];case"Ceil":return[dA(I("x",e,t,n))];case"Complex":return[Tr(I("real",e,t,n),I("imag",e,t,n))];case"Cos":return[Ku(I("x",e,t,n))];case"Cosh":return[kc(I("x",e,t,n))];case"Elu":return[ml(I("x",e,t,n))];case"Erf":return[AA(I("x",e,t,n))];case"Exp":return[qn(I("x",e,t,n))];case"Expm1":return[yA(I("x",e,t,n))];case"Floor":return[yl(I("x",e,t,n))];case"Log":return[Fn(I("x",e,t,n))];case"Log1p":return[Tc(I("x",e,t,n))];case"Imag":return[Sc(I("x",e,t,n))];case"Neg":return[vt(I("x",e,t,n))];case"Reciprocal":return[CA(I("x",e,t,n))];case"Real":return[td(I("x",e,t,n))];case"Relu":return[La(I("x",e,t,n))];case"Round":return[Dc(I("x",e,t,n))];case"Selu":return[zc(I("x",e,t,n))];case"Sigmoid":return[wn(I("x",e,t,n))];case"Sin":return[_c(I("x",e,t,n))];case"Sign":return[MA(I("x",e,t,n))];case"Sinh":return[Pc(I("x",e,t,n))];case"Softplus":return[fi(I("x",e,t,n))];case"Sqrt":return[Jt(I("x",e,t,n))];case"Square":return[st(I("x",e,t,n))];case"Tanh":return[pi(I("x",e,t,n))];case"Tan":return[DA(I("x",e,t,n))];case"ClipByValue":return[kn(I("x",e,t,n),I("clipValueMin",e,t,n),I("clipValueMax",e,t,n))];case"Relu6":return[$c(I("x",e,t,n))];case"Rsqrt":return[Oc(mn(e.inputNames[0],t,n))];case"Prod":return[Fc(I("x",e,t,n),I("axes",e,t,n))];case"LeakyRelu":return[Zu(I("x",e,t,n),I("alpha",e,t,n))];case"Prelu":return[ed(I("x",e,t,n),I("alpha",e,t,n))];case"IsNan":return[xA(mn(e.inputNames[0],t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function ca(e,t,n=""){if(!(typeof e=="number"||typeof t=="number")){k.assert(e.length===t.length,()=>n+` Shapes ${e} and ${t} must match`);for(let a=0;an+` Shapes ${e} and ${t} must match`)}}}function R8(e){return!(typeof e=="number"||e.some(t=>t<0))}function Ud(e,t,n){let a=E2(e,n),r=!R8(a);if(r&&t.length===0)throw new Error(`Tried to calculate elements of an empty list with non-fully-defined elementShape: ${a}`);if(r&&t.forEach(s=>{a=E2(s.shape,a)}),!R8(a))throw new Error(`Non-fully-defined elementShape: ${a}`);return a}function E2(e,t){if(typeof e=="number")return t;if(typeof t=="number")return e;if(e.length!==t.length)throw new Error(`Incompatible ranks during merge: ${e} vs. ${t}`);let n=[];for(let a=0;a=0&&s>=0&&r!==s)throw new Error(`Incompatible shape during merge: ${e} vs. ${t}`);n[a]=r>=0?r:s}return n}var ose=class{constructor(e,t,n,a,r,s,i){this.name=e,this.dtype=t,this.maxSize=n,this.elementShape=a,this.identicalElementShapes=r,this.dynamicSize=s,this.clearAfterRead=i,this.tensors=[],this.closed_=!1,this.idTensor=Se(0),jt(this.idTensor)}get id(){return this.idTensor.id}get closed(){return this.closed_}clearAndClose(e){this.tensors.forEach(t=>{(e==null||!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()}`);let 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(t=>this.read(t))}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}`);let n=this.tensors[e]||{};if(t.dtype!==this.dtype)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, because the value dtype is ${t.dtype}, but TensorArray dtype is ${this.dtype}.`);if(this.size()===0&&(this.elementShape==null||this.elementShape.length===0)&&(this.elementShape=t.shape),ca(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,jt(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((n,a)=>this.write(n,t[a]))}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 a=0;a=this.maxSize)throw new Error(`Max index must be < array size (${n} vs. ${this.maxSize})`);this.writeMany(e,la(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,a=e.map(o=>(n+=o,n));if(n!==t.shape[0])throw new Error(`Expected sum of lengths to be equal to tensor.shape[0], but sum of lengths is - ${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`);let r=n===0?0:t.size/n,s=[];W(()=>{t=H(t,[1,n,r]);for(let o=0;o{if(n!==r.dtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${r.dtype}`);ca(t,r.shape,"TensorList shape mismatch: "),jt(r)}),this.idTensor=Se(0),this.maxNumElements=a,jt(this.idTensor)}get id(){return this.idTensor.id}copy(){return new Ud([...this.tensors],this.elementShape,this.elementDtype)}clearAndClose(e){this.tensors.forEach(t=>{(e==null||!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(n!==-1&&this.tensors.length!==n)throw new Error(`Operation expected a list with ${n} elements but got a list with ${this.tensors.length} elements.`);ca(e,this.elementShape,"TensorList shape mismatch: ");let a=jd(this.elementShape,this.tensors,e);return W(()=>{let r=this.tensors.map(s=>H(s,a));return zn(r,0)})}popBack(e,t){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);if(this.size()===0)throw new Error("Trying to pop from an empty list.");let n=jd(this.elementShape,this.tensors,e),a=this.tensors.pop();return ca(a.shape,e,"TensorList shape mismatch: "),H(a,n)}pushBack(e){if(e.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${this.elementDtype}`);if(ca(e.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");jt(e),this.tensors.push(e)}resize(e){if(e<0)throw new Error(`TensorListResize expects size to be non-negative. Got: ${e}`);if(this.maxNumElements!==-1&&e>this.maxNumElements)throw new Error(`TensorListResize input size ${e} is greater maxNumElement ${this.maxNumElements}.`);this.tensors.length=e}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(this.tensors[e]==null)throw new Error(`element at index ${e} is null.`);ca(this.tensors[e].shape,t,"TensorList shape mismatch: ");let a=jd(this.elementShape,this.tensors,t);return H(this.tensors[e],a)}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||this.maxNumElements!==-1&&e>=this.maxNumElements)throw new Error(`Trying to set element ${e} in a list with max ${this.maxNumElements} elements.`);ca(this.elementShape,t.shape,"TensorList shape mismatch: "),jt(t),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}`);ca(this.elementShape,n,"TensorList shape mismatch: "),e=e.slice(0,this.size());let a=jd(this.elementShape,this.tensors,n);return e.length===0?ia([],[0].concat(a)):W(()=>{let r=e.map(s=>H(this.tensors[s],a));return zn(r,0)})}concat(e,t){if(!!e&&e!==this.elementDtype)throw new Error(`TensorList dtype is ${this.elementDtype} but concat requested dtype ${e}`);ca(this.elementShape,t,"TensorList shape mismatch: ");let n=jd(this.elementShape,this.tensors,t);return this.size()===0?ia([],[0].concat(n)):W(()=>{let a=this.tensors.map(r=>H(r,n));return ot(a,0)})}};function ose(e,t,n){let a=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}`);let r=e.shape.slice(1);ca(r,t,"TensorList shape mismatch: ");let s=la(e);return new Ud(s,t,a)}function lse(e,t,n){return new Ud([],e,t,n)}function use(e,t,n,a){if(t.length!==e.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${t.length} vs. ${e.shape[0]}`);let r=Math.max(...t);if(a!=null&&a!==-1&&r>=a)throw new Error(`Max index must be < array size (${r} vs. ${a})`);let s=new Ud([],n,e.dtype,a),i=la(e,0);return t.forEach((o,l)=>{s.setItem(o,i[l])}),s}function dse(e,t,n){let a=0,r=t.map(u=>(a+=u,a));if(a!==e.shape[0])throw new Error(`Expected sum of lengths to be equal to + ${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`);let r=n===0?0:t.size/n,s=[];W(()=>{t=H(t,[1,n,r]);for(let o=0;o{if(n!==r.dtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${r.dtype}`);ca(t,r.shape,"TensorList shape mismatch: "),jt(r)}),this.idTensor=Se(0),this.maxNumElements=a,jt(this.idTensor)}get id(){return this.idTensor.id}copy(){return new Hd([...this.tensors],this.elementShape,this.elementDtype)}clearAndClose(e){this.tensors.forEach(t=>{(e==null||!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(n!==-1&&this.tensors.length!==n)throw new Error(`Operation expected a list with ${n} elements but got a list with ${this.tensors.length} elements.`);ca(e,this.elementShape,"TensorList shape mismatch: ");let a=Ud(this.elementShape,this.tensors,e);return W(()=>{let r=this.tensors.map(s=>H(s,a));return zn(r,0)})}popBack(e,t){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);if(this.size()===0)throw new Error("Trying to pop from an empty list.");let n=Ud(this.elementShape,this.tensors,e),a=this.tensors.pop();return ca(a.shape,e,"TensorList shape mismatch: "),H(a,n)}pushBack(e){if(e.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${this.elementDtype}`);if(ca(e.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");jt(e),this.tensors.push(e)}resize(e){if(e<0)throw new Error(`TensorListResize expects size to be non-negative. Got: ${e}`);if(this.maxNumElements!==-1&&e>this.maxNumElements)throw new Error(`TensorListResize input size ${e} is greater maxNumElement ${this.maxNumElements}.`);this.tensors.length=e}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(this.tensors[e]==null)throw new Error(`element at index ${e} is null.`);ca(this.tensors[e].shape,t,"TensorList shape mismatch: ");let a=Ud(this.elementShape,this.tensors,t);return H(this.tensors[e],a)}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||this.maxNumElements!==-1&&e>=this.maxNumElements)throw new Error(`Trying to set element ${e} in a list with max ${this.maxNumElements} elements.`);ca(this.elementShape,t.shape,"TensorList shape mismatch: "),jt(t),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}`);ca(this.elementShape,n,"TensorList shape mismatch: "),e=e.slice(0,this.size());let a=Ud(this.elementShape,this.tensors,n);return e.length===0?ia([],[0].concat(a)):W(()=>{let r=e.map(s=>H(this.tensors[s],a));return zn(r,0)})}concat(e,t){if(!!e&&e!==this.elementDtype)throw new Error(`TensorList dtype is ${this.elementDtype} but concat requested dtype ${e}`);ca(this.elementShape,t,"TensorList shape mismatch: ");let n=Ud(this.elementShape,this.tensors,t);return this.size()===0?ia([],[0].concat(n)):W(()=>{let a=this.tensors.map(r=>H(r,n));return ot(a,0)})}};function lse(e,t,n){let a=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}`);let r=e.shape.slice(1);ca(r,t,"TensorList shape mismatch: ");let s=la(e);return new Hd(s,t,a)}function use(e,t,n){return new Hd([],e,t,n)}function dse(e,t,n,a){if(t.length!==e.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${t.length} vs. ${e.shape[0]}`);let r=Math.max(...t);if(a!=null&&a!==-1&&r>=a)throw new Error(`Max index must be < array size (${r} vs. ${a})`);let s=new Hd([],n,e.dtype,a),i=la(e,0);return t.forEach((o,l)=>{s.setItem(o,i[l])}),s}function pse(e,t,n){let a=0,r=t.map(u=>(a+=u,a));if(a!==e.shape[0])throw new Error(`Expected sum of lengths to be equal to tensor.shape[0], but sum of lengths is - ${a}, and tensor's shape is: ${e.shape}`);let s=e.shape.slice(1),i=T2(s,n),o=a===0?0:e.size/a,l=W(()=>{let u=[];e=H(e,[1,a,o]);for(let p=0;p{switch(e.op){case"If":case"StatelessIf":{let a=I("thenBranch",e,t,n),r=I("elseBranch",e,t,n),s=I("cond",e,t,n),i=I("args",e,t,n);return(await s.data())[0]?n.functionMap[a].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap):n.functionMap[r].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap)}case"While":case"StatelessWhile":{let a=I("body",e,t,n),r=I("cond",e,t,n),s=I("args",e,t,n),i=await n.functionMap[r].executeFunctionAsync(s,n.tensorArrayMap,n.tensorListMap),o=s.map(u=>u.id),l=await i[0].data();i.forEach(u=>{!u.kept&&o.indexOf(u.id)===-1&&u.dispose()});let d=s;for(;l[0];){let u=d;d=await n.functionMap[a].executeFunctionAsync(d,n.tensorArrayMap,n.tensorListMap);let p=d.map(h=>h.id);u.forEach(h=>{!h.kept&&o.indexOf(h.id)===-1&&p.indexOf(h.id)===-1&&h.dispose()});let c=await n.functionMap[r].executeFunctionAsync(d,n.tensorArrayMap,n.tensorListMap);l=await c[0].data(),c.forEach(h=>{!h.kept&&o.indexOf(h.id)===-1&&p.indexOf(h.id)===-1&&h.dispose()})}return d}case"LoopCond":{let a=I("pred",e,t,n);return[cr(a)]}case"Switch":{let a=I("pred",e,t,n),r=I("data",e,t,n);return r.kept||(r=cr(r)),(await a.data())[0]?[void 0,r]:[r,void 0]}case"Merge":{let a=e.inputNames.find(r=>mn(r,t,n)!==void 0);if(a){let r=mn(a,t,n);return[cr(r)]}return}case"Enter":{let a=I("frameName",e,t,n),r=I("tensor",e,t,n);return n.enterFrame(a),[cr(r)]}case"Exit":{let a=I("tensor",e,t,n);return n.exitFrame(),[cr(a)]}case"NextIteration":{let a=I("tensor",e,t,n);return n.nextIteration(),[cr(a)]}case"TensorArrayV3":{let a=I("size",e,t,n),r=I("dtype",e,t,n),s=I("elementShape",e,t,n),i=I("dynamicSize",e,t,n),o=I("clearAfterRead",e,t,n),l=I("identicalElementShapes",e,t,n),d=I("name",e,t,n),u=new ise(d,r,a,s,l,i,o);return n.addTensorArray(u),[u.idTensor,Se(1)]}case"TensorArrayWriteV3":{let a=I("tensorArrayId",e,t,n),r=I("index",e,t,n),s=I("tensor",e,t,n),i=n.getTensorArray(a.id);return i.write(r,s),[i.idTensor]}case"TensorArrayReadV3":{let a=I("tensorArrayId",e,t,n),r=I("index",e,t,n);return[n.getTensorArray(a.id).read(r)]}case"TensorArrayGatherV3":{let a=I("tensorArrayId",e,t,n),r=I("indices",e,t,n),s=I("dtype",e,t,n);return[n.getTensorArray(a.id).gather(r,s)]}case"TensorArrayScatterV3":{let a=I("tensorArrayId",e,t,n),r=I("indices",e,t,n),s=I("tensor",e,t,n),i=n.getTensorArray(a.id);return i.scatter(r,s),[i.idTensor]}case"TensorArrayConcatV3":{let a=I("tensorArrayId",e,t,n),r=n.getTensorArray(a.id),s=I("dtype",e,t,n);return[r.concat(s)]}case"TensorArraySplitV3":{let a=I("tensorArrayId",e,t,n),r=I("tensor",e,t,n),s=I("lengths",e,t,n),i=n.getTensorArray(a.id);return i.split(s,r),[i.idTensor]}case"TensorArraySizeV3":{let a=I("tensorArrayId",e,t,n),r=n.getTensorArray(a.id);return[Se(r.size(),"int32")]}case"TensorArrayCloseV3":{let a=I("tensorArrayId",e,t,n),r=n.getTensorArray(a.id);return r.clearAndClose(),[r.idTensor]}case"TensorListSetItem":{let a=I("tensorListId",e,t,n),r=I("index",e,t,n),s=I("tensor",e,t,n),i=n.getTensorList(a.id);return i.setItem(r,s),[i.idTensor]}case"TensorListGetItem":{let a=I("tensorListId",e,t,n),r=I("index",e,t,n),s=I("elementShape",e,t,n),i=I("elementDType",e,t,n);return[n.getTensorList(a.id).getItem(r,s,i)]}case"TensorListScatterV2":case"TensorListScatter":{let a=I("indices",e,t,n),r=I("tensor",e,t,n),s=I("elementShape",e,t,n),i=I("numElements",e,t,n),o=use(r,a,s,i);return n.addTensorList(o),[o.idTensor]}case"TensorListReserve":case"EmptyTensorList":{let a=I("elementShape",e,t,n),r=I("elementDType",e,t,n),s;e.op==="TensorListReserve"?s="numElements":s="maxNumElements";let i=I(s,e,t,n),o=lse(a,r,i);return n.addTensorList(o),[o.idTensor]}case"TensorListGather":{let a=I("tensorListId",e,t,n),r=I("indices",e,t,n),s=I("elementShape",e,t,n),i=I("elementDType",e,t,n);return[n.getTensorList(a.id).gather(r,i,s)]}case"TensorListStack":{let a=I("tensorListId",e,t,n),r=I("elementShape",e,t,n),s=I("elementDType",e,t,n),i=I("numElements",e,t,n);return[n.getTensorList(a.id).stack(r,s,i)]}case"TensorListFromTensor":{let a=I("tensor",e,t,n),r=I("elementShape",e,t,n),s=I("elementDType",e,t,n),i=ose(a,r,s);return n.addTensorList(i),[i.idTensor]}case"TensorListConcat":{let a=I("tensorListId",e,t,n),r=n.getTensorList(a.id),s=I("dtype",e,t,n),i=I("elementShape",e,t,n);return[r.concat(s,i)]}case"TensorListPushBack":{let a=I("tensorListId",e,t,n),r=I("tensor",e,t,n),s=n.getTensorList(a.id);return s.pushBack(r),[s.idTensor]}case"TensorListPopBack":{let a=I("tensorListId",e,t,n),r=I("elementShape",e,t,n),s=I("elementDType",e,t,n);return[n.getTensorList(a.id).popBack(r,s)]}case"TensorListSplit":{let a=I("tensor",e,t,n),r=I("elementShape",e,t,n),s=I("lengths",e,t,n),i=dse(a,s,r);return n.addTensorList(i),[i.idTensor]}default:throw TypeError(`Node type ${e.op} is not implemented`)}};function R8(e,t,n){let[a,r]=I("fusedOps",e,t,n),s=a==="biasadd",i=r==="prelu",o=a==="fusedbatchnorm",l=I("numArgs",e,t,n);if(s){if(i&&l!==2)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!i&&l!==1)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.")}if(o)throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported");let d=I("strides",e,t,n),u=u0(e,t,n),p=I("dataFormat",e,t,n).toUpperCase(),c=I("dilations",e,t,n),[h,m]=I("args",e,t,n),f=I("leakyreluAlpha",e,t,n);return{stride:d,pad:u,dataFormat:p,dilations:c,biasArg:h,preluArg:m,activationFunc:r,leakyreluAlpha:f}}var cse=(e,t,n)=>{switch(e.op){case"Conv1D":{let a=I("stride",e,t,n),r=I("pad",e,t,n),s=I("dataFormat",e,t,n).toUpperCase(),i=I("dilation",e,t,n);return[bc(I("x",e,t,n),I("filter",e,t,n),a,r,s,i)]}case"Conv2D":{let a=I("strides",e,t,n),r=u0(e,t,n),s=I("dataFormat",e,t,n).toUpperCase(),i=I("dilations",e,t,n);return[nr(I("x",e,t,n),I("filter",e,t,n),[a[1],a[2]],r,s,[i[1],i[2]])]}case"_FusedConv2D":{let{stride:a,pad:r,dataFormat:s,dilations:i,biasArg:o,preluArg:l,activationFunc:d,leakyreluAlpha:u}=R8(e,t,n);return[zr.conv2d({x:I("x",e,t,n),filter:I("filter",e,t,n),strides:[a[1],a[2]],pad:r,dataFormat:s,dilations:[i[1],i[2]],bias:o,activation:d,preluActivationWeights:l,leakyreluAlpha:u})]}case"FusedDepthwiseConv2dNative":{let{stride:a,pad:r,dataFormat:s,dilations:i,biasArg:o,preluArg:l,activationFunc:d,leakyreluAlpha:u}=R8(e,t,n);return[zr.depthwiseConv2d({x:I("x",e,t,n),filter:I("filter",e,t,n),strides:[a[1],a[2]],pad:r,dataFormat:s,dilations:[i[1],i[2]],bias:o,activation:d,preluActivationWeights:l,leakyreluAlpha:u})]}case"Conv2DBackpropInput":case"Conv2dTranspose":{let a=I("outputShape",e,t,n),r=I("strides",e,t,n),s=u0(e,t,n);return[vc(I("x",e,t,n),I("filter",e,t,n),a,[r[1],r[2]],s)]}case"DepthwiseConv2dNative":case"DepthwiseConv2d":{let a=I("strides",e,t,n),r=u0(e,t,n),s=I("dilations",e,t,n),i=I("dataFormat",e,t,n).toUpperCase();return[hl(I("input",e,t,n),I("filter",e,t,n),[a[1],a[2]],r,i,[s[1],s[2]])]}case"Conv3D":{let a=I("strides",e,t,n),r=I("pad",e,t,n),s=I("dataFormat",e,t,n).toUpperCase(),i=I("dilations",e,t,n);return[pA(I("x",e,t,n),I("filter",e,t,n),[a[1],a[2],a[3]],r,s,[i[1],i[2],i[3]])]}case"AvgPool":{let a=I("strides",e,t,n),r=I("pad",e,t,n),s=I("kernelSize",e,t,n);return[Gu(I("x",e,t,n),[s[1],s[2]],[a[1],a[2]],r)]}case"MaxPool":{let a=I("strides",e,t,n),r=I("pad",e,t,n),s=I("kernelSize",e,t,n);return[Yu(I("x",e,t,n),[s[1],s[2]],[a[1],a[2]],r)]}case"MaxPoolWithArgmax":{let a=I("strides",e,t,n),r=I("pad",e,t,n),s=I("kernelSize",e,t,n),i=I("includeBatchInIndex",e,t,n),{result:o,indexes:l}=Xb(I("x",e,t,n),[s[1],s[2]],[a[1],a[2]],r,i);return[o,l]}case"AvgPool3D":{let a=I("strides",e,t,n),r=I("pad",e,t,n),s=I("kernelSize",e,t,n);return[oA(I("x",e,t,n),[s[1],s[2],s[3]],[a[1],a[2],a[3]],r)]}case"MaxPool3D":{let a=I("strides",e,t,n),r=I("pad",e,t,n),s=I("kernelSize",e,t,n);return[kA(I("x",e,t,n),[s[1],s[2],s[3]],[a[1],a[2],a[3]],r)]}case"Dilation2D":{let a=I("strides",e,t,n),r=I("pad",e,t,n),s=I("dilations",e,t,n),i=a[1],o=a[2],l=s[1],d=s[2];return[hA(I("x",e,t,n),I("filter",e,t,n),[i,o],r,[l,d],"NHWC")]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},hse=(e,t,n)=>{switch(e.op){case"Fill":{let a=I("shape",e,t,n),r=I("dtype",e,t,n),s=I("value",e,t,n);return[ml(a,s,r)]}case"LinSpace":{let a=I("start",e,t,n),r=I("stop",e,t,n),s=I("num",e,t,n);return[Bb(a,r,s)]}case"Multinomial":{let a=I("logits",e,t,n),r=I("numSamples",e,t,n),s=I("seed",e,t,n);return[Kb(a,r,s)]}case"OneHot":{let a=I("indices",e,t,n),r=I("depth",e,t,n),s=I("onValue",e,t,n),i=I("offValue",e,t,n);return[ol(a,r,s,i)]}case"Ones":return[$n(I("shape",e,t,n),I("dtype",e,t,n))];case"OnesLike":return[Dn(I("x",e,t,n))];case"RandomUniform":return[xl(I("shape",e,t,n),I("minval",e,t,n),I("maxval",e,t,n),I("dtype",e,t,n))];case"Range":{let a=I("start",e,t,n),r=I("stop",e,t,n),s=I("step",e,t,n);return[bl(a,r,s,I("dtype",e,t,n))]}case"TruncatedNormal":{let a=I("shape",e,t,n),r=I("mean",e,t,n),s=I("stdDev",e,t,n),i=I("seed",e,t,n);return[Vc(a,r,s,I("dtype",e,t,n),i)]}case"Zeros":return[Ct(I("shape",e,t,n),I("dtype",e,t,n))];case"ZerosLike":return[Ue(I("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function E2(e,t,n){let a=I("boxes",e,t,n),r=I("scores",e,t,n),s=I("maxOutputSize",e,t,n),i=I("iouThreshold",e,t,n),o=I("scoreThreshold",e,t,n),l=I("softNmsSigma",e,t,n);return{boxes:a,scores:r,maxOutputSize:s,iouThreshold:i,scoreThreshold:o,softNmsSigma:l}}var fse=async(e,t,n)=>{switch(e.op){case"NonMaxSuppressionV5":{let{boxes:a,scores:r,maxOutputSize:s,iouThreshold:i,scoreThreshold:o,softNmsSigma:l}=E2(e,t,n),d=await Ye.nonMaxSuppressionWithScoreAsync(a,r,s,i,o,l);return[d.selectedIndices,d.selectedScores]}case"NonMaxSuppressionV4":{let{boxes:a,scores:r,maxOutputSize:s,iouThreshold:i,scoreThreshold:o}=E2(e,t,n),l=I("padToMaxOutputSize",e,t,n),d=await Ye.nonMaxSuppressionPaddedAsync(a,r,s,i,o,l);return[d.selectedIndices,d.validOutputs]}case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":{let{boxes:a,scores:r,maxOutputSize:s,iouThreshold:i,scoreThreshold:o}=E2(e,t,n);return[await Ye.nonMaxSuppressionAsync(a,r,s,i,o)]}case"Where":{let a=fe(I("condition",e,t,n),"bool"),r=[await zA(a)];return a.dispose(),r}case"ListDiff":return Jb(I("x",e,t,n),I("y",e,t,n));default:throw TypeError(`Node type ${e.op} is not implemented`)}},mse=(e,t,n)=>{switch(e.op){case"TopKV2":{let a=I("x",e,t,n),r=I("k",e,t,n),s=I("sorted",e,t,n),i=DA(a,r,s);return[i.values,i.indices]}case"Unique":{let a=I("x",e,t,n),r=jc(a);return[r.values,r.indices]}case"UniqueV2":{let a=I("x",e,t,n),r=I("axis",e,t,n),s=jc(a,r);return[s.values,s.indices]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},Ase=(e,t,n)=>{switch(e.op){case"Const":return t[e.name];case"PlaceholderWithDefault":let a=I("default",e,t,n);return[mn(e.name,t,n)||a];case"Placeholder":return[mn(e.name,t,n)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":{let d=I("x",e,t,n);return[cr(d)]}case"IdentityN":return I("x",e,t,n).map(d=>cr(d));case"Snapshot":let r=I("x",e,t,n);return[cr(r)];case"Shape":return[Tt(I("x",e,t,n).shape,"int32")];case"ShapeN":return I("x",e,t,n).map(d=>Tt(d.shape));case"Size":return[Se(I("x",e,t,n).size,"int32")];case"Rank":return[Se(I("x",e,t,n).rank,"int32")];case"NoOp":return[Se(1)];case"Print":let s=I("x",e,t,n),i=I("data",e,t,n),o=I("message",e,t,n),l=I("summarize",e,t,n);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(o);for(let d=0;de.dispose()),this.tensorMap.clear(),this.handle.dispose()}size(){return this.tensorMap.size}tensorSize(){return Se(this.size(),"int32")}async import(e,t){this.checkKeyAndValueTensor(e,t);let n=await e.data();return this.tensorMap.forEach(a=>a.dispose()),this.tensorMap.clear(),W(()=>{let a=la(t),r=n.length,s=a.length;k.assert(r===s,()=>`The number of elements doesn't match, keys has ${r} elements, the values has ${s} elements.`);for(let i=0;i{let a=[];for(let r=0;r{switch(e.op){case"HashTable":case"HashTableV2":{let r=I("keyDType",e,t,n),s=I("valueDType",e,t,n),i=new yse(r,s);return a.addHashTable(e.name,i),[i.handle]}case"LookupTableImport":case"LookupTableImportV2":{let r=I("tableHandle",e,t,n,a),s=I("keys",e,t,n),i=I("values",e,t,n);return[await a.getHashTableById(r.id).import(s,i)]}case"LookupTableFind":case"LookupTableFindV2":{let r=I("tableHandle",e,t,n,a),s=I("keys",e,t,n),i=I("defaultValue",e,t,n);return[await a.getHashTableById(r.id).find(s,i)]}case"LookupTableSize":case"LookupTableSizeV2":{let r=I("tableHandle",e,t,n,a);return[a.getHashTableById(r.id).tensorSize()]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},xse=(e,t,n)=>{switch(e.op){case"ResizeBilinear":{let a=I("images",e,t,n),r=I("size",e,t,n),s=I("alignCorners",e,t,n),i=I("halfPixelCenters",e,t,n);return[Ye.resizeBilinear(a,[r[0],r[1]],s,i)]}case"ResizeNearestNeighbor":{let a=I("images",e,t,n),r=I("size",e,t,n),s=I("alignCorners",e,t,n),i=I("halfPixelCenters",e,t,n);return[Ye.resizeNearestNeighbor(a,[r[0],r[1]],s,i)]}case"CropAndResize":{let a=I("image",e,t,n),r=I("boxes",e,t,n),s=I("boxInd",e,t,n),i=I("cropSize",e,t,n),o=I("method",e,t,n),l=I("extrapolationValue",e,t,n);return[Ye.cropAndResize(a,r,s,i,o,l)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},bse=(e,t,n)=>{switch(e.op){case"Equal":return[Mr(I("a",e,t,n),I("b",e,t,n))];case"NotEqual":return[mi(I("a",e,t,n),I("b",e,t,n))];case"Greater":return[Mn(I("a",e,t,n),I("b",e,t,n))];case"GreaterEqual":return[$r(I("a",e,t,n),I("b",e,t,n))];case"Less":return[Sc(I("a",e,t,n),I("b",e,t,n))];case"LessEqual":return[Dr(I("a",e,t,n),I("b",e,t,n))];case"LogicalAnd":return[oa(I("a",e,t,n),I("b",e,t,n))];case"LogicalNot":return[Zu(I("a",e,t,n))];case"LogicalOr":return[Cc(I("a",e,t,n),I("b",e,t,n))];case"Select":case"SelectV2":return[nn(I("condition",e,t,n),I("a",e,t,n),I("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},vse=(e,t,n)=>{switch(e.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[Be(I("a",e,t,n),I("b",e,t,n),I("transposeA",e,t,n),I("transposeB",e,t,n))];case"Einsum":return[Pb(I("equation",e,t,n),...I("tensors",e,t,n))];case"Transpose":return[Ze(I("x",e,t,n),I("perm",e,t,n))];case"_FusedMatMul":let[a,r]=I("fusedOps",e,t,n),s=a==="biasadd",i=r==="prelu",o=I("numArgs",e,t,n),l=I("leakyreluAlpha",e,t,n);if(s){if(i&&o!==2)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!i&&o!==1)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}let[d,u]=I("args",e,t,n);return[zr.matMul({a:I("a",e,t,n),b:I("b",e,t,n),transposeA:I("transposeA",e,t,n),transposeB:I("transposeB",e,t,n),bias:d,activation:r,preluActivationWeights:u,leakyreluAlpha:l})];default:throw TypeError(`Node type ${e.op} is not implemented`)}},wse=(e,t,n)=>{switch(e.op){case"FusedBatchNorm":case"FusedBatchNormV2":return[pi(I("x",e,t,n),I("mean",e,t,n),I("variance",e,t,n),I("offset",e,t,n),I("scale",e,t,n),I("epsilon",e,t,n))];case"FusedBatchNormV3":return[pi(I("x",e,t,n),I("mean",e,t,n),I("variance",e,t,n),I("offset",e,t,n),I("scale",e,t,n),I("epsilon",e,t,n))];case"LRN":return[xA(I("x",e,t,n),I("radius",e,t,n),I("bias",e,t,n),I("alpha",e,t,n),I("beta",e,t,n))];case"Softmax":return[nd(I("x",e,t,n))];case"LogSoftmax":return[Ec(I("x",e,t,n))];case"SparseToDense":return[_A(I("sparseIndices",e,t,n),I("outputShape",e,t,n),I("sparseValues",e,t,n),I("defaultValue",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},kse=(e,t,n)=>{switch(e.op){case"Max":{let i=I("axis",e,t,n),o=I("keepDims",e,t,n);return[Xn(I("x",e,t,n),i,o)]}case"Mean":{let i=I("axis",e,t,n),o=I("keepDims",e,t,n);return[wt(I("x",e,t,n),i,o)]}case"Min":{let i=I("axis",e,t,n),o=I("keepDims",e,t,n);return[yl(I("x",e,t,n),i,o)]}case"Sum":{let i=I("axis",e,t,n),o=I("keepDims",e,t,n);return[ke(I("x",e,t,n),i,o)]}case"All":{let i=I("axis",e,t,n),o=I("keepDims",e,t,n);return[gc(I("x",e,t,n),i,o)]}case"Any":{let i=I("axis",e,t,n),o=I("keepDims",e,t,n);return[ju(I("x",e,t,n),i,o)]}case"ArgMax":{let i=I("axis",e,t,n);return[Uu(I("x",e,t,n),i)]}case"ArgMin":{let i=I("axis",e,t,n);return[Qm(I("x",e,t,n),i)]}case"Prod":{let i=I("axis",e,t,n),o=I("keepDims",e,t,n);return[Mc(I("x",e,t,n),i,o)]}case"Cumsum":{let i=I("axis",e,t,n),o=I("exclusive",e,t,n),l=I("reverse",e,t,n);return[kc(I("x",e,t,n),i,o,l)]}case"Bincount":let a=I("x",e,t,n),r=I("weights",e,t,n),s=I("size",e,t,n);return[lA(a,r,s)];case"DenseBincount":{let i=I("x",e,t,n),o=I("weights",e,t,n),l=I("size",e,t,n),d=I("binaryOutput",e,t,n);return[zb(i,o,l,d)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},Ise=(e,t,n)=>{switch(e.op){case"ConcatV2":case"Concat":{let a=I("n",e,t,n),r=I("axis",e,t,n),s=I("tensors",e,t,n);return s=s.slice(0,a),[ot(s,r)]}case"Gather":{let a=I("x",e,t,n),r=I("indices",e,t,n);return[ci(a,fe(r,"int32"),0)]}case"GatherV2":{let a=I("axis",e,t,n),r=I("batchDims",e,t,n),s=I("x",e,t,n),i=I("indices",e,t,n);return[ci(s,fe(i,"int32"),a,r)]}case"Reverse":{let a=I("dims",e,t,n),r=[];for(let i=0;i{let a=I("axis",e,t,n),r=I("tensors",e,t,n),s=r[0].shape,i=Or(r[0]).shape,o=r.map(l=>{let d=k.arraysEqual(l.shape,s);if(!d&&!k.arraysEqual(Or(l).shape,i))throw new Error("the input tensors shape does not match");return d?l:H(l,s)});return[zn(o,a)]});case"Unpack":{let a=I("axis",e,t,n),r=I("tensor",e,t,n);return la(r,a)}case"Tile":{let a=I("reps",e,t,n);return[Fr(I("x",e,t,n),a)]}case"Split":case"SplitV":{let a=I("axis",e,t,n),r=I("numOrSizeSplits",e,t,n),s=I("x",e,t,n);return an(s,r,a)}case"ScatterNd":{let a=I("indices",e,t,n),r=I("values",e,t,n),s=I("shape",e,t,n);return[n3(a,r,s)]}case"GatherNd":{let a=I("x",e,t,n),r=I("indices",e,t,n);return[a3(a,r)]}case"SparseToDense":{let a=I("sparseIndices",e,t,n),r=I("outputShape",e,t,n),s=I("sparseValues",e,t,n),i=I("defaultValue",e,t,n);return[_A(a,s,r,s.dtype===i.dtype?i:fe(i,s.dtype))]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},Sse=(e,t,n)=>{switch(e.op){case"SparseReshape":{let{outputIndices:a,outputShape:r}=g3.sparseReshape(I("inputIndices",e,t,n),I("inputShape",e,t,n),I("newShape",e,t,n));return[a,r]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},Nse=(e,t,n)=>{switch(e.op){case"FFT":return[ad(I("x",e,t,n))];case"IFFT":return[vl(I("x",e,t,n))];case"RFFT":return[rd(I("x",e,t,n))];case"IRFFT":return[Wc(I("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},Tse=(e,t,n)=>{switch(e.op){case"Cast":return[fe(I("x",e,t,n),I("dtype",e,t,n))];case"ExpandDims":{let a=I("axis",e,t,n);return[ln(I("x",e,t,n),a)]}case"Squeeze":{let a=I("axis",e,t,n);return[Or(I("x",e,t,n),a)]}case"Reshape":return[H(I("x",e,t,n),I("shape",e,t,n))];case"MirrorPad":return[IA(I("x",e,t,n),I("padding",e,t,n),I("mode",e,t,n))];case"PadV2":case"Pad":return[ar(I("x",e,t,n),I("padding",e,t,n),I("constantValue",e,t,n))];case"SpaceToBatchND":{let a=I("blockShape",e,t,n),r=I("paddings",e,t,n);return[Ju(I("x",e,t,n),a,r)]}case"BatchToSpaceND":{let a=I("blockShape",e,t,n),r=I("crops",e,t,n);return[qu(I("x",e,t,n),a,r)]}case"DepthToSpace":{let a=I("blockSize",e,t,n),r=I("dataFormat",e,t,n).toUpperCase();return[cA(I("x",e,t,n),a,r)]}case"BroadcastTo":return[pl(I("x",e,t,n),I("shape",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function M8(e,t,n,a){let r=((s,i,o)=>{switch(s.category){case"arithmetic":return W(()=>rse(s,i,o));case"basic_math":return W(()=>sse(s,i,o));case"control":return pse(s,i,o);case"convolution":return W(()=>cse(s,i,o));case"creation":return W(()=>hse(s,i,o));case"dynamic":return fse(s,i,o);case"evaluation":return W(()=>mse(s,i,o));case"image":return W(()=>xse(s,i,o));case"graph":return W(()=>Ase(s,i,o));case"logical":return W(()=>bse(s,i,o));case"matrices":return W(()=>vse(s,i,o));case"normalization":return W(()=>wse(s,i,o));case"reduction":return W(()=>kse(s,i,o));case"slice_join":return W(()=>Ise(s,i,o));case"sparse":return W(()=>Sse(s,i,o));case"spectral":return W(()=>Nse(s,i,o));case"transformation":return W(()=>Tse(s,i,o));case"hash_table":return gse(s,i,o,a);case"custom":let l=o8(s.op);if(l&&l.customExecutor)return l.customExecutor(new ase(s,i,o));throw TypeError(`Custom op ${s.op} is not registered.`);default:throw TypeError(`Unknown op '${s.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 k.isPromise(r)?r.then(s=>[].concat(s)):[].concat(r)}var F8=class{constructor(e={},t={},n={},a={}){this.weightMap=e,this.tensorArrayMap=t,this.tensorListMap=n,this.functionMap=a,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(){let e=[];for(let t=0;tt.id===0&&t.iterationId===0?"":`${t.frameName}-${t.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)this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift();else throw new Error("Cannot exit frame, the context is empty")}nextIteration(){if(this.contexts&&this.contexts.length>0){this.contexts=this.contexts.slice(),this.lastId++;let 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))}else throw new Error("Cannot increase frame iteration, the context is empty")}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(let t in this.tensorArrayMap)this.tensorArrayMap[t].clearAndClose(e);for(let t in this.tensorListMap)this.tensorListMap[t].clearAndClose(e)}};function D8(e,t,n,a){let r=new Set,s=[],i=null,o=null,l=new Set,d=Object.keys(e).map(c=>Ln(c)[0]),u=[];a!=null&&(u=a.map(c=>Ln(c.name)[0]));let p=[...t];for(;p.length>0;){let c=p.pop();if(($8(c)||Ese(c)||Cse(c))&&i==null&&(i=c,o=i.children.map(h=>h.name).filter(h=>r.has(h))),r.add(c.name),n[c.name]==null&&d.indexOf(c.name)===-1&&u.indexOf(c.name)===-1){if(c.inputs.length===0){s.push(c.name);continue}c.inputs.forEach(h=>{l.has(h.name)||(l.add(h.name),p.push(h))})}}return{inputs:e,outputs:t,usedNodes:r,missingInputs:s,dynamicNode:i,syncInputs:o}}function Rse(e,t,n){let{usedNodes:a,inputs:r}=n,s=[],i=Object.keys(r).map(u=>Ln(u)[0]).map(u=>e.nodes[u]),o=e.initNodes;i.forEach(u=>{a.has(u.name)&&s.push(u)}),e.weights.forEach(u=>{a.has(u.name)&&s.push(u)}),o!=null&&o.forEach(u=>{a.has(u.name)&&s.push(u)});let l=new Set,d=[];for(;s.length>0;){let u=s.pop();l.add(u.name),t[u.name]||d.push(u),u.children.forEach(p=>{!l.has(p.name)&&a.has(p.name)&&p.inputs.every(c=>l.has(c.name))&&s.push(p)})}return d}var Mse=["Switch","Merge","Enter","Exit","NextIteration","StatelessIf","StatelessWhile","if","While"],Fse=["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"],$se=["HashTable","HashTableV2","LookupTableImport","LookupTableImportV2","LookupTableFind","LookupTableFindV2","LookupTableSize","LookupTableSizeV2"];function $8(e){return Mse.indexOf(e.op)>=0}function Ese(e){return Fse.indexOf(e.op)>=0}function Cse(e){return $se.indexOf(e.op)>=0}var C2=class{constructor(e,t){this.graph=e,this.parent=t,this.compiledMap=new Map,this._weightMap={},this.SEPERATOR=",",this._functions={},this._functionExecutorMap={},this._outputs=e.outputs,this._inputs=e.inputs,this._initNodes=e.initNodes,this._signature=e.signature,this._functions=e.functions,e.functions!=null&&Object.keys(e.functions).forEach(n=>{this._functionExecutorMap[n]=new C2(e.functions[n],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){let t=Object.keys(e).map(n=>e[n].map(a=>a.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=>{let 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){let n=e.map(r=>r.name).sort(),a=t.map(r=>r.name).sort();return n.join(this.SEPERATOR)+"--"+a.join(this.SEPERATOR)}compile(e,t){let n=D8(e,t,this.weightMap,this._initNodes),{missingInputs:a,dynamicNode:r,syncInputs:s}=n;if(r!=null)throw new Error(`This execution contains the node '${r.name}', which has the dynamic op '${r.op}'. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs [${s}]`);if(a.length>0){let i=t.map(l=>l.name),o=Object.keys(e);throw new Error(`Cannot compute the outputs [${i}] from the provided inputs [${o}]. Missing the following inputs: [${a}]`)}return Rse(this.graph,this.weightMap,n)}execute(e,t){e=this.mapInputs(e);let n=Object.keys(e).sort();this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t);let a=n.map(u=>this.graph.nodes[Ln(u)[0]]),r=t.map(u=>Ln(u)[0]),s=r.map(u=>this.graph.nodes[u]);s.length===0&&(s=this._outputs);let i=this.getCompilationKey(a,s),o=this.compiledMap.get(i);o==null&&(o=this.compile(e,s),this.compiledMap.set(i,o));let l={},d={};return W(()=>{let u=new F8(this.weightMap,l,d,this.functionExecutorMap),p=Object.assign({},this.weightMap);Object.keys(e).forEach(m=>{let[f,A]=Ln(m),y=[];y[A]=e[m],p[f]=y});let c=this.getFrozenTensorIds(p),h={};for(let m=0;mmn(m,p,u))})}getFrozenTensorIds(e){let t=[].concat.apply([],Object.keys(e).map(n=>e[n]).map(n=>n.map(a=>a.id)));return new Set(t)}checkTensorForDisposal(e,t,n,a,r,s,i){t.category==="control"||s.indexOf(e)!==-1||(n[e].forEach(o=>{o!=null&&(i[o.id]=(i[o.id]||0)+t.children.length)}),t.inputs.forEach(o=>{if(o.category!=="control"){let l=Pre(o.name,n,a);l!=null&&l.forEach(d=>{if(d&&!d.kept&&!r.has(d.id)){let u=i[d.id];u===1?(d.dispose(),delete i[d.id]):u!=null&&i[d.id]--}})}}))}async executeAsync(e,t){return this._executeAsync(e,t)}async _executeAsync(e,t,n=!1,a={},r={}){n||(e=this.mapInputs(e),this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t));let s=new F8(this.weightMap,a,r,this.functionExecutorMap),i=await this.executeWithControlFlow(e,s,t,n),o=t.map(p=>mn(p,i,s)),l=o.map(p=>p.id),d=Object.keys(e).map(p=>e[p].id),u=new Set([...l,...d,...this.weightIds]);return Object.keys(i).forEach(p=>{i[p].forEach(c=>{c&&!c.kept&&!c.isDisposed&&!u.has(c.id)&&c.dispose()})}),this.parent==null&&s.dispose(u),o}async executeFunctionAsync(e,t,n){let a=e.reduce((r,s,i)=>(r[this.inputs[i].name]=s,r),{});return this._executeAsync(a,this.outputNodes,!0,t,n)}async executeWithControlFlow(e,t,n,a){let r=Object.keys(e),s=r.map(g=>this.graph.nodes[Ln(g)[0]]),i=n.map(g=>Ln(g)[0]),o=i.map(g=>this.graph.nodes[g]);o.length===0&&(o=this._outputs);let{usedNodes:l,missingInputs:d,dynamicNode:u,syncInputs:p}=D8(e,o,this.weightMap,this._initNodes),c=[...s,...this.graph.weights,...this._initNodes||[]].map(g=>({node:g,contexts:t.currentContext})),h=Object.assign({},this.weightMap);Object.keys(e).forEach(g=>{let[x,w]=Ln(g),b=[];b[w]=e[g],h[x]=b});let m={},f=this.getFrozenTensorIds(h),A={};for(;c.length>0;){let g=this.processStack(s,c,t,h,A,f,i,m,l);await Promise.all(g)}u==null&&!a&&console.warn("This model execution did not contain any nodes with control flow or dynamic output shapes. You can use model.execute() instead.");let y=o.filter(g=>!$8(g)&&!mn(g.name,h,t)).map(g=>g.name);if(y.length>0){let g="";throw u!=null&&(g=`Alternatively, to avoid the dynamic ops, use model.execute() and specify the inputs [${p}]`),new Error(`Cannot compute the outputs [${y}] from the provided inputs [${r}]. Consider providing the following inputs: [${d}]. ${g}`)}return h}processStack(e,t,n,a,r,s,i,o,l){let d=[];for(;t.length>0;){let u=t.pop();n.currentContext=u.contexts;let p="";if(u.node.op==="Enter"&&I("isConstant",u.node,a,n)&&([p]=pr(u.node.name,n)),a[u.node.name]==null){let c=M8(u.node,a,n,this._resourceManager);p||([p]=pr(u.node.name,n));let h=n.currentContext;k.isPromise(c)?d.push(c.then(m=>(a[p]=m,n.currentContext=h,this.checkTensorForDisposal(p,u.node,a,n,s,i,o),this.processChildNodes(u.node,t,n,a,r,l),m))):(a[p]=c,this.checkTensorForDisposal(p,u.node,a,n,s,i,o),this.processChildNodes(u.node,t,n,a,r,l))}else this.processChildNodes(u.node,t,n,a,r,l)}return d}processChildNodes(e,t,n,a,r,s){e.children.forEach(i=>{let[o]=pr(i.name,n);r[o]||!s.has(i.name)||(i.op==="Merge"?i.inputNames.some(l=>!!mn(l,a,n))&&(r[o]=!0,t.push({contexts:n.currentContext,node:i})):i.inputNames.every(l=>!!mn(l,a,n))&&(r[o]=!0,t.push({contexts:n.currentContext,node:i})))})}dispose(){Object.keys(this.weightMap).forEach(e=>this.weightMap[e].forEach(t=>t.dispose()))}checkInputShapeAndType(e){Object.keys(e).forEach(t=>{let n=e[t],[a]=Ln(t),r=this.graph.nodes[a];if(r.attrParams.shape&&r.attrParams.shape.value){let s=r.attrParams.shape.value,i=s.length===n.shape.length&&n.shape.every((o,l)=>s[l]===-1||s[l]===o);k.assert(i,()=>`The shape of dict['${r.name}'] provided in model.execute(dict) must be [${s}], but was [${n.shape}]`)}r.attrParams.dtype&&r.attrParams.dtype.value&&k.assert(n.dtype===r.attrParams.dtype.value,()=>`The dtype of dict['${r.name}'] provided in model.execute(dict) must be ${r.attrParams.dtype.value}, but was ${n.dtype}`)})}mapInputs(e){let t={};for(let n in e)if(this._signature!=null&&this._signature.inputs!=null&&this._signature.inputs[n]!=null){let a=this._signature.inputs[n];t[a.name]=e[n]}else t[n]=e[n];return t}checkInputs(e){let t=Object.keys(e).filter(n=>{let[a]=Ln(n);return this.graph.nodes[a]==null});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(t=>this._signature!=null&&this._signature.outputs!=null&&this._signature.outputs[t]!=null?this._signature.outputs[t].name:t,{})}checkOutputs(e){e.forEach(t=>{let[n]=Ln(t);if(!this.graph.nodes[n])throw new Error(`The output '${t}' is not found in the graph`)})}},Dse=class{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(let e in this.hashTableMap)this.hashTableMap[e].clearAndClose(),delete this.hashTableMap[e];for(let e in this.hashTableNameToHandle)this.hashTableNameToHandle[e].dispose(),delete this.hashTableNameToHandle[e]}},Ose="?tfjs-format=file",zse="model.json",O8=class{constructor(e,t={}){this.modelUrl=e,this.loadOptions=t,this.version="n/a",t==null&&(this.loadOptions={}),this.resourceManager=new Dse}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}findIOHandler(){let e=this.modelUrl;if(e.load!=null)this.handler=e;else if(this.loadOptions.requestInit!=null)this.handler=vn.browserHTTPRequest(e,this.loadOptions);else{let t=vn.getLoadHandlers(e,this.loadOptions);if(t.length===0)t.push(vn.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]}}async load(){if(this.findIOHandler(),this.handler.load==null)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");let e=await this.handler.load();return this.loadSync(e)}loadSync(e){this.artifacts=e;let t=this.artifacts.modelTopology,n;this.artifacts.userDefinedMetadata!=null&&this.artifacts.userDefinedMetadata.signature!=null?n=this.artifacts.userDefinedMetadata.signature:n=this.artifacts.signature,this.signature=n,this.version=`${t.versions.producer}.${t.versions.minConsumer}`;let a=vn.decodeWeights(this.artifacts.weightData,this.artifacts.weightSpecs);if(this.executor=new C2(N8.Instance.transformGraph(t,this.signature)),this.executor.weightMap=this.convertTensorMapToTensorsMap(a),this.executor.resourceManager=this.resourceManager,e.modelInitializer!=null&&e.modelInitializer.node!=null){let r=N8.Instance.transformGraph(e.modelInitializer);this.initializer=new C2(r),this.initializer.weightMap=this.executor.weightMap,this.initializer.resourceManager=this.resourceManager,this.initializer.executeAsync({},[])}return!0}async save(e,t){if(typeof e=="string"){let n=vn.getSaveHandlers(e);if(n.length===0)throw new Error(`Cannot find any save handlers for URL '${e}'`);if(n.length>1)throw new Error(`Found more than one (${n.length}) save handlers for URL '${e}'`);e=n[0]}if(e.save==null)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){return this.execute(e,this.outputNodes)}normalizeInputs(e){if(!(e instanceof Le)&&!Array.isArray(e))return e;if(e=Array.isArray(e)?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,a)=>(t[n]=e[a],t),{})}normalizeOutputs(e){return e=e||this.outputNodes,Array.isArray(e)?e:[e]}execute(e,t){e=this.normalizeInputs(e),t=this.normalizeOutputs(t);let 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);let n=await this.executor.executeAsync(e,t);return n.length>1?n:n[0]}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 Gt(e,t={}){if(e==null)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");t==null&&(t={}),t.fromTFHub&&e.load==null&&(e.endsWith("/")||(e=e+"/"),e=`${e}${zse}${Ose}`);let n=new O8(e,t);return await n.load(),n}var _se="3.6.0",z8={};Fe(z8,{CSVDataset:()=>P8,Dataset:()=>Gl,FileDataSource:()=>L8,TextLineDataset:()=>_8,URLDataSource:()=>W8,array:()=>Pse,csv:()=>Wse,func:()=>Bse,generator:()=>Vse,microphone:()=>Use,version_data:()=>Hse,webcam:()=>jse,zip:()=>Lse});var Gse=Zi(Vg()),qse=Zi(Vg());function Xse(e,t){return d0(e,t)}function d0(e,t,n=new Map,a=new Set){if(e==null)return null;if(a.has(e))throw new Error("Circular references are not supported.");if(n.has(e))return n.get(e);let r=t(e);if(r.recurse&&r.value!==null)throw new Error("A deep map function may not return both a value and recurse=true.");if(r.recurse)if(ql(e)){let s=Array.isArray(e)?[]:{};a.add(e);for(let i in e){let o=e[i],l=d0(o,t,n,a);s[i]=l}return a.delete(e),s}else throw new Error(`Can't recurse into non-iterable type: ${e}`);else return n.set(e,r.value),r.value}function Kse(e,t=V8){return B8(e,t)}function B8(e,t,n=new Set){let a=e[0];if(n.has(a))throw new Error("Circular references are not supported.");let r=t(e);if(r.recurse&&r.value!==null)throw new Error("A deep zip function may not return both a value and recurse=true.");if(r.recurse)if(ql(a)){let s=Array.isArray(a)?[]:{};n.add(a);for(let i in a){let o=e.map(d=>d[i]),l=B8(o,t,n);s[i]=l}return n.delete(a),s}else throw new Error(`Can't recurse into non-iterable type: ${a}`);else return r.value}function V8(e){return e===null?null:ql(e[0])?{value:null,recurse:!0}:{value:e,recurse:!1}}async function j8(e,t){let n=new Map;d0(e,t,n);for(let a of Array.from(n.keys())){let r=n.get(a);if(k.isPromise(r)){let s=await r;n.set(a,s)}}return d0(e,t,n)}function ql(e){return e!=null&&!ArrayBuffer.isView(e)&&(Array.isArray(e)||typeof e=="object"&&!(e instanceof Le))}function Yse(e){return e==null||Zse(e)||Array.isArray(e)||typeof e=="object"&&e instanceof Le||k.isTypedArray(e)}function Zse(e){return e===null||typeof e!="object"&&typeof e!="function"}function Qse(e){return Xse(e,Jse)}function Jse(e){return e instanceof Le?{value:e.clone(),recurse:!1}:ql(e)?{value:null,recurse:!0}:{value:e,recurse:!1}}var U8=class{constructor(e){if(this.capacity=e,this.begin=0,this.end=0,e==null)throw new RangeError("Can't create a ring buffer of unknown capacity.");if(e<1)throw new RangeError("Can't create ring buffer of capacity < 1.");this.data=new Array(e),this.doubledCapacity=2*e}wrap(e){for(;e<0;)e+=this.doubledCapacity;return e%this.doubledCapacity}get(e){if(e<0)throw new RangeError("Can't get item at a negative index.");return this.data[e%this.capacity]}set(e,t){if(e<0)throw new RangeError("Can't set item at a negative index.");this.data[e%this.capacity]=t}length(){let e=this.end-this.begin;return e<0&&(e=this.doubledCapacity+e),e}isFull(){return this.length()===this.capacity}isEmpty(){return this.length()===0}push(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.set(this.end,e),this.end=this.wrap(this.end+1)}pushAll(e){for(let t of e)this.push(t)}pop(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");this.end=this.wrap(this.end-1);let e=this.get(this.end);return this.set(this.end,void 0),e}unshift(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.begin=this.wrap(this.begin-1),this.set(this.begin,e)}shift(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");let e=this.get(this.begin);return this.set(this.begin,void 0),this.begin=this.wrap(this.begin+1),e}shuffleExcise(e){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");let t=this.wrap(this.begin+e),n=this.get(t);return this.set(t,this.pop()),n}},R2=class extends U8{constructor(){super(R2.INITIAL_CAPACITY)}isFull(){return!1}push(e){super.isFull()&&this.expand(),super.push(e)}unshift(e){super.isFull()&&this.expand(),super.unshift(e)}expand(){let e=this.capacity*2,t=new Array(e),n=this.length();for(let a=0;at===!0)}rowMajorBatch(e,t=!0){return new lie(this,e,t)}columnMajorBatch(e,t=!0,n=V8){return this.rowMajorBatch(e,t).map(a=>Kse(a,n))}concatenate(e,t){return new G8(H8([this,e]),t)}take(e){return e<0||e==null?this:new oie(this,e)}skip(e){return e<0||e==null?this:new iie(this,e)}prefetch(e){return new X8(this,e)}shuffle(e,t){return new hie(this,e,t)}serial(){return new sie(this)}},eie=class extends qt{constructor(e){super();this.items=e,this.trav=0}summary(){return`Array of ${this.items.length} items`}async next(){if(this.trav>=this.items.length)return{value:null,done:!0};let e=this.items[this.trav];return this.trav++,{value:Qse(e),done:!1}}},tie=class extends qt{constructor(e){super();this.nextFn=e}summary(){return"Function call"}async next(){try{return this.nextFn()}catch(e){throw e.message=`Error thrown while iterating through a dataset: ${e.message}`,e}}},sie=class extends qt{constructor(e){super();this.upstream=e,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Serial`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){return this.upstream.next()}},iie=class extends qt{constructor(e,t){super();this.upstream=e,this.maxCount=t,this.count=0,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Skip`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;this.count++ Take`}async next(){return this.count++>=this.maxCount?{value:null,done:!0}:this.upstream.next()}},lie=class extends qt{constructor(e,t,n=!0){super();this.upstream=e,this.batchSize=t,this.enableSmallLastBatch=n,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> RowMajorBatch`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){let e=[];for(;e.length0?{value:e,done:!1}:{value:null,done:!0};e.push(t.value)}return{value:e,done:!1}}},uie=class extends qt{constructor(e,t){super();this.upstream=e,this.predicate=t,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Filter`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;;){let e=await this.upstream.next();if(e.done||this.predicate(e.value))return e;Ee(e.value)}}},die=class extends qt{constructor(e,t){super();this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> Map`}async next(){let e=await this.upstream.next();if(e.done)return{value:null,done:!0};let t=ma.getTensorsInContainer(e.value),n=this.transform(e.value),a=ma.getTensorsInContainer(n);for(let r of t)ma.isTensorInList(r,a)||r.dispose();return{value:n,done:!1}}},pie=class extends qt{constructor(e,t){super();this.upstream=e,this.handler=t,this.count=0,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> handleErrors`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;;)try{return await this.upstream.next()}catch(e){if(!this.handler(e))return{value:null,done:!0}}}},q8=class extends qt{constructor(e,t){super();this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> AsyncMap`}async next(){let e=await this.upstream.next();if(e.done)return{value:null,done:!0};let t=ma.getTensorsInContainer(e.value),n=await this.transform(e.value),a=ma.getTensorsInContainer(n);for(let r of t)ma.isTensorInList(r,a)||r.dispose();return{value:n,done:!1}}},F2=class extends qt{constructor(){super();this.outputQueue=new R2,this.lastRead=Promise.resolve({value:null,done:!1})}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;this.outputQueue.length()===0;)if(!await this.pump())return{value:null,done:!0};return{value:this.outputQueue.shift(),done:!1}}},cie=class extends F2{constructor(e,t){super();this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> Flatmap`}async pump(){let e=await this.upstream.next();if(e.done)return!1;let t=ma.getTensorsInContainer(e.value),n=this.transform(e.value),a=ma.getTensorsInContainer(n);this.outputQueue.pushAll(n);for(let r of t)ma.isTensorInList(r,a)||r.dispose();return!0}},G8=class extends qt{constructor(e,t){super();this.baseErrorHandler=t,this.lastRead=null,this.iterator=null,this.moreIterators=e}summary(){return"TODO: fill in upstream of chained summaries -> Chained"}async next(){return this.lastRead=this.readFromChain(this.lastRead),this.lastRead}async readFromChain(e){if(await e,this.iterator==null){let n=await this.moreIterators.next();if(n.done)return{value:null,done:!0};this.iterator=n.value,this.baseErrorHandler!=null&&(this.iterator=this.iterator.handleErrors(this.baseErrorHandler))}let t=await this.iterator.next();return t.done?(this.iterator=null,this.readFromChain(e)):t}},Xr;(function(e){e[e.FAIL=0]="FAIL",e[e.SHORTEST=1]="SHORTEST",e[e.LONGEST=2]="LONGEST"})(Xr||(Xr={}));var aie=class extends qt{constructor(e,t=Xr.FAIL){super();this.iterators=e,this.mismatchMode=t,this.count=0,this.currentPromise=null}summary(){return"{TODO: fill in upstream of zip summaries} -> Zip"}async nextState(e){await e;let t=0,n=0;function a(s){return s instanceof qt?{value:s.next().then(i=>(t++,i.done&&n++,i.value)),recurse:!1}:{value:null,recurse:!0}}let r=await j8(this.iterators,a);if(t===n)return{value:null,done:!0};if(n>0)switch(this.mismatchMode){case Xr.FAIL:throw new Error(`Zipped streams should have the same length. Mismatched at element ${this.count}.`);case Xr.SHORTEST:return{value:null,done:!0};case Xr.LONGEST:default:}return this.count++,{value:r,done:!1}}async next(){return this.currentPromise=this.nextState(this.currentPromise),this.currentPromise}},X8=class extends qt{constructor(e,t){super();this.upstream=e,this.bufferSize=t,this.buffer=new U8(t)}summary(){return`${this.upstream.summary()} -> Prefetch`}refill(){for(;!this.buffer.isFull();){let e=this.upstream.next();this.buffer.push(e)}}next(){return this.refill(),this.buffer.shift()}},hie=class extends X8{constructor(e,t,n){super(e,t);this.upstream=e,this.windowSize=t,this.upstreamExhausted=!1,this.random=qse.alea(n||k.now().toString()),this.lastRead=Promise.resolve({value:null,done:!1})}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}randomInt(e){return Math.floor(this.random()*e)}chooseIndex(){return this.randomInt(this.buffer.length())}async serialNext(){for(this.upstreamExhausted||this.refill();!this.buffer.isEmpty();){let e=this.chooseIndex(),t=await this.buffer.shuffleExcise(e);if(t.done)this.upstreamExhausted=!0;else return this.refill(),t}return{value:null,done:!0}}},Gl=class{constructor(){this.size=null}batch(e,t=!0){let n=this;k.assert(e>0,()=>`batchSize needs to be positive, but it is - ${e}`);let a;return this.size===Infinity||this.size==null?a=this.size:t?a=Math.ceil(this.size/e):a=Math.floor(this.size/e),Wn(async()=>(await n.iterator()).columnMajorBatch(e,t,fie),a)}concatenate(e){let t=this,n;return this.size===Infinity||e.size===Infinity?n=Infinity:this.size!=null&&e.size!=null?n=this.size+e.size:n=null,Wn(async()=>(await t.iterator()).concatenate(await e.iterator()),n)}filter(e){let t=this,n;return this.size===Infinity?n=Infinity:n=null,Wn(async()=>(await t.iterator()).filter(a=>W(()=>e(a))),n)}async forEachAsync(e){return(await this.iterator()).forEachAsync(e)}map(e){let t=this;return Wn(async()=>(await t.iterator()).map(n=>W(()=>e(n))),this.size)}mapAsync(e){let t=this;return Wn(async()=>(await t.iterator()).mapAsync(e),this.size)}prefetch(e){if(e==null)throw new RangeError("`Dataset.prefetch()` requires bufferSize to be specified.");let t=this;return Wn(async()=>(await t.iterator()).prefetch(e),this.size)}repeat(e){let t=this,n;return this.size!=null&&e>0?n=this.size*e:e===0?n=0:this.size!=null&&(e===void 0||e<0)?n=Infinity:n=null,Wn(async()=>{let a=M2(async()=>({value:await t.iterator(),done:!1}));return nie(a.take(e))},n)}skip(e){let t=this,n;return this.size!=null&&e>=0&&this.size>=e?n=this.size-e:this.size!=null&&(this.size(await t.iterator()).skip(e),n)}shuffle(e,t,n=!0){if(e==null||e<0)throw this.size==null?new RangeError("`Dataset.shuffle()` requires bufferSize to be specified."):new RangeError(`\`Dataset.shuffle()\` requires bufferSize to be specified. If your data fits in main memory (for regular JS objects), and/or GPU memory (for \`tf.Tensor\`s), consider setting bufferSize to the dataset size (${this.size} elements)`);let a=this,r=Gse.alea(t||k.now().toString());return Wn(async()=>{let s=r.int32();return n&&(s+=r.int32()),(await a.iterator()).shuffle(e,s.toString())},this.size)}take(e){let t=this,n;return this.size!=null&&this.size>e?n=e:this.size!=null&&this.size<=e?n=this.size:n=null,Wn(async()=>(await t.iterator()).take(e),n)}async toArray(){if(this.size===Infinity)throw new Error("Can not convert infinite data stream to array.");return(await this.iterator()).toArray()}async toArrayForTest(){if(this.size===Infinity)throw new Error("Can not convert infinite data stream to array.");return(await this.iterator()).toArrayForTest()}};Gl.MAX_BUFFER_SIZE=1e4;function Wn(e,t=null){return new class extends Gl{constructor(){super(...arguments);this.size=t}async iterator(){return e()}}}function Pse(e){return Wn(async()=>H8(e),e.length)}function Lse(e){if(!ql(e))throw new Error("The argument to zip() must be an object or array.");let t;if(Array.isArray(e))for(let n=0;n{let n=await j8(e,a=>{if(a instanceof Gl)return{value:a.iterator(),recurse:!1};if(ql(a))return{value:null,recurse:!0};throw new Error("Leaves of the structure passed to zip() must be Datasets, not primitives.")});return rie(n,Xr.SHORTEST)},t)}function fie(e){if(e===null)return null;let t=e[0];return Yse(t)?{value:mie(e),recurse:!1}:{value:null,recurse:!0}}function mie(e){if(e.length===0)throw new Error("Can't make a batch of zero elements.");return e[0]instanceof Le?zn(e):ia(e)}var _8=class extends Gl{constructor(e){super();this.input=e}async iterator(){return(await this.input.iterator()).decodeUTF8().split(` -`).map(e=>(e.endsWith("\r")&&(e=e.slice(0,-1)),e))}},p0='"',Hd=Symbol("out"),K8=Symbol("field"),c0=Symbol("quote"),$2=Symbol("quoteafterquote"),Z8=Symbol("quoteinquote"),P8=class extends Gl{constructor(e,t){super();this.input=e,this.hasHeader=!0,this.fullColumnNames=null,this.columnNamesValidated=!1,this.columnConfigs=null,this.configuredColumnsOnly=!1,this.delimiter=",",this.delimWhitespace=!1,this.base=new _8(e),t||(t={}),this.hasHeader=t.hasHeader!==!1,this.fullColumnNames=t.columnNames,this.columnConfigs=t.columnConfigs,this.configuredColumnsOnly=t.configuredColumnsOnly,t.delimWhitespace?(k.assert(t.delimiter==null,()=>"Delimiter should not be provided when delimWhitespace is true."),this.delimWhitespace=!0,this.delimiter=" "):this.delimiter=t.delimiter?t.delimiter:","}async columnNames(){return this.columnNamesValidated||await this.setColumnNames(),this.configuredColumnsOnly?Object.keys(this.columnConfigs):this.fullColumnNames}async setColumnNames(){let e=await this.maybeReadHeaderLine();if(!this.fullColumnNames&&!e)throw new Error("Column names must be provided if there is no header line.");this.fullColumnNames&&e&&k.assert(e.length===this.fullColumnNames.length,()=>"The length of provided columnNames ("+this.fullColumnNames.length.toString()+") does not match the length of the header line read from file ("+e.length.toString()+")."),this.fullColumnNames||(this.fullColumnNames=e);let t=this.fullColumnNames.reduce((a,r)=>(a[r]=a[r]+1||1,a),{}),n=Object.keys(t).filter(a=>t[a]>1);if(k.assert(n.length===0,()=>"Duplicate column names found: "+n.toString()),this.columnConfigs){for(let a of Object.keys(this.columnConfigs))if(this.fullColumnNames.indexOf(a)===-1)throw new Error('The key "'+a+'" provided in columnConfigs does not match any of the column names ('+this.fullColumnNames.toString()+").")}this.columnNamesValidated=!0}async maybeReadHeaderLine(){if(this.hasHeader){let e=await(await this.base.iterator()).next();if(e.done)throw new Error("No data was found for CSV parsing.");let t=e.value;return this.parseRow(t,!1)}else return null}async iterator(){this.columnNamesValidated||await this.setColumnNames();let e=await this.base.iterator();return this.hasHeader&&(e=e.skip(1)),e.map(t=>this.makeDataElement(t))}makeDataElement(e){let t=this.parseRow(e),n={},a={};for(let r=0;r14||!Number.isInteger(t))throw new Error(`Invalid fftSize: it must be a power of 2 between 2 to 4 and 2 to 14, but got ${this.fftSize}`);if(this.numFrames=e.numFramesPerSpectrogram||43,this.sampleRateHz=e.sampleRateHz,this.columnTruncateLength=e.columnTruncateLength||this.fftSize,this.audioTrackConstraints=e.audioTrackConstraints,this.smoothingTimeConstant=e.smoothingTimeConstant||0,this.includeSpectrogram=e.includeSpectrogram!==!1,this.includeWaveform=e.includeWaveform===!0,!this.includeSpectrogram&&!this.includeWaveform)throw new Error("Both includeSpectrogram and includeWaveform are false. At least one type of data should be returned.")}summary(){return"microphone"}static async create(e={}){if(J().get("IS_NODE"))throw new Error("microphone API is only supported in browser environment.");let t=new Y8(e);return await t.start(),t}async start(){try{this.stream=await navigator.mediaDevices.getUserMedia({audio:this.audioTrackConstraints==null?!0:this.audioTrackConstraints,video:!1})}catch(n){throw new Error(`Error thrown while initializing video stream: ${n.message}`)}if(!this.stream)throw new Error("Could not obtain audio from microphone.");let e=window.AudioContext||window.webkitAudioContext;if(this.audioContext=new e,!this.sampleRateHz)this.sampleRateHz=this.audioContext.sampleRate;else if(this.audioContext.sampleRate!==this.sampleRateHz)throw new Error(`Mismatch in sampling rate: Expected: ${this.sampleRateHz}; Actual: ${this.audioContext.sampleRate}`);let t=this.audioContext.createMediaStreamSource(this.stream);this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=this.fftSize*2,this.analyser.smoothingTimeConstant=this.smoothingTimeConstant,t.connect(this.analyser),this.freqData=new Float32Array(this.fftSize),this.timeData=new Float32Array(this.fftSize)}async next(){if(this.isClosed)return{value:null,done:!0};let e,t,n=await this.getAudioData();if(this.includeSpectrogram){let a=this.flattenQueue(n.freqDataQueue);e=this.getTensorFromAudioDataArray(a,[this.numFrames,this.columnTruncateLength,1])}if(this.includeWaveform){let a=this.flattenQueue(n.timeDataQueue);t=this.getTensorFromAudioDataArray(a,[this.numFrames*this.fftSize,1])}return{value:{spectrogram:e,waveform:t},done:!1}}async capture(){return(await this.next()).value}async getAudioData(){let e=[],t=[],n=0;return new Promise(a=>{let r=setInterval(()=>{this.includeSpectrogram&&(this.analyser.getFloatFrequencyData(this.freqData),this.freqData[0]===-Infinity&&a({freqDataQueue:e,timeDataQueue:t}),e.push(this.freqData.slice(0,this.columnTruncateLength))),this.includeWaveform&&(this.analyser.getFloatTimeDomainData(this.timeData),t.push(this.timeData.slice())),++n===this.numFrames&&(clearInterval(r),a({freqDataQueue:e,timeDataQueue:t}))},this.fftSize/this.sampleRateHz*1e3)})}stop(){this.isClosed||(this.isClosed=!0,this.analyser.disconnect(),this.audioContext.close(),this.stream!=null&&this.stream.getTracks().length>0&&this.stream.getTracks()[0].stop())}toArray(){throw new Error("Can not convert infinite audio stream to array.")}getSampleRate(){return this.sampleRateHz}flattenQueue(e){let t=e[0].length,n=new Float32Array(e.length*t);return e.forEach((a,r)=>n.set(a,r*t)),n}getTensorFromAudioDataArray(e,t){let n=new Float32Array(k.sizeFromShape(t));return n.set(e,n.length-e.length),ia(n,t)}},J8=class extends qt{constructor(e,t){super();if(this.webcamVideoElement=e,this.webcamConfig=t,this.isClosed=!0,this.resize=!1,this.needToResize())if(this.resize=!0,this.cropSize=[this.webcamConfig.resizeHeight,this.webcamConfig.resizeWidth],this.cropBoxInd=Tt([0],"int32"),this.webcamConfig.centerCrop){let n=this.webcamConfig.resizeWidth*1/this.webcamVideoElement.width,a=this.webcamConfig.resizeHeight*1/this.webcamVideoElement.height,r=(1-n)/2,s=(1-a)/2,i=r+n,o=a+s;this.cropBox=ya([s,r,o,i],[1,4])}else this.cropBox=ya([0,0,1,1],[1,4])}summary(){return"webcam"}static async create(e,t={}){if(J().get("IS_NODE"))throw new Error("tf.data.webcam is only supported in browser environment.");if(!e){if(e=document.createElement("video"),!t.resizeWidth||!t.resizeHeight)throw new Error("Please provide webcam video element, or resizeWidth and resizeHeight to create a hidden video element.");e.width=t.resizeWidth,e.height=t.resizeHeight}let n=new J8(e,t);return await n.start(),n}async start(){this.webcamConfig.facingMode&&k.assert(this.webcamConfig.facingMode==="user"||this.webcamConfig.facingMode==="environment",()=>`Invalid webcam facing mode: ${this.webcamConfig.facingMode}. Please provide 'user' or 'environment'`);try{this.stream=await navigator.mediaDevices.getUserMedia({video:{deviceId:this.webcamConfig.deviceId,facingMode:this.webcamConfig.facingMode?this.webcamConfig.facingMode:"user",width:this.webcamVideoElement.width,height:this.webcamVideoElement.height}})}catch(e){throw e.message=`Error thrown while initializing video stream: ${e.message}`,e}if(!this.stream)throw new Error("Could not obtain video from webcam.");try{this.webcamVideoElement.srcObject=this.stream}catch(e){console.log(e),this.webcamVideoElement.src=window.URL.createObjectURL(this.stream)}return this.webcamVideoElement.play(),this.isClosed=!1,new Promise(e=>{this.webcamVideoElement.onloadedmetadata=()=>{e()}})}async next(){if(this.isClosed)return{value:null,done:!0};let e;try{e=oi.fromPixels(this.webcamVideoElement)}catch(t){throw new Error(`Error thrown converting video to pixels: ${JSON.stringify(t)}`)}if(this.resize)try{return{value:this.cropAndResizeFrame(e),done:!1}}catch(t){throw new Error(`Error thrown cropping the video: ${t.message}`)}finally{e.dispose()}else return{value:e,done:!1}}needToResize(){return!!(this.webcamConfig.resizeWidth&&this.webcamConfig.resizeHeight&&(this.webcamVideoElement.width!==this.webcamConfig.resizeWidth||this.webcamVideoElement.height!==this.webcamConfig.resizeHeight))}cropAndResizeFrame(e){return W(()=>{let t=ln(fe(e,"float32"),0),n;n=Ye.cropAndResize(t,this.cropBox,this.cropBoxInd,this.cropSize,"bilinear");let a=n.shape;return H(n,a.slice(1))})}async capture(){return(await this.next()).value}stop(){this.stream.getTracks().forEach(e=>e.stop());try{this.webcamVideoElement.srcObject=null}catch(e){console.log(e),this.webcamVideoElement.src=null}this.isClosed=!0}toArray(){throw new Error("Can not convert infinite video stream to array.")}},Q8=class{},ek=class extends qt{split(e){return new Aie(this,e)}},Aie=class extends ek{constructor(e,t){super();this.upstream=e,this.impl=new yie(e,t)}summary(){return this.impl.summary()}async next(){return this.impl.next()}},yie=class extends F2{constructor(e,t){super();this.upstream=e,this.separator=t,this.carryover=""}summary(){return`${this.upstream.summary()} -> Split('${this.separator}')`}async pump(){let e=await this.upstream.next();if(e.done)return this.carryover===""?!1:(this.outputQueue.push(this.carryover),this.carryover="",!0);let t=e.value.split(this.separator);t[0]=this.carryover+t[0];for(let n of t.slice(0,-1))this.outputQueue.push(n);return this.carryover=t[t.length-1],!0}},xie=class extends qt{decodeUTF8(){return new gie(this)}},gie=class extends ek{constructor(e){super();this.upstream=e,this.impl=new bie(e)}summary(){return this.impl.summary()}async next(){return this.impl.next()}},bie=class extends F2{constructor(e){super();if(this.upstream=e,J().get("IS_BROWSER"))this.decoder=new TextDecoder("utf-8");else{let{StringDecoder:t}=pI();this.decoder=new t("utf8")}}summary(){return`${this.upstream.summary()} -> Utf8`}async pump(){let e=await this.upstream.next(),t;if(e.done)return!1;t=e.value;let n;return J().get("IS_BROWSER")?n=this.decoder.decode(t,{stream:!0}):n=this.decoder.write(Buffer.from(t.buffer)),this.outputQueue.push(n),!0}},tk=class extends xie{constructor(e,t={}){super();this.file=e,this.options=t,k.assert(e instanceof Uint8Array||(J().get("IS_BROWSER")?e instanceof File||e instanceof Blob:!1),()=>"FileChunkIterator only supports File, Blob and Uint8Array right now."),this.offset=t.offset||0,this.chunkSize=t.chunkSize||1024*1024}summary(){return`FileChunks ${this.file}`}async next(){return this.offset>=(this.file instanceof Uint8Array?this.file.byteLength:this.file.size)?{value:null,done:!0}:{value:await new Promise((e,t)=>{let n=this.offset+this.chunkSize;if(this.file instanceof Uint8Array)e(new Uint8Array(this.file.slice(this.offset,n)));else{let a=new FileReader;a.onload=s=>{let i=a.result;if(i instanceof ArrayBuffer&&(i=new Uint8Array(i)),!(i instanceof Uint8Array))return t(new TypeError("FileReader returned unknown type."));e(i)},a.onabort=s=>t(new Error("Aborted")),a.onerror=s=>t(new Error(s.type));let r=this.file.slice(this.offset,n);a.readAsArrayBuffer(r)}this.offset=n}),done:!1}}};async function wie(e,t={}){let n,a;typeof e=="string"?n=e:(n=e.url,a=vie(e));let r=await k.fetch(n,a);if(r.ok){let s=new Uint8Array(await r.arrayBuffer());return new tk(s,t)}else throw new Error(r.statusText)}var vie=e=>({method:e.method,headers:e.headers,body:e.body,mode:e.mode,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,integrity:e.integrity});function nk(e){return typeof e=="string"&&e.substr(0,7)==="file://"}var L8=class extends Q8{constructor(e,t={}){super();this.input=e,this.options=t}async iterator(){if(nk(this.input)&&J().get("IS_NODE")){let e=require("fs");this.input=e.readFileSync(this.input.substr(7))}return new tk(this.input,this.options)}},W8=class extends Q8{constructor(e,t={}){super();this.url=e,this.fileOptions=t}async iterator(){return nk(this.url)?new L8(this.url,this.fileOptions).iterator():wie(this.url,this.fileOptions)}};function Wse(e,t={}){return new P8(new W8(e),t)}function Bse(e){let t=M2(e);return Wn(async()=>t)}function Vse(e){return Wn(async()=>{let t=await e();return M2(()=>t.next())})}async function jse(e,t){return J8.create(e,t)}async function Use(e){return Y8.create(e)}var Hse="3.6.0",kie={tfjs:(dm==null?void 0:dm.version)||void 0,"tfjs-core":(pm==null?void 0:pm.version)||void 0,"tfjs-data":(cm==null?void 0:cm.version)||void 0,"tfjs-layers":(hm==null?void 0:hm.version)||void 0,"tfjs-converter":(fm==null?void 0:fm.version)||void 0,"tfjs-backend-cpu":J3||void 0,"tfjs-backend-webgl":vv||void 0,"tfjs-backend-wasm":h6||void 0};var Bn={name:"humangl",priority:99,canvas:null,gl:null,width:1024,height:1024,webGLattr:{alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!1,desynchronized:!0}};function ak(){if(!Zm(Bn.name)){he("backend registration:",Bn.name);try{Bn.canvas=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(Bn.width,Bn.height):document.createElement("canvas")}catch(e){he("error: cannot create canvas:",e);return}try{Bn.gl=Bn.canvas.getContext("webgl2",Bn.webGLattr)}catch(e){he("error: cannot get WebGL2 context:",e);return}try{ph(2,Bn.gl)}catch(e){he("error: cannot set WebGL2 context:",e);return}try{let e=new mh(Bn.gl);ul(Bn.name,()=>new Ol(e),Bn.priority)}catch(e){he("error: cannot register WebGL backend:",e);return}try{nl("webgl").forEach(t=>{let n={...t,backendName:Bn.name};ai(n)})}catch(e){he("error: cannot update WebGL backend registration:",e);return}try{fa.set("WEBGL_VERSION",2)}catch(e){he("error: cannot set WebGL backend flags:",e);return}he("backend registered:",Bn.name)}}var W2={};Ma(W2,{load:()=>j2,predict:()=>V2,triangulation:()=>mk,uvmap:()=>Ak});function rk(e,t){let n=[e.startPoint[0]*t[0],e.startPoint[1]*t[1]],a=[e.endPoint[0]*t[0],e.endPoint[1]*t[1]];return{startPoint:n,endPoint:a}}function Gd(e){return[Math.abs(e.endPoint[0]-e.startPoint[0]),Math.abs(e.endPoint[1]-e.startPoint[1])]}function Xl(e){return[e.startPoint[0]+(e.endPoint[0]-e.startPoint[0])/2,e.startPoint[1]+(e.endPoint[1]-e.startPoint[1])/2]}function Kl(e,t,n){let a=t.shape[1],r=t.shape[2],s=[[e.startPoint[1]/a,e.startPoint[0]/r,e.endPoint[1]/a,e.endPoint[0]/r]];return Ye.cropAndResize(t,s,[0],n)}function h0(e,t=1.5){let n=Xl(e),a=Gd(e),r=[t*a[0]/2,t*a[1]/2],s=[n[0]-r[0],n[1]-r[1]],i=[n[0]+r[0],n[1]+r[1]];return{startPoint:s,endPoint:i,landmarks:e.landmarks}}function f0(e){let t=Xl(e),n=Gd(e),r=Math.max(...n)/2,s=[Math.round(t[0]-r),Math.round(t[1]-r)],i=[Math.round(t[0]+r),Math.round(t[1]+r)];return{startPoint:s,endPoint:i,landmarks:e.landmarks}}function D2(e){let t=e.map(s=>s[0]),n=e.map(s=>s[1]),a=[Math.min(...t),Math.min(...n)],r=[Math.max(...t),Math.max(...n)];return{startPoint:a,endPoint:r,landmarks:e}}var sk=e=>({startPoint:Re(e,[0,0],[-1,2]),endPoint:Re(e,[0,2],[-1,2])});var m0=[[1,0,0],[0,1,0],[0,0,1]];function Iie(e){return e-2*Math.PI*Math.floor((e+Math.PI)/(2*Math.PI))}function O2(e,t){let n=Math.PI/2-Math.atan2(-(t[1]-e[1]),t[0]-e[0]);return Iie(n)}function ik(e,t){return[[1,0,e],[0,1,t],[0,0,1]]}function Kr(e,t){let n=0;for(let a=0;a{let d=t.resizeBilinear([this.inputSize,this.inputSize]).div(127.5).sub(.5),u=this.model.execute(d),p;if(Array.isArray(u)){let f=u.sort((x,w)=>x.size-w.size),A=ot([f[0],f[2]],2),y=ot([f[1],f[3]],2);p=ot([y,A],1).squeeze(0)}else p=u.squeeze();let c=Nie(p,this.anchors,[this.inputSize,this.inputSize]),h=Re(p,[0,0],[-1,1]),m=wn(h).squeeze().dataSync();return[p,c,m]}),s=await Ye.nonMaxSuppressionAsync(a,r,this.config.face.detector.maxDetected,this.config.face.detector.iouThreshold,this.config.face.detector.minConfidence),i=s.arraySync();s.dispose();let o=[];for(let l=0;lthis.config.face.detector.minConfidence){let u=Re(a,[i[l],0],[1,-1]),p=sk(u);u.dispose();let c=this.anchorsData[i[l]],h=W(()=>Re(n,[i[l],pk-1],[1,-1]).squeeze().reshape([pk,-1]));o.push({box:p,landmarks:h,anchor:c,confidence:d})}}return n.dispose(),a.dispose(),{boxes:o,scaleFactor:[t.shape[2]/this.inputSize,t.shape[1]/this.inputSize]}}};async function hk(e){let t=await Gt(Yt(e.modelBasePath,e.face.detector.modelPath),{fromTFHub:e.face.detector.modelPath.includes("tfhub.dev")}),n=new ck(t,e);return!t||!t.modelUrl?he("load model failed:",e.face.detector.modelPath):e.debug&&he("load model:",t.modelUrl),n}var qa={silhouette:[10,338,297,332,284,251,389,356,454,323,361,288,397,365,379,378,400,377,152,148,176,149,150,136,172,58,132,93,234,127,162,21,54,103,67,109],lipsUpperOuter:[61,185,40,39,37,0,267,269,270,409,291],lipsLowerOuter:[146,91,181,84,17,314,405,321,375,291],lipsUpperInner:[78,191,80,81,82,13,312,311,310,415,308],lipsLowerInner:[78,95,88,178,87,14,317,402,318,324,308],rightEyeUpper0:[246,161,160,159,158,157,173],rightEyeLower0:[33,7,163,144,145,153,154,155,133],rightEyeUpper1:[247,30,29,27,28,56,190],rightEyeLower1:[130,25,110,24,23,22,26,112,243],rightEyeUpper2:[113,225,224,223,222,221,189],rightEyeLower2:[226,31,228,229,230,231,232,233,244],rightEyeLower3:[143,111,117,118,119,120,121,128,245],rightEyebrowUpper:[156,70,63,105,66,107,55,193],rightEyebrowLower:[35,124,46,53,52,65],rightEyeIris:[473,474,475,476,477],leftEyeUpper0:[466,388,387,386,385,384,398],leftEyeLower0:[263,249,390,373,374,380,381,382,362],leftEyeUpper1:[467,260,259,257,258,286,414],leftEyeLower1:[359,255,339,254,253,252,256,341,463],leftEyeUpper2:[342,445,444,443,442,441,413],leftEyeLower2:[446,261,448,449,450,451,452,453,464],leftEyeLower3:[372,340,346,347,348,349,350,357,465],leftEyebrowUpper:[383,300,293,334,296,336,285,417],leftEyebrowLower:[265,353,276,283,282,295],leftEyeIris:[468,469,470,471,472],midwayBetweenEyes:[168],noseTip:[1],noseBottom:[2],noseRightCorner:[98],noseLeftCorner:[327],rightCheek:[205],leftCheek:[425]},z2=[{key:"EyeUpper0",indices:[9,10,11,12,13,14,15]},{key:"EyeUpper1",indices:[25,26,27,28,29,30,31]},{key:"EyeUpper2",indices:[41,42,43,44,45,46,47]},{key:"EyeLower0",indices:[0,1,2,3,4,5,6,7,8]},{key:"EyeLower1",indices:[16,17,18,19,20,21,22,23,24]},{key:"EyeLower2",indices:[32,33,34,35,36,37,38,39,40]},{key:"EyeLower3",indices:[54,55,56,57,58,59,60,61,62]}],qd=[[.499976992607117,.652534008026123],[.500025987625122,.547487020492554],[.499974012374878,.602371990680695],[.482113003730774,.471979022026062],[.500150978565216,.527155995368958],[.499909996986389,.498252987861633],[.499523013830185,.40106201171875],[.289712011814117,.380764007568359],[.499954998493195,.312398016452789],[.499987006187439,.269918978214264],[.500023007392883,.107050001621246],[.500023007392883,.666234016418457],[.5000159740448,.679224014282227],[.500023007392883,.692348003387451],[.499976992607117,.695277988910675],[.499976992607117,.70593398809433],[.499976992607117,.719385027885437],[.499976992607117,.737019002437592],[.499967992305756,.781370997428894],[.499816000461578,.562981009483337],[.473773002624512,.573909997940063],[.104906998574734,.254140973091125],[.365929991006851,.409575998783112],[.338757991790771,.41302502155304],[.311120003461838,.409460008144379],[.274657994508743,.389131009578705],[.393361985683441,.403706014156342],[.345234006643295,.344011008739471],[.370094001293182,.346076011657715],[.319321990013123,.347265005111694],[.297903001308441,.353591024875641],[.24779200553894,.410809993743896],[.396889001131058,.842755019664764],[.280097991228104,.375599980354309],[.106310002505779,.399955987930298],[.2099249958992,.391353011131287],[.355807989835739,.534406006336212],[.471751004457474,.65040397644043],[.474155008792877,.680191993713379],[.439785003662109,.657229006290436],[.414617002010345,.66654098033905],[.450374007225037,.680860996246338],[.428770989179611,.682690978050232],[.374971002340317,.727805018424988],[.486716985702515,.547628998756409],[.485300987958908,.527395009994507],[.257764995098114,.314490020275116],[.401223003864288,.455172002315521],[.429818987846375,.548614978790283],[.421351999044418,.533740997314453],[.276895999908447,.532056987285614],[.483370006084442,.499586999416351],[.33721199631691,.282882988452911],[.296391993761063,.293242990970612],[.169294998049736,.193813979625702],[.447580009698868,.302609980106354],[.392390012741089,.353887975215912],[.354490011930466,.696784019470215],[.067304998636246,.730105042457581],[.442739009857178,.572826027870178],[.457098007202148,.584792017936707],[.381974011659622,.694710969924927],[.392388999462128,.694203019142151],[.277076005935669,.271932005882263],[.422551989555359,.563233017921448],[.385919004678726,.281364023685455],[.383103013038635,.255840003490448],[.331431001424789,.119714021682739],[.229923993349075,.232002973556519],[.364500999450684,.189113974571228],[.229622006416321,.299540996551514],[.173287004232407,.278747975826263],[.472878992557526,.666198015213013],[.446828007698059,.668527007102966],[.422762006521225,.673889994621277],[.445307999849319,.580065965652466],[.388103008270264,.693961024284363],[.403039008378983,.706539988517761],[.403629004955292,.693953037261963],[.460041999816895,.557139039039612],[.431158006191254,.692366003990173],[.452181994915009,.692366003990173],[.475387006998062,.692366003990173],[.465828001499176,.779190003871918],[.472328990697861,.736225962638855],[.473087012767792,.717857003211975],[.473122000694275,.704625964164734],[.473033010959625,.695277988910675],[.427942007780075,.695277988910675],[.426479011774063,.703539967536926],[.423162013292313,.711845993995667],[.4183090031147,.720062971115112],[.390094995498657,.639572978019714],[.013953999616206,.560034036636353],[.499913990497589,.58014702796936],[.413199990987778,.69539999961853],[.409626007080078,.701822996139526],[.468080013990402,.601534962654114],[.422728985548019,.585985004901886],[.463079988956451,.593783974647522],[.37211999297142,.47341400384903],[.334562003612518,.496073007583618],[.411671012639999,.546965003013611],[.242175996303558,.14767599105835],[.290776997804642,.201445996761322],[.327338010072708,.256527006626129],[.399509996175766,.748921036720276],[.441727995872498,.261676013469696],[.429764986038208,.187834024429321],[.412198007106781,.108901023864746],[.288955003023148,.398952007293701],[.218936994671822,.435410976409912],[.41278201341629,.398970007896423],[.257135003805161,.355440020561218],[.427684992551804,.437960982322693],[.448339998722076,.536936044692993],[.178560003638268,.45755398273468],[.247308000922203,.457193970680237],[.286267012357712,.467674970626831],[.332827985286713,.460712015628815],[.368755996227264,.447206974029541],[.398963987827301,.432654976844788],[.476410001516342,.405806005001068],[.189241006970406,.523923993110657],[.228962004184723,.348950982093811],[.490725994110107,.562400996685028],[.404670000076294,.485132992267609],[.019469000399113,.401564002037048],[.426243007183075,.420431017875671],[.396993011236191,.548797011375427],[.266469985246658,.376977026462555],[.439121007919312,.51895797252655],[.032313998788595,.644356966018677],[.419054001569748,.387154996395111],[.462783008813858,.505746960639954],[.238978996872902,.779744982719421],[.198220998048782,.831938028335571],[.107550002634525,.540755033493042],[.183610007166862,.740257024765015],[.134409993886948,.333683013916016],[.385764002799988,.883153975009918],[.490967005491257,.579378008842468],[.382384985685349,.508572995662689],[.174399003386497,.397670984268188],[.318785011768341,.39623498916626],[.343364000320435,.400596976280212],[.396100014448166,.710216999053955],[.187885001301765,.588537991046906],[.430987000465393,.944064974784851],[.318993002176285,.898285031318665],[.266247987747192,.869701027870178],[.500023007392883,.190576016902924],[.499976992607117,.954452991485596],[.366169989109039,.398822009563446],[.393207013607025,.39553701877594],[.410373002290726,.391080021858215],[.194993004202843,.342101991176605],[.388664990663528,.362284004688263],[.365961998701096,.355970978736877],[.343364000320435,.355356991291046],[.318785011768341,.35834002494812],[.301414996385574,.363156020641327],[.058132998645306,.319076001644135],[.301414996385574,.387449026107788],[.499987989664078,.618434011936188],[.415838003158569,.624195992946625],[.445681989192963,.566076993942261],[.465844005346298,.620640993118286],[.49992299079895,.351523995399475],[.288718998432159,.819945991039276],[.335278987884521,.852819979190826],[.440512001514435,.902418971061707],[.128294005990028,.791940987110138],[.408771991729736,.373893976211548],[.455606997013092,.451801002025604],[.499877005815506,.908990025520325],[.375436991453171,.924192011356354],[.11421000212431,.615022003650665],[.448662012815475,.695277988910675],[.4480200111866,.704632043838501],[.447111994028091,.715808033943176],[.444831997156143,.730794012546539],[.430011987686157,.766808986663818],[.406787008047104,.685672998428345],[.400738000869751,.681069016456604],[.392399996519089,.677703022956848],[.367855995893478,.663918972015381],[.247923001646996,.601333022117615],[.452769994735718,.420849978923798],[.43639200925827,.359887003898621],[.416164010763168,.368713974952698],[.413385987281799,.692366003990173],[.228018000721931,.683571994304657],[.468268007040024,.352671027183533],[.411361992359161,.804327011108398],[.499989002943039,.469825029373169],[.479153990745544,.442654013633728],[.499974012374878,.439637005329132],[.432112008333206,.493588984012604],[.499886006116867,.866917014122009],[.49991300702095,.821729004383087],[.456548988819122,.819200992584229],[.344549000263214,.745438992977142],[.37890899181366,.574010014533997],[.374292999505997,.780184984207153],[.319687992334366,.570737957954407],[.357154995203018,.604269981384277],[.295284003019333,.621580958366394],[.447750002145767,.862477004528046],[.410986006259918,.508723020553589],[.31395098567009,.775308012962341],[.354128003120422,.812552988529205],[.324548006057739,.703992962837219],[.189096003770828,.646299958229065],[.279776990413666,.71465802192688],[.1338230073452,.682700991630554],[.336768001317978,.644733011722565],[.429883986711502,.466521978378296],[.455527991056442,.548622965812683],[.437114000320435,.558896005153656],[.467287987470627,.529924988746643],[.414712011814117,.335219979286194],[.37704598903656,.322777986526489],[.344107985496521,.320150971412659],[.312875986099243,.32233202457428],[.283526003360748,.333190023899078],[.241245999932289,.382785975933075],[.102986000478268,.468762993812561],[.267612010240555,.424560010433197],[.297879010438919,.433175981044769],[.333433985710144,.433878004550934],[.366427004337311,.426115989685059],[.396012008190155,.416696012020111],[.420121014118195,.41022801399231],[.007561000064015,.480777025222778],[.432949006557465,.569517970085144],[.458638995885849,.479089021682739],[.473466008901596,.545744001865387],[.476087987422943,.563830018043518],[.468472003936768,.555056989192963],[.433990985155106,.582361996173859],[.483518004417419,.562983989715576],[.482482999563217,.57784903049469],[.42645001411438,.389798998832703],[.438998997211456,.39649498462677],[.450067013502121,.400434017181396],[.289712011814117,.368252992630005],[.276670008897781,.363372981548309],[.517862021923065,.471948027610779],[.710287988185883,.380764007568359],[.526226997375488,.573909997940063],[.895093023777008,.254140973091125],[.634069979190826,.409575998783112],[.661242008209229,.41302502155304],[.688880026340485,.409460008144379],[.725341975688934,.389131009578705],[.606630027294159,.40370500087738],[.654766023159027,.344011008739471],[.629905998706818,.346076011657715],[.680678009986877,.347265005111694],[.702096998691559,.353591024875641],[.75221198797226,.410804986953735],[.602918028831482,.842862963676453],[.719901978969574,.375599980354309],[.893692970275879,.399959981441498],[.790081977844238,.391354024410248],[.643998026847839,.534487962722778],[.528249025344849,.65040397644043],[.525849997997284,.680191040039062],[.560214996337891,.657229006290436],[.585384011268616,.66654098033905],[.549625992774963,.680860996246338],[.57122802734375,.682691991329193],[.624852001667023,.72809898853302],[.513050019741058,.547281980514526],[.51509702205658,.527251958847046],[.742246985435486,.314507007598877],[.598631024360657,.454979002475739],[.570338010787964,.548575043678284],[.578631997108459,.533622980117798],[.723087012767792,.532054007053375],[.516445994377136,.499638974666595],[.662801027297974,.282917976379395],[.70362401008606,.293271005153656],[.830704987049103,.193813979625702],[.552385985851288,.302568018436432],[.607609987258911,.353887975215912],[.645429015159607,.696707010269165],[.932694971561432,.730105042457581],[.557260990142822,.572826027870178],[.542901992797852,.584792017936707],[.6180260181427,.694710969924927],[.607590973377228,.694203019142151],[.722943007946014,.271963000297546],[.577413976192474,.563166975975037],[.614082992076874,.281386971473694],[.616907000541687,.255886018276215],[.668509006500244,.119913995265961],[.770092010498047,.232020974159241],[.635536015033722,.189248979091644],[.77039098739624,.299556016921997],[.826722025871277,.278755009174347],[.527121007442474,.666198015213013],[.553171992301941,.668527007102966],[.577238023281097,.673889994621277],[.554691970348358,.580065965652466],[.611896991729736,.693961024284363],[.59696102142334,.706539988517761],[.596370995044708,.693953037261963],[.539958000183105,.557139039039612],[.568841993808746,.692366003990173],[.547818005084991,.692366003990173],[.52461302280426,.692366003990173],[.534089982509613,.779141008853912],[.527670979499817,.736225962638855],[.526912987232208,.717857003211975],[.526877999305725,.704625964164734],[.526966989040375,.695277988910675],[.572058022022247,.695277988910675],[.573521018028259,.703539967536926],[.57683801651001,.711845993995667],[.581691026687622,.720062971115112],[.609944999217987,.639909982681274],[.986046016216278,.560034036636353],[.5867999792099,.69539999961853],[.590372025966644,.701822996139526],[.531915009021759,.601536989212036],[.577268004417419,.585934996604919],[.536915004253387,.593786001205444],[.627542972564697,.473352015018463],[.665585994720459,.495950996875763],[.588353991508484,.546862006187439],[.757824003696442,.14767599105835],[.709249973297119,.201507985591888],[.672684013843536,.256581008434296],[.600408971309662,.74900496006012],[.55826598405838,.261672019958496],[.570303976535797,.187870979309082],[.588165998458862,.109044015407562],[.711045026779175,.398952007293701],[.781069993972778,.435405015945435],[.587247014045715,.398931980133057],[.742869973182678,.355445981025696],[.572156012058258,.437651991844177],[.55186802148819,.536570012569427],[.821442008018494,.457556009292603],[.752701997756958,.457181990146637],[.71375697851181,.467626988887787],[.66711300611496,.460672974586487],[.631101012229919,.447153985500336],[.6008620262146,.432473003864288],[.523481011390686,.405627012252808],[.810747981071472,.523926019668579],[.771045982837677,.348959028720856],[.509127020835876,.562718033790588],[.595292985439301,.485023975372314],[.980530977249146,.401564002037048],[.573499977588654,.420000016689301],[.602994978427887,.548687994480133],[.733529984951019,.376977026462555],[.560611009597778,.519016981124878],[.967685997486115,.644356966018677],[.580985009670258,.387160003185272],[.537728011608124,.505385041236877],[.760966002941132,.779752969741821],[.801778972148895,.831938028335571],[.892440974712372,.54076099395752],[.816350996494293,.740260004997253],[.865594983100891,.333687007427216],[.614073991775513,.883246004581451],[.508952975273132,.579437971115112],[.617941975593567,.508316040039062],[.825608015060425,.397674977779388],[.681214988231659,.39623498916626],[.656635999679565,.400596976280212],[.603900015354156,.710216999053955],[.81208598613739,.588539004325867],[.56801301240921,.944564998149872],[.681007981300354,.898285031318665],[.733752012252808,.869701027870178],[.633830010890961,.398822009563446],[.606792986392975,.39553701877594],[.589659988880157,.391062021255493],[.805015981197357,.342108011245728],[.611334979534149,.362284004688263],[.634037971496582,.355970978736877],[.656635999679565,.355356991291046],[.681214988231659,.35834002494812],[.698584973812103,.363156020641327],[.941866993904114,.319076001644135],[.698584973812103,.387449026107788],[.584177017211914,.624107003211975],[.554318010807037,.566076993942261],[.534153997898102,.62064003944397],[.711217999458313,.819975018501282],[.664629995822906,.852871000766754],[.559099972248077,.902631998062134],[.871706008911133,.791940987110138],[.591234028339386,.373893976211548],[.544341027736664,.451583981513977],[.624562978744507,.924192011356354],[.88577002286911,.615028977394104],[.551338016986847,.695277988910675],[.551980018615723,.704632043838501],[.552887976169586,.715808033943176],[.555167973041534,.730794012546539],[.569944024085999,.767035007476807],[.593203008174896,.685675978660583],[.599261999130249,.681069016456604],[.607599973678589,.677703022956848],[.631937980651855,.663500010967255],[.752032995223999,.601315021514893],[.547226011753082,.420395016670227],[.563543975353241,.359827995300293],[.583841025829315,.368713974952698],[.586614012718201,.692366003990173],[.771915018558502,.683578014373779],[.531597018241882,.352482974529266],[.588370978832245,.804440975189209],[.52079701423645,.442565023899078],[.567984998226166,.493479013442993],[.543282985687256,.819254994392395],[.655317008495331,.745514988899231],[.621008992195129,.574018001556396],[.625559985637665,.78031200170517],[.680198013782501,.570719003677368],[.64276397228241,.604337990283966],[.704662978649139,.621529996395111],[.552012026309967,.862591981887817],[.589071989059448,.508637011051178],[.685944974422455,.775357007980347],[.645735025405884,.812640011310577],[.675342977046967,.703978002071381],[.810858011245728,.646304965019226],[.72012197971344,.714666962623596],[.866151988506317,.682704985141754],[.663187026977539,.644596993923187],[.570082008838654,.466325998306274],[.544561982154846,.548375964164734],[.562758982181549,.558784961700439],[.531987011432648,.530140042304993],[.585271000862122,.335177004337311],[.622952997684479,.32277899980545],[.655896008014679,.320163011550903],[.687132000923157,.322345972061157],[.716481983661652,.333200991153717],[.758756995201111,.382786989212036],[.897013008594513,.468769013881683],[.732392013072968,.424547016620636],[.70211398601532,.433162987232208],[.66652500629425,.433866024017334],[.633504986763,.426087975502014],[.603875994682312,.416586995124817],[.579657971858978,.409945011138916],[.992439985275269,.480777025222778],[.567192018032074,.569419980049133],[.54136598110199,.478899002075195],[.526564002037048,.546118021011353],[.523913025856018,.563830018043518],[.531529009342194,.555056989192963],[.566035985946655,.582329034805298],[.51631098985672,.563053965568542],[.5174720287323,.577877044677734],[.573594987392426,.389806985855103],[.560697972774506,.395331978797913],[.549755990505219,.399751007556915],[.710287988185883,.368252992630005],[.723330020904541,.363372981548309]],Oi=[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];var Tie=[127,234,132,58,172,150,149,148,152,377,378,379,397,288,361,454,356,70,63,105,66,107,336,296,334,293,300,168,6,195,4,98,97,2,326,327,33,160,158,133,153,144,362,385,387,263,373,380,57,40,37,0,267,270,287,321,314,17,84,91,78,81,13,311,308,402,14,178],Eie=[33,133,362,263,1,62,308,159,145,386,374,6,102,331,2,13,14,70,105,107,336,334,300,54,10,284,50,280,234,454,58,288,152],Cie=[33,133,362,263,1,78,308],hoe=Tie.map(e=>qd[e]),foe=Eie.map(e=>qd[e]),moe=Cie.map(e=>qd[e]);var _2=qa.leftEyeLower0,P2=qa.rightEyeLower0,Zl={leftBounds:[_2[0],_2[_2.length-1]],rightBounds:[P2[0],P2[P2.length-1]]},y0={count:468,mouth:13,symmetryLine:[13,qa.midwayBetweenEyes[0]]},fk={leftEye:0,rightEye:1,nose:2,mouth:3,leftEar:4,rightEar:5,symmetryLine:[3,2]},Yl={upperCenter:3,lowerCenter:4,index:71,numCoordinates:76};function g0(e,t,n,a){for(let r=0;r[s[0]/this.meshSize*(p[0]-this.meshSize/2),s[1]/this.meshSize*(p[1]-this.meshSize/2),p[2]]),o=a!==0?A0(a,[0,0]):m0,l=a!==0?i.map(p=>[...uk(p,o),p[2]]):i,d=a!==0?lk(r):m0,u=[...Xl({startPoint:n.startPoint,endPoint:n.endPoint}),1];return l.map(p=>[Math.round(p[0]+Kr(u,d[0])),Math.round(p[1]+Kr(u,d[1])),Math.round(p[2])])}getLeftToRightEyeDepthDifference(t){let n=t[Zl.leftBounds[0]][2],a=t[Zl.rightBounds[0]][2];return n-a}getEyeBox(t,n,a,r,s=!1){let i=f0(h0(D2([t[a],t[r]]),this.irisEnlarge)),o=Gd(i),l=Ye.cropAndResize(n,[[i.startPoint[1]/this.meshSize,i.startPoint[0]/this.meshSize,i.endPoint[1]/this.meshSize,i.endPoint[0]/this.meshSize]],[0],[this.irisSize,this.irisSize]);return s&&fa.flags.IS_BROWSER&&(l=Ye.flipLeftRight(l)),{box:i,boxSize:o,crop:l}}getEyeCoords(t,n,a,r=!1){let s=[];for(let i=0;i{let d=i;return l===2?d=r:l===4&&(d=s),[o[0],o[1],d]})}async predict(t,n){let a=!1,r;if((this.skipped===0||this.skipped>n.face.detector.skipFrames||!n.face.mesh.enabled||!n.videoOptimized)&&(r=await this.boundingBoxDetector.getBoundingBoxes(t),this.skipped=0),n.videoOptimized&&this.skipped++,!n.videoOptimized||r&&r.boxes&&(!n.face.mesh.enabled||r.boxes.length!==this.detectedFaces&&this.detectedFaces!==n.face.detector.maxDetected)){this.storedBoxes=[],this.detectedFaces=0;for(let i of r.boxes)this.storedBoxes.push({startPoint:i.box.startPoint.dataSync(),endPoint:i.box.endPoint.dataSync(),landmarks:i.landmarks,confidence:i.confidence});this.storedBoxes.length>0&&(a=!0)}if(n.face.detector.skipInitial&&this.detectedFaces===0&&(this.skipped=0),a){if(!r||!r.boxes||r.boxes.length===0)return this.storedBoxes=[],this.detectedFaces=0,null;for(let i=0;i{i.box.startPoint.dispose(),i.box.endPoint.dispose(),i.landmarks.dispose()});let s=W(()=>this.storedBoxes.map((i,o)=>{let l,d=0,u;if(n.face.detector.rotation&&n.face.mesh.enabled&&fa.flags.IS_BROWSER){let[w,b]=i.landmarks.length>=y0.count?y0.symmetryLine:fk.symmetryLine;d=O2(i.landmarks[w],i.landmarks[b]);let v=Xl({startPoint:i.startPoint,endPoint:i.endPoint}),N=[v[0]/t.shape[2],v[1]/t.shape[1]],T=Ye.rotateWithOffset(t,d,0,N);u=A0(-d,v),n.face.mesh.enabled?l=Kl({startPoint:i.startPoint,endPoint:i.endPoint},T,[this.meshSize,this.meshSize]).div(255):l=Kl({startPoint:i.startPoint,endPoint:i.endPoint},T,[this.boxSize,this.boxSize]).div(255)}else{u=m0;let w=t.clone();n.face.mesh.enabled?l=Kl({startPoint:i.startPoint,endPoint:i.endPoint},w,[this.meshSize,this.meshSize]).div(255):l=Kl({startPoint:i.startPoint,endPoint:i.endPoint},w,[this.boxSize,this.boxSize]).div(255)}if(!n.face.mesh.enabled)return{mesh:[],box:i,faceConfidence:null,boxConfidence:i.confidence,confidence:i.confidence,image:l};let[,p,c]=this.meshDetector.execute(l),h=p.dataSync()[0];if(h=y0.count?y0.symmetryLine:fk.symmetryLine;d=O2(i.landmarks[w],i.landmarks[b]);let v=Xl({startPoint:i.startPoint,endPoint:i.endPoint}),N=[v[0]/t.shape[2],v[1]/t.shape[1]],T=Ye.rotateWithOffset(t.toFloat(),d,0,N);u=A0(-d,v),l=Kl({startPoint:i.startPoint,endPoint:i.endPoint},T,[this.meshSize,this.meshSize]).div(255)}let g={mesh:A,box:i,faceConfidence:h,boxConfidence:i.confidence,image:l},x=f0(i);return x.confidence=i.confidence,x.faceConfidence=h,this.storedBoxes[o]=x,g}));return n.face.mesh.enabled&&(this.storedBoxes=this.storedBoxes.filter(i=>i.confidence>n.face.detector.minConfidence)),this.detectedFaces=s.length,s}};var Wt=[null,null,null],B2;async function V2(e,t){let n=await B2.predict(e,t),a=[];for(let r of n||[]){if(!r||r.isDisposedInternal)continue;let s=r.mesh.map(d=>[d[0]/e.shape[2],d[1]/e.shape[1],d[2]/B2.meshSize]),i={};if(r.mesh&&r.mesh.length>0)for(let d of Object.keys(qa))i[d]=qa[d].map(u=>r.mesh[u]);let o=r.box?[Math.max(0,r.box.startPoint[0]),Math.max(0,r.box.startPoint[1]),Math.min(e.shape[2],r.box.endPoint[0])-Math.max(0,r.box.startPoint[0]),Math.min(e.shape[1],r.box.endPoint[1])-Math.max(0,r.box.startPoint[1])]:0,l=r.box?[r.box.startPoint[0]/e.shape[2],r.box.startPoint[1]/e.shape[1],(r.box.endPoint[0]-r.box.startPoint[0])/e.shape[2],(r.box.endPoint[1]-r.box.startPoint[1])/e.shape[1]]:[];a.push({confidence:Math.round(100*r.faceConfidence||100*r.boxConfidence||0)/100,boxConfidence:Math.round(100*r.boxConfidence)/100,faceConfidence:Math.round(100*r.faceConfidence)/100,box:o,boxRaw:l,mesh:r.mesh,meshRaw:s,annotations:i,image:r.image}),r.coords&&r.coords.dispose()}return a}async function j2(e){return!Wt[0]&&e.face.enabled||!Wt[1]&&e.face.mesh.enabled||!Wt[2]&&e.face.iris.enabled?(Wt=await Promise.all([!Wt[0]&&e.face.enabled?hk(e):null,!Wt[1]&&e.face.mesh.enabled?Gt(Yt(e.modelBasePath,e.face.mesh.modelPath),{fromTFHub:e.face.mesh.modelPath.includes("tfhub.dev")}):null,!Wt[2]&&e.face.iris.enabled?Gt(Yt(e.modelBasePath,e.face.iris.modelPath),{fromTFHub:e.face.iris.modelPath.includes("tfhub.dev")}):null]),e.face.mesh.enabled&&(!Wt[1]||!Wt[1].modelUrl?he("load model failed:",e.face.mesh.modelPath):e.debug&&he("load model:",Wt[1].modelUrl)),e.face.iris.enabled&&(!Wt[2]||!Wt[1].modelUrl?he("load model failed:",e.face.iris.modelPath):e.debug&&he("load model:",Wt[2].modelUrl))):e.debug&&(he("cached model:",Wt[0].model.modelUrl),he("cached model:",Wt[1].modelUrl),he("cached model:",Wt[2].modelUrl)),B2=new L2(Wt[0],Wt[1],Wt[2]),Wt}var mk=Oi,Ak=qd;var U2={};Ma(U2,{load:()=>q2,predict:()=>b0});var Rie=["angry","disgust","fear","happy","sad","surprise","neutral"],Ea,H2=[],x0=Number.MAX_SAFE_INTEGER,G2=[.2989,.587,.114];async function q2(e){return Ea?e.debug&&he("cached model:",Ea.modelUrl):(Ea=await Gt(Yt(e.modelBasePath,e.face.emotion.modelPath)),!Ea||!Ea.modelUrl?he("load model failed:",e.face.emotion.modelPath):e.debug&&he("load model:",Ea.modelUrl)),Ea}async function b0(e,t){return Ea?x00?(x0++,H2):(t.videoOptimized?x0=0:x0=Number.MAX_SAFE_INTEGER,new Promise(async n=>{let a=Ye.resizeBilinear(e,[Ea.inputs[0].shape[2],Ea.inputs[0].shape[1]],!1),[r,s,i]=an(a,3,3);a.dispose();let o=_(r,G2[0]),l=_(s,G2[1]),d=_(i,G2[2]);r.dispose(),s.dispose(),i.dispose();let u=yc([o,l,d]);o.dispose(),l.dispose(),d.dispose();let p=W(()=>u.sub(.5).mul(2));u.dispose();let c=[];if(t.face.emotion.enabled){let h=await Ea.predict(p),m=h.dataSync();Ee(h);for(let f=0;ft.face.emotion.minConfidence&&c.push({score:Math.min(.99,Math.trunc(100*m[f])/100),emotion:Rie[f]});c.sort((f,A)=>A.score-f.score)}p.dispose(),H2=c,n(c)})):null}var X2={};Ma(X2,{enhance:()=>Y2,load:()=>K2,match:()=>yk,predict:()=>k0,similarity:()=>Z2});var Qn,v0={age:0},w0=Number.MAX_SAFE_INTEGER;async function K2(e){return Qn?e.debug&&he("cached model:",Qn.modelUrl):(Qn=await Gt(Yt(e.modelBasePath,e.face.description.modelPath)),!Qn||!Qn.modelUrl?he("load model failed:",e.face.description.modelPath):e.debug&&he("load model:",Qn.modelUrl)),Qn}function Z2(e,t,n=2){if(!e||!t||(e==null?void 0:e.length)===0||(t==null?void 0:t.length)===0||(e==null?void 0:e.length)!==(t==null?void 0:t.length))return 0;let a=5*e.map((s,i)=>Math.abs(e[i]-t[i])**n).reduce((s,i)=>s+i,0)**(1/n);return Math.max(0,100-a)/100}function yk(e,t,n=0){let a={similarity:0,name:"",source:"",embedding:[]};if(!e||!t||!Array.isArray(e)||!Array.isArray(t))return a;for(let r of t)if(r.embedding&&r.name){let s=Z2(e,r.embedding);s>n&&s>a.similarity&&(a={...r,similarity:s})}return a}function Y2(e){return W(()=>{let n=e.image||e.tensor||e;if(!(n instanceof Le))return null;let a=[[.05,.15,.85,.85]];return(n.shape.length===3?Ye.cropAndResize(ln(n,0),a,[0],[Qn.inputs[0].shape[2],Qn.inputs[0].shape[1]]):Ye.cropAndResize(n,a,[0],[Qn.inputs[0].shape[2],Qn.inputs[0].shape[1]])).mul(255)})}async function k0(e,t){return Qn?w00?(w0++,v0):(t.videoOptimized?w0=0:w0=Number.MAX_SAFE_INTEGER,new Promise(async n=>{let a=Y2(e),r,s={age:0,gender:"unknown",genderConfidence:0,descriptor:[]};t.face.description.enabled&&(r=await Qn.predict(a)),Ee(a),r&&(W(()=>{let i=r.find(p=>p.shape[1]===1).dataSync(),o=Math.trunc(200*Math.abs(i[0]-.5))/100;o>t.face.description.minConfidence&&(s.gender=i[0]<=.5?"female":"male",s.genderConfidence=Math.min(.99,o));let l=r.find(p=>p.shape[1]===100).argMax(1).dataSync()[0],d=r.find(p=>p.shape[1]===100).dataSync();s.age=Math.round(d[l-1]>d[l+1]?10*l-100*d[l-1]:10*l+100*d[l+1])/10;let u=r.find(p=>p.shape[1]===1024);s.descriptor=[...u.dataSync()]}),r.forEach(i=>Ee(i))),v0=s,n(s)})):null}var Mie=(e,t)=>{let n=A=>A*180/Math.PI,a=A=>{let y=Math.sqrt(A[0]*A[0]+A[1]*A[1]+A[2]*A[2]);return A[0]/=y,A[1]/=y,A[2]/=y,A},r=(A,y)=>{let g=A[0]-y[0],x=A[1]-y[1],w=A[2]-y[2];return[g,x,w]},s=(A,y)=>{let g=A[1]*y[2]-A[2]*y[1],x=A[2]*y[0]-A[0]*y[2],w=A[0]*y[1]-A[1]*y[0];return[g,x,w]},i=A=>{let[y,g,x,w,b,v,N,T,R]=A,$,z,P;return w<1?w>-1?(P=Math.asin(w),z=Math.atan2(-N,y),$=Math.atan2(-v,b)):(P=-Math.PI/2,z=-Math.atan2(T,R),$=0):(P=Math.PI/2,z=Math.atan2(T,R),$=0),{pitch:2*-$,yaw:2*-z,roll:2*-P}},o=A=>{let y=(x,w,b,v)=>Math.atan2(v-w,b-x);return{pitch:y(A[10][1],A[10][2],A[152][1],A[152][2]),yaw:y(A[33][0],A[33][2],A[263][0],A[263][2]),roll:y(A[33][0],A[33][1],A[263][0],A[263][1])}},l=e.meshRaw;if(!l||l.length<300)return{angle:{pitch:0,yaw:0,roll:0},matrix:[1,0,0,0,1,0,0,0,1]};let d=Math.max(e.boxRaw[2]*t[0],e.boxRaw[3]*t[1])/1.5,u=[l[10],l[152],l[234],l[454]].map(A=>[A[0]*t[0]/d,A[1]*t[1]/d,A[2]]),p=a(r(u[1],u[0])),c=a(r(u[3],u[2])),h=a(s(c,p));c=s(p,h);let m=[c[0],c[1],c[2],p[0],p[1],p[2],h[0],h[1],h[2]];return{angle:i(m),matrix:m}},J2=async(e,t)=>{var u,p,c,h,m,f;let n,a,r,s,i,o,l=[];e.state="run:face",n=it();let d=await V2(t,e.config);if(e.perf.face=Math.trunc(it()-n),!d)return[];for(let A of d){if(e.analyze("Get Face"),!A.image||A.image.isDisposedInternal){he("Face object is disposed:",A.image);continue}let y=Mie(A,[t.shape[2],t.shape[1]]);e.analyze("Start Emotion:"),e.config.async?s=e.config.face.emotion.enabled?b0(A.image,e.config):{}:(e.state="run:emotion",n=it(),s=e.config.face.emotion.enabled?await b0(A.image,e.config):{},e.perf.emotion=Math.trunc(it()-n)),e.analyze("End Emotion:"),e.analyze("Start Description:"),e.config.async?o=e.config.face.description.enabled?k0(A,e.config):[]:(e.state="run:description",n=it(),o=e.config.face.description.enabled?await k0(A.image,e.config):[],e.perf.embedding=Math.trunc(it()-n)),e.analyze("End Description:"),e.config.async&&([a,r,s,i,o]=await Promise.all([a,r,s,i,o])),e.analyze("Finish Face:"),!e.config.face.iris.enabled&&((u=A==null?void 0:A.annotations)==null?void 0:u.leftEyeIris)&&((p=A==null?void 0:A.annotations)==null?void 0:p.rightEyeIris)&&(delete A.annotations.leftEyeIris,delete A.annotations.rightEyeIris);let g=((c=A.annotations)==null?void 0:c.leftEyeIris)&&((h=A.annotations)==null?void 0:h.rightEyeIris)?11.7*Math.max(Math.abs(A.annotations.leftEyeIris[3][0]-A.annotations.leftEyeIris[1][0]),Math.abs(A.annotations.rightEyeIris[4][1]-A.annotations.rightEyeIris[2][1])):0;l.push({...A,age:o.age,gender:o.gender,genderConfidence:o.genderConfidence,embedding:o.descriptor,emotion:s,iris:g!==0?Math.trunc(g)/100:0,rotation:y,tensor:e.config.face.detector.return?(m=A.image)==null?void 0:m.squeeze():null}),(f=A.image)==null||f.dispose(),e.analyze("End Face")}return e.analyze("End FaceMesh:"),e.config.async&&(e.perf.face&&delete e.perf.face,e.perf.age&&delete e.perf.age,e.perf.gender&&delete e.perf.gender,e.perf.emotion&&delete e.perf.emotion),l};var rg={};Ma(rg,{load:()=>ig,predict:()=>sg});var Xd=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"],gk=Xd.length,Kd=Xd.reduce((e,t,n)=>(e[t]=n,e),{}),Fie=[["leftHip","leftShoulder"],["leftElbow","leftShoulder"],["leftElbow","leftWrist"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["rightHip","rightShoulder"],["rightElbow","rightShoulder"],["rightElbow","rightWrist"],["rightHip","rightKnee"],["rightKnee","rightAnkle"],["leftShoulder","rightShoulder"],["leftHip","rightHip"]],$ie=Fie.map(([e,t])=>[Kd[e],Kd[t]]),xk=[["nose","leftEye"],["leftEye","leftEar"],["nose","rightEye"],["rightEye","rightEar"],["nose","leftShoulder"],["leftShoulder","leftElbow"],["leftElbow","leftWrist"],["leftShoulder","leftHip"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["nose","rightShoulder"],["rightShoulder","rightElbow"],["rightElbow","rightWrist"],["rightShoulder","rightHip"],["rightHip","rightKnee"],["rightKnee","rightAnkle"]];function bk(e){let t=e.reduce(({maxX:n,maxY:a,minX:r,minY:s},{position:{x:i,y:o}})=>({maxX:Math.max(n,i),maxY:Math.max(a,o),minX:Math.min(r,i),minY:Math.min(s,o)}),{maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY});return[t.minX,t.minY,t.maxX-t.minX,t.maxY-t.minY]}function vk(e,[t,n],[a,r]){let s=(o,l,d)=>({score:o.score,box:[Math.trunc(o.box[0]*d),Math.trunc(o.box[1]*l),Math.trunc(o.box[2]*d),Math.trunc(o.box[3]*l)],keypoints:o.keypoints.map(({score:u,part:p,position:c})=>({score:u,part:p,position:{x:Math.trunc(c.x*d),y:Math.trunc(c.y*l)}}))});return e.map(o=>s(o,t/a,n/r))}var Q2=class{constructor(t,n){this.priorityQueue=new Array(t),this.numberOfElements=-1,this.getElementValue=n}enqueue(t){this.priorityQueue[++this.numberOfElements]=t,this.swim(this.numberOfElements)}dequeue(){let t=this.priorityQueue[0];return this.exchange(0,this.numberOfElements--),this.sink(0),this.priorityQueue[this.numberOfElements+1]=null,t}empty(){return this.numberOfElements===-1}size(){return this.numberOfElements+1}all(){return this.priorityQueue.slice(0,this.numberOfElements+1)}max(){return this.priorityQueue[0]}swim(t){for(;t>0&&this.less(Math.floor(t/2),t);)this.exchange(t,Math.floor(t/2)),t=Math.floor(t/2)}sink(t){for(;2*t<=this.numberOfElements;){let n=2*t;if(nn?n:e}function wk(e,t,n,a){let r=n-e,s=a-t;return r*r+s*s}function ag(e,t){return{x:e.x+t.x,y:e.y+t.y}}var I0=1,Jl=16,Die=50**2;function kk(e,t,n,a,r,s,i=2){let o=y=>({y:s.get(y.y,y.x,e),x:s.get(y.y,y.x,s.shape[2]/2+e)}),l=(y,g,x)=>({y:ng(Math.round(y.y/Jl),0,g-1),x:ng(Math.round(y.x/Jl),0,x-1)}),[d,u]=a.shape,p=l(t.position,d,u),c=o(p),m=ag(t.position,c);for(let y=0;y[Kd[c],Kd[h]]),i=s.map(([,c])=>c),o=s.map(([c])=>c),l=t.shape[2],d=i.length,u=new Array(l),p=tg(e.part,Jl,n);u[e.part.id]={score:e.score,part:Xd[e.part.id],position:p};for(let c=d-1;c>=0;--c){let h=i[c],m=o[c];u[h]&&!u[m]&&(u[m]=kk(c,u[h],m,t,n,r))}for(let c=0;ct){o=!1;break}if(!o)break}return o}function _ie(e,t){let[n,a,r]=t.shape,s=new Q2(n*a*r,({score:i})=>i);for(let i=0;i{var i;let s=(i=r[a])==null?void 0:i.position;return s?wk(n,t,s.y,s.x)<=Die:!1})}function Pie(e,t){return t.reduce((a,{position:r,score:s},i)=>(Ik(e,r,i)||(a+=s),a),0)/t.length}function Sk(e,t,n,a,r,s){let i=[],o=_ie(s,t);for(;i.lengthh.score>s);let p=Pie(i,u),c=bk(u);p>s&&i.push({keypoints:u,box:c,score:Math.round(100*p)/100})}return i}var ha,Lie=["MobilenetV1/offset_2/BiasAdd","MobilenetV1/heatmap_2/BiasAdd","MobilenetV1/displacement_fwd_2/BiasAdd","MobilenetV1/displacement_bwd_2/BiasAdd"];async function sg(e,t){let n=W(()=>{let o=e.resizeBilinear([ha.inputs[0].shape[2],ha.inputs[0].shape[1]]).toFloat().div(127.5).sub(1),d=ha.execute(o,Lie).map(u=>u.squeeze([0]));return d[1]=d[1].sigmoid(),d}),a=await Promise.all(n.map(i=>i.buffer()));for(let i of n)i.dispose();let r=await Sk(a[0],a[1],a[2],a[3],t.body.maxDetected,t.body.minConfidence);return vk(r,[e.shape[1],e.shape[2]],[ha.inputs[0].shape[2],ha.inputs[0].shape[1]])}async function ig(e){return ha?e.debug&&he("cached model:",ha.modelUrl):(ha=await Gt(Yt(e.modelBasePath,e.body.modelPath)),!ha||!ha.modelUrl?he("load model failed:",e.body.modelPath):e.debug&&he("load model:",ha.modelUrl)),ha}var pg={};Ma(pg,{load:()=>hg,predict:()=>cg});function S0(e){return[Math.abs(e.endPoint[0]-e.startPoint[0]),Math.abs(e.endPoint[1]-e.startPoint[1])]}function Zd(e){return[e.startPoint[0]+(e.endPoint[0]-e.startPoint[0])/2,e.startPoint[1]+(e.endPoint[1]-e.startPoint[1])/2]}function Nk(e,t,n){let a=t.shape[1],r=t.shape[2],s=[[e.startPoint[1]/a,e.startPoint[0]/r,e.endPoint[1]/a,e.endPoint[0]/r]];return Ye.cropAndResize(t,s,[0],n)}function Tk(e,t){let n=[e.startPoint[0]*t[0],e.startPoint[1]*t[1]],a=[e.endPoint[0]*t[0],e.endPoint[1]*t[1]],r=e.palmLandmarks.map(s=>[s[0]*t[0],s[1]*t[1]]);return{startPoint:n,endPoint:a,palmLandmarks:r,confidence:e.confidence}}function N0(e,t=1.5){let n=Zd(e),a=S0(e),r=[t*a[0]/2,t*a[1]/2],s=[n[0]-r[0],n[1]-r[1]],i=[n[0]+r[0],n[1]+r[1]];return{startPoint:s,endPoint:i,palmLandmarks:e.palmLandmarks}}function T0(e){let t=Zd(e),n=S0(e),r=Math.max(...n)/2,s=[t[0]-r,t[1]-r],i=[t[0]+r,t[1]+r];return{startPoint:s,endPoint:i,palmLandmarks:e.palmLandmarks}}var Ek=[{x:.015625,y:.015625},{x:.015625,y:.015625},{x:.046875,y:.015625},{x:.046875,y:.015625},{x:.078125,y:.015625},{x:.078125,y:.015625},{x:.109375,y:.015625},{x:.109375,y:.015625},{x:.140625,y:.015625},{x:.140625,y:.015625},{x:.171875,y:.015625},{x:.171875,y:.015625},{x:.203125,y:.015625},{x:.203125,y:.015625},{x:.234375,y:.015625},{x:.234375,y:.015625},{x:.265625,y:.015625},{x:.265625,y:.015625},{x:.296875,y:.015625},{x:.296875,y:.015625},{x:.328125,y:.015625},{x:.328125,y:.015625},{x:.359375,y:.015625},{x:.359375,y:.015625},{x:.390625,y:.015625},{x:.390625,y:.015625},{x:.421875,y:.015625},{x:.421875,y:.015625},{x:.453125,y:.015625},{x:.453125,y:.015625},{x:.484375,y:.015625},{x:.484375,y:.015625},{x:.515625,y:.015625},{x:.515625,y:.015625},{x:.546875,y:.015625},{x:.546875,y:.015625},{x:.578125,y:.015625},{x:.578125,y:.015625},{x:.609375,y:.015625},{x:.609375,y:.015625},{x:.640625,y:.015625},{x:.640625,y:.015625},{x:.671875,y:.015625},{x:.671875,y:.015625},{x:.703125,y:.015625},{x:.703125,y:.015625},{x:.734375,y:.015625},{x:.734375,y:.015625},{x:.765625,y:.015625},{x:.765625,y:.015625},{x:.796875,y:.015625},{x:.796875,y:.015625},{x:.828125,y:.015625},{x:.828125,y:.015625},{x:.859375,y:.015625},{x:.859375,y:.015625},{x:.890625,y:.015625},{x:.890625,y:.015625},{x:.921875,y:.015625},{x:.921875,y:.015625},{x:.953125,y:.015625},{x:.953125,y:.015625},{x:.984375,y:.015625},{x:.984375,y:.015625},{x:.015625,y:.046875},{x:.015625,y:.046875},{x:.046875,y:.046875},{x:.046875,y:.046875},{x:.078125,y:.046875},{x:.078125,y:.046875},{x:.109375,y:.046875},{x:.109375,y:.046875},{x:.140625,y:.046875},{x:.140625,y:.046875},{x:.171875,y:.046875},{x:.171875,y:.046875},{x:.203125,y:.046875},{x:.203125,y:.046875},{x:.234375,y:.046875},{x:.234375,y:.046875},{x:.265625,y:.046875},{x:.265625,y:.046875},{x:.296875,y:.046875},{x:.296875,y:.046875},{x:.328125,y:.046875},{x:.328125,y:.046875},{x:.359375,y:.046875},{x:.359375,y:.046875},{x:.390625,y:.046875},{x:.390625,y:.046875},{x:.421875,y:.046875},{x:.421875,y:.046875},{x:.453125,y:.046875},{x:.453125,y:.046875},{x:.484375,y:.046875},{x:.484375,y:.046875},{x:.515625,y:.046875},{x:.515625,y:.046875},{x:.546875,y:.046875},{x:.546875,y:.046875},{x:.578125,y:.046875},{x:.578125,y:.046875},{x:.609375,y:.046875},{x:.609375,y:.046875},{x:.640625,y:.046875},{x:.640625,y:.046875},{x:.671875,y:.046875},{x:.671875,y:.046875},{x:.703125,y:.046875},{x:.703125,y:.046875},{x:.734375,y:.046875},{x:.734375,y:.046875},{x:.765625,y:.046875},{x:.765625,y:.046875},{x:.796875,y:.046875},{x:.796875,y:.046875},{x:.828125,y:.046875},{x:.828125,y:.046875},{x:.859375,y:.046875},{x:.859375,y:.046875},{x:.890625,y:.046875},{x:.890625,y:.046875},{x:.921875,y:.046875},{x:.921875,y:.046875},{x:.953125,y:.046875},{x:.953125,y:.046875},{x:.984375,y:.046875},{x:.984375,y:.046875},{x:.015625,y:.078125},{x:.015625,y:.078125},{x:.046875,y:.078125},{x:.046875,y:.078125},{x:.078125,y:.078125},{x:.078125,y:.078125},{x:.109375,y:.078125},{x:.109375,y:.078125},{x:.140625,y:.078125},{x:.140625,y:.078125},{x:.171875,y:.078125},{x:.171875,y:.078125},{x:.203125,y:.078125},{x:.203125,y:.078125},{x:.234375,y:.078125},{x:.234375,y:.078125},{x:.265625,y:.078125},{x:.265625,y:.078125},{x:.296875,y:.078125},{x:.296875,y:.078125},{x:.328125,y:.078125},{x:.328125,y:.078125},{x:.359375,y:.078125},{x:.359375,y:.078125},{x:.390625,y:.078125},{x:.390625,y:.078125},{x:.421875,y:.078125},{x:.421875,y:.078125},{x:.453125,y:.078125},{x:.453125,y:.078125},{x:.484375,y:.078125},{x:.484375,y:.078125},{x:.515625,y:.078125},{x:.515625,y:.078125},{x:.546875,y:.078125},{x:.546875,y:.078125},{x:.578125,y:.078125},{x:.578125,y:.078125},{x:.609375,y:.078125},{x:.609375,y:.078125},{x:.640625,y:.078125},{x:.640625,y:.078125},{x:.671875,y:.078125},{x:.671875,y:.078125},{x:.703125,y:.078125},{x:.703125,y:.078125},{x:.734375,y:.078125},{x:.734375,y:.078125},{x:.765625,y:.078125},{x:.765625,y:.078125},{x:.796875,y:.078125},{x:.796875,y:.078125},{x:.828125,y:.078125},{x:.828125,y:.078125},{x:.859375,y:.078125},{x:.859375,y:.078125},{x:.890625,y:.078125},{x:.890625,y:.078125},{x:.921875,y:.078125},{x:.921875,y:.078125},{x:.953125,y:.078125},{x:.953125,y:.078125},{x:.984375,y:.078125},{x:.984375,y:.078125},{x:.015625,y:.109375},{x:.015625,y:.109375},{x:.046875,y:.109375},{x:.046875,y:.109375},{x:.078125,y:.109375},{x:.078125,y:.109375},{x:.109375,y:.109375},{x:.109375,y:.109375},{x:.140625,y:.109375},{x:.140625,y:.109375},{x:.171875,y:.109375},{x:.171875,y:.109375},{x:.203125,y:.109375},{x:.203125,y:.109375},{x:.234375,y:.109375},{x:.234375,y:.109375},{x:.265625,y:.109375},{x:.265625,y:.109375},{x:.296875,y:.109375},{x:.296875,y:.109375},{x:.328125,y:.109375},{x:.328125,y:.109375},{x:.359375,y:.109375},{x:.359375,y:.109375},{x:.390625,y:.109375},{x:.390625,y:.109375},{x:.421875,y:.109375},{x:.421875,y:.109375},{x:.453125,y:.109375},{x:.453125,y:.109375},{x:.484375,y:.109375},{x:.484375,y:.109375},{x:.515625,y:.109375},{x:.515625,y:.109375},{x:.546875,y:.109375},{x:.546875,y:.109375},{x:.578125,y:.109375},{x:.578125,y:.109375},{x:.609375,y:.109375},{x:.609375,y:.109375},{x:.640625,y:.109375},{x:.640625,y:.109375},{x:.671875,y:.109375},{x:.671875,y:.109375},{x:.703125,y:.109375},{x:.703125,y:.109375},{x:.734375,y:.109375},{x:.734375,y:.109375},{x:.765625,y:.109375},{x:.765625,y:.109375},{x:.796875,y:.109375},{x:.796875,y:.109375},{x:.828125,y:.109375},{x:.828125,y:.109375},{x:.859375,y:.109375},{x:.859375,y:.109375},{x:.890625,y:.109375},{x:.890625,y:.109375},{x:.921875,y:.109375},{x:.921875,y:.109375},{x:.953125,y:.109375},{x:.953125,y:.109375},{x:.984375,y:.109375},{x:.984375,y:.109375},{x:.015625,y:.140625},{x:.015625,y:.140625},{x:.046875,y:.140625},{x:.046875,y:.140625},{x:.078125,y:.140625},{x:.078125,y:.140625},{x:.109375,y:.140625},{x:.109375,y:.140625},{x:.140625,y:.140625},{x:.140625,y:.140625},{x:.171875,y:.140625},{x:.171875,y:.140625},{x:.203125,y:.140625},{x:.203125,y:.140625},{x:.234375,y:.140625},{x:.234375,y:.140625},{x:.265625,y:.140625},{x:.265625,y:.140625},{x:.296875,y:.140625},{x:.296875,y:.140625},{x:.328125,y:.140625},{x:.328125,y:.140625},{x:.359375,y:.140625},{x:.359375,y:.140625},{x:.390625,y:.140625},{x:.390625,y:.140625},{x:.421875,y:.140625},{x:.421875,y:.140625},{x:.453125,y:.140625},{x:.453125,y:.140625},{x:.484375,y:.140625},{x:.484375,y:.140625},{x:.515625,y:.140625},{x:.515625,y:.140625},{x:.546875,y:.140625},{x:.546875,y:.140625},{x:.578125,y:.140625},{x:.578125,y:.140625},{x:.609375,y:.140625},{x:.609375,y:.140625},{x:.640625,y:.140625},{x:.640625,y:.140625},{x:.671875,y:.140625},{x:.671875,y:.140625},{x:.703125,y:.140625},{x:.703125,y:.140625},{x:.734375,y:.140625},{x:.734375,y:.140625},{x:.765625,y:.140625},{x:.765625,y:.140625},{x:.796875,y:.140625},{x:.796875,y:.140625},{x:.828125,y:.140625},{x:.828125,y:.140625},{x:.859375,y:.140625},{x:.859375,y:.140625},{x:.890625,y:.140625},{x:.890625,y:.140625},{x:.921875,y:.140625},{x:.921875,y:.140625},{x:.953125,y:.140625},{x:.953125,y:.140625},{x:.984375,y:.140625},{x:.984375,y:.140625},{x:.015625,y:.171875},{x:.015625,y:.171875},{x:.046875,y:.171875},{x:.046875,y:.171875},{x:.078125,y:.171875},{x:.078125,y:.171875},{x:.109375,y:.171875},{x:.109375,y:.171875},{x:.140625,y:.171875},{x:.140625,y:.171875},{x:.171875,y:.171875},{x:.171875,y:.171875},{x:.203125,y:.171875},{x:.203125,y:.171875},{x:.234375,y:.171875},{x:.234375,y:.171875},{x:.265625,y:.171875},{x:.265625,y:.171875},{x:.296875,y:.171875},{x:.296875,y:.171875},{x:.328125,y:.171875},{x:.328125,y:.171875},{x:.359375,y:.171875},{x:.359375,y:.171875},{x:.390625,y:.171875},{x:.390625,y:.171875},{x:.421875,y:.171875},{x:.421875,y:.171875},{x:.453125,y:.171875},{x:.453125,y:.171875},{x:.484375,y:.171875},{x:.484375,y:.171875},{x:.515625,y:.171875},{x:.515625,y:.171875},{x:.546875,y:.171875},{x:.546875,y:.171875},{x:.578125,y:.171875},{x:.578125,y:.171875},{x:.609375,y:.171875},{x:.609375,y:.171875},{x:.640625,y:.171875},{x:.640625,y:.171875},{x:.671875,y:.171875},{x:.671875,y:.171875},{x:.703125,y:.171875},{x:.703125,y:.171875},{x:.734375,y:.171875},{x:.734375,y:.171875},{x:.765625,y:.171875},{x:.765625,y:.171875},{x:.796875,y:.171875},{x:.796875,y:.171875},{x:.828125,y:.171875},{x:.828125,y:.171875},{x:.859375,y:.171875},{x:.859375,y:.171875},{x:.890625,y:.171875},{x:.890625,y:.171875},{x:.921875,y:.171875},{x:.921875,y:.171875},{x:.953125,y:.171875},{x:.953125,y:.171875},{x:.984375,y:.171875},{x:.984375,y:.171875},{x:.015625,y:.203125},{x:.015625,y:.203125},{x:.046875,y:.203125},{x:.046875,y:.203125},{x:.078125,y:.203125},{x:.078125,y:.203125},{x:.109375,y:.203125},{x:.109375,y:.203125},{x:.140625,y:.203125},{x:.140625,y:.203125},{x:.171875,y:.203125},{x:.171875,y:.203125},{x:.203125,y:.203125},{x:.203125,y:.203125},{x:.234375,y:.203125},{x:.234375,y:.203125},{x:.265625,y:.203125},{x:.265625,y:.203125},{x:.296875,y:.203125},{x:.296875,y:.203125},{x:.328125,y:.203125},{x:.328125,y:.203125},{x:.359375,y:.203125},{x:.359375,y:.203125},{x:.390625,y:.203125},{x:.390625,y:.203125},{x:.421875,y:.203125},{x:.421875,y:.203125},{x:.453125,y:.203125},{x:.453125,y:.203125},{x:.484375,y:.203125},{x:.484375,y:.203125},{x:.515625,y:.203125},{x:.515625,y:.203125},{x:.546875,y:.203125},{x:.546875,y:.203125},{x:.578125,y:.203125},{x:.578125,y:.203125},{x:.609375,y:.203125},{x:.609375,y:.203125},{x:.640625,y:.203125},{x:.640625,y:.203125},{x:.671875,y:.203125},{x:.671875,y:.203125},{x:.703125,y:.203125},{x:.703125,y:.203125},{x:.734375,y:.203125},{x:.734375,y:.203125},{x:.765625,y:.203125},{x:.765625,y:.203125},{x:.796875,y:.203125},{x:.796875,y:.203125},{x:.828125,y:.203125},{x:.828125,y:.203125},{x:.859375,y:.203125},{x:.859375,y:.203125},{x:.890625,y:.203125},{x:.890625,y:.203125},{x:.921875,y:.203125},{x:.921875,y:.203125},{x:.953125,y:.203125},{x:.953125,y:.203125},{x:.984375,y:.203125},{x:.984375,y:.203125},{x:.015625,y:.234375},{x:.015625,y:.234375},{x:.046875,y:.234375},{x:.046875,y:.234375},{x:.078125,y:.234375},{x:.078125,y:.234375},{x:.109375,y:.234375},{x:.109375,y:.234375},{x:.140625,y:.234375},{x:.140625,y:.234375},{x:.171875,y:.234375},{x:.171875,y:.234375},{x:.203125,y:.234375},{x:.203125,y:.234375},{x:.234375,y:.234375},{x:.234375,y:.234375},{x:.265625,y:.234375},{x:.265625,y:.234375},{x:.296875,y:.234375},{x:.296875,y:.234375},{x:.328125,y:.234375},{x:.328125,y:.234375},{x:.359375,y:.234375},{x:.359375,y:.234375},{x:.390625,y:.234375},{x:.390625,y:.234375},{x:.421875,y:.234375},{x:.421875,y:.234375},{x:.453125,y:.234375},{x:.453125,y:.234375},{x:.484375,y:.234375},{x:.484375,y:.234375},{x:.515625,y:.234375},{x:.515625,y:.234375},{x:.546875,y:.234375},{x:.546875,y:.234375},{x:.578125,y:.234375},{x:.578125,y:.234375},{x:.609375,y:.234375},{x:.609375,y:.234375},{x:.640625,y:.234375},{x:.640625,y:.234375},{x:.671875,y:.234375},{x:.671875,y:.234375},{x:.703125,y:.234375},{x:.703125,y:.234375},{x:.734375,y:.234375},{x:.734375,y:.234375},{x:.765625,y:.234375},{x:.765625,y:.234375},{x:.796875,y:.234375},{x:.796875,y:.234375},{x:.828125,y:.234375},{x:.828125,y:.234375},{x:.859375,y:.234375},{x:.859375,y:.234375},{x:.890625,y:.234375},{x:.890625,y:.234375},{x:.921875,y:.234375},{x:.921875,y:.234375},{x:.953125,y:.234375},{x:.953125,y:.234375},{x:.984375,y:.234375},{x:.984375,y:.234375},{x:.015625,y:.265625},{x:.015625,y:.265625},{x:.046875,y:.265625},{x:.046875,y:.265625},{x:.078125,y:.265625},{x:.078125,y:.265625},{x:.109375,y:.265625},{x:.109375,y:.265625},{x:.140625,y:.265625},{x:.140625,y:.265625},{x:.171875,y:.265625},{x:.171875,y:.265625},{x:.203125,y:.265625},{x:.203125,y:.265625},{x:.234375,y:.265625},{x:.234375,y:.265625},{x:.265625,y:.265625},{x:.265625,y:.265625},{x:.296875,y:.265625},{x:.296875,y:.265625},{x:.328125,y:.265625},{x:.328125,y:.265625},{x:.359375,y:.265625},{x:.359375,y:.265625},{x:.390625,y:.265625},{x:.390625,y:.265625},{x:.421875,y:.265625},{x:.421875,y:.265625},{x:.453125,y:.265625},{x:.453125,y:.265625},{x:.484375,y:.265625},{x:.484375,y:.265625},{x:.515625,y:.265625},{x:.515625,y:.265625},{x:.546875,y:.265625},{x:.546875,y:.265625},{x:.578125,y:.265625},{x:.578125,y:.265625},{x:.609375,y:.265625},{x:.609375,y:.265625},{x:.640625,y:.265625},{x:.640625,y:.265625},{x:.671875,y:.265625},{x:.671875,y:.265625},{x:.703125,y:.265625},{x:.703125,y:.265625},{x:.734375,y:.265625},{x:.734375,y:.265625},{x:.765625,y:.265625},{x:.765625,y:.265625},{x:.796875,y:.265625},{x:.796875,y:.265625},{x:.828125,y:.265625},{x:.828125,y:.265625},{x:.859375,y:.265625},{x:.859375,y:.265625},{x:.890625,y:.265625},{x:.890625,y:.265625},{x:.921875,y:.265625},{x:.921875,y:.265625},{x:.953125,y:.265625},{x:.953125,y:.265625},{x:.984375,y:.265625},{x:.984375,y:.265625},{x:.015625,y:.296875},{x:.015625,y:.296875},{x:.046875,y:.296875},{x:.046875,y:.296875},{x:.078125,y:.296875},{x:.078125,y:.296875},{x:.109375,y:.296875},{x:.109375,y:.296875},{x:.140625,y:.296875},{x:.140625,y:.296875},{x:.171875,y:.296875},{x:.171875,y:.296875},{x:.203125,y:.296875},{x:.203125,y:.296875},{x:.234375,y:.296875},{x:.234375,y:.296875},{x:.265625,y:.296875},{x:.265625,y:.296875},{x:.296875,y:.296875},{x:.296875,y:.296875},{x:.328125,y:.296875},{x:.328125,y:.296875},{x:.359375,y:.296875},{x:.359375,y:.296875},{x:.390625,y:.296875},{x:.390625,y:.296875},{x:.421875,y:.296875},{x:.421875,y:.296875},{x:.453125,y:.296875},{x:.453125,y:.296875},{x:.484375,y:.296875},{x:.484375,y:.296875},{x:.515625,y:.296875},{x:.515625,y:.296875},{x:.546875,y:.296875},{x:.546875,y:.296875},{x:.578125,y:.296875},{x:.578125,y:.296875},{x:.609375,y:.296875},{x:.609375,y:.296875},{x:.640625,y:.296875},{x:.640625,y:.296875},{x:.671875,y:.296875},{x:.671875,y:.296875},{x:.703125,y:.296875},{x:.703125,y:.296875},{x:.734375,y:.296875},{x:.734375,y:.296875},{x:.765625,y:.296875},{x:.765625,y:.296875},{x:.796875,y:.296875},{x:.796875,y:.296875},{x:.828125,y:.296875},{x:.828125,y:.296875},{x:.859375,y:.296875},{x:.859375,y:.296875},{x:.890625,y:.296875},{x:.890625,y:.296875},{x:.921875,y:.296875},{x:.921875,y:.296875},{x:.953125,y:.296875},{x:.953125,y:.296875},{x:.984375,y:.296875},{x:.984375,y:.296875},{x:.015625,y:.328125},{x:.015625,y:.328125},{x:.046875,y:.328125},{x:.046875,y:.328125},{x:.078125,y:.328125},{x:.078125,y:.328125},{x:.109375,y:.328125},{x:.109375,y:.328125},{x:.140625,y:.328125},{x:.140625,y:.328125},{x:.171875,y:.328125},{x:.171875,y:.328125},{x:.203125,y:.328125},{x:.203125,y:.328125},{x:.234375,y:.328125},{x:.234375,y:.328125},{x:.265625,y:.328125},{x:.265625,y:.328125},{x:.296875,y:.328125},{x:.296875,y:.328125},{x:.328125,y:.328125},{x:.328125,y:.328125},{x:.359375,y:.328125},{x:.359375,y:.328125},{x:.390625,y:.328125},{x:.390625,y:.328125},{x:.421875,y:.328125},{x:.421875,y:.328125},{x:.453125,y:.328125},{x:.453125,y:.328125},{x:.484375,y:.328125},{x:.484375,y:.328125},{x:.515625,y:.328125},{x:.515625,y:.328125},{x:.546875,y:.328125},{x:.546875,y:.328125},{x:.578125,y:.328125},{x:.578125,y:.328125},{x:.609375,y:.328125},{x:.609375,y:.328125},{x:.640625,y:.328125},{x:.640625,y:.328125},{x:.671875,y:.328125},{x:.671875,y:.328125},{x:.703125,y:.328125},{x:.703125,y:.328125},{x:.734375,y:.328125},{x:.734375,y:.328125},{x:.765625,y:.328125},{x:.765625,y:.328125},{x:.796875,y:.328125},{x:.796875,y:.328125},{x:.828125,y:.328125},{x:.828125,y:.328125},{x:.859375,y:.328125},{x:.859375,y:.328125},{x:.890625,y:.328125},{x:.890625,y:.328125},{x:.921875,y:.328125},{x:.921875,y:.328125},{x:.953125,y:.328125},{x:.953125,y:.328125},{x:.984375,y:.328125},{x:.984375,y:.328125},{x:.015625,y:.359375},{x:.015625,y:.359375},{x:.046875,y:.359375},{x:.046875,y:.359375},{x:.078125,y:.359375},{x:.078125,y:.359375},{x:.109375,y:.359375},{x:.109375,y:.359375},{x:.140625,y:.359375},{x:.140625,y:.359375},{x:.171875,y:.359375},{x:.171875,y:.359375},{x:.203125,y:.359375},{x:.203125,y:.359375},{x:.234375,y:.359375},{x:.234375,y:.359375},{x:.265625,y:.359375},{x:.265625,y:.359375},{x:.296875,y:.359375},{x:.296875,y:.359375},{x:.328125,y:.359375},{x:.328125,y:.359375},{x:.359375,y:.359375},{x:.359375,y:.359375},{x:.390625,y:.359375},{x:.390625,y:.359375},{x:.421875,y:.359375},{x:.421875,y:.359375},{x:.453125,y:.359375},{x:.453125,y:.359375},{x:.484375,y:.359375},{x:.484375,y:.359375},{x:.515625,y:.359375},{x:.515625,y:.359375},{x:.546875,y:.359375},{x:.546875,y:.359375},{x:.578125,y:.359375},{x:.578125,y:.359375},{x:.609375,y:.359375},{x:.609375,y:.359375},{x:.640625,y:.359375},{x:.640625,y:.359375},{x:.671875,y:.359375},{x:.671875,y:.359375},{x:.703125,y:.359375},{x:.703125,y:.359375},{x:.734375,y:.359375},{x:.734375,y:.359375},{x:.765625,y:.359375},{x:.765625,y:.359375},{x:.796875,y:.359375},{x:.796875,y:.359375},{x:.828125,y:.359375},{x:.828125,y:.359375},{x:.859375,y:.359375},{x:.859375,y:.359375},{x:.890625,y:.359375},{x:.890625,y:.359375},{x:.921875,y:.359375},{x:.921875,y:.359375},{x:.953125,y:.359375},{x:.953125,y:.359375},{x:.984375,y:.359375},{x:.984375,y:.359375},{x:.015625,y:.390625},{x:.015625,y:.390625},{x:.046875,y:.390625},{x:.046875,y:.390625},{x:.078125,y:.390625},{x:.078125,y:.390625},{x:.109375,y:.390625},{x:.109375,y:.390625},{x:.140625,y:.390625},{x:.140625,y:.390625},{x:.171875,y:.390625},{x:.171875,y:.390625},{x:.203125,y:.390625},{x:.203125,y:.390625},{x:.234375,y:.390625},{x:.234375,y:.390625},{x:.265625,y:.390625},{x:.265625,y:.390625},{x:.296875,y:.390625},{x:.296875,y:.390625},{x:.328125,y:.390625},{x:.328125,y:.390625},{x:.359375,y:.390625},{x:.359375,y:.390625},{x:.390625,y:.390625},{x:.390625,y:.390625},{x:.421875,y:.390625},{x:.421875,y:.390625},{x:.453125,y:.390625},{x:.453125,y:.390625},{x:.484375,y:.390625},{x:.484375,y:.390625},{x:.515625,y:.390625},{x:.515625,y:.390625},{x:.546875,y:.390625},{x:.546875,y:.390625},{x:.578125,y:.390625},{x:.578125,y:.390625},{x:.609375,y:.390625},{x:.609375,y:.390625},{x:.640625,y:.390625},{x:.640625,y:.390625},{x:.671875,y:.390625},{x:.671875,y:.390625},{x:.703125,y:.390625},{x:.703125,y:.390625},{x:.734375,y:.390625},{x:.734375,y:.390625},{x:.765625,y:.390625},{x:.765625,y:.390625},{x:.796875,y:.390625},{x:.796875,y:.390625},{x:.828125,y:.390625},{x:.828125,y:.390625},{x:.859375,y:.390625},{x:.859375,y:.390625},{x:.890625,y:.390625},{x:.890625,y:.390625},{x:.921875,y:.390625},{x:.921875,y:.390625},{x:.953125,y:.390625},{x:.953125,y:.390625},{x:.984375,y:.390625},{x:.984375,y:.390625},{x:.015625,y:.421875},{x:.015625,y:.421875},{x:.046875,y:.421875},{x:.046875,y:.421875},{x:.078125,y:.421875},{x:.078125,y:.421875},{x:.109375,y:.421875},{x:.109375,y:.421875},{x:.140625,y:.421875},{x:.140625,y:.421875},{x:.171875,y:.421875},{x:.171875,y:.421875},{x:.203125,y:.421875},{x:.203125,y:.421875},{x:.234375,y:.421875},{x:.234375,y:.421875},{x:.265625,y:.421875},{x:.265625,y:.421875},{x:.296875,y:.421875},{x:.296875,y:.421875},{x:.328125,y:.421875},{x:.328125,y:.421875},{x:.359375,y:.421875},{x:.359375,y:.421875},{x:.390625,y:.421875},{x:.390625,y:.421875},{x:.421875,y:.421875},{x:.421875,y:.421875},{x:.453125,y:.421875},{x:.453125,y:.421875},{x:.484375,y:.421875},{x:.484375,y:.421875},{x:.515625,y:.421875},{x:.515625,y:.421875},{x:.546875,y:.421875},{x:.546875,y:.421875},{x:.578125,y:.421875},{x:.578125,y:.421875},{x:.609375,y:.421875},{x:.609375,y:.421875},{x:.640625,y:.421875},{x:.640625,y:.421875},{x:.671875,y:.421875},{x:.671875,y:.421875},{x:.703125,y:.421875},{x:.703125,y:.421875},{x:.734375,y:.421875},{x:.734375,y:.421875},{x:.765625,y:.421875},{x:.765625,y:.421875},{x:.796875,y:.421875},{x:.796875,y:.421875},{x:.828125,y:.421875},{x:.828125,y:.421875},{x:.859375,y:.421875},{x:.859375,y:.421875},{x:.890625,y:.421875},{x:.890625,y:.421875},{x:.921875,y:.421875},{x:.921875,y:.421875},{x:.953125,y:.421875},{x:.953125,y:.421875},{x:.984375,y:.421875},{x:.984375,y:.421875},{x:.015625,y:.453125},{x:.015625,y:.453125},{x:.046875,y:.453125},{x:.046875,y:.453125},{x:.078125,y:.453125},{x:.078125,y:.453125},{x:.109375,y:.453125},{x:.109375,y:.453125},{x:.140625,y:.453125},{x:.140625,y:.453125},{x:.171875,y:.453125},{x:.171875,y:.453125},{x:.203125,y:.453125},{x:.203125,y:.453125},{x:.234375,y:.453125},{x:.234375,y:.453125},{x:.265625,y:.453125},{x:.265625,y:.453125},{x:.296875,y:.453125},{x:.296875,y:.453125},{x:.328125,y:.453125},{x:.328125,y:.453125},{x:.359375,y:.453125},{x:.359375,y:.453125},{x:.390625,y:.453125},{x:.390625,y:.453125},{x:.421875,y:.453125},{x:.421875,y:.453125},{x:.453125,y:.453125},{x:.453125,y:.453125},{x:.484375,y:.453125},{x:.484375,y:.453125},{x:.515625,y:.453125},{x:.515625,y:.453125},{x:.546875,y:.453125},{x:.546875,y:.453125},{x:.578125,y:.453125},{x:.578125,y:.453125},{x:.609375,y:.453125},{x:.609375,y:.453125},{x:.640625,y:.453125},{x:.640625,y:.453125},{x:.671875,y:.453125},{x:.671875,y:.453125},{x:.703125,y:.453125},{x:.703125,y:.453125},{x:.734375,y:.453125},{x:.734375,y:.453125},{x:.765625,y:.453125},{x:.765625,y:.453125},{x:.796875,y:.453125},{x:.796875,y:.453125},{x:.828125,y:.453125},{x:.828125,y:.453125},{x:.859375,y:.453125},{x:.859375,y:.453125},{x:.890625,y:.453125},{x:.890625,y:.453125},{x:.921875,y:.453125},{x:.921875,y:.453125},{x:.953125,y:.453125},{x:.953125,y:.453125},{x:.984375,y:.453125},{x:.984375,y:.453125},{x:.015625,y:.484375},{x:.015625,y:.484375},{x:.046875,y:.484375},{x:.046875,y:.484375},{x:.078125,y:.484375},{x:.078125,y:.484375},{x:.109375,y:.484375},{x:.109375,y:.484375},{x:.140625,y:.484375},{x:.140625,y:.484375},{x:.171875,y:.484375},{x:.171875,y:.484375},{x:.203125,y:.484375},{x:.203125,y:.484375},{x:.234375,y:.484375},{x:.234375,y:.484375},{x:.265625,y:.484375},{x:.265625,y:.484375},{x:.296875,y:.484375},{x:.296875,y:.484375},{x:.328125,y:.484375},{x:.328125,y:.484375},{x:.359375,y:.484375},{x:.359375,y:.484375},{x:.390625,y:.484375},{x:.390625,y:.484375},{x:.421875,y:.484375},{x:.421875,y:.484375},{x:.453125,y:.484375},{x:.453125,y:.484375},{x:.484375,y:.484375},{x:.484375,y:.484375},{x:.515625,y:.484375},{x:.515625,y:.484375},{x:.546875,y:.484375},{x:.546875,y:.484375},{x:.578125,y:.484375},{x:.578125,y:.484375},{x:.609375,y:.484375},{x:.609375,y:.484375},{x:.640625,y:.484375},{x:.640625,y:.484375},{x:.671875,y:.484375},{x:.671875,y:.484375},{x:.703125,y:.484375},{x:.703125,y:.484375},{x:.734375,y:.484375},{x:.734375,y:.484375},{x:.765625,y:.484375},{x:.765625,y:.484375},{x:.796875,y:.484375},{x:.796875,y:.484375},{x:.828125,y:.484375},{x:.828125,y:.484375},{x:.859375,y:.484375},{x:.859375,y:.484375},{x:.890625,y:.484375},{x:.890625,y:.484375},{x:.921875,y:.484375},{x:.921875,y:.484375},{x:.953125,y:.484375},{x:.953125,y:.484375},{x:.984375,y:.484375},{x:.984375,y:.484375},{x:.015625,y:.515625},{x:.015625,y:.515625},{x:.046875,y:.515625},{x:.046875,y:.515625},{x:.078125,y:.515625},{x:.078125,y:.515625},{x:.109375,y:.515625},{x:.109375,y:.515625},{x:.140625,y:.515625},{x:.140625,y:.515625},{x:.171875,y:.515625},{x:.171875,y:.515625},{x:.203125,y:.515625},{x:.203125,y:.515625},{x:.234375,y:.515625},{x:.234375,y:.515625},{x:.265625,y:.515625},{x:.265625,y:.515625},{x:.296875,y:.515625},{x:.296875,y:.515625},{x:.328125,y:.515625},{x:.328125,y:.515625},{x:.359375,y:.515625},{x:.359375,y:.515625},{x:.390625,y:.515625},{x:.390625,y:.515625},{x:.421875,y:.515625},{x:.421875,y:.515625},{x:.453125,y:.515625},{x:.453125,y:.515625},{x:.484375,y:.515625},{x:.484375,y:.515625},{x:.515625,y:.515625},{x:.515625,y:.515625},{x:.546875,y:.515625},{x:.546875,y:.515625},{x:.578125,y:.515625},{x:.578125,y:.515625},{x:.609375,y:.515625},{x:.609375,y:.515625},{x:.640625,y:.515625},{x:.640625,y:.515625},{x:.671875,y:.515625},{x:.671875,y:.515625},{x:.703125,y:.515625},{x:.703125,y:.515625},{x:.734375,y:.515625},{x:.734375,y:.515625},{x:.765625,y:.515625},{x:.765625,y:.515625},{x:.796875,y:.515625},{x:.796875,y:.515625},{x:.828125,y:.515625},{x:.828125,y:.515625},{x:.859375,y:.515625},{x:.859375,y:.515625},{x:.890625,y:.515625},{x:.890625,y:.515625},{x:.921875,y:.515625},{x:.921875,y:.515625},{x:.953125,y:.515625},{x:.953125,y:.515625},{x:.984375,y:.515625},{x:.984375,y:.515625},{x:.015625,y:.546875},{x:.015625,y:.546875},{x:.046875,y:.546875},{x:.046875,y:.546875},{x:.078125,y:.546875},{x:.078125,y:.546875},{x:.109375,y:.546875},{x:.109375,y:.546875},{x:.140625,y:.546875},{x:.140625,y:.546875},{x:.171875,y:.546875},{x:.171875,y:.546875},{x:.203125,y:.546875},{x:.203125,y:.546875},{x:.234375,y:.546875},{x:.234375,y:.546875},{x:.265625,y:.546875},{x:.265625,y:.546875},{x:.296875,y:.546875},{x:.296875,y:.546875},{x:.328125,y:.546875},{x:.328125,y:.546875},{x:.359375,y:.546875},{x:.359375,y:.546875},{x:.390625,y:.546875},{x:.390625,y:.546875},{x:.421875,y:.546875},{x:.421875,y:.546875},{x:.453125,y:.546875},{x:.453125,y:.546875},{x:.484375,y:.546875},{x:.484375,y:.546875},{x:.515625,y:.546875},{x:.515625,y:.546875},{x:.546875,y:.546875},{x:.546875,y:.546875},{x:.578125,y:.546875},{x:.578125,y:.546875},{x:.609375,y:.546875},{x:.609375,y:.546875},{x:.640625,y:.546875},{x:.640625,y:.546875},{x:.671875,y:.546875},{x:.671875,y:.546875},{x:.703125,y:.546875},{x:.703125,y:.546875},{x:.734375,y:.546875},{x:.734375,y:.546875},{x:.765625,y:.546875},{x:.765625,y:.546875},{x:.796875,y:.546875},{x:.796875,y:.546875},{x:.828125,y:.546875},{x:.828125,y:.546875},{x:.859375,y:.546875},{x:.859375,y:.546875},{x:.890625,y:.546875},{x:.890625,y:.546875},{x:.921875,y:.546875},{x:.921875,y:.546875},{x:.953125,y:.546875},{x:.953125,y:.546875},{x:.984375,y:.546875},{x:.984375,y:.546875},{x:.015625,y:.578125},{x:.015625,y:.578125},{x:.046875,y:.578125},{x:.046875,y:.578125},{x:.078125,y:.578125},{x:.078125,y:.578125},{x:.109375,y:.578125},{x:.109375,y:.578125},{x:.140625,y:.578125},{x:.140625,y:.578125},{x:.171875,y:.578125},{x:.171875,y:.578125},{x:.203125,y:.578125},{x:.203125,y:.578125},{x:.234375,y:.578125},{x:.234375,y:.578125},{x:.265625,y:.578125},{x:.265625,y:.578125},{x:.296875,y:.578125},{x:.296875,y:.578125},{x:.328125,y:.578125},{x:.328125,y:.578125},{x:.359375,y:.578125},{x:.359375,y:.578125},{x:.390625,y:.578125},{x:.390625,y:.578125},{x:.421875,y:.578125},{x:.421875,y:.578125},{x:.453125,y:.578125},{x:.453125,y:.578125},{x:.484375,y:.578125},{x:.484375,y:.578125},{x:.515625,y:.578125},{x:.515625,y:.578125},{x:.546875,y:.578125},{x:.546875,y:.578125},{x:.578125,y:.578125},{x:.578125,y:.578125},{x:.609375,y:.578125},{x:.609375,y:.578125},{x:.640625,y:.578125},{x:.640625,y:.578125},{x:.671875,y:.578125},{x:.671875,y:.578125},{x:.703125,y:.578125},{x:.703125,y:.578125},{x:.734375,y:.578125},{x:.734375,y:.578125},{x:.765625,y:.578125},{x:.765625,y:.578125},{x:.796875,y:.578125},{x:.796875,y:.578125},{x:.828125,y:.578125},{x:.828125,y:.578125},{x:.859375,y:.578125},{x:.859375,y:.578125},{x:.890625,y:.578125},{x:.890625,y:.578125},{x:.921875,y:.578125},{x:.921875,y:.578125},{x:.953125,y:.578125},{x:.953125,y:.578125},{x:.984375,y:.578125},{x:.984375,y:.578125},{x:.015625,y:.609375},{x:.015625,y:.609375},{x:.046875,y:.609375},{x:.046875,y:.609375},{x:.078125,y:.609375},{x:.078125,y:.609375},{x:.109375,y:.609375},{x:.109375,y:.609375},{x:.140625,y:.609375},{x:.140625,y:.609375},{x:.171875,y:.609375},{x:.171875,y:.609375},{x:.203125,y:.609375},{x:.203125,y:.609375},{x:.234375,y:.609375},{x:.234375,y:.609375},{x:.265625,y:.609375},{x:.265625,y:.609375},{x:.296875,y:.609375},{x:.296875,y:.609375},{x:.328125,y:.609375},{x:.328125,y:.609375},{x:.359375,y:.609375},{x:.359375,y:.609375},{x:.390625,y:.609375},{x:.390625,y:.609375},{x:.421875,y:.609375},{x:.421875,y:.609375},{x:.453125,y:.609375},{x:.453125,y:.609375},{x:.484375,y:.609375},{x:.484375,y:.609375},{x:.515625,y:.609375},{x:.515625,y:.609375},{x:.546875,y:.609375},{x:.546875,y:.609375},{x:.578125,y:.609375},{x:.578125,y:.609375},{x:.609375,y:.609375},{x:.609375,y:.609375},{x:.640625,y:.609375},{x:.640625,y:.609375},{x:.671875,y:.609375},{x:.671875,y:.609375},{x:.703125,y:.609375},{x:.703125,y:.609375},{x:.734375,y:.609375},{x:.734375,y:.609375},{x:.765625,y:.609375},{x:.765625,y:.609375},{x:.796875,y:.609375},{x:.796875,y:.609375},{x:.828125,y:.609375},{x:.828125,y:.609375},{x:.859375,y:.609375},{x:.859375,y:.609375},{x:.890625,y:.609375},{x:.890625,y:.609375},{x:.921875,y:.609375},{x:.921875,y:.609375},{x:.953125,y:.609375},{x:.953125,y:.609375},{x:.984375,y:.609375},{x:.984375,y:.609375},{x:.015625,y:.640625},{x:.015625,y:.640625},{x:.046875,y:.640625},{x:.046875,y:.640625},{x:.078125,y:.640625},{x:.078125,y:.640625},{x:.109375,y:.640625},{x:.109375,y:.640625},{x:.140625,y:.640625},{x:.140625,y:.640625},{x:.171875,y:.640625},{x:.171875,y:.640625},{x:.203125,y:.640625},{x:.203125,y:.640625},{x:.234375,y:.640625},{x:.234375,y:.640625},{x:.265625,y:.640625},{x:.265625,y:.640625},{x:.296875,y:.640625},{x:.296875,y:.640625},{x:.328125,y:.640625},{x:.328125,y:.640625},{x:.359375,y:.640625},{x:.359375,y:.640625},{x:.390625,y:.640625},{x:.390625,y:.640625},{x:.421875,y:.640625},{x:.421875,y:.640625},{x:.453125,y:.640625},{x:.453125,y:.640625},{x:.484375,y:.640625},{x:.484375,y:.640625},{x:.515625,y:.640625},{x:.515625,y:.640625},{x:.546875,y:.640625},{x:.546875,y:.640625},{x:.578125,y:.640625},{x:.578125,y:.640625},{x:.609375,y:.640625},{x:.609375,y:.640625},{x:.640625,y:.640625},{x:.640625,y:.640625},{x:.671875,y:.640625},{x:.671875,y:.640625},{x:.703125,y:.640625},{x:.703125,y:.640625},{x:.734375,y:.640625},{x:.734375,y:.640625},{x:.765625,y:.640625},{x:.765625,y:.640625},{x:.796875,y:.640625},{x:.796875,y:.640625},{x:.828125,y:.640625},{x:.828125,y:.640625},{x:.859375,y:.640625},{x:.859375,y:.640625},{x:.890625,y:.640625},{x:.890625,y:.640625},{x:.921875,y:.640625},{x:.921875,y:.640625},{x:.953125,y:.640625},{x:.953125,y:.640625},{x:.984375,y:.640625},{x:.984375,y:.640625},{x:.015625,y:.671875},{x:.015625,y:.671875},{x:.046875,y:.671875},{x:.046875,y:.671875},{x:.078125,y:.671875},{x:.078125,y:.671875},{x:.109375,y:.671875},{x:.109375,y:.671875},{x:.140625,y:.671875},{x:.140625,y:.671875},{x:.171875,y:.671875},{x:.171875,y:.671875},{x:.203125,y:.671875},{x:.203125,y:.671875},{x:.234375,y:.671875},{x:.234375,y:.671875},{x:.265625,y:.671875},{x:.265625,y:.671875},{x:.296875,y:.671875},{x:.296875,y:.671875},{x:.328125,y:.671875},{x:.328125,y:.671875},{x:.359375,y:.671875},{x:.359375,y:.671875},{x:.390625,y:.671875},{x:.390625,y:.671875},{x:.421875,y:.671875},{x:.421875,y:.671875},{x:.453125,y:.671875},{x:.453125,y:.671875},{x:.484375,y:.671875},{x:.484375,y:.671875},{x:.515625,y:.671875},{x:.515625,y:.671875},{x:.546875,y:.671875},{x:.546875,y:.671875},{x:.578125,y:.671875},{x:.578125,y:.671875},{x:.609375,y:.671875},{x:.609375,y:.671875},{x:.640625,y:.671875},{x:.640625,y:.671875},{x:.671875,y:.671875},{x:.671875,y:.671875},{x:.703125,y:.671875},{x:.703125,y:.671875},{x:.734375,y:.671875},{x:.734375,y:.671875},{x:.765625,y:.671875},{x:.765625,y:.671875},{x:.796875,y:.671875},{x:.796875,y:.671875},{x:.828125,y:.671875},{x:.828125,y:.671875},{x:.859375,y:.671875},{x:.859375,y:.671875},{x:.890625,y:.671875},{x:.890625,y:.671875},{x:.921875,y:.671875},{x:.921875,y:.671875},{x:.953125,y:.671875},{x:.953125,y:.671875},{x:.984375,y:.671875},{x:.984375,y:.671875},{x:.015625,y:.703125},{x:.015625,y:.703125},{x:.046875,y:.703125},{x:.046875,y:.703125},{x:.078125,y:.703125},{x:.078125,y:.703125},{x:.109375,y:.703125},{x:.109375,y:.703125},{x:.140625,y:.703125},{x:.140625,y:.703125},{x:.171875,y:.703125},{x:.171875,y:.703125},{x:.203125,y:.703125},{x:.203125,y:.703125},{x:.234375,y:.703125},{x:.234375,y:.703125},{x:.265625,y:.703125},{x:.265625,y:.703125},{x:.296875,y:.703125},{x:.296875,y:.703125},{x:.328125,y:.703125},{x:.328125,y:.703125},{x:.359375,y:.703125},{x:.359375,y:.703125},{x:.390625,y:.703125},{x:.390625,y:.703125},{x:.421875,y:.703125},{x:.421875,y:.703125},{x:.453125,y:.703125},{x:.453125,y:.703125},{x:.484375,y:.703125},{x:.484375,y:.703125},{x:.515625,y:.703125},{x:.515625,y:.703125},{x:.546875,y:.703125},{x:.546875,y:.703125},{x:.578125,y:.703125},{x:.578125,y:.703125},{x:.609375,y:.703125},{x:.609375,y:.703125},{x:.640625,y:.703125},{x:.640625,y:.703125},{x:.671875,y:.703125},{x:.671875,y:.703125},{x:.703125,y:.703125},{x:.703125,y:.703125},{x:.734375,y:.703125},{x:.734375,y:.703125},{x:.765625,y:.703125},{x:.765625,y:.703125},{x:.796875,y:.703125},{x:.796875,y:.703125},{x:.828125,y:.703125},{x:.828125,y:.703125},{x:.859375,y:.703125},{x:.859375,y:.703125},{x:.890625,y:.703125},{x:.890625,y:.703125},{x:.921875,y:.703125},{x:.921875,y:.703125},{x:.953125,y:.703125},{x:.953125,y:.703125},{x:.984375,y:.703125},{x:.984375,y:.703125},{x:.015625,y:.734375},{x:.015625,y:.734375},{x:.046875,y:.734375},{x:.046875,y:.734375},{x:.078125,y:.734375},{x:.078125,y:.734375},{x:.109375,y:.734375},{x:.109375,y:.734375},{x:.140625,y:.734375},{x:.140625,y:.734375},{x:.171875,y:.734375},{x:.171875,y:.734375},{x:.203125,y:.734375},{x:.203125,y:.734375},{x:.234375,y:.734375},{x:.234375,y:.734375},{x:.265625,y:.734375},{x:.265625,y:.734375},{x:.296875,y:.734375},{x:.296875,y:.734375},{x:.328125,y:.734375},{x:.328125,y:.734375},{x:.359375,y:.734375},{x:.359375,y:.734375},{x:.390625,y:.734375},{x:.390625,y:.734375},{x:.421875,y:.734375},{x:.421875,y:.734375},{x:.453125,y:.734375},{x:.453125,y:.734375},{x:.484375,y:.734375},{x:.484375,y:.734375},{x:.515625,y:.734375},{x:.515625,y:.734375},{x:.546875,y:.734375},{x:.546875,y:.734375},{x:.578125,y:.734375},{x:.578125,y:.734375},{x:.609375,y:.734375},{x:.609375,y:.734375},{x:.640625,y:.734375},{x:.640625,y:.734375},{x:.671875,y:.734375},{x:.671875,y:.734375},{x:.703125,y:.734375},{x:.703125,y:.734375},{x:.734375,y:.734375},{x:.734375,y:.734375},{x:.765625,y:.734375},{x:.765625,y:.734375},{x:.796875,y:.734375},{x:.796875,y:.734375},{x:.828125,y:.734375},{x:.828125,y:.734375},{x:.859375,y:.734375},{x:.859375,y:.734375},{x:.890625,y:.734375},{x:.890625,y:.734375},{x:.921875,y:.734375},{x:.921875,y:.734375},{x:.953125,y:.734375},{x:.953125,y:.734375},{x:.984375,y:.734375},{x:.984375,y:.734375},{x:.015625,y:.765625},{x:.015625,y:.765625},{x:.046875,y:.765625},{x:.046875,y:.765625},{x:.078125,y:.765625},{x:.078125,y:.765625},{x:.109375,y:.765625},{x:.109375,y:.765625},{x:.140625,y:.765625},{x:.140625,y:.765625},{x:.171875,y:.765625},{x:.171875,y:.765625},{x:.203125,y:.765625},{x:.203125,y:.765625},{x:.234375,y:.765625},{x:.234375,y:.765625},{x:.265625,y:.765625},{x:.265625,y:.765625},{x:.296875,y:.765625},{x:.296875,y:.765625},{x:.328125,y:.765625},{x:.328125,y:.765625},{x:.359375,y:.765625},{x:.359375,y:.765625},{x:.390625,y:.765625},{x:.390625,y:.765625},{x:.421875,y:.765625},{x:.421875,y:.765625},{x:.453125,y:.765625},{x:.453125,y:.765625},{x:.484375,y:.765625},{x:.484375,y:.765625},{x:.515625,y:.765625},{x:.515625,y:.765625},{x:.546875,y:.765625},{x:.546875,y:.765625},{x:.578125,y:.765625},{x:.578125,y:.765625},{x:.609375,y:.765625},{x:.609375,y:.765625},{x:.640625,y:.765625},{x:.640625,y:.765625},{x:.671875,y:.765625},{x:.671875,y:.765625},{x:.703125,y:.765625},{x:.703125,y:.765625},{x:.734375,y:.765625},{x:.734375,y:.765625},{x:.765625,y:.765625},{x:.765625,y:.765625},{x:.796875,y:.765625},{x:.796875,y:.765625},{x:.828125,y:.765625},{x:.828125,y:.765625},{x:.859375,y:.765625},{x:.859375,y:.765625},{x:.890625,y:.765625},{x:.890625,y:.765625},{x:.921875,y:.765625},{x:.921875,y:.765625},{x:.953125,y:.765625},{x:.953125,y:.765625},{x:.984375,y:.765625},{x:.984375,y:.765625},{x:.015625,y:.796875},{x:.015625,y:.796875},{x:.046875,y:.796875},{x:.046875,y:.796875},{x:.078125,y:.796875},{x:.078125,y:.796875},{x:.109375,y:.796875},{x:.109375,y:.796875},{x:.140625,y:.796875},{x:.140625,y:.796875},{x:.171875,y:.796875},{x:.171875,y:.796875},{x:.203125,y:.796875},{x:.203125,y:.796875},{x:.234375,y:.796875},{x:.234375,y:.796875},{x:.265625,y:.796875},{x:.265625,y:.796875},{x:.296875,y:.796875},{x:.296875,y:.796875},{x:.328125,y:.796875},{x:.328125,y:.796875},{x:.359375,y:.796875},{x:.359375,y:.796875},{x:.390625,y:.796875},{x:.390625,y:.796875},{x:.421875,y:.796875},{x:.421875,y:.796875},{x:.453125,y:.796875},{x:.453125,y:.796875},{x:.484375,y:.796875},{x:.484375,y:.796875},{x:.515625,y:.796875},{x:.515625,y:.796875},{x:.546875,y:.796875},{x:.546875,y:.796875},{x:.578125,y:.796875},{x:.578125,y:.796875},{x:.609375,y:.796875},{x:.609375,y:.796875},{x:.640625,y:.796875},{x:.640625,y:.796875},{x:.671875,y:.796875},{x:.671875,y:.796875},{x:.703125,y:.796875},{x:.703125,y:.796875},{x:.734375,y:.796875},{x:.734375,y:.796875},{x:.765625,y:.796875},{x:.765625,y:.796875},{x:.796875,y:.796875},{x:.796875,y:.796875},{x:.828125,y:.796875},{x:.828125,y:.796875},{x:.859375,y:.796875},{x:.859375,y:.796875},{x:.890625,y:.796875},{x:.890625,y:.796875},{x:.921875,y:.796875},{x:.921875,y:.796875},{x:.953125,y:.796875},{x:.953125,y:.796875},{x:.984375,y:.796875},{x:.984375,y:.796875},{x:.015625,y:.828125},{x:.015625,y:.828125},{x:.046875,y:.828125},{x:.046875,y:.828125},{x:.078125,y:.828125},{x:.078125,y:.828125},{x:.109375,y:.828125},{x:.109375,y:.828125},{x:.140625,y:.828125},{x:.140625,y:.828125},{x:.171875,y:.828125},{x:.171875,y:.828125},{x:.203125,y:.828125},{x:.203125,y:.828125},{x:.234375,y:.828125},{x:.234375,y:.828125},{x:.265625,y:.828125},{x:.265625,y:.828125},{x:.296875,y:.828125},{x:.296875,y:.828125},{x:.328125,y:.828125},{x:.328125,y:.828125},{x:.359375,y:.828125},{x:.359375,y:.828125},{x:.390625,y:.828125},{x:.390625,y:.828125},{x:.421875,y:.828125},{x:.421875,y:.828125},{x:.453125,y:.828125},{x:.453125,y:.828125},{x:.484375,y:.828125},{x:.484375,y:.828125},{x:.515625,y:.828125},{x:.515625,y:.828125},{x:.546875,y:.828125},{x:.546875,y:.828125},{x:.578125,y:.828125},{x:.578125,y:.828125},{x:.609375,y:.828125},{x:.609375,y:.828125},{x:.640625,y:.828125},{x:.640625,y:.828125},{x:.671875,y:.828125},{x:.671875,y:.828125},{x:.703125,y:.828125},{x:.703125,y:.828125},{x:.734375,y:.828125},{x:.734375,y:.828125},{x:.765625,y:.828125},{x:.765625,y:.828125},{x:.796875,y:.828125},{x:.796875,y:.828125},{x:.828125,y:.828125},{x:.828125,y:.828125},{x:.859375,y:.828125},{x:.859375,y:.828125},{x:.890625,y:.828125},{x:.890625,y:.828125},{x:.921875,y:.828125},{x:.921875,y:.828125},{x:.953125,y:.828125},{x:.953125,y:.828125},{x:.984375,y:.828125},{x:.984375,y:.828125},{x:.015625,y:.859375},{x:.015625,y:.859375},{x:.046875,y:.859375},{x:.046875,y:.859375},{x:.078125,y:.859375},{x:.078125,y:.859375},{x:.109375,y:.859375},{x:.109375,y:.859375},{x:.140625,y:.859375},{x:.140625,y:.859375},{x:.171875,y:.859375},{x:.171875,y:.859375},{x:.203125,y:.859375},{x:.203125,y:.859375},{x:.234375,y:.859375},{x:.234375,y:.859375},{x:.265625,y:.859375},{x:.265625,y:.859375},{x:.296875,y:.859375},{x:.296875,y:.859375},{x:.328125,y:.859375},{x:.328125,y:.859375},{x:.359375,y:.859375},{x:.359375,y:.859375},{x:.390625,y:.859375},{x:.390625,y:.859375},{x:.421875,y:.859375},{x:.421875,y:.859375},{x:.453125,y:.859375},{x:.453125,y:.859375},{x:.484375,y:.859375},{x:.484375,y:.859375},{x:.515625,y:.859375},{x:.515625,y:.859375},{x:.546875,y:.859375},{x:.546875,y:.859375},{x:.578125,y:.859375},{x:.578125,y:.859375},{x:.609375,y:.859375},{x:.609375,y:.859375},{x:.640625,y:.859375},{x:.640625,y:.859375},{x:.671875,y:.859375},{x:.671875,y:.859375},{x:.703125,y:.859375},{x:.703125,y:.859375},{x:.734375,y:.859375},{x:.734375,y:.859375},{x:.765625,y:.859375},{x:.765625,y:.859375},{x:.796875,y:.859375},{x:.796875,y:.859375},{x:.828125,y:.859375},{x:.828125,y:.859375},{x:.859375,y:.859375},{x:.859375,y:.859375},{x:.890625,y:.859375},{x:.890625,y:.859375},{x:.921875,y:.859375},{x:.921875,y:.859375},{x:.953125,y:.859375},{x:.953125,y:.859375},{x:.984375,y:.859375},{x:.984375,y:.859375},{x:.015625,y:.890625},{x:.015625,y:.890625},{x:.046875,y:.890625},{x:.046875,y:.890625},{x:.078125,y:.890625},{x:.078125,y:.890625},{x:.109375,y:.890625},{x:.109375,y:.890625},{x:.140625,y:.890625},{x:.140625,y:.890625},{x:.171875,y:.890625},{x:.171875,y:.890625},{x:.203125,y:.890625},{x:.203125,y:.890625},{x:.234375,y:.890625},{x:.234375,y:.890625},{x:.265625,y:.890625},{x:.265625,y:.890625},{x:.296875,y:.890625},{x:.296875,y:.890625},{x:.328125,y:.890625},{x:.328125,y:.890625},{x:.359375,y:.890625},{x:.359375,y:.890625},{x:.390625,y:.890625},{x:.390625,y:.890625},{x:.421875,y:.890625},{x:.421875,y:.890625},{x:.453125,y:.890625},{x:.453125,y:.890625},{x:.484375,y:.890625},{x:.484375,y:.890625},{x:.515625,y:.890625},{x:.515625,y:.890625},{x:.546875,y:.890625},{x:.546875,y:.890625},{x:.578125,y:.890625},{x:.578125,y:.890625},{x:.609375,y:.890625},{x:.609375,y:.890625},{x:.640625,y:.890625},{x:.640625,y:.890625},{x:.671875,y:.890625},{x:.671875,y:.890625},{x:.703125,y:.890625},{x:.703125,y:.890625},{x:.734375,y:.890625},{x:.734375,y:.890625},{x:.765625,y:.890625},{x:.765625,y:.890625},{x:.796875,y:.890625},{x:.796875,y:.890625},{x:.828125,y:.890625},{x:.828125,y:.890625},{x:.859375,y:.890625},{x:.859375,y:.890625},{x:.890625,y:.890625},{x:.890625,y:.890625},{x:.921875,y:.890625},{x:.921875,y:.890625},{x:.953125,y:.890625},{x:.953125,y:.890625},{x:.984375,y:.890625},{x:.984375,y:.890625},{x:.015625,y:.921875},{x:.015625,y:.921875},{x:.046875,y:.921875},{x:.046875,y:.921875},{x:.078125,y:.921875},{x:.078125,y:.921875},{x:.109375,y:.921875},{x:.109375,y:.921875},{x:.140625,y:.921875},{x:.140625,y:.921875},{x:.171875,y:.921875},{x:.171875,y:.921875},{x:.203125,y:.921875},{x:.203125,y:.921875},{x:.234375,y:.921875},{x:.234375,y:.921875},{x:.265625,y:.921875},{x:.265625,y:.921875},{x:.296875,y:.921875},{x:.296875,y:.921875},{x:.328125,y:.921875},{x:.328125,y:.921875},{x:.359375,y:.921875},{x:.359375,y:.921875},{x:.390625,y:.921875},{x:.390625,y:.921875},{x:.421875,y:.921875},{x:.421875,y:.921875},{x:.453125,y:.921875},{x:.453125,y:.921875},{x:.484375,y:.921875},{x:.484375,y:.921875},{x:.515625,y:.921875},{x:.515625,y:.921875},{x:.546875,y:.921875},{x:.546875,y:.921875},{x:.578125,y:.921875},{x:.578125,y:.921875},{x:.609375,y:.921875},{x:.609375,y:.921875},{x:.640625,y:.921875},{x:.640625,y:.921875},{x:.671875,y:.921875},{x:.671875,y:.921875},{x:.703125,y:.921875},{x:.703125,y:.921875},{x:.734375,y:.921875},{x:.734375,y:.921875},{x:.765625,y:.921875},{x:.765625,y:.921875},{x:.796875,y:.921875},{x:.796875,y:.921875},{x:.828125,y:.921875},{x:.828125,y:.921875},{x:.859375,y:.921875},{x:.859375,y:.921875},{x:.890625,y:.921875},{x:.890625,y:.921875},{x:.921875,y:.921875},{x:.921875,y:.921875},{x:.953125,y:.921875},{x:.953125,y:.921875},{x:.984375,y:.921875},{x:.984375,y:.921875},{x:.015625,y:.953125},{x:.015625,y:.953125},{x:.046875,y:.953125},{x:.046875,y:.953125},{x:.078125,y:.953125},{x:.078125,y:.953125},{x:.109375,y:.953125},{x:.109375,y:.953125},{x:.140625,y:.953125},{x:.140625,y:.953125},{x:.171875,y:.953125},{x:.171875,y:.953125},{x:.203125,y:.953125},{x:.203125,y:.953125},{x:.234375,y:.953125},{x:.234375,y:.953125},{x:.265625,y:.953125},{x:.265625,y:.953125},{x:.296875,y:.953125},{x:.296875,y:.953125},{x:.328125,y:.953125},{x:.328125,y:.953125},{x:.359375,y:.953125},{x:.359375,y:.953125},{x:.390625,y:.953125},{x:.390625,y:.953125},{x:.421875,y:.953125},{x:.421875,y:.953125},{x:.453125,y:.953125},{x:.453125,y:.953125},{x:.484375,y:.953125},{x:.484375,y:.953125},{x:.515625,y:.953125},{x:.515625,y:.953125},{x:.546875,y:.953125},{x:.546875,y:.953125},{x:.578125,y:.953125},{x:.578125,y:.953125},{x:.609375,y:.953125},{x:.609375,y:.953125},{x:.640625,y:.953125},{x:.640625,y:.953125},{x:.671875,y:.953125},{x:.671875,y:.953125},{x:.703125,y:.953125},{x:.703125,y:.953125},{x:.734375,y:.953125},{x:.734375,y:.953125},{x:.765625,y:.953125},{x:.765625,y:.953125},{x:.796875,y:.953125},{x:.796875,y:.953125},{x:.828125,y:.953125},{x:.828125,y:.953125},{x:.859375,y:.953125},{x:.859375,y:.953125},{x:.890625,y:.953125},{x:.890625,y:.953125},{x:.921875,y:.953125},{x:.921875,y:.953125},{x:.953125,y:.953125},{x:.953125,y:.953125},{x:.984375,y:.953125},{x:.984375,y:.953125},{x:.015625,y:.984375},{x:.015625,y:.984375},{x:.046875,y:.984375},{x:.046875,y:.984375},{x:.078125,y:.984375},{x:.078125,y:.984375},{x:.109375,y:.984375},{x:.109375,y:.984375},{x:.140625,y:.984375},{x:.140625,y:.984375},{x:.171875,y:.984375},{x:.171875,y:.984375},{x:.203125,y:.984375},{x:.203125,y:.984375},{x:.234375,y:.984375},{x:.234375,y:.984375},{x:.265625,y:.984375},{x:.265625,y:.984375},{x:.296875,y:.984375},{x:.296875,y:.984375},{x:.328125,y:.984375},{x:.328125,y:.984375},{x:.359375,y:.984375},{x:.359375,y:.984375},{x:.390625,y:.984375},{x:.390625,y:.984375},{x:.421875,y:.984375},{x:.421875,y:.984375},{x:.453125,y:.984375},{x:.453125,y:.984375},{x:.484375,y:.984375},{x:.484375,y:.984375},{x:.515625,y:.984375},{x:.515625,y:.984375},{x:.546875,y:.984375},{x:.546875,y:.984375},{x:.578125,y:.984375},{x:.578125,y:.984375},{x:.609375,y:.984375},{x:.609375,y:.984375},{x:.640625,y:.984375},{x:.640625,y:.984375},{x:.671875,y:.984375},{x:.671875,y:.984375},{x:.703125,y:.984375},{x:.703125,y:.984375},{x:.734375,y:.984375},{x:.734375,y:.984375},{x:.765625,y:.984375},{x:.765625,y:.984375},{x:.796875,y:.984375},{x:.796875,y:.984375},{x:.828125,y:.984375},{x:.828125,y:.984375},{x:.859375,y:.984375},{x:.859375,y:.984375},{x:.890625,y:.984375},{x:.890625,y:.984375},{x:.921875,y:.984375},{x:.921875,y:.984375},{x:.953125,y:.984375},{x:.953125,y:.984375},{x:.984375,y:.984375},{x:.984375,y:.984375},{x:.03125,y:.03125},{x:.03125,y:.03125},{x:.09375,y:.03125},{x:.09375,y:.03125},{x:.15625,y:.03125},{x:.15625,y:.03125},{x:.21875,y:.03125},{x:.21875,y:.03125},{x:.28125,y:.03125},{x:.28125,y:.03125},{x:.34375,y:.03125},{x:.34375,y:.03125},{x:.40625,y:.03125},{x:.40625,y:.03125},{x:.46875,y:.03125},{x:.46875,y:.03125},{x:.53125,y:.03125},{x:.53125,y:.03125},{x:.59375,y:.03125},{x:.59375,y:.03125},{x:.65625,y:.03125},{x:.65625,y:.03125},{x:.71875,y:.03125},{x:.71875,y:.03125},{x:.78125,y:.03125},{x:.78125,y:.03125},{x:.84375,y:.03125},{x:.84375,y:.03125},{x:.90625,y:.03125},{x:.90625,y:.03125},{x:.96875,y:.03125},{x:.96875,y:.03125},{x:.03125,y:.09375},{x:.03125,y:.09375},{x:.09375,y:.09375},{x:.09375,y:.09375},{x:.15625,y:.09375},{x:.15625,y:.09375},{x:.21875,y:.09375},{x:.21875,y:.09375},{x:.28125,y:.09375},{x:.28125,y:.09375},{x:.34375,y:.09375},{x:.34375,y:.09375},{x:.40625,y:.09375},{x:.40625,y:.09375},{x:.46875,y:.09375},{x:.46875,y:.09375},{x:.53125,y:.09375},{x:.53125,y:.09375},{x:.59375,y:.09375},{x:.59375,y:.09375},{x:.65625,y:.09375},{x:.65625,y:.09375},{x:.71875,y:.09375},{x:.71875,y:.09375},{x:.78125,y:.09375},{x:.78125,y:.09375},{x:.84375,y:.09375},{x:.84375,y:.09375},{x:.90625,y:.09375},{x:.90625,y:.09375},{x:.96875,y:.09375},{x:.96875,y:.09375},{x:.03125,y:.15625},{x:.03125,y:.15625},{x:.09375,y:.15625},{x:.09375,y:.15625},{x:.15625,y:.15625},{x:.15625,y:.15625},{x:.21875,y:.15625},{x:.21875,y:.15625},{x:.28125,y:.15625},{x:.28125,y:.15625},{x:.34375,y:.15625},{x:.34375,y:.15625},{x:.40625,y:.15625},{x:.40625,y:.15625},{x:.46875,y:.15625},{x:.46875,y:.15625},{x:.53125,y:.15625},{x:.53125,y:.15625},{x:.59375,y:.15625},{x:.59375,y:.15625},{x:.65625,y:.15625},{x:.65625,y:.15625},{x:.71875,y:.15625},{x:.71875,y:.15625},{x:.78125,y:.15625},{x:.78125,y:.15625},{x:.84375,y:.15625},{x:.84375,y:.15625},{x:.90625,y:.15625},{x:.90625,y:.15625},{x:.96875,y:.15625},{x:.96875,y:.15625},{x:.03125,y:.21875},{x:.03125,y:.21875},{x:.09375,y:.21875},{x:.09375,y:.21875},{x:.15625,y:.21875},{x:.15625,y:.21875},{x:.21875,y:.21875},{x:.21875,y:.21875},{x:.28125,y:.21875},{x:.28125,y:.21875},{x:.34375,y:.21875},{x:.34375,y:.21875},{x:.40625,y:.21875},{x:.40625,y:.21875},{x:.46875,y:.21875},{x:.46875,y:.21875},{x:.53125,y:.21875},{x:.53125,y:.21875},{x:.59375,y:.21875},{x:.59375,y:.21875},{x:.65625,y:.21875},{x:.65625,y:.21875},{x:.71875,y:.21875},{x:.71875,y:.21875},{x:.78125,y:.21875},{x:.78125,y:.21875},{x:.84375,y:.21875},{x:.84375,y:.21875},{x:.90625,y:.21875},{x:.90625,y:.21875},{x:.96875,y:.21875},{x:.96875,y:.21875},{x:.03125,y:.28125},{x:.03125,y:.28125},{x:.09375,y:.28125},{x:.09375,y:.28125},{x:.15625,y:.28125},{x:.15625,y:.28125},{x:.21875,y:.28125},{x:.21875,y:.28125},{x:.28125,y:.28125},{x:.28125,y:.28125},{x:.34375,y:.28125},{x:.34375,y:.28125},{x:.40625,y:.28125},{x:.40625,y:.28125},{x:.46875,y:.28125},{x:.46875,y:.28125},{x:.53125,y:.28125},{x:.53125,y:.28125},{x:.59375,y:.28125},{x:.59375,y:.28125},{x:.65625,y:.28125},{x:.65625,y:.28125},{x:.71875,y:.28125},{x:.71875,y:.28125},{x:.78125,y:.28125},{x:.78125,y:.28125},{x:.84375,y:.28125},{x:.84375,y:.28125},{x:.90625,y:.28125},{x:.90625,y:.28125},{x:.96875,y:.28125},{x:.96875,y:.28125},{x:.03125,y:.34375},{x:.03125,y:.34375},{x:.09375,y:.34375},{x:.09375,y:.34375},{x:.15625,y:.34375},{x:.15625,y:.34375},{x:.21875,y:.34375},{x:.21875,y:.34375},{x:.28125,y:.34375},{x:.28125,y:.34375},{x:.34375,y:.34375},{x:.34375,y:.34375},{x:.40625,y:.34375},{x:.40625,y:.34375},{x:.46875,y:.34375},{x:.46875,y:.34375},{x:.53125,y:.34375},{x:.53125,y:.34375},{x:.59375,y:.34375},{x:.59375,y:.34375},{x:.65625,y:.34375},{x:.65625,y:.34375},{x:.71875,y:.34375},{x:.71875,y:.34375},{x:.78125,y:.34375},{x:.78125,y:.34375},{x:.84375,y:.34375},{x:.84375,y:.34375},{x:.90625,y:.34375},{x:.90625,y:.34375},{x:.96875,y:.34375},{x:.96875,y:.34375},{x:.03125,y:.40625},{x:.03125,y:.40625},{x:.09375,y:.40625},{x:.09375,y:.40625},{x:.15625,y:.40625},{x:.15625,y:.40625},{x:.21875,y:.40625},{x:.21875,y:.40625},{x:.28125,y:.40625},{x:.28125,y:.40625},{x:.34375,y:.40625},{x:.34375,y:.40625},{x:.40625,y:.40625},{x:.40625,y:.40625},{x:.46875,y:.40625},{x:.46875,y:.40625},{x:.53125,y:.40625},{x:.53125,y:.40625},{x:.59375,y:.40625},{x:.59375,y:.40625},{x:.65625,y:.40625},{x:.65625,y:.40625},{x:.71875,y:.40625},{x:.71875,y:.40625},{x:.78125,y:.40625},{x:.78125,y:.40625},{x:.84375,y:.40625},{x:.84375,y:.40625},{x:.90625,y:.40625},{x:.90625,y:.40625},{x:.96875,y:.40625},{x:.96875,y:.40625},{x:.03125,y:.46875},{x:.03125,y:.46875},{x:.09375,y:.46875},{x:.09375,y:.46875},{x:.15625,y:.46875},{x:.15625,y:.46875},{x:.21875,y:.46875},{x:.21875,y:.46875},{x:.28125,y:.46875},{x:.28125,y:.46875},{x:.34375,y:.46875},{x:.34375,y:.46875},{x:.40625,y:.46875},{x:.40625,y:.46875},{x:.46875,y:.46875},{x:.46875,y:.46875},{x:.53125,y:.46875},{x:.53125,y:.46875},{x:.59375,y:.46875},{x:.59375,y:.46875},{x:.65625,y:.46875},{x:.65625,y:.46875},{x:.71875,y:.46875},{x:.71875,y:.46875},{x:.78125,y:.46875},{x:.78125,y:.46875},{x:.84375,y:.46875},{x:.84375,y:.46875},{x:.90625,y:.46875},{x:.90625,y:.46875},{x:.96875,y:.46875},{x:.96875,y:.46875},{x:.03125,y:.53125},{x:.03125,y:.53125},{x:.09375,y:.53125},{x:.09375,y:.53125},{x:.15625,y:.53125},{x:.15625,y:.53125},{x:.21875,y:.53125},{x:.21875,y:.53125},{x:.28125,y:.53125},{x:.28125,y:.53125},{x:.34375,y:.53125},{x:.34375,y:.53125},{x:.40625,y:.53125},{x:.40625,y:.53125},{x:.46875,y:.53125},{x:.46875,y:.53125},{x:.53125,y:.53125},{x:.53125,y:.53125},{x:.59375,y:.53125},{x:.59375,y:.53125},{x:.65625,y:.53125},{x:.65625,y:.53125},{x:.71875,y:.53125},{x:.71875,y:.53125},{x:.78125,y:.53125},{x:.78125,y:.53125},{x:.84375,y:.53125},{x:.84375,y:.53125},{x:.90625,y:.53125},{x:.90625,y:.53125},{x:.96875,y:.53125},{x:.96875,y:.53125},{x:.03125,y:.59375},{x:.03125,y:.59375},{x:.09375,y:.59375},{x:.09375,y:.59375},{x:.15625,y:.59375},{x:.15625,y:.59375},{x:.21875,y:.59375},{x:.21875,y:.59375},{x:.28125,y:.59375},{x:.28125,y:.59375},{x:.34375,y:.59375},{x:.34375,y:.59375},{x:.40625,y:.59375},{x:.40625,y:.59375},{x:.46875,y:.59375},{x:.46875,y:.59375},{x:.53125,y:.59375},{x:.53125,y:.59375},{x:.59375,y:.59375},{x:.59375,y:.59375},{x:.65625,y:.59375},{x:.65625,y:.59375},{x:.71875,y:.59375},{x:.71875,y:.59375},{x:.78125,y:.59375},{x:.78125,y:.59375},{x:.84375,y:.59375},{x:.84375,y:.59375},{x:.90625,y:.59375},{x:.90625,y:.59375},{x:.96875,y:.59375},{x:.96875,y:.59375},{x:.03125,y:.65625},{x:.03125,y:.65625},{x:.09375,y:.65625},{x:.09375,y:.65625},{x:.15625,y:.65625},{x:.15625,y:.65625},{x:.21875,y:.65625},{x:.21875,y:.65625},{x:.28125,y:.65625},{x:.28125,y:.65625},{x:.34375,y:.65625},{x:.34375,y:.65625},{x:.40625,y:.65625},{x:.40625,y:.65625},{x:.46875,y:.65625},{x:.46875,y:.65625},{x:.53125,y:.65625},{x:.53125,y:.65625},{x:.59375,y:.65625},{x:.59375,y:.65625},{x:.65625,y:.65625},{x:.65625,y:.65625},{x:.71875,y:.65625},{x:.71875,y:.65625},{x:.78125,y:.65625},{x:.78125,y:.65625},{x:.84375,y:.65625},{x:.84375,y:.65625},{x:.90625,y:.65625},{x:.90625,y:.65625},{x:.96875,y:.65625},{x:.96875,y:.65625},{x:.03125,y:.71875},{x:.03125,y:.71875},{x:.09375,y:.71875},{x:.09375,y:.71875},{x:.15625,y:.71875},{x:.15625,y:.71875},{x:.21875,y:.71875},{x:.21875,y:.71875},{x:.28125,y:.71875},{x:.28125,y:.71875},{x:.34375,y:.71875},{x:.34375,y:.71875},{x:.40625,y:.71875},{x:.40625,y:.71875},{x:.46875,y:.71875},{x:.46875,y:.71875},{x:.53125,y:.71875},{x:.53125,y:.71875},{x:.59375,y:.71875},{x:.59375,y:.71875},{x:.65625,y:.71875},{x:.65625,y:.71875},{x:.71875,y:.71875},{x:.71875,y:.71875},{x:.78125,y:.71875},{x:.78125,y:.71875},{x:.84375,y:.71875},{x:.84375,y:.71875},{x:.90625,y:.71875},{x:.90625,y:.71875},{x:.96875,y:.71875},{x:.96875,y:.71875},{x:.03125,y:.78125},{x:.03125,y:.78125},{x:.09375,y:.78125},{x:.09375,y:.78125},{x:.15625,y:.78125},{x:.15625,y:.78125},{x:.21875,y:.78125},{x:.21875,y:.78125},{x:.28125,y:.78125},{x:.28125,y:.78125},{x:.34375,y:.78125},{x:.34375,y:.78125},{x:.40625,y:.78125},{x:.40625,y:.78125},{x:.46875,y:.78125},{x:.46875,y:.78125},{x:.53125,y:.78125},{x:.53125,y:.78125},{x:.59375,y:.78125},{x:.59375,y:.78125},{x:.65625,y:.78125},{x:.65625,y:.78125},{x:.71875,y:.78125},{x:.71875,y:.78125},{x:.78125,y:.78125},{x:.78125,y:.78125},{x:.84375,y:.78125},{x:.84375,y:.78125},{x:.90625,y:.78125},{x:.90625,y:.78125},{x:.96875,y:.78125},{x:.96875,y:.78125},{x:.03125,y:.84375},{x:.03125,y:.84375},{x:.09375,y:.84375},{x:.09375,y:.84375},{x:.15625,y:.84375},{x:.15625,y:.84375},{x:.21875,y:.84375},{x:.21875,y:.84375},{x:.28125,y:.84375},{x:.28125,y:.84375},{x:.34375,y:.84375},{x:.34375,y:.84375},{x:.40625,y:.84375},{x:.40625,y:.84375},{x:.46875,y:.84375},{x:.46875,y:.84375},{x:.53125,y:.84375},{x:.53125,y:.84375},{x:.59375,y:.84375},{x:.59375,y:.84375},{x:.65625,y:.84375},{x:.65625,y:.84375},{x:.71875,y:.84375},{x:.71875,y:.84375},{x:.78125,y:.84375},{x:.78125,y:.84375},{x:.84375,y:.84375},{x:.84375,y:.84375},{x:.90625,y:.84375},{x:.90625,y:.84375},{x:.96875,y:.84375},{x:.96875,y:.84375},{x:.03125,y:.90625},{x:.03125,y:.90625},{x:.09375,y:.90625},{x:.09375,y:.90625},{x:.15625,y:.90625},{x:.15625,y:.90625},{x:.21875,y:.90625},{x:.21875,y:.90625},{x:.28125,y:.90625},{x:.28125,y:.90625},{x:.34375,y:.90625},{x:.34375,y:.90625},{x:.40625,y:.90625},{x:.40625,y:.90625},{x:.46875,y:.90625},{x:.46875,y:.90625},{x:.53125,y:.90625},{x:.53125,y:.90625},{x:.59375,y:.90625},{x:.59375,y:.90625},{x:.65625,y:.90625},{x:.65625,y:.90625},{x:.71875,y:.90625},{x:.71875,y:.90625},{x:.78125,y:.90625},{x:.78125,y:.90625},{x:.84375,y:.90625},{x:.84375,y:.90625},{x:.90625,y:.90625},{x:.90625,y:.90625},{x:.96875,y:.90625},{x:.96875,y:.90625},{x:.03125,y:.96875},{x:.03125,y:.96875},{x:.09375,y:.96875},{x:.09375,y:.96875},{x:.15625,y:.96875},{x:.15625,y:.96875},{x:.21875,y:.96875},{x:.21875,y:.96875},{x:.28125,y:.96875},{x:.28125,y:.96875},{x:.34375,y:.96875},{x:.34375,y:.96875},{x:.40625,y:.96875},{x:.40625,y:.96875},{x:.46875,y:.96875},{x:.46875,y:.96875},{x:.53125,y:.96875},{x:.53125,y:.96875},{x:.59375,y:.96875},{x:.59375,y:.96875},{x:.65625,y:.96875},{x:.65625,y:.96875},{x:.71875,y:.96875},{x:.71875,y:.96875},{x:.78125,y:.96875},{x:.78125,y:.96875},{x:.84375,y:.96875},{x:.84375,y:.96875},{x:.90625,y:.96875},{x:.90625,y:.96875},{x:.96875,y:.96875},{x:.96875,y:.96875},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375}];var og=class{constructor(t){var n;this.model=t,this.anchors=Ek.map(a=>[a.x,a.y]),this.anchorsTensor=ya(this.anchors),this.inputSize=(n=this.model)==null?void 0:n.inputs[0].shape[2],this.inputSizeTensor=Tt([this.inputSize,this.inputSize]),this.doubleInputSizeTensor=Tt([this.inputSize*2,this.inputSize*2])}normalizeBoxes(t){return W(()=>{let n=Re(t,[0,0],[-1,2]),a=Re(t,[0,2],[-1,2]),r=se(me(n,this.inputSizeTensor),this.anchorsTensor),s=me(a,this.doubleInputSizeTensor),i=_(ge(r,s),this.inputSizeTensor),o=_(se(r,s),this.inputSizeTensor);return cl([i,o],1)})}normalizeLandmarks(t,n){return W(()=>{let a=se(me(t.reshape([-1,7,2]),this.inputSizeTensor),this.anchors[n]);return _(a,this.inputSizeTensor)})}async getBoxes(t,n){let a=this.model.predict(t),r=a.squeeze();a.dispose();let s=W(()=>wn(Re(r,[0,0],[-1,1])).squeeze()),i=s.dataSync(),o=Re(r,[0,1],[-1,4]),l=this.normalizeBoxes(o);o.dispose();let d=await Ye.nonMaxSuppressionAsync(l,i,n.hand.maxDetected,n.hand.iouThreshold,n.hand.minConfidence),u=d.arraySync();s.dispose(),d.dispose();let p=[];for(let c of u)if(i[c]>=n.hand.minConfidence){let h=Re(l,[c,0],[1,-1]),m=Re(r,[c,5],[1,14]),f=W(()=>this.normalizeLandmarks(m,c).reshape([-1,2]));m.dispose(),p.push({box:h,palmLandmarks:f,confidence:i[c]})}return r.dispose(),l.dispose(),p}async estimateHandBounds(t,n){let a=t.shape[1],r=t.shape[2],s=W(()=>t.resizeBilinear([this.inputSize,this.inputSize]).div(127.5).sub(1)),i=await this.getBoxes(s,n);s.dispose();let o=[];if(!i||i.length===0)return o;for(let l of i){let d=l.box.dataSync(),u=d.slice(0,2),p=d.slice(2,4),c=l.palmLandmarks.arraySync();l.box.dispose(),l.palmLandmarks.dispose(),o.push(Tk({startPoint:u,endPoint:p,palmLandmarks:c,confidence:l.confidence},[r/this.inputSize,a/this.inputSize]))}return o}};function Wie(e){return e-2*Math.PI*Math.floor((e+Math.PI)/(2*Math.PI))}function Ck(e,t){let n=Math.PI/2-Math.atan2(-(t[1]-e[1]),t[0]-e[0]);return Wie(n)}var Rk=(e,t)=>[[1,0,e],[0,1,t],[0,0,1]];function Zr(e,t){let n=0;for(let a=0;ai[0]),a=t.map(i=>i[1]),r=[Math.min(...n),Math.min(...a)],s=[Math.max(...n),Math.max(...a)];return{startPoint:r,endPoint:s}}getBoxForPalmLandmarks(t,n){let a=t.map(s=>ug([...s,1],n)),r=this.calculateLandmarksBoundingBox(a);return N0(T0(r),Vie)}getBoxForHandLandmarks(t){let n=this.calculateLandmarksBoundingBox(t),a=N0(T0(n),$k);a.palmLandmarks=[];for(let r=0;r[i[0]*(h[0]-this.inputSize/2),i[1]*(h[1]-this.inputSize/2),i[2]*h[2]]),l=lg(a,[0,0]),d=o.map(h=>[...ug(h,l),h[2]]),u=Fk(r),p=[...Zd(n),1],c=[Zr(p,u[0]),Zr(p,u[1])];return d.map(h=>[h[0]+c[0],h[1]+c[1],h[2]])}async estimateHands(t,n){let a=!1,r;(this.skipped===0||this.skipped>n.hand.skipFrames||!n.hand.landmarks||!n.videoOptimized)&&(r=await this.handDetector.estimateHandBounds(t,n),this.skipped=0),n.videoOptimized&&this.skipped++,r&&r.length>0&&(r.length!==this.detectedHands&&this.detectedHands!==n.hand.maxDetected||!n.hand.landmarks)&&(this.detectedHands=0,this.storedBoxes=[...r],this.storedBoxes.length>0&&(a=!0));let s=[];n.hand.skipInitial&&this.detectedHands===0&&(this.skipped=0);for(let i=0;i=n.hand.minConfidence){let x=H(y,[-1,3]),w=x.arraySync();y.dispose(),x.dispose();let b=this.transformRawCoords(w,h,l,c),v=this.getBoxForHandLandmarks(b);this.storedBoxes[i]=v;let N={landmarks:b,confidence:g,box:{topLeft:v.startPoint,bottomRight:v.endPoint}};s.push(N)}else this.storedBoxes[i]=null;y.dispose()}else{let l=N0(T0(o),$k),d={confidence:o.confidence,box:{topLeft:l.startPoint,bottomRight:l.endPoint}};s.push(d)}}return this.storedBoxes=this.storedBoxes.filter(i=>i!==null),this.detectedHands=s.length,s}};var Ok={thumb:[1,2,3,4],indexFinger:[5,6,7,8],middleFinger:[9,10,11,12],ringFinger:[13,14,15,16],pinky:[17,18,19,20],palmBase:[0]},Yr,Jr,zk;async function cg(e,t){let n=await zk.estimateHands(e,t);if(!n)return[];let a=[];for(let r of n){let s={};if(r.landmarks)for(let l of Object.keys(Ok))s[l]=Ok[l].map(d=>r.landmarks[d]);let i=r.box?[Math.max(0,r.box.topLeft[0]),Math.max(0,r.box.topLeft[1]),Math.min(e.shape[2],r.box.bottomRight[0])-Math.max(0,r.box.topLeft[0]),Math.min(e.shape[1],r.box.bottomRight[1])-Math.max(0,r.box.topLeft[1])]:[],o=[r.box.topLeft[0]/e.shape[2],r.box.topLeft[1]/e.shape[1],(r.box.bottomRight[0]-r.box.topLeft[0])/e.shape[2],(r.box.bottomRight[1]-r.box.topLeft[1])/e.shape[1]];a.push({confidence:Math.round(100*r.confidence)/100,box:i,boxRaw:o,landmarks:r.landmarks,annotations:s})}return a}async function hg(e){!Yr||!Jr?([Yr,Jr]=await Promise.all([e.hand.enabled?Gt(Yt(e.modelBasePath,e.hand.detector.modelPath),{fromTFHub:e.hand.detector.modelPath.includes("tfhub.dev")}):null,e.hand.landmarks?Gt(Yt(e.modelBasePath,e.hand.skeleton.modelPath),{fromTFHub:e.hand.skeleton.modelPath.includes("tfhub.dev")}):null]),e.hand.enabled&&(!Yr||!Yr.modelUrl?he("load model failed:",e.hand.detector.modelPath):e.debug&&he("load model:",Yr.modelUrl),!Jr||!Jr.modelUrl?he("load model failed:",e.hand.skeleton.modelPath):e.debug&&he("load model:",Jr.modelUrl))):(e.debug&&he("cached model:",Yr.modelUrl),e.debug&&he("cached model:",Jr.modelUrl));let t=new og(Yr);return zk=new dg(t,Jr),[Yr,Jr]}var fg={};Ma(fg,{load:()=>mg,predict:()=>Ag});var _k=["nose","leftEyeInside","leftEye","leftEyeOutside","rightEyeInside","rightEye","rightEyeOutside","leftEar","rightEar","leftMouth","rightMouth","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftPalm","rightPalm","leftIndex","rightIndex","leftPinky","rightPinky","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle","leftHeel","rightHeel","leftFoot","rightFoot","midHip","forehead","leftThumb","leftHand","rightThumb","rightHand"],Pk=["nose","leftEyeInside","leftEye","leftEyeOutside","rightEyeInside","rightEye","rightEyeOutside","leftEar","rightEar","leftMouth","rightMouth","leftShoulder","rightShoulder","leftElbow","rightElbow","left:15","right:16","left:17","right:18","left:19","right:20","left:21","right:22","leftChest","rightChest","neck","forehead","left:27","right:28","left:29","right:30"];var En;async function mg(e){return En?e.debug&&he("cached model:",En.modelUrl):(En=await Gt(Yt(e.modelBasePath,e.body.modelPath)),En.width=parseInt(En.signature.inputs["input_1:0"].tensorShape.dim[2].size),En.height=parseInt(En.signature.inputs["input_1:0"].tensorShape.dim[1].size),!En||!En.modelUrl?he("load model failed:",e.body.modelPath):e.debug&&he("load model:",En.modelUrl)),En}async function Ag(e,t){if(!En||!t.body.enabled)return null;let n={width:e.shape[2],height:e.shape[1]},a=Ye.resizeBilinear(e,[En.width,En.height],!1),r=me(a,[255]);a.dispose();let s=await En.predict(r),i=s.find(p=>p.size===195||p.size===155).dataSync();s.forEach(p=>p.dispose()),r.dispose();let o=[],l=i.length===195?_k:Pk,d=5;for(let p=0;pc.score>p?c.score:p,0),keypoints:o}]}var yg={};Ma(yg,{load:()=>xg,predict:()=>bg});var E0=[{class:1,label:"person"},{class:2,label:"bicycle"},{class:3,label:"car"},{class:4,label:"motorcycle"},{class:5,label:"airplane"},{class:6,label:"bus"},{class:7,label:"train"},{class:8,label:"truck"},{class:9,label:"boat"},{class:10,label:"traffic light"},{class:11,label:"fire hydrant"},{class:12,label:"stop sign"},{class:13,label:"parking meter"},{class:14,label:"bench"},{class:15,label:"bird"},{class:16,label:"cat"},{class:17,label:"dog"},{class:18,label:"horse"},{class:19,label:"sheep"},{class:20,label:"cow"},{class:21,label:"elephant"},{class:22,label:"bear"},{class:23,label:"zebra"},{class:24,label:"giraffe"},{class:25,label:"backpack"},{class:26,label:"umbrella"},{class:27,label:"handbag"},{class:28,label:"tie"},{class:29,label:"suitcase"},{class:30,label:"frisbee"},{class:31,label:"skis"},{class:32,label:"snowboard"},{class:33,label:"sports ball"},{class:34,label:"kite"},{class:35,label:"baseball bat"},{class:36,label:"baseball glove"},{class:37,label:"skateboard"},{class:38,label:"surfboard"},{class:39,label:"tennis racket"},{class:40,label:"bottle"},{class:41,label:"wine glass"},{class:42,label:"cup"},{class:43,label:"fork"},{class:44,label:"knife"},{class:45,label:"spoon"},{class:46,label:"bowl"},{class:47,label:"banana"},{class:48,label:"apple"},{class:49,label:"sandwich"},{class:50,label:"orange"},{class:51,label:"broccoli"},{class:52,label:"carrot"},{class:53,label:"hot dog"},{class:54,label:"pizza"},{class:55,label:"donut"},{class:56,label:"cake"},{class:57,label:"chair"},{class:58,label:"couch"},{class:59,label:"potted plant"},{class:60,label:"bed"},{class:61,label:"dining table"},{class:62,label:"toilet"},{class:63,label:"tv"},{class:64,label:"laptop"},{class:65,label:"mouse"},{class:66,label:"remote"},{class:67,label:"keyboard"},{class:68,label:"cell phone"},{class:69,label:"microwave"},{class:70,label:"oven"},{class:71,label:"toaster"},{class:72,label:"sink"},{class:73,label:"refrigerator"},{class:74,label:"book"},{class:75,label:"clock"},{class:76,label:"vase"},{class:77,label:"scissors"},{class:78,label:"teddy bear"},{class:79,label:"hair drier"},{class:80,label:"toothbrush"}];var Cn,gg=[],C0=Number.MAX_SAFE_INTEGER,R0=2.5;async function xg(e){if(Cn)e.debug&&he("cached model:",Cn.modelUrl);else{Cn=await Gt(Yt(e.modelBasePath,e.object.modelPath));let t=Object.values(Cn.modelSignature.inputs);if(Cn.inputSize=Array.isArray(t)?parseInt(t[0].tensorShape.dim[2].size):null,!Cn.inputSize)throw new Error(`Human: Cannot determine model inputSize: ${e.object.modelPath}`);!Cn||!Cn.modelUrl?he("load model failed:",e.object.modelPath):e.debug&&he("load model:",Cn.modelUrl)}return Cn}async function Hie(e,t,n,a){let r=0,s=[];for(let d of[1,2,4])W(()=>{var A,y;let u=d*13,p=(A=e.find(g=>g.shape[1]===u**2&&g.shape[2]===E0.length))==null?void 0:A.squeeze(),c=(y=e.find(g=>g.shape[1]===u**2&&g.shape[2]a.object.minConfidence&&x!==61){let b=(.5+Math.trunc(g%u))/u,v=(.5+Math.trunc(g/u))/u,N=m[g].map(U=>U*(u/d/t)),[T,R]=[b-R0/d*N[0],v-R0/d*N[1]],[$,z]=[b+R0/d*N[2]-T,v+R0/d*N[3]-R],P=[T,R,$,z];P=P.map(U=>Math.max(0,Math.min(U,1)));let V=[P[0]*n[0],P[1]*n[1],P[2]*n[0],P[3]*n[1]],j={id:r++,strideSize:d,score:Math.round(100*w)/100,class:x+1,label:E0[x].label,center:[Math.trunc(n[0]*b),Math.trunc(n[1]*v)],centerRaw:[b,v],box:V.map(U=>Math.trunc(U)),boxRaw:P};s.push(j)}}});e.forEach(d=>Ee(d));let i=s.map(d=>d.boxRaw),o=s.map(d=>d.score),l=[];if(i&&i.length>0){let d=await Ye.nonMaxSuppressionAsync(i,o,a.object.maxDetected,a.object.iouThreshold,a.object.minConfidence);l=d.dataSync(),Ee(d)}return s=s.filter((d,u)=>l.includes(u)).sort((d,u)=>u.score-d.score),s}async function bg(e,t){return Cn?C00?(C0++,gg):(t.videoOptimized?C0=0:C0=Number.MAX_SAFE_INTEGER,new Promise(async n=>{let a=[e.shape[2],e.shape[1]],r=Ye.resizeBilinear(e,[Cn.inputSize,Cn.inputSize],!1),s=r.div(255),i=s.transpose([0,3,1,2]);s.dispose(),r.dispose();let o;t.object.enabled&&(o=await Cn.predict(i)),i.dispose();let l=await Hie(o,Cn.inputSize,a,t);gg=l,n(l)})):null}var Lk=e=>{if(!e)return[];let t=[];for(let n=0;nl.part==="leftWrist"),r=e[n].keypoints.find(l=>l.part==="rightWrist"),s=e[n].keypoints.find(l=>l.part==="nose");s&&a&&r&&a.position.yl.part==="leftShoulder"),o=e[n].keypoints.find(l=>l.part==="rightShoulder");i&&o&&t.push({body:n,gesture:`leaning ${i.position.y>o.position.y?"left":"right"}`})}return t},Wk=e=>{if(!e)return[];let t=[];for(let n=0;n0){let a=e[n].mesh[33][2]-e[n].mesh[263][2];Math.abs(a)<10?t.push({face:n,gesture:"facing center"}):t.push({face:n,gesture:`facing ${a<0?"left":"right"}`}),Math.abs(e[n].mesh[374][1]-e[n].mesh[386][1])/Math.abs(e[n].mesh[443][1]-e[n].mesh[450][1])<.2&&t.push({face:n,gesture:"blink left eye"}),Math.abs(e[n].mesh[145][1]-e[n].mesh[159][1])/Math.abs(e[n].mesh[223][1]-e[n].mesh[230][1])<.2&&t.push({face:n,gesture:"blink right eye"});let i=Math.min(100,500*Math.abs(e[n].mesh[13][1]-e[n].mesh[14][1])/Math.abs(e[n].mesh[10][1]-e[n].mesh[152][1]));i>10&&t.push({face:n,gesture:`mouth ${Math.trunc(i)}% open`});let o=e[n].mesh[152][2];Math.abs(o)>10&&t.push({face:n,gesture:`head ${o<0?"up":"down"}`})}return t},Bk=e=>{if(!e)return[];let t=[];for(let n=0;n.033||p>.033)&&(d=!1),c>.033&&t.push({iris:n,gesture:"looking right"}),p>.033&&t.push({iris:n,gesture:"looking left"});let h=Math.abs(e[n].mesh[145][1]-e[n].annotations.rightEyeIris[0][1])/e[n].annotations.rightEyeIris[0][1],m=Math.abs(e[n].mesh[374][1]-e[n].annotations.leftEyeIris[0][1])/e[n].annotations.leftEyeIris[0][1];(m<.015||h<.015||m>.03||h>.03)&&(d=!1),(m<.015||h<.015)&&t.push({iris:n,gesture:"looking down"}),(m>.03||h>.03)&&t.push({iris:n,gesture:"looking up"}),d&&t.push({iris:n,gesture:"looking center"})}return t},Vk=e=>{if(!e)return[];let t=[];for(let n=0;n0){let r=a.reduce((i,o)=>i.position[2]i.position[1]wg});function Gie(e,t,n){let a=function(o,l,d){let u=new RegExp("\\b"+l+" \\w+ (\\w+)","ig");o.replace(u,(p,c)=>(d[c]=0,p))},r=function(o,l){let d=e.createShader(l);if(e.shaderSource(d,o),e.compileShader(d),!e.getShaderParameter(d,e.COMPILE_STATUS))throw new Error("Filter: GL compile failed",e.getShaderInfoLog(d));return d};this.uniform={},this.attribute={};let s=r(t,e.VERTEX_SHADER),i=r(n,e.FRAGMENT_SHADER);if(this.id=e.createProgram(),e.attachShader(this.id,s),e.attachShader(this.id,i),e.linkProgram(this.id),!e.getProgramParameter(this.id,e.LINK_STATUS))throw new Error("Filter: GL link failed",e.getProgramInfoLog(this.id));e.useProgram(this.id),a(t,"attribute",this.attribute);for(let o in this.attribute)this.attribute[o]=e.getAttribLocation(this.id,o);a(t,"uniform",this.uniform),a(n,"uniform",this.uniform);for(let o in this.uniform)this.uniform[o]=e.getUniformLocation(this.id,o)}function jk(e){e||(e={});let t=0,n=null,a=!1,r=-1,s=[null,null],i=[],o=-1,l=-1,d=null,u=null,p={},c=e.canvas||document.createElement("canvas"),h={},m={INTERMEDIATE:1},f=c.getContext("webgl");if(!f)throw new Error("Filter: getContext() failed");this.addFilter=function(b){let v=Array.prototype.slice.call(arguments,1),N=p[b];i.push({func:N,args:v})},this.reset=function(){i=[]};let A=function(b,v){if(!(b===o&&v===l)){if(c.width=b,o=b,c.height=v,l=v,!d){let N=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,-1,1,0,0,1,-1,1,1,1,1,1,0]);d=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,d),f.bufferData(f.ARRAY_BUFFER,N,f.STATIC_DRAW),f.pixelStorei(f.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0)}f.viewport(0,0,o,l),s=[null,null]}},y=function(b,v){let N=f.createFramebuffer();f.bindFramebuffer(f.FRAMEBUFFER,N);let T=f.createRenderbuffer();f.bindRenderbuffer(f.RENDERBUFFER,T);let R=f.createTexture();return f.bindTexture(f.TEXTURE_2D,R),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,b,v,0,f.RGBA,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.LINEAR),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.LINEAR),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,R,0),f.bindTexture(f.TEXTURE_2D,null),f.bindFramebuffer(f.FRAMEBUFFER,null),{fbo:N,texture:R}},g=function(b){return s[b]=s[b]||y(o,l),s[b]},x=function(b=null){var R,$;let v=null,N=null,T=!1;t===0?v=n:v=(R=g(r))==null?void 0:R.texture,t++,a&&!(b&m.INTERMEDIATE)?(N=null,T=t%2==0):(r=(r+1)%2,N=($=g(r))==null?void 0:$.fbo),f.bindTexture(f.TEXTURE_2D,v),f.bindFramebuffer(f.FRAMEBUFFER,N),f.uniform1f(u.uniform.flipY,T?-1:1),f.drawArrays(f.TRIANGLES,0,6)};this.apply=function(b){if(A(b.width,b.height),t=0,n||(n=f.createTexture()),f.bindTexture(f.TEXTURE_2D,n),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b),i.length===0)return x(),c;for(let v=0;v{let u=[];e=H(e,[1,a,o]);for(let p=0;p{switch(e.op){case"If":case"StatelessIf":{let a=I("thenBranch",e,t,n),r=I("elseBranch",e,t,n),s=I("cond",e,t,n),i=I("args",e,t,n);return(await s.data())[0]?n.functionMap[a].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap):n.functionMap[r].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap)}case"While":case"StatelessWhile":{let a=I("body",e,t,n),r=I("cond",e,t,n),s=I("args",e,t,n),i=await n.functionMap[r].executeFunctionAsync(s,n.tensorArrayMap,n.tensorListMap),o=s.map(u=>u.id),l=await i[0].data();i.forEach(u=>{!u.kept&&o.indexOf(u.id)===-1&&u.dispose()});let d=s;for(;l[0];){let u=d;d=await n.functionMap[a].executeFunctionAsync(d,n.tensorArrayMap,n.tensorListMap);let p=d.map(h=>h.id);u.forEach(h=>{!h.kept&&o.indexOf(h.id)===-1&&p.indexOf(h.id)===-1&&h.dispose()});let c=await n.functionMap[r].executeFunctionAsync(d,n.tensorArrayMap,n.tensorListMap);l=await c[0].data(),c.forEach(h=>{!h.kept&&o.indexOf(h.id)===-1&&p.indexOf(h.id)===-1&&h.dispose()})}return d}case"LoopCond":{let a=I("pred",e,t,n);return[hr(a)]}case"Switch":{let a=I("pred",e,t,n),r=I("data",e,t,n);return r.kept||(r=hr(r)),(await a.data())[0]?[void 0,r]:[r,void 0]}case"Merge":{let a=e.inputNames.find(r=>mn(r,t,n)!==void 0);if(a){let r=mn(a,t,n);return[hr(r)]}return}case"Enter":{let a=I("frameName",e,t,n),r=I("tensor",e,t,n);return n.enterFrame(a),[hr(r)]}case"Exit":{let a=I("tensor",e,t,n);return n.exitFrame(),[hr(a)]}case"NextIteration":{let a=I("tensor",e,t,n);return n.nextIteration(),[hr(a)]}case"TensorArrayV3":{let a=I("size",e,t,n),r=I("dtype",e,t,n),s=I("elementShape",e,t,n),i=I("dynamicSize",e,t,n),o=I("clearAfterRead",e,t,n),l=I("identicalElementShapes",e,t,n),d=I("name",e,t,n),u=new ose(d,r,a,s,l,i,o);return n.addTensorArray(u),[u.idTensor,Se(1)]}case"TensorArrayWriteV3":{let a=I("tensorArrayId",e,t,n),r=I("index",e,t,n),s=I("tensor",e,t,n),i=n.getTensorArray(a.id);return i.write(r,s),[i.idTensor]}case"TensorArrayReadV3":{let a=I("tensorArrayId",e,t,n),r=I("index",e,t,n);return[n.getTensorArray(a.id).read(r)]}case"TensorArrayGatherV3":{let a=I("tensorArrayId",e,t,n),r=I("indices",e,t,n),s=I("dtype",e,t,n);return[n.getTensorArray(a.id).gather(r,s)]}case"TensorArrayScatterV3":{let a=I("tensorArrayId",e,t,n),r=I("indices",e,t,n),s=I("tensor",e,t,n),i=n.getTensorArray(a.id);return i.scatter(r,s),[i.idTensor]}case"TensorArrayConcatV3":{let a=I("tensorArrayId",e,t,n),r=n.getTensorArray(a.id),s=I("dtype",e,t,n);return[r.concat(s)]}case"TensorArraySplitV3":{let a=I("tensorArrayId",e,t,n),r=I("tensor",e,t,n),s=I("lengths",e,t,n),i=n.getTensorArray(a.id);return i.split(s,r),[i.idTensor]}case"TensorArraySizeV3":{let a=I("tensorArrayId",e,t,n),r=n.getTensorArray(a.id);return[Se(r.size(),"int32")]}case"TensorArrayCloseV3":{let a=I("tensorArrayId",e,t,n),r=n.getTensorArray(a.id);return r.clearAndClose(),[r.idTensor]}case"TensorListSetItem":{let a=I("tensorListId",e,t,n),r=I("index",e,t,n),s=I("tensor",e,t,n),i=n.getTensorList(a.id);return i.setItem(r,s),[i.idTensor]}case"TensorListGetItem":{let a=I("tensorListId",e,t,n),r=I("index",e,t,n),s=I("elementShape",e,t,n),i=I("elementDType",e,t,n);return[n.getTensorList(a.id).getItem(r,s,i)]}case"TensorListScatterV2":case"TensorListScatter":{let a=I("indices",e,t,n),r=I("tensor",e,t,n),s=I("elementShape",e,t,n),i=I("numElements",e,t,n),o=dse(r,a,s,i);return n.addTensorList(o),[o.idTensor]}case"TensorListReserve":case"EmptyTensorList":{let a=I("elementShape",e,t,n),r=I("elementDType",e,t,n),s;e.op==="TensorListReserve"?s="numElements":s="maxNumElements";let i=I(s,e,t,n),o=use(a,r,i);return n.addTensorList(o),[o.idTensor]}case"TensorListGather":{let a=I("tensorListId",e,t,n),r=I("indices",e,t,n),s=I("elementShape",e,t,n),i=I("elementDType",e,t,n);return[n.getTensorList(a.id).gather(r,i,s)]}case"TensorListStack":{let a=I("tensorListId",e,t,n),r=I("elementShape",e,t,n),s=I("elementDType",e,t,n),i=I("numElements",e,t,n);return[n.getTensorList(a.id).stack(r,s,i)]}case"TensorListFromTensor":{let a=I("tensor",e,t,n),r=I("elementShape",e,t,n),s=I("elementDType",e,t,n),i=lse(a,r,s);return n.addTensorList(i),[i.idTensor]}case"TensorListConcat":{let a=I("tensorListId",e,t,n),r=n.getTensorList(a.id),s=I("dtype",e,t,n),i=I("elementShape",e,t,n);return[r.concat(s,i)]}case"TensorListPushBack":{let a=I("tensorListId",e,t,n),r=I("tensor",e,t,n),s=n.getTensorList(a.id);return s.pushBack(r),[s.idTensor]}case"TensorListPopBack":{let a=I("tensorListId",e,t,n),r=I("elementShape",e,t,n),s=I("elementDType",e,t,n);return[n.getTensorList(a.id).popBack(r,s)]}case"TensorListSplit":{let a=I("tensor",e,t,n),r=I("elementShape",e,t,n),s=I("lengths",e,t,n),i=pse(a,s,r);return n.addTensorList(i),[i.idTensor]}default:throw TypeError(`Node type ${e.op} is not implemented`)}};function M8(e,t,n){let[a,r]=I("fusedOps",e,t,n),s=a==="biasadd",i=r==="prelu",o=a==="fusedbatchnorm",l=I("numArgs",e,t,n);if(s){if(i&&l!==2)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!i&&l!==1)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.")}if(o)throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported");let d=I("strides",e,t,n),u=d0(e,t,n),p=I("dataFormat",e,t,n).toUpperCase(),c=I("dilations",e,t,n),[h,m]=I("args",e,t,n),f=I("leakyreluAlpha",e,t,n);return{stride:d,pad:u,dataFormat:p,dilations:c,biasArg:h,preluArg:m,activationFunc:r,leakyreluAlpha:f}}var hse=(e,t,n)=>{switch(e.op){case"Conv1D":{let a=I("stride",e,t,n),r=I("pad",e,t,n),s=I("dataFormat",e,t,n).toUpperCase(),i=I("dilation",e,t,n);return[vc(I("x",e,t,n),I("filter",e,t,n),a,r,s,i)]}case"Conv2D":{let a=I("strides",e,t,n),r=d0(e,t,n),s=I("dataFormat",e,t,n).toUpperCase(),i=I("dilations",e,t,n);return[ar(I("x",e,t,n),I("filter",e,t,n),[a[1],a[2]],r,s,[i[1],i[2]])]}case"_FusedConv2D":{let{stride:a,pad:r,dataFormat:s,dilations:i,biasArg:o,preluArg:l,activationFunc:d,leakyreluAlpha:u}=M8(e,t,n);return[_r.conv2d({x:I("x",e,t,n),filter:I("filter",e,t,n),strides:[a[1],a[2]],pad:r,dataFormat:s,dilations:[i[1],i[2]],bias:o,activation:d,preluActivationWeights:l,leakyreluAlpha:u})]}case"FusedDepthwiseConv2dNative":{let{stride:a,pad:r,dataFormat:s,dilations:i,biasArg:o,preluArg:l,activationFunc:d,leakyreluAlpha:u}=M8(e,t,n);return[_r.depthwiseConv2d({x:I("x",e,t,n),filter:I("filter",e,t,n),strides:[a[1],a[2]],pad:r,dataFormat:s,dilations:[i[1],i[2]],bias:o,activation:d,preluActivationWeights:l,leakyreluAlpha:u})]}case"Conv2DBackpropInput":case"Conv2dTranspose":{let a=I("outputShape",e,t,n),r=I("strides",e,t,n),s=d0(e,t,n);return[wc(I("x",e,t,n),I("filter",e,t,n),a,[r[1],r[2]],s)]}case"DepthwiseConv2dNative":case"DepthwiseConv2d":{let a=I("strides",e,t,n),r=d0(e,t,n),s=I("dilations",e,t,n),i=I("dataFormat",e,t,n).toUpperCase();return[fl(I("input",e,t,n),I("filter",e,t,n),[a[1],a[2]],r,i,[s[1],s[2]])]}case"Conv3D":{let a=I("strides",e,t,n),r=I("pad",e,t,n),s=I("dataFormat",e,t,n).toUpperCase(),i=I("dilations",e,t,n);return[cA(I("x",e,t,n),I("filter",e,t,n),[a[1],a[2],a[3]],r,s,[i[1],i[2],i[3]])]}case"AvgPool":{let a=I("strides",e,t,n),r=I("pad",e,t,n),s=I("kernelSize",e,t,n);return[qu(I("x",e,t,n),[s[1],s[2]],[a[1],a[2]],r)]}case"MaxPool":{let a=I("strides",e,t,n),r=I("pad",e,t,n),s=I("kernelSize",e,t,n);return[Ju(I("x",e,t,n),[s[1],s[2]],[a[1],a[2]],r)]}case"MaxPoolWithArgmax":{let a=I("strides",e,t,n),r=I("pad",e,t,n),s=I("kernelSize",e,t,n),i=I("includeBatchInIndex",e,t,n),{result:o,indexes:l}=Kb(I("x",e,t,n),[s[1],s[2]],[a[1],a[2]],r,i);return[o,l]}case"AvgPool3D":{let a=I("strides",e,t,n),r=I("pad",e,t,n),s=I("kernelSize",e,t,n);return[lA(I("x",e,t,n),[s[1],s[2],s[3]],[a[1],a[2],a[3]],r)]}case"MaxPool3D":{let a=I("strides",e,t,n),r=I("pad",e,t,n),s=I("kernelSize",e,t,n);return[IA(I("x",e,t,n),[s[1],s[2],s[3]],[a[1],a[2],a[3]],r)]}case"Dilation2D":{let a=I("strides",e,t,n),r=I("pad",e,t,n),s=I("dilations",e,t,n),i=a[1],o=a[2],l=s[1],d=s[2];return[fA(I("x",e,t,n),I("filter",e,t,n),[i,o],r,[l,d],"NHWC")]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},fse=(e,t,n)=>{switch(e.op){case"Fill":{let a=I("shape",e,t,n),r=I("dtype",e,t,n),s=I("value",e,t,n);return[Al(a,s,r)]}case"LinSpace":{let a=I("start",e,t,n),r=I("stop",e,t,n),s=I("num",e,t,n);return[Vb(a,r,s)]}case"Multinomial":{let a=I("logits",e,t,n),r=I("numSamples",e,t,n),s=I("seed",e,t,n);return[Zb(a,r,s)]}case"OneHot":{let a=I("indices",e,t,n),r=I("depth",e,t,n),s=I("onValue",e,t,n),i=I("offValue",e,t,n);return[ll(a,r,s,i)]}case"Ones":return[$n(I("shape",e,t,n),I("dtype",e,t,n))];case"OnesLike":return[Dn(I("x",e,t,n))];case"RandomUniform":return[bl(I("shape",e,t,n),I("minval",e,t,n),I("maxval",e,t,n),I("dtype",e,t,n))];case"Range":{let a=I("start",e,t,n),r=I("stop",e,t,n),s=I("step",e,t,n);return[vl(a,r,s,I("dtype",e,t,n))]}case"TruncatedNormal":{let a=I("shape",e,t,n),r=I("mean",e,t,n),s=I("stdDev",e,t,n),i=I("seed",e,t,n);return[jc(a,r,s,I("dtype",e,t,n),i)]}case"Zeros":return[Ct(I("shape",e,t,n),I("dtype",e,t,n))];case"ZerosLike":return[Ue(I("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function C2(e,t,n){let a=I("boxes",e,t,n),r=I("scores",e,t,n),s=I("maxOutputSize",e,t,n),i=I("iouThreshold",e,t,n),o=I("scoreThreshold",e,t,n),l=I("softNmsSigma",e,t,n);return{boxes:a,scores:r,maxOutputSize:s,iouThreshold:i,scoreThreshold:o,softNmsSigma:l}}var mse=async(e,t,n)=>{switch(e.op){case"NonMaxSuppressionV5":{let{boxes:a,scores:r,maxOutputSize:s,iouThreshold:i,scoreThreshold:o,softNmsSigma:l}=C2(e,t,n),d=await Ye.nonMaxSuppressionWithScoreAsync(a,r,s,i,o,l);return[d.selectedIndices,d.selectedScores]}case"NonMaxSuppressionV4":{let{boxes:a,scores:r,maxOutputSize:s,iouThreshold:i,scoreThreshold:o}=C2(e,t,n),l=I("padToMaxOutputSize",e,t,n),d=await Ye.nonMaxSuppressionPaddedAsync(a,r,s,i,o,l);return[d.selectedIndices,d.validOutputs]}case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":{let{boxes:a,scores:r,maxOutputSize:s,iouThreshold:i,scoreThreshold:o}=C2(e,t,n);return[await Ye.nonMaxSuppressionAsync(a,r,s,i,o)]}case"Where":{let a=fe(I("condition",e,t,n),"bool"),r=[await _A(a)];return a.dispose(),r}case"ListDiff":return Qb(I("x",e,t,n),I("y",e,t,n));default:throw TypeError(`Node type ${e.op} is not implemented`)}},Ase=(e,t,n)=>{switch(e.op){case"TopKV2":{let a=I("x",e,t,n),r=I("k",e,t,n),s=I("sorted",e,t,n),i=OA(a,r,s);return[i.values,i.indices]}case"Unique":{let a=I("x",e,t,n),r=Uc(a);return[r.values,r.indices]}case"UniqueV2":{let a=I("x",e,t,n),r=I("axis",e,t,n),s=Uc(a,r);return[s.values,s.indices]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},yse=(e,t,n)=>{switch(e.op){case"Const":return t[e.name];case"PlaceholderWithDefault":let a=I("default",e,t,n);return[mn(e.name,t,n)||a];case"Placeholder":return[mn(e.name,t,n)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":{let d=I("x",e,t,n);return[hr(d)]}case"IdentityN":return I("x",e,t,n).map(d=>hr(d));case"Snapshot":let r=I("x",e,t,n);return[hr(r)];case"Shape":return[Tt(I("x",e,t,n).shape,"int32")];case"ShapeN":return I("x",e,t,n).map(d=>Tt(d.shape));case"Size":return[Se(I("x",e,t,n).size,"int32")];case"Rank":return[Se(I("x",e,t,n).rank,"int32")];case"NoOp":return[Se(1)];case"Print":let s=I("x",e,t,n),i=I("data",e,t,n),o=I("message",e,t,n),l=I("summarize",e,t,n);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(o);for(let d=0;de.dispose()),this.tensorMap.clear(),this.handle.dispose()}size(){return this.tensorMap.size}tensorSize(){return Se(this.size(),"int32")}async import(e,t){this.checkKeyAndValueTensor(e,t);let n=await e.data();return this.tensorMap.forEach(a=>a.dispose()),this.tensorMap.clear(),W(()=>{let a=la(t),r=n.length,s=a.length;k.assert(r===s,()=>`The number of elements doesn't match, keys has ${r} elements, the values has ${s} elements.`);for(let i=0;i{let a=[];for(let r=0;r{switch(e.op){case"HashTable":case"HashTableV2":{let r=I("keyDType",e,t,n),s=I("valueDType",e,t,n),i=new gse(r,s);return a.addHashTable(e.name,i),[i.handle]}case"LookupTableImport":case"LookupTableImportV2":{let r=I("tableHandle",e,t,n,a),s=I("keys",e,t,n),i=I("values",e,t,n);return[await a.getHashTableById(r.id).import(s,i)]}case"LookupTableFind":case"LookupTableFindV2":{let r=I("tableHandle",e,t,n,a),s=I("keys",e,t,n),i=I("defaultValue",e,t,n);return[await a.getHashTableById(r.id).find(s,i)]}case"LookupTableSize":case"LookupTableSizeV2":{let r=I("tableHandle",e,t,n,a);return[a.getHashTableById(r.id).tensorSize()]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},bse=(e,t,n)=>{switch(e.op){case"ResizeBilinear":{let a=I("images",e,t,n),r=I("size",e,t,n),s=I("alignCorners",e,t,n),i=I("halfPixelCenters",e,t,n);return[Ye.resizeBilinear(a,[r[0],r[1]],s,i)]}case"ResizeNearestNeighbor":{let a=I("images",e,t,n),r=I("size",e,t,n),s=I("alignCorners",e,t,n),i=I("halfPixelCenters",e,t,n);return[Ye.resizeNearestNeighbor(a,[r[0],r[1]],s,i)]}case"CropAndResize":{let a=I("image",e,t,n),r=I("boxes",e,t,n),s=I("boxInd",e,t,n),i=I("cropSize",e,t,n),o=I("method",e,t,n),l=I("extrapolationValue",e,t,n);return[Ye.cropAndResize(a,r,s,i,o,l)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},vse=(e,t,n)=>{switch(e.op){case"Equal":return[Fr(I("a",e,t,n),I("b",e,t,n))];case"NotEqual":return[Ai(I("a",e,t,n),I("b",e,t,n))];case"Greater":return[Mn(I("a",e,t,n),I("b",e,t,n))];case"GreaterEqual":return[Dr(I("a",e,t,n),I("b",e,t,n))];case"Less":return[Nc(I("a",e,t,n),I("b",e,t,n))];case"LessEqual":return[Or(I("a",e,t,n),I("b",e,t,n))];case"LogicalAnd":return[oa(I("a",e,t,n),I("b",e,t,n))];case"LogicalNot":return[Yu(I("a",e,t,n))];case"LogicalOr":return[Rc(I("a",e,t,n),I("b",e,t,n))];case"Select":case"SelectV2":return[nn(I("condition",e,t,n),I("a",e,t,n),I("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},wse=(e,t,n)=>{switch(e.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[Be(I("a",e,t,n),I("b",e,t,n),I("transposeA",e,t,n),I("transposeB",e,t,n))];case"Einsum":return[Lb(I("equation",e,t,n),...I("tensors",e,t,n))];case"Transpose":return[Ze(I("x",e,t,n),I("perm",e,t,n))];case"_FusedMatMul":let[a,r]=I("fusedOps",e,t,n),s=a==="biasadd",i=r==="prelu",o=I("numArgs",e,t,n),l=I("leakyreluAlpha",e,t,n);if(s){if(i&&o!==2)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!i&&o!==1)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}let[d,u]=I("args",e,t,n);return[_r.matMul({a:I("a",e,t,n),b:I("b",e,t,n),transposeA:I("transposeA",e,t,n),transposeB:I("transposeB",e,t,n),bias:d,activation:r,preluActivationWeights:u,leakyreluAlpha:l})];default:throw TypeError(`Node type ${e.op} is not implemented`)}},kse=(e,t,n)=>{switch(e.op){case"FusedBatchNorm":case"FusedBatchNormV2":return[ci(I("x",e,t,n),I("mean",e,t,n),I("variance",e,t,n),I("offset",e,t,n),I("scale",e,t,n),I("epsilon",e,t,n))];case"FusedBatchNormV3":return[ci(I("x",e,t,n),I("mean",e,t,n),I("variance",e,t,n),I("offset",e,t,n),I("scale",e,t,n),I("epsilon",e,t,n))];case"LRN":return[bA(I("x",e,t,n),I("radius",e,t,n),I("bias",e,t,n),I("alpha",e,t,n),I("beta",e,t,n))];case"Softmax":return[ad(I("x",e,t,n))];case"LogSoftmax":return[Cc(I("x",e,t,n))];case"SparseToDense":return[PA(I("sparseIndices",e,t,n),I("outputShape",e,t,n),I("sparseValues",e,t,n),I("defaultValue",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},Ise=(e,t,n)=>{switch(e.op){case"Max":{let i=I("axis",e,t,n),o=I("keepDims",e,t,n);return[Xn(I("x",e,t,n),i,o)]}case"Mean":{let i=I("axis",e,t,n),o=I("keepDims",e,t,n);return[wt(I("x",e,t,n),i,o)]}case"Min":{let i=I("axis",e,t,n),o=I("keepDims",e,t,n);return[gl(I("x",e,t,n),i,o)]}case"Sum":{let i=I("axis",e,t,n),o=I("keepDims",e,t,n);return[ke(I("x",e,t,n),i,o)]}case"All":{let i=I("axis",e,t,n),o=I("keepDims",e,t,n);return[xc(I("x",e,t,n),i,o)]}case"Any":{let i=I("axis",e,t,n),o=I("keepDims",e,t,n);return[Uu(I("x",e,t,n),i,o)]}case"ArgMax":{let i=I("axis",e,t,n);return[Hu(I("x",e,t,n),i)]}case"ArgMin":{let i=I("axis",e,t,n);return[eA(I("x",e,t,n),i)]}case"Prod":{let i=I("axis",e,t,n),o=I("keepDims",e,t,n);return[Fc(I("x",e,t,n),i,o)]}case"Cumsum":{let i=I("axis",e,t,n),o=I("exclusive",e,t,n),l=I("reverse",e,t,n);return[Ic(I("x",e,t,n),i,o,l)]}case"Bincount":let a=I("x",e,t,n),r=I("weights",e,t,n),s=I("size",e,t,n);return[uA(a,r,s)];case"DenseBincount":{let i=I("x",e,t,n),o=I("weights",e,t,n),l=I("size",e,t,n),d=I("binaryOutput",e,t,n);return[_b(i,o,l,d)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},Sse=(e,t,n)=>{switch(e.op){case"ConcatV2":case"Concat":{let a=I("n",e,t,n),r=I("axis",e,t,n),s=I("tensors",e,t,n);return s=s.slice(0,a),[ot(s,r)]}case"Gather":{let a=I("x",e,t,n),r=I("indices",e,t,n);return[hi(a,fe(r,"int32"),0)]}case"GatherV2":{let a=I("axis",e,t,n),r=I("batchDims",e,t,n),s=I("x",e,t,n),i=I("indices",e,t,n);return[hi(s,fe(i,"int32"),a,r)]}case"Reverse":{let a=I("dims",e,t,n),r=[];for(let i=0;i{let a=I("axis",e,t,n),r=I("tensors",e,t,n),s=r[0].shape,i=zr(r[0]).shape,o=r.map(l=>{let d=k.arraysEqual(l.shape,s);if(!d&&!k.arraysEqual(zr(l).shape,i))throw new Error("the input tensors shape does not match");return d?l:H(l,s)});return[zn(o,a)]});case"Unpack":{let a=I("axis",e,t,n),r=I("tensor",e,t,n);return la(r,a)}case"Tile":{let a=I("reps",e,t,n);return[$r(I("x",e,t,n),a)]}case"Split":case"SplitV":{let a=I("axis",e,t,n),r=I("numOrSizeSplits",e,t,n),s=I("x",e,t,n);return an(s,r,a)}case"ScatterNd":{let a=I("indices",e,t,n),r=I("values",e,t,n),s=I("shape",e,t,n);return[a3(a,r,s)]}case"GatherNd":{let a=I("x",e,t,n),r=I("indices",e,t,n);return[r3(a,r)]}case"SparseToDense":{let a=I("sparseIndices",e,t,n),r=I("outputShape",e,t,n),s=I("sparseValues",e,t,n),i=I("defaultValue",e,t,n);return[PA(a,s,r,s.dtype===i.dtype?i:fe(i,s.dtype))]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},Nse=(e,t,n)=>{switch(e.op){case"SparseReshape":{let{outputIndices:a,outputShape:r}=x3.sparseReshape(I("inputIndices",e,t,n),I("inputShape",e,t,n),I("newShape",e,t,n));return[a,r]}default:throw TypeError(`Node type ${e.op} is not implemented`)}},Tse=(e,t,n)=>{switch(e.op){case"FFT":return[rd(I("x",e,t,n))];case"IFFT":return[wl(I("x",e,t,n))];case"RFFT":return[sd(I("x",e,t,n))];case"IRFFT":return[Bc(I("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}},Ese=(e,t,n)=>{switch(e.op){case"Cast":return[fe(I("x",e,t,n),I("dtype",e,t,n))];case"ExpandDims":{let a=I("axis",e,t,n);return[ln(I("x",e,t,n),a)]}case"Squeeze":{let a=I("axis",e,t,n);return[zr(I("x",e,t,n),a)]}case"Reshape":return[H(I("x",e,t,n),I("shape",e,t,n))];case"MirrorPad":return[SA(I("x",e,t,n),I("padding",e,t,n),I("mode",e,t,n))];case"PadV2":case"Pad":return[rr(I("x",e,t,n),I("padding",e,t,n),I("constantValue",e,t,n))];case"SpaceToBatchND":{let a=I("blockShape",e,t,n),r=I("paddings",e,t,n);return[Qu(I("x",e,t,n),a,r)]}case"BatchToSpaceND":{let a=I("blockShape",e,t,n),r=I("crops",e,t,n);return[Xu(I("x",e,t,n),a,r)]}case"DepthToSpace":{let a=I("blockSize",e,t,n),r=I("dataFormat",e,t,n).toUpperCase();return[hA(I("x",e,t,n),a,r)]}case"BroadcastTo":return[cl(I("x",e,t,n),I("shape",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function F8(e,t,n,a){let r=((s,i,o)=>{switch(s.category){case"arithmetic":return W(()=>sse(s,i,o));case"basic_math":return W(()=>ise(s,i,o));case"control":return cse(s,i,o);case"convolution":return W(()=>hse(s,i,o));case"creation":return W(()=>fse(s,i,o));case"dynamic":return mse(s,i,o);case"evaluation":return W(()=>Ase(s,i,o));case"image":return W(()=>bse(s,i,o));case"graph":return W(()=>yse(s,i,o));case"logical":return W(()=>vse(s,i,o));case"matrices":return W(()=>wse(s,i,o));case"normalization":return W(()=>kse(s,i,o));case"reduction":return W(()=>Ise(s,i,o));case"slice_join":return W(()=>Sse(s,i,o));case"sparse":return W(()=>Nse(s,i,o));case"spectral":return W(()=>Tse(s,i,o));case"transformation":return W(()=>Ese(s,i,o));case"hash_table":return xse(s,i,o,a);case"custom":let l=l8(s.op);if(l&&l.customExecutor)return l.customExecutor(new rse(s,i,o));throw TypeError(`Custom op ${s.op} is not registered.`);default:throw TypeError(`Unknown op '${s.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 k.isPromise(r)?r.then(s=>[].concat(s)):[].concat(r)}var $8=class{constructor(e={},t={},n={},a={}){this.weightMap=e,this.tensorArrayMap=t,this.tensorListMap=n,this.functionMap=a,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(){let e=[];for(let t=0;tt.id===0&&t.iterationId===0?"":`${t.frameName}-${t.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)this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift();else throw new Error("Cannot exit frame, the context is empty")}nextIteration(){if(this.contexts&&this.contexts.length>0){this.contexts=this.contexts.slice(),this.lastId++;let 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))}else throw new Error("Cannot increase frame iteration, the context is empty")}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(let t in this.tensorArrayMap)this.tensorArrayMap[t].clearAndClose(e);for(let t in this.tensorListMap)this.tensorListMap[t].clearAndClose(e)}};function O8(e,t,n,a){let r=new Set,s=[],i=null,o=null,l=new Set,d=Object.keys(e).map(c=>Ln(c)[0]),u=[];a!=null&&(u=a.map(c=>Ln(c.name)[0]));let p=[...t];for(;p.length>0;){let c=p.pop();if((D8(c)||Cse(c)||Rse(c))&&i==null&&(i=c,o=i.children.map(h=>h.name).filter(h=>r.has(h))),r.add(c.name),n[c.name]==null&&d.indexOf(c.name)===-1&&u.indexOf(c.name)===-1){if(c.inputs.length===0){s.push(c.name);continue}c.inputs.forEach(h=>{l.has(h.name)||(l.add(h.name),p.push(h))})}}return{inputs:e,outputs:t,usedNodes:r,missingInputs:s,dynamicNode:i,syncInputs:o}}function Mse(e,t,n){let{usedNodes:a,inputs:r}=n,s=[],i=Object.keys(r).map(u=>Ln(u)[0]).map(u=>e.nodes[u]),o=e.initNodes;i.forEach(u=>{a.has(u.name)&&s.push(u)}),e.weights.forEach(u=>{a.has(u.name)&&s.push(u)}),o!=null&&o.forEach(u=>{a.has(u.name)&&s.push(u)});let l=new Set,d=[];for(;s.length>0;){let u=s.pop();l.add(u.name),t[u.name]||d.push(u),u.children.forEach(p=>{!l.has(p.name)&&a.has(p.name)&&p.inputs.every(c=>l.has(c.name))&&s.push(p)})}return d}var Fse=["Switch","Merge","Enter","Exit","NextIteration","StatelessIf","StatelessWhile","if","While"],$se=["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"],Dse=["HashTable","HashTableV2","LookupTableImport","LookupTableImportV2","LookupTableFind","LookupTableFindV2","LookupTableSize","LookupTableSizeV2"];function D8(e){return Fse.indexOf(e.op)>=0}function Cse(e){return $se.indexOf(e.op)>=0}function Rse(e){return Dse.indexOf(e.op)>=0}var R2=class{constructor(e,t){this.graph=e,this.parent=t,this.compiledMap=new Map,this._weightMap={},this.SEPERATOR=",",this._functions={},this._functionExecutorMap={},this._outputs=e.outputs,this._inputs=e.inputs,this._initNodes=e.initNodes,this._signature=e.signature,this._functions=e.functions,e.functions!=null&&Object.keys(e.functions).forEach(n=>{this._functionExecutorMap[n]=new R2(e.functions[n],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){let t=Object.keys(e).map(n=>e[n].map(a=>a.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=>{let 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){let n=e.map(r=>r.name).sort(),a=t.map(r=>r.name).sort();return n.join(this.SEPERATOR)+"--"+a.join(this.SEPERATOR)}compile(e,t){let n=O8(e,t,this.weightMap,this._initNodes),{missingInputs:a,dynamicNode:r,syncInputs:s}=n;if(r!=null)throw new Error(`This execution contains the node '${r.name}', which has the dynamic op '${r.op}'. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs [${s}]`);if(a.length>0){let i=t.map(l=>l.name),o=Object.keys(e);throw new Error(`Cannot compute the outputs [${i}] from the provided inputs [${o}]. Missing the following inputs: [${a}]`)}return Mse(this.graph,this.weightMap,n)}execute(e,t){e=this.mapInputs(e);let n=Object.keys(e).sort();this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t);let a=n.map(u=>this.graph.nodes[Ln(u)[0]]),r=t.map(u=>Ln(u)[0]),s=r.map(u=>this.graph.nodes[u]);s.length===0&&(s=this._outputs);let i=this.getCompilationKey(a,s),o=this.compiledMap.get(i);o==null&&(o=this.compile(e,s),this.compiledMap.set(i,o));let l={},d={};return W(()=>{let u=new $8(this.weightMap,l,d,this.functionExecutorMap),p=Object.assign({},this.weightMap);Object.keys(e).forEach(m=>{let[f,A]=Ln(m),y=[];y[A]=e[m],p[f]=y});let c=this.getFrozenTensorIds(p),h={};for(let m=0;mmn(m,p,u))})}getFrozenTensorIds(e){let t=[].concat.apply([],Object.keys(e).map(n=>e[n]).map(n=>n.map(a=>a.id)));return new Set(t)}checkTensorForDisposal(e,t,n,a,r,s,i){t.category==="control"||s.indexOf(e)!==-1||(n[e].forEach(o=>{o!=null&&(i[o.id]=(i[o.id]||0)+t.children.length)}),t.inputs.forEach(o=>{if(o.category!=="control"){let l=Lre(o.name,n,a);l!=null&&l.forEach(d=>{if(d&&!d.kept&&!r.has(d.id)){let u=i[d.id];u===1?(d.dispose(),delete i[d.id]):u!=null&&i[d.id]--}})}}))}async executeAsync(e,t){return this._executeAsync(e,t)}async _executeAsync(e,t,n=!1,a={},r={}){n||(e=this.mapInputs(e),this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t));let s=new $8(this.weightMap,a,r,this.functionExecutorMap),i=await this.executeWithControlFlow(e,s,t,n),o=t.map(p=>mn(p,i,s)),l=o.map(p=>p.id),d=Object.keys(e).map(p=>e[p].id),u=new Set([...l,...d,...this.weightIds]);return Object.keys(i).forEach(p=>{i[p].forEach(c=>{c&&!c.kept&&!c.isDisposed&&!u.has(c.id)&&c.dispose()})}),this.parent==null&&s.dispose(u),o}async executeFunctionAsync(e,t,n){let a=e.reduce((r,s,i)=>(r[this.inputs[i].name]=s,r),{});return this._executeAsync(a,this.outputNodes,!0,t,n)}async executeWithControlFlow(e,t,n,a){let r=Object.keys(e),s=r.map(g=>this.graph.nodes[Ln(g)[0]]),i=n.map(g=>Ln(g)[0]),o=i.map(g=>this.graph.nodes[g]);o.length===0&&(o=this._outputs);let{usedNodes:l,missingInputs:d,dynamicNode:u,syncInputs:p}=O8(e,o,this.weightMap,this._initNodes),c=[...s,...this.graph.weights,...this._initNodes||[]].map(g=>({node:g,contexts:t.currentContext})),h=Object.assign({},this.weightMap);Object.keys(e).forEach(g=>{let[x,w]=Ln(g),b=[];b[w]=e[g],h[x]=b});let m={},f=this.getFrozenTensorIds(h),A={};for(;c.length>0;){let g=this.processStack(s,c,t,h,A,f,i,m,l);await Promise.all(g)}u==null&&!a&&console.warn("This model execution did not contain any nodes with control flow or dynamic output shapes. You can use model.execute() instead.");let y=o.filter(g=>!D8(g)&&!mn(g.name,h,t)).map(g=>g.name);if(y.length>0){let g="";throw u!=null&&(g=`Alternatively, to avoid the dynamic ops, use model.execute() and specify the inputs [${p}]`),new Error(`Cannot compute the outputs [${y}] from the provided inputs [${r}]. Consider providing the following inputs: [${d}]. ${g}`)}return h}processStack(e,t,n,a,r,s,i,o,l){let d=[];for(;t.length>0;){let u=t.pop();n.currentContext=u.contexts;let p="";if(u.node.op==="Enter"&&I("isConstant",u.node,a,n)&&([p]=cr(u.node.name,n)),a[u.node.name]==null){let c=F8(u.node,a,n,this._resourceManager);p||([p]=cr(u.node.name,n));let h=n.currentContext;k.isPromise(c)?d.push(c.then(m=>(a[p]=m,n.currentContext=h,this.checkTensorForDisposal(p,u.node,a,n,s,i,o),this.processChildNodes(u.node,t,n,a,r,l),m))):(a[p]=c,this.checkTensorForDisposal(p,u.node,a,n,s,i,o),this.processChildNodes(u.node,t,n,a,r,l))}else this.processChildNodes(u.node,t,n,a,r,l)}return d}processChildNodes(e,t,n,a,r,s){e.children.forEach(i=>{let[o]=cr(i.name,n);r[o]||!s.has(i.name)||(i.op==="Merge"?i.inputNames.some(l=>!!mn(l,a,n))&&(r[o]=!0,t.push({contexts:n.currentContext,node:i})):i.inputNames.every(l=>!!mn(l,a,n))&&(r[o]=!0,t.push({contexts:n.currentContext,node:i})))})}dispose(){Object.keys(this.weightMap).forEach(e=>this.weightMap[e].forEach(t=>t.dispose()))}checkInputShapeAndType(e){Object.keys(e).forEach(t=>{let n=e[t],[a]=Ln(t),r=this.graph.nodes[a];if(r.attrParams.shape&&r.attrParams.shape.value){let s=r.attrParams.shape.value,i=s.length===n.shape.length&&n.shape.every((o,l)=>s[l]===-1||s[l]===o);k.assert(i,()=>`The shape of dict['${r.name}'] provided in model.execute(dict) must be [${s}], but was [${n.shape}]`)}r.attrParams.dtype&&r.attrParams.dtype.value&&k.assert(n.dtype===r.attrParams.dtype.value,()=>`The dtype of dict['${r.name}'] provided in model.execute(dict) must be ${r.attrParams.dtype.value}, but was ${n.dtype}`)})}mapInputs(e){let t={};for(let n in e)if(this._signature!=null&&this._signature.inputs!=null&&this._signature.inputs[n]!=null){let a=this._signature.inputs[n];t[a.name]=e[n]}else t[n]=e[n];return t}checkInputs(e){let t=Object.keys(e).filter(n=>{let[a]=Ln(n);return this.graph.nodes[a]==null});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(t=>this._signature!=null&&this._signature.outputs!=null&&this._signature.outputs[t]!=null?this._signature.outputs[t].name:t,{})}checkOutputs(e){e.forEach(t=>{let[n]=Ln(t);if(!this.graph.nodes[n])throw new Error(`The output '${t}' is not found in the graph`)})}},Ose=class{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(let e in this.hashTableMap)this.hashTableMap[e].clearAndClose(),delete this.hashTableMap[e];for(let e in this.hashTableNameToHandle)this.hashTableNameToHandle[e].dispose(),delete this.hashTableNameToHandle[e]}},zse="?tfjs-format=file",_se="model.json",z8=class{constructor(e,t={}){this.modelUrl=e,this.loadOptions=t,this.version="n/a",t==null&&(this.loadOptions={}),this.resourceManager=new Ose}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}findIOHandler(){let e=this.modelUrl;if(e.load!=null)this.handler=e;else if(this.loadOptions.requestInit!=null)this.handler=vn.browserHTTPRequest(e,this.loadOptions);else{let t=vn.getLoadHandlers(e,this.loadOptions);if(t.length===0)t.push(vn.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]}}async load(){if(this.findIOHandler(),this.handler.load==null)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");let e=await this.handler.load();return this.loadSync(e)}loadSync(e){this.artifacts=e;let t=this.artifacts.modelTopology,n;this.artifacts.userDefinedMetadata!=null&&this.artifacts.userDefinedMetadata.signature!=null?n=this.artifacts.userDefinedMetadata.signature:n=this.artifacts.signature,this.signature=n,this.version=`${t.versions.producer}.${t.versions.minConsumer}`;let a=vn.decodeWeights(this.artifacts.weightData,this.artifacts.weightSpecs);if(this.executor=new R2(T8.Instance.transformGraph(t,this.signature)),this.executor.weightMap=this.convertTensorMapToTensorsMap(a),this.executor.resourceManager=this.resourceManager,e.modelInitializer!=null&&e.modelInitializer.node!=null){let r=T8.Instance.transformGraph(e.modelInitializer);this.initializer=new R2(r),this.initializer.weightMap=this.executor.weightMap,this.initializer.resourceManager=this.resourceManager,this.initializer.executeAsync({},[])}return!0}async save(e,t){if(typeof e=="string"){let n=vn.getSaveHandlers(e);if(n.length===0)throw new Error(`Cannot find any save handlers for URL '${e}'`);if(n.length>1)throw new Error(`Found more than one (${n.length}) save handlers for URL '${e}'`);e=n[0]}if(e.save==null)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){return this.execute(e,this.outputNodes)}normalizeInputs(e){if(!(e instanceof Le)&&!Array.isArray(e))return e;if(e=Array.isArray(e)?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,a)=>(t[n]=e[a],t),{})}normalizeOutputs(e){return e=e||this.outputNodes,Array.isArray(e)?e:[e]}execute(e,t){e=this.normalizeInputs(e),t=this.normalizeOutputs(t);let 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);let n=await this.executor.executeAsync(e,t);return n.length>1?n:n[0]}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 Gt(e,t={}){if(e==null)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");t==null&&(t={}),t.fromTFHub&&e.load==null&&(e.endsWith("/")||(e=e+"/"),e=`${e}${_se}${zse}`);let n=new z8(e,t);return await n.load(),n}var Pse="3.6.0",_8={};Fe(_8,{CSVDataset:()=>L8,Dataset:()=>ql,FileDataSource:()=>W8,TextLineDataset:()=>P8,URLDataSource:()=>B8,array:()=>Lse,csv:()=>Bse,func:()=>Vse,generator:()=>jse,microphone:()=>Hse,version_data:()=>Gse,webcam:()=>Use,zip:()=>Wse});var qse=Yi(jg()),Xse=Yi(jg());function Kse(e,t){return p0(e,t)}function p0(e,t,n=new Map,a=new Set){if(e==null)return null;if(a.has(e))throw new Error("Circular references are not supported.");if(n.has(e))return n.get(e);let r=t(e);if(r.recurse&&r.value!==null)throw new Error("A deep map function may not return both a value and recurse=true.");if(r.recurse)if(Xl(e)){let s=Array.isArray(e)?[]:{};a.add(e);for(let i in e){let o=e[i],l=p0(o,t,n,a);s[i]=l}return a.delete(e),s}else throw new Error(`Can't recurse into non-iterable type: ${e}`);else return n.set(e,r.value),r.value}function Zse(e,t=j8){return V8(e,t)}function V8(e,t,n=new Set){let a=e[0];if(n.has(a))throw new Error("Circular references are not supported.");let r=t(e);if(r.recurse&&r.value!==null)throw new Error("A deep zip function may not return both a value and recurse=true.");if(r.recurse)if(Xl(a)){let s=Array.isArray(a)?[]:{};n.add(a);for(let i in a){let o=e.map(d=>d[i]),l=V8(o,t,n);s[i]=l}return n.delete(a),s}else throw new Error(`Can't recurse into non-iterable type: ${a}`);else return r.value}function j8(e){return e===null?null:Xl(e[0])?{value:null,recurse:!0}:{value:e,recurse:!1}}async function U8(e,t){let n=new Map;p0(e,t,n);for(let a of Array.from(n.keys())){let r=n.get(a);if(k.isPromise(r)){let s=await r;n.set(a,s)}}return p0(e,t,n)}function Xl(e){return e!=null&&!ArrayBuffer.isView(e)&&(Array.isArray(e)||typeof e=="object"&&!(e instanceof Le))}function Jse(e){return e==null||Yse(e)||Array.isArray(e)||typeof e=="object"&&e instanceof Le||k.isTypedArray(e)}function Yse(e){return e===null||typeof e!="object"&&typeof e!="function"}function eie(e){return Kse(e,Qse)}function Qse(e){return e instanceof Le?{value:e.clone(),recurse:!1}:Xl(e)?{value:null,recurse:!0}:{value:e,recurse:!1}}var H8=class{constructor(e){if(this.capacity=e,this.begin=0,this.end=0,e==null)throw new RangeError("Can't create a ring buffer of unknown capacity.");if(e<1)throw new RangeError("Can't create ring buffer of capacity < 1.");this.data=new Array(e),this.doubledCapacity=2*e}wrap(e){for(;e<0;)e+=this.doubledCapacity;return e%this.doubledCapacity}get(e){if(e<0)throw new RangeError("Can't get item at a negative index.");return this.data[e%this.capacity]}set(e,t){if(e<0)throw new RangeError("Can't set item at a negative index.");this.data[e%this.capacity]=t}length(){let e=this.end-this.begin;return e<0&&(e=this.doubledCapacity+e),e}isFull(){return this.length()===this.capacity}isEmpty(){return this.length()===0}push(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.set(this.end,e),this.end=this.wrap(this.end+1)}pushAll(e){for(let t of e)this.push(t)}pop(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");this.end=this.wrap(this.end-1);let e=this.get(this.end);return this.set(this.end,void 0),e}unshift(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.begin=this.wrap(this.begin-1),this.set(this.begin,e)}shift(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");let e=this.get(this.begin);return this.set(this.begin,void 0),this.begin=this.wrap(this.begin+1),e}shuffleExcise(e){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");let t=this.wrap(this.begin+e),n=this.get(t);return this.set(t,this.pop()),n}},M2=class extends H8{constructor(){super(M2.INITIAL_CAPACITY)}isFull(){return!1}push(e){super.isFull()&&this.expand(),super.push(e)}unshift(e){super.isFull()&&this.expand(),super.unshift(e)}expand(){let e=this.capacity*2,t=new Array(e),n=this.length();for(let a=0;at===!0)}rowMajorBatch(e,t=!0){return new uie(this,e,t)}columnMajorBatch(e,t=!0,n=j8){return this.rowMajorBatch(e,t).map(a=>Zse(a,n))}concatenate(e,t){return new q8(G8([this,e]),t)}take(e){return e<0||e==null?this:new lie(this,e)}skip(e){return e<0||e==null?this:new oie(this,e)}prefetch(e){return new K8(this,e)}shuffle(e,t){return new fie(this,e,t)}serial(){return new iie(this)}},tie=class extends qt{constructor(e){super();this.items=e,this.trav=0}summary(){return`Array of ${this.items.length} items`}async next(){if(this.trav>=this.items.length)return{value:null,done:!0};let e=this.items[this.trav];return this.trav++,{value:eie(e),done:!1}}},nie=class extends qt{constructor(e){super();this.nextFn=e}summary(){return"Function call"}async next(){try{return this.nextFn()}catch(e){throw e.message=`Error thrown while iterating through a dataset: ${e.message}`,e}}},iie=class extends qt{constructor(e){super();this.upstream=e,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Serial`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){return this.upstream.next()}},oie=class extends qt{constructor(e,t){super();this.upstream=e,this.maxCount=t,this.count=0,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Skip`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;this.count++ Take`}async next(){return this.count++>=this.maxCount?{value:null,done:!0}:this.upstream.next()}},uie=class extends qt{constructor(e,t,n=!0){super();this.upstream=e,this.batchSize=t,this.enableSmallLastBatch=n,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> RowMajorBatch`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){let e=[];for(;e.length0?{value:e,done:!1}:{value:null,done:!0};e.push(t.value)}return{value:e,done:!1}}},die=class extends qt{constructor(e,t){super();this.upstream=e,this.predicate=t,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> Filter`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;;){let e=await this.upstream.next();if(e.done||this.predicate(e.value))return e;Ee(e.value)}}},pie=class extends qt{constructor(e,t){super();this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> Map`}async next(){let e=await this.upstream.next();if(e.done)return{value:null,done:!0};let t=ma.getTensorsInContainer(e.value),n=this.transform(e.value),a=ma.getTensorsInContainer(n);for(let r of t)ma.isTensorInList(r,a)||r.dispose();return{value:n,done:!1}}},cie=class extends qt{constructor(e,t){super();this.upstream=e,this.handler=t,this.count=0,this.lastRead=Promise.resolve({value:null,done:!1})}summary(){return`${this.upstream.summary()} -> handleErrors`}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;;)try{return await this.upstream.next()}catch(e){if(!this.handler(e))return{value:null,done:!0}}}},X8=class extends qt{constructor(e,t){super();this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> AsyncMap`}async next(){let e=await this.upstream.next();if(e.done)return{value:null,done:!0};let t=ma.getTensorsInContainer(e.value),n=await this.transform(e.value),a=ma.getTensorsInContainer(n);for(let r of t)ma.isTensorInList(r,a)||r.dispose();return{value:n,done:!1}}},$2=class extends qt{constructor(){super();this.outputQueue=new M2,this.lastRead=Promise.resolve({value:null,done:!1})}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}async serialNext(){for(;this.outputQueue.length()===0;)if(!await this.pump())return{value:null,done:!0};return{value:this.outputQueue.shift(),done:!1}}},hie=class extends $2{constructor(e,t){super();this.upstream=e,this.transform=t}summary(){return`${this.upstream.summary()} -> Flatmap`}async pump(){let e=await this.upstream.next();if(e.done)return!1;let t=ma.getTensorsInContainer(e.value),n=this.transform(e.value),a=ma.getTensorsInContainer(n);this.outputQueue.pushAll(n);for(let r of t)ma.isTensorInList(r,a)||r.dispose();return!0}},q8=class extends qt{constructor(e,t){super();this.baseErrorHandler=t,this.lastRead=null,this.iterator=null,this.moreIterators=e}summary(){return"TODO: fill in upstream of chained summaries -> Chained"}async next(){return this.lastRead=this.readFromChain(this.lastRead),this.lastRead}async readFromChain(e){if(await e,this.iterator==null){let n=await this.moreIterators.next();if(n.done)return{value:null,done:!0};this.iterator=n.value,this.baseErrorHandler!=null&&(this.iterator=this.iterator.handleErrors(this.baseErrorHandler))}let t=await this.iterator.next();return t.done?(this.iterator=null,this.readFromChain(e)):t}},Kr;(function(e){e[e.FAIL=0]="FAIL",e[e.SHORTEST=1]="SHORTEST",e[e.LONGEST=2]="LONGEST"})(Kr||(Kr={}));var rie=class extends qt{constructor(e,t=Kr.FAIL){super();this.iterators=e,this.mismatchMode=t,this.count=0,this.currentPromise=null}summary(){return"{TODO: fill in upstream of zip summaries} -> Zip"}async nextState(e){await e;let t=0,n=0;function a(s){return s instanceof qt?{value:s.next().then(i=>(t++,i.done&&n++,i.value)),recurse:!1}:{value:null,recurse:!0}}let r=await U8(this.iterators,a);if(t===n)return{value:null,done:!0};if(n>0)switch(this.mismatchMode){case Kr.FAIL:throw new Error(`Zipped streams should have the same length. Mismatched at element ${this.count}.`);case Kr.SHORTEST:return{value:null,done:!0};case Kr.LONGEST:default:}return this.count++,{value:r,done:!1}}async next(){return this.currentPromise=this.nextState(this.currentPromise),this.currentPromise}},K8=class extends qt{constructor(e,t){super();this.upstream=e,this.bufferSize=t,this.buffer=new H8(t)}summary(){return`${this.upstream.summary()} -> Prefetch`}refill(){for(;!this.buffer.isFull();){let e=this.upstream.next();this.buffer.push(e)}}next(){return this.refill(),this.buffer.shift()}},fie=class extends K8{constructor(e,t,n){super(e,t);this.upstream=e,this.windowSize=t,this.upstreamExhausted=!1,this.random=Xse.alea(n||k.now().toString()),this.lastRead=Promise.resolve({value:null,done:!1})}async next(){return this.lastRead=this.lastRead.then(()=>this.serialNext()),this.lastRead}randomInt(e){return Math.floor(this.random()*e)}chooseIndex(){return this.randomInt(this.buffer.length())}async serialNext(){for(this.upstreamExhausted||this.refill();!this.buffer.isEmpty();){let e=this.chooseIndex(),t=await this.buffer.shuffleExcise(e);if(t.done)this.upstreamExhausted=!0;else return this.refill(),t}return{value:null,done:!0}}},ql=class{constructor(){this.size=null}batch(e,t=!0){let n=this;k.assert(e>0,()=>`batchSize needs to be positive, but it is + ${e}`);let a;return this.size===Infinity||this.size==null?a=this.size:t?a=Math.ceil(this.size/e):a=Math.floor(this.size/e),Wn(async()=>(await n.iterator()).columnMajorBatch(e,t,mie),a)}concatenate(e){let t=this,n;return this.size===Infinity||e.size===Infinity?n=Infinity:this.size!=null&&e.size!=null?n=this.size+e.size:n=null,Wn(async()=>(await t.iterator()).concatenate(await e.iterator()),n)}filter(e){let t=this,n;return this.size===Infinity?n=Infinity:n=null,Wn(async()=>(await t.iterator()).filter(a=>W(()=>e(a))),n)}async forEachAsync(e){return(await this.iterator()).forEachAsync(e)}map(e){let t=this;return Wn(async()=>(await t.iterator()).map(n=>W(()=>e(n))),this.size)}mapAsync(e){let t=this;return Wn(async()=>(await t.iterator()).mapAsync(e),this.size)}prefetch(e){if(e==null)throw new RangeError("`Dataset.prefetch()` requires bufferSize to be specified.");let t=this;return Wn(async()=>(await t.iterator()).prefetch(e),this.size)}repeat(e){let t=this,n;return this.size!=null&&e>0?n=this.size*e:e===0?n=0:this.size!=null&&(e===void 0||e<0)?n=Infinity:n=null,Wn(async()=>{let a=F2(async()=>({value:await t.iterator(),done:!1}));return aie(a.take(e))},n)}skip(e){let t=this,n;return this.size!=null&&e>=0&&this.size>=e?n=this.size-e:this.size!=null&&(this.size(await t.iterator()).skip(e),n)}shuffle(e,t,n=!0){if(e==null||e<0)throw this.size==null?new RangeError("`Dataset.shuffle()` requires bufferSize to be specified."):new RangeError(`\`Dataset.shuffle()\` requires bufferSize to be specified. If your data fits in main memory (for regular JS objects), and/or GPU memory (for \`tf.Tensor\`s), consider setting bufferSize to the dataset size (${this.size} elements)`);let a=this,r=qse.alea(t||k.now().toString());return Wn(async()=>{let s=r.int32();return n&&(s+=r.int32()),(await a.iterator()).shuffle(e,s.toString())},this.size)}take(e){let t=this,n;return this.size!=null&&this.size>e?n=e:this.size!=null&&this.size<=e?n=this.size:n=null,Wn(async()=>(await t.iterator()).take(e),n)}async toArray(){if(this.size===Infinity)throw new Error("Can not convert infinite data stream to array.");return(await this.iterator()).toArray()}async toArrayForTest(){if(this.size===Infinity)throw new Error("Can not convert infinite data stream to array.");return(await this.iterator()).toArrayForTest()}};ql.MAX_BUFFER_SIZE=1e4;function Wn(e,t=null){return new class extends ql{constructor(){super(...arguments);this.size=t}async iterator(){return e()}}}function Lse(e){return Wn(async()=>G8(e),e.length)}function Wse(e){if(!Xl(e))throw new Error("The argument to zip() must be an object or array.");let t;if(Array.isArray(e))for(let n=0;n{let n=await U8(e,a=>{if(a instanceof ql)return{value:a.iterator(),recurse:!1};if(Xl(a))return{value:null,recurse:!0};throw new Error("Leaves of the structure passed to zip() must be Datasets, not primitives.")});return sie(n,Kr.SHORTEST)},t)}function mie(e){if(e===null)return null;let t=e[0];return Jse(t)?{value:Aie(e),recurse:!1}:{value:null,recurse:!0}}function Aie(e){if(e.length===0)throw new Error("Can't make a batch of zero elements.");return e[0]instanceof Le?zn(e):ia(e)}var P8=class extends ql{constructor(e){super();this.input=e}async iterator(){return(await this.input.iterator()).decodeUTF8().split(` +`).map(e=>(e.endsWith("\r")&&(e=e.slice(0,-1)),e))}},c0='"',Gd=Symbol("out"),Z8=Symbol("field"),h0=Symbol("quote"),D2=Symbol("quoteafterquote"),Y8=Symbol("quoteinquote"),L8=class extends ql{constructor(e,t){super();this.input=e,this.hasHeader=!0,this.fullColumnNames=null,this.columnNamesValidated=!1,this.columnConfigs=null,this.configuredColumnsOnly=!1,this.delimiter=",",this.delimWhitespace=!1,this.base=new P8(e),t||(t={}),this.hasHeader=t.hasHeader!==!1,this.fullColumnNames=t.columnNames,this.columnConfigs=t.columnConfigs,this.configuredColumnsOnly=t.configuredColumnsOnly,t.delimWhitespace?(k.assert(t.delimiter==null,()=>"Delimiter should not be provided when delimWhitespace is true."),this.delimWhitespace=!0,this.delimiter=" "):this.delimiter=t.delimiter?t.delimiter:","}async columnNames(){return this.columnNamesValidated||await this.setColumnNames(),this.configuredColumnsOnly?Object.keys(this.columnConfigs):this.fullColumnNames}async setColumnNames(){let e=await this.maybeReadHeaderLine();if(!this.fullColumnNames&&!e)throw new Error("Column names must be provided if there is no header line.");this.fullColumnNames&&e&&k.assert(e.length===this.fullColumnNames.length,()=>"The length of provided columnNames ("+this.fullColumnNames.length.toString()+") does not match the length of the header line read from file ("+e.length.toString()+")."),this.fullColumnNames||(this.fullColumnNames=e);let t=this.fullColumnNames.reduce((a,r)=>(a[r]=a[r]+1||1,a),{}),n=Object.keys(t).filter(a=>t[a]>1);if(k.assert(n.length===0,()=>"Duplicate column names found: "+n.toString()),this.columnConfigs){for(let a of Object.keys(this.columnConfigs))if(this.fullColumnNames.indexOf(a)===-1)throw new Error('The key "'+a+'" provided in columnConfigs does not match any of the column names ('+this.fullColumnNames.toString()+").")}this.columnNamesValidated=!0}async maybeReadHeaderLine(){if(this.hasHeader){let e=await(await this.base.iterator()).next();if(e.done)throw new Error("No data was found for CSV parsing.");let t=e.value;return this.parseRow(t,!1)}else return null}async iterator(){this.columnNamesValidated||await this.setColumnNames();let e=await this.base.iterator();return this.hasHeader&&(e=e.skip(1)),e.map(t=>this.makeDataElement(t))}makeDataElement(e){let t=this.parseRow(e),n={},a={};for(let r=0;r14||!Number.isInteger(t))throw new Error(`Invalid fftSize: it must be a power of 2 between 2 to 4 and 2 to 14, but got ${this.fftSize}`);if(this.numFrames=e.numFramesPerSpectrogram||43,this.sampleRateHz=e.sampleRateHz,this.columnTruncateLength=e.columnTruncateLength||this.fftSize,this.audioTrackConstraints=e.audioTrackConstraints,this.smoothingTimeConstant=e.smoothingTimeConstant||0,this.includeSpectrogram=e.includeSpectrogram!==!1,this.includeWaveform=e.includeWaveform===!0,!this.includeSpectrogram&&!this.includeWaveform)throw new Error("Both includeSpectrogram and includeWaveform are false. At least one type of data should be returned.")}summary(){return"microphone"}static async create(e={}){if(J().get("IS_NODE"))throw new Error("microphone API is only supported in browser environment.");let t=new J8(e);return await t.start(),t}async start(){try{this.stream=await navigator.mediaDevices.getUserMedia({audio:this.audioTrackConstraints==null?!0:this.audioTrackConstraints,video:!1})}catch(n){throw new Error(`Error thrown while initializing video stream: ${n.message}`)}if(!this.stream)throw new Error("Could not obtain audio from microphone.");let e=window.AudioContext||window.webkitAudioContext;if(this.audioContext=new e,!this.sampleRateHz)this.sampleRateHz=this.audioContext.sampleRate;else if(this.audioContext.sampleRate!==this.sampleRateHz)throw new Error(`Mismatch in sampling rate: Expected: ${this.sampleRateHz}; Actual: ${this.audioContext.sampleRate}`);let t=this.audioContext.createMediaStreamSource(this.stream);this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=this.fftSize*2,this.analyser.smoothingTimeConstant=this.smoothingTimeConstant,t.connect(this.analyser),this.freqData=new Float32Array(this.fftSize),this.timeData=new Float32Array(this.fftSize)}async next(){if(this.isClosed)return{value:null,done:!0};let e,t,n=await this.getAudioData();if(this.includeSpectrogram){let a=this.flattenQueue(n.freqDataQueue);e=this.getTensorFromAudioDataArray(a,[this.numFrames,this.columnTruncateLength,1])}if(this.includeWaveform){let a=this.flattenQueue(n.timeDataQueue);t=this.getTensorFromAudioDataArray(a,[this.numFrames*this.fftSize,1])}return{value:{spectrogram:e,waveform:t},done:!1}}async capture(){return(await this.next()).value}async getAudioData(){let e=[],t=[],n=0;return new Promise(a=>{let r=setInterval(()=>{this.includeSpectrogram&&(this.analyser.getFloatFrequencyData(this.freqData),this.freqData[0]===-Infinity&&a({freqDataQueue:e,timeDataQueue:t}),e.push(this.freqData.slice(0,this.columnTruncateLength))),this.includeWaveform&&(this.analyser.getFloatTimeDomainData(this.timeData),t.push(this.timeData.slice())),++n===this.numFrames&&(clearInterval(r),a({freqDataQueue:e,timeDataQueue:t}))},this.fftSize/this.sampleRateHz*1e3)})}stop(){this.isClosed||(this.isClosed=!0,this.analyser.disconnect(),this.audioContext.close(),this.stream!=null&&this.stream.getTracks().length>0&&this.stream.getTracks()[0].stop())}toArray(){throw new Error("Can not convert infinite audio stream to array.")}getSampleRate(){return this.sampleRateHz}flattenQueue(e){let t=e[0].length,n=new Float32Array(e.length*t);return e.forEach((a,r)=>n.set(a,r*t)),n}getTensorFromAudioDataArray(e,t){let n=new Float32Array(k.sizeFromShape(t));return n.set(e,n.length-e.length),ia(n,t)}},Q8=class extends qt{constructor(e,t){super();if(this.webcamVideoElement=e,this.webcamConfig=t,this.isClosed=!0,this.resize=!1,this.needToResize())if(this.resize=!0,this.cropSize=[this.webcamConfig.resizeHeight,this.webcamConfig.resizeWidth],this.cropBoxInd=Tt([0],"int32"),this.webcamConfig.centerCrop){let n=this.webcamConfig.resizeWidth*1/this.webcamVideoElement.width,a=this.webcamConfig.resizeHeight*1/this.webcamVideoElement.height,r=(1-n)/2,s=(1-a)/2,i=r+n,o=a+s;this.cropBox=ya([s,r,o,i],[1,4])}else this.cropBox=ya([0,0,1,1],[1,4])}summary(){return"webcam"}static async create(e,t={}){if(J().get("IS_NODE"))throw new Error("tf.data.webcam is only supported in browser environment.");if(!e){if(e=document.createElement("video"),!t.resizeWidth||!t.resizeHeight)throw new Error("Please provide webcam video element, or resizeWidth and resizeHeight to create a hidden video element.");e.width=t.resizeWidth,e.height=t.resizeHeight}let n=new Q8(e,t);return await n.start(),n}async start(){this.webcamConfig.facingMode&&k.assert(this.webcamConfig.facingMode==="user"||this.webcamConfig.facingMode==="environment",()=>`Invalid webcam facing mode: ${this.webcamConfig.facingMode}. Please provide 'user' or 'environment'`);try{this.stream=await navigator.mediaDevices.getUserMedia({video:{deviceId:this.webcamConfig.deviceId,facingMode:this.webcamConfig.facingMode?this.webcamConfig.facingMode:"user",width:this.webcamVideoElement.width,height:this.webcamVideoElement.height}})}catch(e){throw e.message=`Error thrown while initializing video stream: ${e.message}`,e}if(!this.stream)throw new Error("Could not obtain video from webcam.");try{this.webcamVideoElement.srcObject=this.stream}catch(e){console.log(e),this.webcamVideoElement.src=window.URL.createObjectURL(this.stream)}return this.webcamVideoElement.play(),this.isClosed=!1,new Promise(e=>{this.webcamVideoElement.onloadedmetadata=()=>{e()}})}async next(){if(this.isClosed)return{value:null,done:!0};let e;try{e=li.fromPixels(this.webcamVideoElement)}catch(t){throw new Error(`Error thrown converting video to pixels: ${JSON.stringify(t)}`)}if(this.resize)try{return{value:this.cropAndResizeFrame(e),done:!1}}catch(t){throw new Error(`Error thrown cropping the video: ${t.message}`)}finally{e.dispose()}else return{value:e,done:!1}}needToResize(){return!!(this.webcamConfig.resizeWidth&&this.webcamConfig.resizeHeight&&(this.webcamVideoElement.width!==this.webcamConfig.resizeWidth||this.webcamVideoElement.height!==this.webcamConfig.resizeHeight))}cropAndResizeFrame(e){return W(()=>{let t=ln(fe(e,"float32"),0),n;n=Ye.cropAndResize(t,this.cropBox,this.cropBoxInd,this.cropSize,"bilinear");let a=n.shape;return H(n,a.slice(1))})}async capture(){return(await this.next()).value}stop(){this.stream.getTracks().forEach(e=>e.stop());try{this.webcamVideoElement.srcObject=null}catch(e){console.log(e),this.webcamVideoElement.src=null}this.isClosed=!0}toArray(){throw new Error("Can not convert infinite video stream to array.")}},ek=class{},tk=class extends qt{split(e){return new yie(this,e)}},yie=class extends tk{constructor(e,t){super();this.upstream=e,this.impl=new gie(e,t)}summary(){return this.impl.summary()}async next(){return this.impl.next()}},gie=class extends $2{constructor(e,t){super();this.upstream=e,this.separator=t,this.carryover=""}summary(){return`${this.upstream.summary()} -> Split('${this.separator}')`}async pump(){let e=await this.upstream.next();if(e.done)return this.carryover===""?!1:(this.outputQueue.push(this.carryover),this.carryover="",!0);let t=e.value.split(this.separator);t[0]=this.carryover+t[0];for(let n of t.slice(0,-1))this.outputQueue.push(n);return this.carryover=t[t.length-1],!0}},bie=class extends qt{decodeUTF8(){return new xie(this)}},xie=class extends tk{constructor(e){super();this.upstream=e,this.impl=new vie(e)}summary(){return this.impl.summary()}async next(){return this.impl.next()}},vie=class extends $2{constructor(e){super();if(this.upstream=e,J().get("IS_BROWSER"))this.decoder=new TextDecoder("utf-8");else{let{StringDecoder:t}=cI();this.decoder=new t("utf8")}}summary(){return`${this.upstream.summary()} -> Utf8`}async pump(){let e=await this.upstream.next(),t;if(e.done)return!1;t=e.value;let n;return J().get("IS_BROWSER")?n=this.decoder.decode(t,{stream:!0}):n=this.decoder.write(Buffer.from(t.buffer)),this.outputQueue.push(n),!0}},nk=class extends bie{constructor(e,t={}){super();this.file=e,this.options=t,k.assert(e instanceof Uint8Array||(J().get("IS_BROWSER")?e instanceof File||e instanceof Blob:!1),()=>"FileChunkIterator only supports File, Blob and Uint8Array right now."),this.offset=t.offset||0,this.chunkSize=t.chunkSize||1024*1024}summary(){return`FileChunks ${this.file}`}async next(){return this.offset>=(this.file instanceof Uint8Array?this.file.byteLength:this.file.size)?{value:null,done:!0}:{value:await new Promise((e,t)=>{let n=this.offset+this.chunkSize;if(this.file instanceof Uint8Array)e(new Uint8Array(this.file.slice(this.offset,n)));else{let a=new FileReader;a.onload=s=>{let i=a.result;if(i instanceof ArrayBuffer&&(i=new Uint8Array(i)),!(i instanceof Uint8Array))return t(new TypeError("FileReader returned unknown type."));e(i)},a.onabort=s=>t(new Error("Aborted")),a.onerror=s=>t(new Error(s.type));let r=this.file.slice(this.offset,n);a.readAsArrayBuffer(r)}this.offset=n}),done:!1}}};async function kie(e,t={}){let n,a;typeof e=="string"?n=e:(n=e.url,a=wie(e));let r=await k.fetch(n,a);if(r.ok){let s=new Uint8Array(await r.arrayBuffer());return new nk(s,t)}else throw new Error(r.statusText)}var wie=e=>({method:e.method,headers:e.headers,body:e.body,mode:e.mode,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,integrity:e.integrity});function ak(e){return typeof e=="string"&&e.substr(0,7)==="file://"}var W8=class extends ek{constructor(e,t={}){super();this.input=e,this.options=t}async iterator(){if(ak(this.input)&&J().get("IS_NODE")){let e=require("fs");this.input=e.readFileSync(this.input.substr(7))}return new nk(this.input,this.options)}},B8=class extends ek{constructor(e,t={}){super();this.url=e,this.fileOptions=t}async iterator(){return ak(this.url)?new W8(this.url,this.fileOptions).iterator():kie(this.url,this.fileOptions)}};function Bse(e,t={}){return new L8(new B8(e),t)}function Vse(e){let t=F2(e);return Wn(async()=>t)}function jse(e){return Wn(async()=>{let t=await e();return F2(()=>t.next())})}async function Use(e,t){return Q8.create(e,t)}async function Hse(e){return J8.create(e)}var Gse="3.6.0",Iie={tfjs:(pm==null?void 0:pm.version)||void 0,"tfjs-core":(cm==null?void 0:cm.version)||void 0,"tfjs-data":(hm==null?void 0:hm.version)||void 0,"tfjs-layers":(fm==null?void 0:fm.version)||void 0,"tfjs-converter":(mm==null?void 0:mm.version)||void 0,"tfjs-backend-cpu":Q3||void 0,"tfjs-backend-webgl":wv||void 0,"tfjs-backend-wasm":f6||void 0};var Bn={name:"humangl",priority:99,canvas:null,gl:null,width:1024,height:1024,webGLattr:{alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!1,desynchronized:!0}};function rk(){if(!Ym(Bn.name)){he("backend registration:",Bn.name);try{Bn.canvas=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(Bn.width,Bn.height):document.createElement("canvas")}catch(e){he("error: cannot create canvas:",e);return}try{Bn.gl=Bn.canvas.getContext("webgl2",Bn.webGLattr)}catch(e){he("error: cannot get WebGL2 context:",e);return}try{ch(2,Bn.gl)}catch(e){he("error: cannot set WebGL2 context:",e);return}try{let e=new Ah(Bn.gl);dl(Bn.name,()=>new zl(e),Bn.priority)}catch(e){he("error: cannot register WebGL backend:",e);return}try{al("webgl").forEach(t=>{let n={...t,backendName:Bn.name};ri(n)})}catch(e){he("error: cannot update WebGL backend registration:",e);return}try{fa.set("WEBGL_VERSION",2)}catch(e){he("error: cannot set WebGL backend flags:",e);return}he("backend registered:",Bn.name)}}var B2={};Ma(B2,{load:()=>U2,predict:()=>j2,triangulation:()=>Ak,uvmap:()=>yk});function sk(e,t){let n=[e.startPoint[0]*t[0],e.startPoint[1]*t[1]],a=[e.endPoint[0]*t[0],e.endPoint[1]*t[1]];return{startPoint:n,endPoint:a}}function qd(e){return[Math.abs(e.endPoint[0]-e.startPoint[0]),Math.abs(e.endPoint[1]-e.startPoint[1])]}function Kl(e){return[e.startPoint[0]+(e.endPoint[0]-e.startPoint[0])/2,e.startPoint[1]+(e.endPoint[1]-e.startPoint[1])/2]}function Zl(e,t,n){let a=t.shape[1],r=t.shape[2],s=[[e.startPoint[1]/a,e.startPoint[0]/r,e.endPoint[1]/a,e.endPoint[0]/r]];return Ye.cropAndResize(t,s,[0],n)}function f0(e,t=1.5){let n=Kl(e),a=qd(e),r=[t*a[0]/2,t*a[1]/2],s=[n[0]-r[0],n[1]-r[1]],i=[n[0]+r[0],n[1]+r[1]];return{startPoint:s,endPoint:i,landmarks:e.landmarks}}function m0(e){let t=Kl(e),n=qd(e),r=Math.max(...n)/2,s=[Math.round(t[0]-r),Math.round(t[1]-r)],i=[Math.round(t[0]+r),Math.round(t[1]+r)];return{startPoint:s,endPoint:i,landmarks:e.landmarks}}function O2(e){let t=e.map(s=>s[0]),n=e.map(s=>s[1]),a=[Math.min(...t),Math.min(...n)],r=[Math.max(...t),Math.max(...n)];return{startPoint:a,endPoint:r,landmarks:e}}var ik=e=>({startPoint:Re(e,[0,0],[-1,2]),endPoint:Re(e,[0,2],[-1,2])});var A0=[[1,0,0],[0,1,0],[0,0,1]];function Sie(e){return e-2*Math.PI*Math.floor((e+Math.PI)/(2*Math.PI))}function z2(e,t){let n=Math.PI/2-Math.atan2(-(t[1]-e[1]),t[0]-e[0]);return Sie(n)}function ok(e,t){return[[1,0,e],[0,1,t],[0,0,1]]}function Zr(e,t){let n=0;for(let a=0;a{let d=t.resizeBilinear([this.inputSize,this.inputSize]).div(127.5).sub(.5),u=this.model.execute(d),p;if(Array.isArray(u)){let f=u.sort((x,w)=>x.size-w.size),A=ot([f[0],f[2]],2),y=ot([f[1],f[3]],2);p=ot([y,A],1).squeeze(0)}else p=u.squeeze();let c=Tie(p,this.anchors,[this.inputSize,this.inputSize]),h=Re(p,[0,0],[-1,1]),m=wn(h).squeeze().dataSync();return[p,c,m]}),s=await Ye.nonMaxSuppressionAsync(a,r,this.config.face.detector.maxDetected,this.config.face.detector.iouThreshold,this.config.face.detector.minConfidence),i=s.arraySync();s.dispose();let o=[];for(let l=0;lthis.config.face.detector.minConfidence){let u=Re(a,[i[l],0],[1,-1]),p=ik(u);u.dispose();let c=this.anchorsData[i[l]],h=W(()=>Re(n,[i[l],ck-1],[1,-1]).squeeze().reshape([ck,-1]));o.push({box:p,landmarks:h,anchor:c,confidence:d})}}return n.dispose(),a.dispose(),{boxes:o,scaleFactor:[t.shape[2]/this.inputSize,t.shape[1]/this.inputSize]}}};async function fk(e){let t=await Gt(Yt(e.modelBasePath,e.face.detector.modelPath),{fromTFHub:e.face.detector.modelPath.includes("tfhub.dev")}),n=new hk(t,e);return!t||!t.modelUrl?he("load model failed:",e.face.detector.modelPath):e.debug&&he("load model:",t.modelUrl),n}var Xa={silhouette:[10,338,297,332,284,251,389,356,454,323,361,288,397,365,379,378,400,377,152,148,176,149,150,136,172,58,132,93,234,127,162,21,54,103,67,109],lipsUpperOuter:[61,185,40,39,37,0,267,269,270,409,291],lipsLowerOuter:[146,91,181,84,17,314,405,321,375,291],lipsUpperInner:[78,191,80,81,82,13,312,311,310,415,308],lipsLowerInner:[78,95,88,178,87,14,317,402,318,324,308],rightEyeUpper0:[246,161,160,159,158,157,173],rightEyeLower0:[33,7,163,144,145,153,154,155,133],rightEyeUpper1:[247,30,29,27,28,56,190],rightEyeLower1:[130,25,110,24,23,22,26,112,243],rightEyeUpper2:[113,225,224,223,222,221,189],rightEyeLower2:[226,31,228,229,230,231,232,233,244],rightEyeLower3:[143,111,117,118,119,120,121,128,245],rightEyebrowUpper:[156,70,63,105,66,107,55,193],rightEyebrowLower:[35,124,46,53,52,65],rightEyeIris:[473,474,475,476,477],leftEyeUpper0:[466,388,387,386,385,384,398],leftEyeLower0:[263,249,390,373,374,380,381,382,362],leftEyeUpper1:[467,260,259,257,258,286,414],leftEyeLower1:[359,255,339,254,253,252,256,341,463],leftEyeUpper2:[342,445,444,443,442,441,413],leftEyeLower2:[446,261,448,449,450,451,452,453,464],leftEyeLower3:[372,340,346,347,348,349,350,357,465],leftEyebrowUpper:[383,300,293,334,296,336,285,417],leftEyebrowLower:[265,353,276,283,282,295],leftEyeIris:[468,469,470,471,472],midwayBetweenEyes:[168],noseTip:[1],noseBottom:[2],noseRightCorner:[98],noseLeftCorner:[327],rightCheek:[205],leftCheek:[425]},_2=[{key:"EyeUpper0",indices:[9,10,11,12,13,14,15]},{key:"EyeUpper1",indices:[25,26,27,28,29,30,31]},{key:"EyeUpper2",indices:[41,42,43,44,45,46,47]},{key:"EyeLower0",indices:[0,1,2,3,4,5,6,7,8]},{key:"EyeLower1",indices:[16,17,18,19,20,21,22,23,24]},{key:"EyeLower2",indices:[32,33,34,35,36,37,38,39,40]},{key:"EyeLower3",indices:[54,55,56,57,58,59,60,61,62]}],Xd=[[.499976992607117,.652534008026123],[.500025987625122,.547487020492554],[.499974012374878,.602371990680695],[.482113003730774,.471979022026062],[.500150978565216,.527155995368958],[.499909996986389,.498252987861633],[.499523013830185,.40106201171875],[.289712011814117,.380764007568359],[.499954998493195,.312398016452789],[.499987006187439,.269918978214264],[.500023007392883,.107050001621246],[.500023007392883,.666234016418457],[.5000159740448,.679224014282227],[.500023007392883,.692348003387451],[.499976992607117,.695277988910675],[.499976992607117,.70593398809433],[.499976992607117,.719385027885437],[.499976992607117,.737019002437592],[.499967992305756,.781370997428894],[.499816000461578,.562981009483337],[.473773002624512,.573909997940063],[.104906998574734,.254140973091125],[.365929991006851,.409575998783112],[.338757991790771,.41302502155304],[.311120003461838,.409460008144379],[.274657994508743,.389131009578705],[.393361985683441,.403706014156342],[.345234006643295,.344011008739471],[.370094001293182,.346076011657715],[.319321990013123,.347265005111694],[.297903001308441,.353591024875641],[.24779200553894,.410809993743896],[.396889001131058,.842755019664764],[.280097991228104,.375599980354309],[.106310002505779,.399955987930298],[.2099249958992,.391353011131287],[.355807989835739,.534406006336212],[.471751004457474,.65040397644043],[.474155008792877,.680191993713379],[.439785003662109,.657229006290436],[.414617002010345,.66654098033905],[.450374007225037,.680860996246338],[.428770989179611,.682690978050232],[.374971002340317,.727805018424988],[.486716985702515,.547628998756409],[.485300987958908,.527395009994507],[.257764995098114,.314490020275116],[.401223003864288,.455172002315521],[.429818987846375,.548614978790283],[.421351999044418,.533740997314453],[.276895999908447,.532056987285614],[.483370006084442,.499586999416351],[.33721199631691,.282882988452911],[.296391993761063,.293242990970612],[.169294998049736,.193813979625702],[.447580009698868,.302609980106354],[.392390012741089,.353887975215912],[.354490011930466,.696784019470215],[.067304998636246,.730105042457581],[.442739009857178,.572826027870178],[.457098007202148,.584792017936707],[.381974011659622,.694710969924927],[.392388999462128,.694203019142151],[.277076005935669,.271932005882263],[.422551989555359,.563233017921448],[.385919004678726,.281364023685455],[.383103013038635,.255840003490448],[.331431001424789,.119714021682739],[.229923993349075,.232002973556519],[.364500999450684,.189113974571228],[.229622006416321,.299540996551514],[.173287004232407,.278747975826263],[.472878992557526,.666198015213013],[.446828007698059,.668527007102966],[.422762006521225,.673889994621277],[.445307999849319,.580065965652466],[.388103008270264,.693961024284363],[.403039008378983,.706539988517761],[.403629004955292,.693953037261963],[.460041999816895,.557139039039612],[.431158006191254,.692366003990173],[.452181994915009,.692366003990173],[.475387006998062,.692366003990173],[.465828001499176,.779190003871918],[.472328990697861,.736225962638855],[.473087012767792,.717857003211975],[.473122000694275,.704625964164734],[.473033010959625,.695277988910675],[.427942007780075,.695277988910675],[.426479011774063,.703539967536926],[.423162013292313,.711845993995667],[.4183090031147,.720062971115112],[.390094995498657,.639572978019714],[.013953999616206,.560034036636353],[.499913990497589,.58014702796936],[.413199990987778,.69539999961853],[.409626007080078,.701822996139526],[.468080013990402,.601534962654114],[.422728985548019,.585985004901886],[.463079988956451,.593783974647522],[.37211999297142,.47341400384903],[.334562003612518,.496073007583618],[.411671012639999,.546965003013611],[.242175996303558,.14767599105835],[.290776997804642,.201445996761322],[.327338010072708,.256527006626129],[.399509996175766,.748921036720276],[.441727995872498,.261676013469696],[.429764986038208,.187834024429321],[.412198007106781,.108901023864746],[.288955003023148,.398952007293701],[.218936994671822,.435410976409912],[.41278201341629,.398970007896423],[.257135003805161,.355440020561218],[.427684992551804,.437960982322693],[.448339998722076,.536936044692993],[.178560003638268,.45755398273468],[.247308000922203,.457193970680237],[.286267012357712,.467674970626831],[.332827985286713,.460712015628815],[.368755996227264,.447206974029541],[.398963987827301,.432654976844788],[.476410001516342,.405806005001068],[.189241006970406,.523923993110657],[.228962004184723,.348950982093811],[.490725994110107,.562400996685028],[.404670000076294,.485132992267609],[.019469000399113,.401564002037048],[.426243007183075,.420431017875671],[.396993011236191,.548797011375427],[.266469985246658,.376977026462555],[.439121007919312,.51895797252655],[.032313998788595,.644356966018677],[.419054001569748,.387154996395111],[.462783008813858,.505746960639954],[.238978996872902,.779744982719421],[.198220998048782,.831938028335571],[.107550002634525,.540755033493042],[.183610007166862,.740257024765015],[.134409993886948,.333683013916016],[.385764002799988,.883153975009918],[.490967005491257,.579378008842468],[.382384985685349,.508572995662689],[.174399003386497,.397670984268188],[.318785011768341,.39623498916626],[.343364000320435,.400596976280212],[.396100014448166,.710216999053955],[.187885001301765,.588537991046906],[.430987000465393,.944064974784851],[.318993002176285,.898285031318665],[.266247987747192,.869701027870178],[.500023007392883,.190576016902924],[.499976992607117,.954452991485596],[.366169989109039,.398822009563446],[.393207013607025,.39553701877594],[.410373002290726,.391080021858215],[.194993004202843,.342101991176605],[.388664990663528,.362284004688263],[.365961998701096,.355970978736877],[.343364000320435,.355356991291046],[.318785011768341,.35834002494812],[.301414996385574,.363156020641327],[.058132998645306,.319076001644135],[.301414996385574,.387449026107788],[.499987989664078,.618434011936188],[.415838003158569,.624195992946625],[.445681989192963,.566076993942261],[.465844005346298,.620640993118286],[.49992299079895,.351523995399475],[.288718998432159,.819945991039276],[.335278987884521,.852819979190826],[.440512001514435,.902418971061707],[.128294005990028,.791940987110138],[.408771991729736,.373893976211548],[.455606997013092,.451801002025604],[.499877005815506,.908990025520325],[.375436991453171,.924192011356354],[.11421000212431,.615022003650665],[.448662012815475,.695277988910675],[.4480200111866,.704632043838501],[.447111994028091,.715808033943176],[.444831997156143,.730794012546539],[.430011987686157,.766808986663818],[.406787008047104,.685672998428345],[.400738000869751,.681069016456604],[.392399996519089,.677703022956848],[.367855995893478,.663918972015381],[.247923001646996,.601333022117615],[.452769994735718,.420849978923798],[.43639200925827,.359887003898621],[.416164010763168,.368713974952698],[.413385987281799,.692366003990173],[.228018000721931,.683571994304657],[.468268007040024,.352671027183533],[.411361992359161,.804327011108398],[.499989002943039,.469825029373169],[.479153990745544,.442654013633728],[.499974012374878,.439637005329132],[.432112008333206,.493588984012604],[.499886006116867,.866917014122009],[.49991300702095,.821729004383087],[.456548988819122,.819200992584229],[.344549000263214,.745438992977142],[.37890899181366,.574010014533997],[.374292999505997,.780184984207153],[.319687992334366,.570737957954407],[.357154995203018,.604269981384277],[.295284003019333,.621580958366394],[.447750002145767,.862477004528046],[.410986006259918,.508723020553589],[.31395098567009,.775308012962341],[.354128003120422,.812552988529205],[.324548006057739,.703992962837219],[.189096003770828,.646299958229065],[.279776990413666,.71465802192688],[.1338230073452,.682700991630554],[.336768001317978,.644733011722565],[.429883986711502,.466521978378296],[.455527991056442,.548622965812683],[.437114000320435,.558896005153656],[.467287987470627,.529924988746643],[.414712011814117,.335219979286194],[.37704598903656,.322777986526489],[.344107985496521,.320150971412659],[.312875986099243,.32233202457428],[.283526003360748,.333190023899078],[.241245999932289,.382785975933075],[.102986000478268,.468762993812561],[.267612010240555,.424560010433197],[.297879010438919,.433175981044769],[.333433985710144,.433878004550934],[.366427004337311,.426115989685059],[.396012008190155,.416696012020111],[.420121014118195,.41022801399231],[.007561000064015,.480777025222778],[.432949006557465,.569517970085144],[.458638995885849,.479089021682739],[.473466008901596,.545744001865387],[.476087987422943,.563830018043518],[.468472003936768,.555056989192963],[.433990985155106,.582361996173859],[.483518004417419,.562983989715576],[.482482999563217,.57784903049469],[.42645001411438,.389798998832703],[.438998997211456,.39649498462677],[.450067013502121,.400434017181396],[.289712011814117,.368252992630005],[.276670008897781,.363372981548309],[.517862021923065,.471948027610779],[.710287988185883,.380764007568359],[.526226997375488,.573909997940063],[.895093023777008,.254140973091125],[.634069979190826,.409575998783112],[.661242008209229,.41302502155304],[.688880026340485,.409460008144379],[.725341975688934,.389131009578705],[.606630027294159,.40370500087738],[.654766023159027,.344011008739471],[.629905998706818,.346076011657715],[.680678009986877,.347265005111694],[.702096998691559,.353591024875641],[.75221198797226,.410804986953735],[.602918028831482,.842862963676453],[.719901978969574,.375599980354309],[.893692970275879,.399959981441498],[.790081977844238,.391354024410248],[.643998026847839,.534487962722778],[.528249025344849,.65040397644043],[.525849997997284,.680191040039062],[.560214996337891,.657229006290436],[.585384011268616,.66654098033905],[.549625992774963,.680860996246338],[.57122802734375,.682691991329193],[.624852001667023,.72809898853302],[.513050019741058,.547281980514526],[.51509702205658,.527251958847046],[.742246985435486,.314507007598877],[.598631024360657,.454979002475739],[.570338010787964,.548575043678284],[.578631997108459,.533622980117798],[.723087012767792,.532054007053375],[.516445994377136,.499638974666595],[.662801027297974,.282917976379395],[.70362401008606,.293271005153656],[.830704987049103,.193813979625702],[.552385985851288,.302568018436432],[.607609987258911,.353887975215912],[.645429015159607,.696707010269165],[.932694971561432,.730105042457581],[.557260990142822,.572826027870178],[.542901992797852,.584792017936707],[.6180260181427,.694710969924927],[.607590973377228,.694203019142151],[.722943007946014,.271963000297546],[.577413976192474,.563166975975037],[.614082992076874,.281386971473694],[.616907000541687,.255886018276215],[.668509006500244,.119913995265961],[.770092010498047,.232020974159241],[.635536015033722,.189248979091644],[.77039098739624,.299556016921997],[.826722025871277,.278755009174347],[.527121007442474,.666198015213013],[.553171992301941,.668527007102966],[.577238023281097,.673889994621277],[.554691970348358,.580065965652466],[.611896991729736,.693961024284363],[.59696102142334,.706539988517761],[.596370995044708,.693953037261963],[.539958000183105,.557139039039612],[.568841993808746,.692366003990173],[.547818005084991,.692366003990173],[.52461302280426,.692366003990173],[.534089982509613,.779141008853912],[.527670979499817,.736225962638855],[.526912987232208,.717857003211975],[.526877999305725,.704625964164734],[.526966989040375,.695277988910675],[.572058022022247,.695277988910675],[.573521018028259,.703539967536926],[.57683801651001,.711845993995667],[.581691026687622,.720062971115112],[.609944999217987,.639909982681274],[.986046016216278,.560034036636353],[.5867999792099,.69539999961853],[.590372025966644,.701822996139526],[.531915009021759,.601536989212036],[.577268004417419,.585934996604919],[.536915004253387,.593786001205444],[.627542972564697,.473352015018463],[.665585994720459,.495950996875763],[.588353991508484,.546862006187439],[.757824003696442,.14767599105835],[.709249973297119,.201507985591888],[.672684013843536,.256581008434296],[.600408971309662,.74900496006012],[.55826598405838,.261672019958496],[.570303976535797,.187870979309082],[.588165998458862,.109044015407562],[.711045026779175,.398952007293701],[.781069993972778,.435405015945435],[.587247014045715,.398931980133057],[.742869973182678,.355445981025696],[.572156012058258,.437651991844177],[.55186802148819,.536570012569427],[.821442008018494,.457556009292603],[.752701997756958,.457181990146637],[.71375697851181,.467626988887787],[.66711300611496,.460672974586487],[.631101012229919,.447153985500336],[.6008620262146,.432473003864288],[.523481011390686,.405627012252808],[.810747981071472,.523926019668579],[.771045982837677,.348959028720856],[.509127020835876,.562718033790588],[.595292985439301,.485023975372314],[.980530977249146,.401564002037048],[.573499977588654,.420000016689301],[.602994978427887,.548687994480133],[.733529984951019,.376977026462555],[.560611009597778,.519016981124878],[.967685997486115,.644356966018677],[.580985009670258,.387160003185272],[.537728011608124,.505385041236877],[.760966002941132,.779752969741821],[.801778972148895,.831938028335571],[.892440974712372,.54076099395752],[.816350996494293,.740260004997253],[.865594983100891,.333687007427216],[.614073991775513,.883246004581451],[.508952975273132,.579437971115112],[.617941975593567,.508316040039062],[.825608015060425,.397674977779388],[.681214988231659,.39623498916626],[.656635999679565,.400596976280212],[.603900015354156,.710216999053955],[.81208598613739,.588539004325867],[.56801301240921,.944564998149872],[.681007981300354,.898285031318665],[.733752012252808,.869701027870178],[.633830010890961,.398822009563446],[.606792986392975,.39553701877594],[.589659988880157,.391062021255493],[.805015981197357,.342108011245728],[.611334979534149,.362284004688263],[.634037971496582,.355970978736877],[.656635999679565,.355356991291046],[.681214988231659,.35834002494812],[.698584973812103,.363156020641327],[.941866993904114,.319076001644135],[.698584973812103,.387449026107788],[.584177017211914,.624107003211975],[.554318010807037,.566076993942261],[.534153997898102,.62064003944397],[.711217999458313,.819975018501282],[.664629995822906,.852871000766754],[.559099972248077,.902631998062134],[.871706008911133,.791940987110138],[.591234028339386,.373893976211548],[.544341027736664,.451583981513977],[.624562978744507,.924192011356354],[.88577002286911,.615028977394104],[.551338016986847,.695277988910675],[.551980018615723,.704632043838501],[.552887976169586,.715808033943176],[.555167973041534,.730794012546539],[.569944024085999,.767035007476807],[.593203008174896,.685675978660583],[.599261999130249,.681069016456604],[.607599973678589,.677703022956848],[.631937980651855,.663500010967255],[.752032995223999,.601315021514893],[.547226011753082,.420395016670227],[.563543975353241,.359827995300293],[.583841025829315,.368713974952698],[.586614012718201,.692366003990173],[.771915018558502,.683578014373779],[.531597018241882,.352482974529266],[.588370978832245,.804440975189209],[.52079701423645,.442565023899078],[.567984998226166,.493479013442993],[.543282985687256,.819254994392395],[.655317008495331,.745514988899231],[.621008992195129,.574018001556396],[.625559985637665,.78031200170517],[.680198013782501,.570719003677368],[.64276397228241,.604337990283966],[.704662978649139,.621529996395111],[.552012026309967,.862591981887817],[.589071989059448,.508637011051178],[.685944974422455,.775357007980347],[.645735025405884,.812640011310577],[.675342977046967,.703978002071381],[.810858011245728,.646304965019226],[.72012197971344,.714666962623596],[.866151988506317,.682704985141754],[.663187026977539,.644596993923187],[.570082008838654,.466325998306274],[.544561982154846,.548375964164734],[.562758982181549,.558784961700439],[.531987011432648,.530140042304993],[.585271000862122,.335177004337311],[.622952997684479,.32277899980545],[.655896008014679,.320163011550903],[.687132000923157,.322345972061157],[.716481983661652,.333200991153717],[.758756995201111,.382786989212036],[.897013008594513,.468769013881683],[.732392013072968,.424547016620636],[.70211398601532,.433162987232208],[.66652500629425,.433866024017334],[.633504986763,.426087975502014],[.603875994682312,.416586995124817],[.579657971858978,.409945011138916],[.992439985275269,.480777025222778],[.567192018032074,.569419980049133],[.54136598110199,.478899002075195],[.526564002037048,.546118021011353],[.523913025856018,.563830018043518],[.531529009342194,.555056989192963],[.566035985946655,.582329034805298],[.51631098985672,.563053965568542],[.5174720287323,.577877044677734],[.573594987392426,.389806985855103],[.560697972774506,.395331978797913],[.549755990505219,.399751007556915],[.710287988185883,.368252992630005],[.723330020904541,.363372981548309]],zi=[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];var Eie=[127,234,132,58,172,150,149,148,152,377,378,379,397,288,361,454,356,70,63,105,66,107,336,296,334,293,300,168,6,195,4,98,97,2,326,327,33,160,158,133,153,144,362,385,387,263,373,380,57,40,37,0,267,270,287,321,314,17,84,91,78,81,13,311,308,402,14,178],Cie=[33,133,362,263,1,62,308,159,145,386,374,6,102,331,2,13,14,70,105,107,336,334,300,54,10,284,50,280,234,454,58,288,152],Rie=[33,133,362,263,1,78,308],foe=Eie.map(e=>Xd[e]),moe=Cie.map(e=>Xd[e]),Aoe=Rie.map(e=>Xd[e]);var P2=Xa.leftEyeLower0,L2=Xa.rightEyeLower0,Yl={leftBounds:[P2[0],P2[P2.length-1]],rightBounds:[L2[0],L2[L2.length-1]]},g0={count:468,mouth:13,symmetryLine:[13,Xa.midwayBetweenEyes[0]]},mk={leftEye:0,rightEye:1,nose:2,mouth:3,leftEar:4,rightEar:5,symmetryLine:[3,2]},Jl={upperCenter:3,lowerCenter:4,index:71,numCoordinates:76};function x0(e,t,n,a){for(let r=0;r<_2.length;r++){let{key:s,indices:i}=_2[r],o=Xa[`${n}${s}`];if(!a||a.includes(s))for(let l=0;l[s[0]/this.meshSize*(p[0]-this.meshSize/2),s[1]/this.meshSize*(p[1]-this.meshSize/2),p[2]]),o=a!==0?y0(a,[0,0]):A0,l=a!==0?i.map(p=>[...dk(p,o),p[2]]):i,d=a!==0?uk(r):A0,u=[...Kl({startPoint:n.startPoint,endPoint:n.endPoint}),1];return l.map(p=>[Math.round(p[0]+Zr(u,d[0])),Math.round(p[1]+Zr(u,d[1])),Math.round(p[2])])}getLeftToRightEyeDepthDifference(t){let n=t[Yl.leftBounds[0]][2],a=t[Yl.rightBounds[0]][2];return n-a}getEyeBox(t,n,a,r,s=!1){let i=m0(f0(O2([t[a],t[r]]),this.irisEnlarge)),o=qd(i),l=Ye.cropAndResize(n,[[i.startPoint[1]/this.meshSize,i.startPoint[0]/this.meshSize,i.endPoint[1]/this.meshSize,i.endPoint[0]/this.meshSize]],[0],[this.irisSize,this.irisSize]);return s&&fa.flags.IS_BROWSER&&(l=Ye.flipLeftRight(l)),{box:i,boxSize:o,crop:l}}getEyeCoords(t,n,a,r=!1){let s=[];for(let i=0;i{let d=i;return l===2?d=r:l===4&&(d=s),[o[0],o[1],d]})}async predict(t,n){let a=!1,r;if((this.skipped===0||this.skipped>n.face.detector.skipFrames||!n.face.mesh.enabled||!n.videoOptimized)&&(r=await this.boundingBoxDetector.getBoundingBoxes(t),this.skipped=0),n.videoOptimized&&this.skipped++,!n.videoOptimized||r&&r.boxes&&(!n.face.mesh.enabled||r.boxes.length!==this.detectedFaces&&this.detectedFaces!==n.face.detector.maxDetected)){this.storedBoxes=[],this.detectedFaces=0;for(let i of r.boxes)this.storedBoxes.push({startPoint:i.box.startPoint.dataSync(),endPoint:i.box.endPoint.dataSync(),landmarks:i.landmarks,confidence:i.confidence});this.storedBoxes.length>0&&(a=!0)}if(n.face.detector.skipInitial&&this.detectedFaces===0&&(this.skipped=0),a){if(!r||!r.boxes||r.boxes.length===0)return this.storedBoxes=[],this.detectedFaces=0,null;for(let i=0;i{i.box.startPoint.dispose(),i.box.endPoint.dispose(),i.landmarks.dispose()});let s=W(()=>this.storedBoxes.map((i,o)=>{let l,d=0,u;if(n.face.detector.rotation&&n.face.mesh.enabled&&fa.flags.IS_BROWSER){let[w,b]=i.landmarks.length>=g0.count?g0.symmetryLine:mk.symmetryLine;d=z2(i.landmarks[w],i.landmarks[b]);let v=Kl({startPoint:i.startPoint,endPoint:i.endPoint}),N=[v[0]/t.shape[2],v[1]/t.shape[1]],T=Ye.rotateWithOffset(t,d,0,N);u=y0(-d,v),n.face.mesh.enabled?l=Zl({startPoint:i.startPoint,endPoint:i.endPoint},T,[this.meshSize,this.meshSize]).div(255):l=Zl({startPoint:i.startPoint,endPoint:i.endPoint},T,[this.boxSize,this.boxSize]).div(255)}else{u=A0;let w=t.clone();n.face.mesh.enabled?l=Zl({startPoint:i.startPoint,endPoint:i.endPoint},w,[this.meshSize,this.meshSize]).div(255):l=Zl({startPoint:i.startPoint,endPoint:i.endPoint},w,[this.boxSize,this.boxSize]).div(255)}if(!n.face.mesh.enabled)return{mesh:[],box:i,faceConfidence:null,boxConfidence:i.confidence,confidence:i.confidence,image:l};let[,p,c]=this.meshDetector.execute(l),h=p.dataSync()[0];if(h=g0.count?g0.symmetryLine:mk.symmetryLine;d=z2(i.landmarks[w],i.landmarks[b]);let v=Kl({startPoint:i.startPoint,endPoint:i.endPoint}),N=[v[0]/t.shape[2],v[1]/t.shape[1]],T=Ye.rotateWithOffset(t.toFloat(),d,0,N);u=y0(-d,v),l=Zl({startPoint:i.startPoint,endPoint:i.endPoint},T,[this.meshSize,this.meshSize]).div(255)}let g={mesh:A,box:i,faceConfidence:h,boxConfidence:i.confidence,image:l},x=m0(i);return x.confidence=i.confidence,x.faceConfidence=h,this.storedBoxes[o]=x,g}));return n.face.mesh.enabled&&(this.storedBoxes=this.storedBoxes.filter(i=>i.confidence>n.face.detector.minConfidence)),this.detectedFaces=s.length,s}};var Wt=[null,null,null],V2;async function j2(e,t){let n=await V2.predict(e,t),a=[];for(let r of n||[]){if(!r||r.isDisposedInternal)continue;let s=r.mesh.map(d=>[d[0]/e.shape[2],d[1]/e.shape[1],d[2]/V2.meshSize]),i={};if(r.mesh&&r.mesh.length>0)for(let d of Object.keys(Xa))i[d]=Xa[d].map(u=>r.mesh[u]);let o=r.box?[Math.max(0,r.box.startPoint[0]),Math.max(0,r.box.startPoint[1]),Math.min(e.shape[2],r.box.endPoint[0])-Math.max(0,r.box.startPoint[0]),Math.min(e.shape[1],r.box.endPoint[1])-Math.max(0,r.box.startPoint[1])]:0,l=r.box?[r.box.startPoint[0]/e.shape[2],r.box.startPoint[1]/e.shape[1],(r.box.endPoint[0]-r.box.startPoint[0])/e.shape[2],(r.box.endPoint[1]-r.box.startPoint[1])/e.shape[1]]:[];a.push({confidence:Math.round(100*r.faceConfidence||100*r.boxConfidence||0)/100,boxConfidence:Math.round(100*r.boxConfidence)/100,faceConfidence:Math.round(100*r.faceConfidence)/100,box:o,boxRaw:l,mesh:r.mesh,meshRaw:s,annotations:i,image:r.image}),r.coords&&r.coords.dispose()}return a}async function U2(e){return!Wt[0]&&e.face.enabled||!Wt[1]&&e.face.mesh.enabled||!Wt[2]&&e.face.iris.enabled?(Wt=await Promise.all([!Wt[0]&&e.face.enabled?fk(e):null,!Wt[1]&&e.face.mesh.enabled?Gt(Yt(e.modelBasePath,e.face.mesh.modelPath),{fromTFHub:e.face.mesh.modelPath.includes("tfhub.dev")}):null,!Wt[2]&&e.face.iris.enabled?Gt(Yt(e.modelBasePath,e.face.iris.modelPath),{fromTFHub:e.face.iris.modelPath.includes("tfhub.dev")}):null]),e.face.mesh.enabled&&(!Wt[1]||!Wt[1].modelUrl?he("load model failed:",e.face.mesh.modelPath):e.debug&&he("load model:",Wt[1].modelUrl)),e.face.iris.enabled&&(!Wt[2]||!Wt[1].modelUrl?he("load model failed:",e.face.iris.modelPath):e.debug&&he("load model:",Wt[2].modelUrl))):e.debug&&(he("cached model:",Wt[0].model.modelUrl),he("cached model:",Wt[1].modelUrl),he("cached model:",Wt[2].modelUrl)),V2=new W2(Wt[0],Wt[1],Wt[2]),Wt}var Ak=zi,yk=Xd;var H2={};Ma(H2,{load:()=>X2,predict:()=>v0});var Mie=["angry","disgust","fear","happy","sad","surprise","neutral"],Ea,G2=[],b0=Number.MAX_SAFE_INTEGER,q2=[.2989,.587,.114];async function X2(e){return Ea?e.debug&&he("cached model:",Ea.modelUrl):(Ea=await Gt(Yt(e.modelBasePath,e.face.emotion.modelPath)),!Ea||!Ea.modelUrl?he("load model failed:",e.face.emotion.modelPath):e.debug&&he("load model:",Ea.modelUrl)),Ea}async function v0(e,t){return Ea?b00?(b0++,G2):(t.videoOptimized?b0=0:b0=Number.MAX_SAFE_INTEGER,new Promise(async n=>{let a=Ye.resizeBilinear(e,[Ea.inputs[0].shape[2],Ea.inputs[0].shape[1]],!1),[r,s,i]=an(a,3,3);a.dispose();let o=_(r,q2[0]),l=_(s,q2[1]),d=_(i,q2[2]);r.dispose(),s.dispose(),i.dispose();let u=gc([o,l,d]);o.dispose(),l.dispose(),d.dispose();let p=W(()=>u.sub(.5).mul(2));u.dispose();let c=[];if(t.face.emotion.enabled){let h=await Ea.predict(p),m=h.dataSync();Ee(h);for(let f=0;ft.face.emotion.minConfidence&&c.push({score:Math.min(.99,Math.trunc(100*m[f])/100),emotion:Mie[f]});c.sort((f,A)=>A.score-f.score)}p.dispose(),G2=c,n(c)})):null}var K2={};Ma(K2,{enhance:()=>J2,load:()=>Z2,match:()=>gk,predict:()=>I0,similarity:()=>Y2});var Qn,w0={age:0},k0=Number.MAX_SAFE_INTEGER;async function Z2(e){return Qn?e.debug&&he("cached model:",Qn.modelUrl):(Qn=await Gt(Yt(e.modelBasePath,e.face.description.modelPath)),!Qn||!Qn.modelUrl?he("load model failed:",e.face.description.modelPath):e.debug&&he("load model:",Qn.modelUrl)),Qn}function Y2(e,t,n=2){if(!e||!t||(e==null?void 0:e.length)===0||(t==null?void 0:t.length)===0||(e==null?void 0:e.length)!==(t==null?void 0:t.length))return 0;let a=5*e.map((s,i)=>Math.abs(e[i]-t[i])**n).reduce((s,i)=>s+i,0)**(1/n);return Math.max(0,100-a)/100}function gk(e,t,n=0){let a={similarity:0,name:"",source:"",embedding:[]};if(!e||!t||!Array.isArray(e)||!Array.isArray(t))return a;for(let r of t)if(r.embedding&&r.name){let s=Y2(e,r.embedding);s>n&&s>a.similarity&&(a={...r,similarity:s})}return a}function J2(e){return W(()=>{let n=e.image||e.tensor||e;if(!(n instanceof Le))return null;let a=[[.05,.15,.85,.85]];return(n.shape.length===3?Ye.cropAndResize(ln(n,0),a,[0],[Qn.inputs[0].shape[2],Qn.inputs[0].shape[1]]):Ye.cropAndResize(n,a,[0],[Qn.inputs[0].shape[2],Qn.inputs[0].shape[1]])).mul(255)})}async function I0(e,t){return Qn?k00?(k0++,w0):(t.videoOptimized?k0=0:k0=Number.MAX_SAFE_INTEGER,new Promise(async n=>{let a=J2(e),r,s={age:0,gender:"unknown",genderConfidence:0,descriptor:[]};t.face.description.enabled&&(r=await Qn.predict(a)),Ee(a),r&&(W(()=>{let i=r.find(p=>p.shape[1]===1).dataSync(),o=Math.trunc(200*Math.abs(i[0]-.5))/100;o>t.face.description.minConfidence&&(s.gender=i[0]<=.5?"female":"male",s.genderConfidence=Math.min(.99,o));let l=r.find(p=>p.shape[1]===100).argMax(1).dataSync()[0],d=r.find(p=>p.shape[1]===100).dataSync();s.age=Math.round(d[l-1]>d[l+1]?10*l-100*d[l-1]:10*l+100*d[l+1])/10;let u=r.find(p=>p.shape[1]===1024);s.descriptor=[...u.dataSync()]}),r.forEach(i=>Ee(i))),w0=s,n(s)})):null}var Fie=(e,t)=>{let n=A=>A*180/Math.PI,a=A=>{let y=Math.sqrt(A[0]*A[0]+A[1]*A[1]+A[2]*A[2]);return A[0]/=y,A[1]/=y,A[2]/=y,A},r=(A,y)=>{let g=A[0]-y[0],x=A[1]-y[1],w=A[2]-y[2];return[g,x,w]},s=(A,y)=>{let g=A[1]*y[2]-A[2]*y[1],x=A[2]*y[0]-A[0]*y[2],w=A[0]*y[1]-A[1]*y[0];return[g,x,w]},i=A=>{let[y,g,x,w,b,v,N,T,R]=A,$,z,P;return w<1?w>-1?(P=Math.asin(w),z=Math.atan2(-N,y),$=Math.atan2(-v,b)):(P=-Math.PI/2,z=-Math.atan2(T,R),$=0):(P=Math.PI/2,z=Math.atan2(T,R),$=0),{pitch:2*-$,yaw:2*-z,roll:2*-P}},o=A=>{let y=(x,w,b,v)=>Math.atan2(v-w,b-x);return{pitch:y(A[10][1],A[10][2],A[152][1],A[152][2]),yaw:y(A[33][0],A[33][2],A[263][0],A[263][2]),roll:y(A[33][0],A[33][1],A[263][0],A[263][1])}},l=e.meshRaw;if(!l||l.length<300)return{angle:{pitch:0,yaw:0,roll:0},matrix:[1,0,0,0,1,0,0,0,1]};let d=Math.max(e.boxRaw[2]*t[0],e.boxRaw[3]*t[1])/1.5,u=[l[10],l[152],l[234],l[454]].map(A=>[A[0]*t[0]/d,A[1]*t[1]/d,A[2]]),p=a(r(u[1],u[0])),c=a(r(u[3],u[2])),h=a(s(c,p));c=s(p,h);let m=[c[0],c[1],c[2],p[0],p[1],p[2],h[0],h[1],h[2]];return{angle:i(m),matrix:m}},Q2=async(e,t)=>{var u,p,c,h,m,f;let n,a,r,s,i,o,l=[];e.state="run:face",n=it();let d=await j2(t,e.config);if(e.perf.face=Math.trunc(it()-n),!d)return[];for(let A of d){if(e.analyze("Get Face"),!A.image||A.image.isDisposedInternal){he("Face object is disposed:",A.image);continue}let y=Fie(A,[t.shape[2],t.shape[1]]);e.analyze("Start Emotion:"),e.config.async?s=e.config.face.emotion.enabled?v0(A.image,e.config):{}:(e.state="run:emotion",n=it(),s=e.config.face.emotion.enabled?await v0(A.image,e.config):{},e.perf.emotion=Math.trunc(it()-n)),e.analyze("End Emotion:"),e.analyze("Start Description:"),e.config.async?o=e.config.face.description.enabled?I0(A,e.config):[]:(e.state="run:description",n=it(),o=e.config.face.description.enabled?await I0(A.image,e.config):[],e.perf.embedding=Math.trunc(it()-n)),e.analyze("End Description:"),e.config.async&&([a,r,s,i,o]=await Promise.all([a,r,s,i,o])),e.analyze("Finish Face:"),!e.config.face.iris.enabled&&((u=A==null?void 0:A.annotations)==null?void 0:u.leftEyeIris)&&((p=A==null?void 0:A.annotations)==null?void 0:p.rightEyeIris)&&(delete A.annotations.leftEyeIris,delete A.annotations.rightEyeIris);let g=((c=A.annotations)==null?void 0:c.leftEyeIris)&&((h=A.annotations)==null?void 0:h.rightEyeIris)?11.7*Math.max(Math.abs(A.annotations.leftEyeIris[3][0]-A.annotations.leftEyeIris[1][0]),Math.abs(A.annotations.rightEyeIris[4][1]-A.annotations.rightEyeIris[2][1])):0;l.push({...A,age:o.age,gender:o.gender,genderConfidence:o.genderConfidence,embedding:o.descriptor,emotion:s,iris:g!==0?Math.trunc(g)/100:0,rotation:y,tensor:e.config.face.detector.return?(m=A.image)==null?void 0:m.squeeze():null}),(f=A.image)==null||f.dispose(),e.analyze("End Face")}return e.analyze("End FaceMesh:"),e.config.async&&(e.perf.face&&delete e.perf.face,e.perf.age&&delete e.perf.age,e.perf.gender&&delete e.perf.gender,e.perf.emotion&&delete e.perf.emotion),l};var sg={};Ma(sg,{load:()=>og,predict:()=>ig});var Kd=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"],xk=Kd.length,Zd=Kd.reduce((e,t,n)=>(e[t]=n,e),{}),$ie=[["leftHip","leftShoulder"],["leftElbow","leftShoulder"],["leftElbow","leftWrist"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["rightHip","rightShoulder"],["rightElbow","rightShoulder"],["rightElbow","rightWrist"],["rightHip","rightKnee"],["rightKnee","rightAnkle"],["leftShoulder","rightShoulder"],["leftHip","rightHip"]],Die=$ie.map(([e,t])=>[Zd[e],Zd[t]]),bk=[["nose","leftEye"],["leftEye","leftEar"],["nose","rightEye"],["rightEye","rightEar"],["nose","leftShoulder"],["leftShoulder","leftElbow"],["leftElbow","leftWrist"],["leftShoulder","leftHip"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["nose","rightShoulder"],["rightShoulder","rightElbow"],["rightElbow","rightWrist"],["rightShoulder","rightHip"],["rightHip","rightKnee"],["rightKnee","rightAnkle"]];function vk(e){let t=e.reduce(({maxX:n,maxY:a,minX:r,minY:s},{position:{x:i,y:o}})=>({maxX:Math.max(n,i),maxY:Math.max(a,o),minX:Math.min(r,i),minY:Math.min(s,o)}),{maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY});return[t.minX,t.minY,t.maxX-t.minX,t.maxY-t.minY]}function wk(e,[t,n],[a,r]){let s=(o,l,d)=>({score:o.score,box:[Math.trunc(o.box[0]*d),Math.trunc(o.box[1]*l),Math.trunc(o.box[2]*d),Math.trunc(o.box[3]*l)],keypoints:o.keypoints.map(({score:u,part:p,position:c})=>({score:u,part:p,position:{x:Math.trunc(c.x*d),y:Math.trunc(c.y*l)}}))});return e.map(o=>s(o,t/a,n/r))}var eg=class{constructor(t,n){this.priorityQueue=new Array(t),this.numberOfElements=-1,this.getElementValue=n}enqueue(t){this.priorityQueue[++this.numberOfElements]=t,this.swim(this.numberOfElements)}dequeue(){let t=this.priorityQueue[0];return this.exchange(0,this.numberOfElements--),this.sink(0),this.priorityQueue[this.numberOfElements+1]=null,t}empty(){return this.numberOfElements===-1}size(){return this.numberOfElements+1}all(){return this.priorityQueue.slice(0,this.numberOfElements+1)}max(){return this.priorityQueue[0]}swim(t){for(;t>0&&this.less(Math.floor(t/2),t);)this.exchange(t,Math.floor(t/2)),t=Math.floor(t/2)}sink(t){for(;2*t<=this.numberOfElements;){let n=2*t;if(nn?n:e}function kk(e,t,n,a){let r=n-e,s=a-t;return r*r+s*s}function rg(e,t){return{x:e.x+t.x,y:e.y+t.y}}var S0=1,Ql=16,Oie=50**2;function Ik(e,t,n,a,r,s,i=2){let o=y=>({y:s.get(y.y,y.x,e),x:s.get(y.y,y.x,s.shape[2]/2+e)}),l=(y,g,x)=>({y:ag(Math.round(y.y/Ql),0,g-1),x:ag(Math.round(y.x/Ql),0,x-1)}),[d,u]=a.shape,p=l(t.position,d,u),c=o(p),m=rg(t.position,c);for(let y=0;y[Zd[c],Zd[h]]),i=s.map(([,c])=>c),o=s.map(([c])=>c),l=t.shape[2],d=i.length,u=new Array(l),p=ng(e.part,Ql,n);u[e.part.id]={score:e.score,part:Kd[e.part.id],position:p};for(let c=d-1;c>=0;--c){let h=i[c],m=o[c];u[h]&&!u[m]&&(u[m]=Ik(c,u[h],m,t,n,r))}for(let c=0;ct){o=!1;break}if(!o)break}return o}function Pie(e,t){let[n,a,r]=t.shape,s=new eg(n*a*r,({score:i})=>i);for(let i=0;i{var i;let s=(i=r[a])==null?void 0:i.position;return s?kk(n,t,s.y,s.x)<=Oie:!1})}function Lie(e,t){return t.reduce((a,{position:r,score:s},i)=>(Sk(e,r,i)||(a+=s),a),0)/t.length}function Nk(e,t,n,a,r,s){let i=[],o=Pie(s,t);for(;i.lengthh.score>s);let p=Lie(i,u),c=vk(u);p>s&&i.push({keypoints:u,box:c,score:Math.round(100*p)/100})}return i}var ha,Wie=["MobilenetV1/offset_2/BiasAdd","MobilenetV1/heatmap_2/BiasAdd","MobilenetV1/displacement_fwd_2/BiasAdd","MobilenetV1/displacement_bwd_2/BiasAdd"];async function ig(e,t){let n=W(()=>{let o=e.resizeBilinear([ha.inputs[0].shape[2],ha.inputs[0].shape[1]]).toFloat().div(127.5).sub(1),d=ha.execute(o,Wie).map(u=>u.squeeze([0]));return d[1]=d[1].sigmoid(),d}),a=await Promise.all(n.map(i=>i.buffer()));for(let i of n)i.dispose();let r=await Nk(a[0],a[1],a[2],a[3],t.body.maxDetected,t.body.minConfidence);return wk(r,[e.shape[1],e.shape[2]],[ha.inputs[0].shape[2],ha.inputs[0].shape[1]])}async function og(e){return ha?e.debug&&he("cached model:",ha.modelUrl):(ha=await Gt(Yt(e.modelBasePath,e.body.modelPath)),!ha||!ha.modelUrl?he("load model failed:",e.body.modelPath):e.debug&&he("load model:",ha.modelUrl)),ha}var cg={};Ma(cg,{load:()=>fg,predict:()=>hg});function N0(e){return[Math.abs(e.endPoint[0]-e.startPoint[0]),Math.abs(e.endPoint[1]-e.startPoint[1])]}function Yd(e){return[e.startPoint[0]+(e.endPoint[0]-e.startPoint[0])/2,e.startPoint[1]+(e.endPoint[1]-e.startPoint[1])/2]}function Tk(e,t,n){let a=t.shape[1],r=t.shape[2],s=[[e.startPoint[1]/a,e.startPoint[0]/r,e.endPoint[1]/a,e.endPoint[0]/r]];return Ye.cropAndResize(t,s,[0],n)}function Ek(e,t){let n=[e.startPoint[0]*t[0],e.startPoint[1]*t[1]],a=[e.endPoint[0]*t[0],e.endPoint[1]*t[1]],r=e.palmLandmarks.map(s=>[s[0]*t[0],s[1]*t[1]]);return{startPoint:n,endPoint:a,palmLandmarks:r,confidence:e.confidence}}function T0(e,t=1.5){let n=Yd(e),a=N0(e),r=[t*a[0]/2,t*a[1]/2],s=[n[0]-r[0],n[1]-r[1]],i=[n[0]+r[0],n[1]+r[1]];return{startPoint:s,endPoint:i,palmLandmarks:e.palmLandmarks}}function E0(e){let t=Yd(e),n=N0(e),r=Math.max(...n)/2,s=[t[0]-r,t[1]-r],i=[t[0]+r,t[1]+r];return{startPoint:s,endPoint:i,palmLandmarks:e.palmLandmarks}}var Ck=[{x:.015625,y:.015625},{x:.015625,y:.015625},{x:.046875,y:.015625},{x:.046875,y:.015625},{x:.078125,y:.015625},{x:.078125,y:.015625},{x:.109375,y:.015625},{x:.109375,y:.015625},{x:.140625,y:.015625},{x:.140625,y:.015625},{x:.171875,y:.015625},{x:.171875,y:.015625},{x:.203125,y:.015625},{x:.203125,y:.015625},{x:.234375,y:.015625},{x:.234375,y:.015625},{x:.265625,y:.015625},{x:.265625,y:.015625},{x:.296875,y:.015625},{x:.296875,y:.015625},{x:.328125,y:.015625},{x:.328125,y:.015625},{x:.359375,y:.015625},{x:.359375,y:.015625},{x:.390625,y:.015625},{x:.390625,y:.015625},{x:.421875,y:.015625},{x:.421875,y:.015625},{x:.453125,y:.015625},{x:.453125,y:.015625},{x:.484375,y:.015625},{x:.484375,y:.015625},{x:.515625,y:.015625},{x:.515625,y:.015625},{x:.546875,y:.015625},{x:.546875,y:.015625},{x:.578125,y:.015625},{x:.578125,y:.015625},{x:.609375,y:.015625},{x:.609375,y:.015625},{x:.640625,y:.015625},{x:.640625,y:.015625},{x:.671875,y:.015625},{x:.671875,y:.015625},{x:.703125,y:.015625},{x:.703125,y:.015625},{x:.734375,y:.015625},{x:.734375,y:.015625},{x:.765625,y:.015625},{x:.765625,y:.015625},{x:.796875,y:.015625},{x:.796875,y:.015625},{x:.828125,y:.015625},{x:.828125,y:.015625},{x:.859375,y:.015625},{x:.859375,y:.015625},{x:.890625,y:.015625},{x:.890625,y:.015625},{x:.921875,y:.015625},{x:.921875,y:.015625},{x:.953125,y:.015625},{x:.953125,y:.015625},{x:.984375,y:.015625},{x:.984375,y:.015625},{x:.015625,y:.046875},{x:.015625,y:.046875},{x:.046875,y:.046875},{x:.046875,y:.046875},{x:.078125,y:.046875},{x:.078125,y:.046875},{x:.109375,y:.046875},{x:.109375,y:.046875},{x:.140625,y:.046875},{x:.140625,y:.046875},{x:.171875,y:.046875},{x:.171875,y:.046875},{x:.203125,y:.046875},{x:.203125,y:.046875},{x:.234375,y:.046875},{x:.234375,y:.046875},{x:.265625,y:.046875},{x:.265625,y:.046875},{x:.296875,y:.046875},{x:.296875,y:.046875},{x:.328125,y:.046875},{x:.328125,y:.046875},{x:.359375,y:.046875},{x:.359375,y:.046875},{x:.390625,y:.046875},{x:.390625,y:.046875},{x:.421875,y:.046875},{x:.421875,y:.046875},{x:.453125,y:.046875},{x:.453125,y:.046875},{x:.484375,y:.046875},{x:.484375,y:.046875},{x:.515625,y:.046875},{x:.515625,y:.046875},{x:.546875,y:.046875},{x:.546875,y:.046875},{x:.578125,y:.046875},{x:.578125,y:.046875},{x:.609375,y:.046875},{x:.609375,y:.046875},{x:.640625,y:.046875},{x:.640625,y:.046875},{x:.671875,y:.046875},{x:.671875,y:.046875},{x:.703125,y:.046875},{x:.703125,y:.046875},{x:.734375,y:.046875},{x:.734375,y:.046875},{x:.765625,y:.046875},{x:.765625,y:.046875},{x:.796875,y:.046875},{x:.796875,y:.046875},{x:.828125,y:.046875},{x:.828125,y:.046875},{x:.859375,y:.046875},{x:.859375,y:.046875},{x:.890625,y:.046875},{x:.890625,y:.046875},{x:.921875,y:.046875},{x:.921875,y:.046875},{x:.953125,y:.046875},{x:.953125,y:.046875},{x:.984375,y:.046875},{x:.984375,y:.046875},{x:.015625,y:.078125},{x:.015625,y:.078125},{x:.046875,y:.078125},{x:.046875,y:.078125},{x:.078125,y:.078125},{x:.078125,y:.078125},{x:.109375,y:.078125},{x:.109375,y:.078125},{x:.140625,y:.078125},{x:.140625,y:.078125},{x:.171875,y:.078125},{x:.171875,y:.078125},{x:.203125,y:.078125},{x:.203125,y:.078125},{x:.234375,y:.078125},{x:.234375,y:.078125},{x:.265625,y:.078125},{x:.265625,y:.078125},{x:.296875,y:.078125},{x:.296875,y:.078125},{x:.328125,y:.078125},{x:.328125,y:.078125},{x:.359375,y:.078125},{x:.359375,y:.078125},{x:.390625,y:.078125},{x:.390625,y:.078125},{x:.421875,y:.078125},{x:.421875,y:.078125},{x:.453125,y:.078125},{x:.453125,y:.078125},{x:.484375,y:.078125},{x:.484375,y:.078125},{x:.515625,y:.078125},{x:.515625,y:.078125},{x:.546875,y:.078125},{x:.546875,y:.078125},{x:.578125,y:.078125},{x:.578125,y:.078125},{x:.609375,y:.078125},{x:.609375,y:.078125},{x:.640625,y:.078125},{x:.640625,y:.078125},{x:.671875,y:.078125},{x:.671875,y:.078125},{x:.703125,y:.078125},{x:.703125,y:.078125},{x:.734375,y:.078125},{x:.734375,y:.078125},{x:.765625,y:.078125},{x:.765625,y:.078125},{x:.796875,y:.078125},{x:.796875,y:.078125},{x:.828125,y:.078125},{x:.828125,y:.078125},{x:.859375,y:.078125},{x:.859375,y:.078125},{x:.890625,y:.078125},{x:.890625,y:.078125},{x:.921875,y:.078125},{x:.921875,y:.078125},{x:.953125,y:.078125},{x:.953125,y:.078125},{x:.984375,y:.078125},{x:.984375,y:.078125},{x:.015625,y:.109375},{x:.015625,y:.109375},{x:.046875,y:.109375},{x:.046875,y:.109375},{x:.078125,y:.109375},{x:.078125,y:.109375},{x:.109375,y:.109375},{x:.109375,y:.109375},{x:.140625,y:.109375},{x:.140625,y:.109375},{x:.171875,y:.109375},{x:.171875,y:.109375},{x:.203125,y:.109375},{x:.203125,y:.109375},{x:.234375,y:.109375},{x:.234375,y:.109375},{x:.265625,y:.109375},{x:.265625,y:.109375},{x:.296875,y:.109375},{x:.296875,y:.109375},{x:.328125,y:.109375},{x:.328125,y:.109375},{x:.359375,y:.109375},{x:.359375,y:.109375},{x:.390625,y:.109375},{x:.390625,y:.109375},{x:.421875,y:.109375},{x:.421875,y:.109375},{x:.453125,y:.109375},{x:.453125,y:.109375},{x:.484375,y:.109375},{x:.484375,y:.109375},{x:.515625,y:.109375},{x:.515625,y:.109375},{x:.546875,y:.109375},{x:.546875,y:.109375},{x:.578125,y:.109375},{x:.578125,y:.109375},{x:.609375,y:.109375},{x:.609375,y:.109375},{x:.640625,y:.109375},{x:.640625,y:.109375},{x:.671875,y:.109375},{x:.671875,y:.109375},{x:.703125,y:.109375},{x:.703125,y:.109375},{x:.734375,y:.109375},{x:.734375,y:.109375},{x:.765625,y:.109375},{x:.765625,y:.109375},{x:.796875,y:.109375},{x:.796875,y:.109375},{x:.828125,y:.109375},{x:.828125,y:.109375},{x:.859375,y:.109375},{x:.859375,y:.109375},{x:.890625,y:.109375},{x:.890625,y:.109375},{x:.921875,y:.109375},{x:.921875,y:.109375},{x:.953125,y:.109375},{x:.953125,y:.109375},{x:.984375,y:.109375},{x:.984375,y:.109375},{x:.015625,y:.140625},{x:.015625,y:.140625},{x:.046875,y:.140625},{x:.046875,y:.140625},{x:.078125,y:.140625},{x:.078125,y:.140625},{x:.109375,y:.140625},{x:.109375,y:.140625},{x:.140625,y:.140625},{x:.140625,y:.140625},{x:.171875,y:.140625},{x:.171875,y:.140625},{x:.203125,y:.140625},{x:.203125,y:.140625},{x:.234375,y:.140625},{x:.234375,y:.140625},{x:.265625,y:.140625},{x:.265625,y:.140625},{x:.296875,y:.140625},{x:.296875,y:.140625},{x:.328125,y:.140625},{x:.328125,y:.140625},{x:.359375,y:.140625},{x:.359375,y:.140625},{x:.390625,y:.140625},{x:.390625,y:.140625},{x:.421875,y:.140625},{x:.421875,y:.140625},{x:.453125,y:.140625},{x:.453125,y:.140625},{x:.484375,y:.140625},{x:.484375,y:.140625},{x:.515625,y:.140625},{x:.515625,y:.140625},{x:.546875,y:.140625},{x:.546875,y:.140625},{x:.578125,y:.140625},{x:.578125,y:.140625},{x:.609375,y:.140625},{x:.609375,y:.140625},{x:.640625,y:.140625},{x:.640625,y:.140625},{x:.671875,y:.140625},{x:.671875,y:.140625},{x:.703125,y:.140625},{x:.703125,y:.140625},{x:.734375,y:.140625},{x:.734375,y:.140625},{x:.765625,y:.140625},{x:.765625,y:.140625},{x:.796875,y:.140625},{x:.796875,y:.140625},{x:.828125,y:.140625},{x:.828125,y:.140625},{x:.859375,y:.140625},{x:.859375,y:.140625},{x:.890625,y:.140625},{x:.890625,y:.140625},{x:.921875,y:.140625},{x:.921875,y:.140625},{x:.953125,y:.140625},{x:.953125,y:.140625},{x:.984375,y:.140625},{x:.984375,y:.140625},{x:.015625,y:.171875},{x:.015625,y:.171875},{x:.046875,y:.171875},{x:.046875,y:.171875},{x:.078125,y:.171875},{x:.078125,y:.171875},{x:.109375,y:.171875},{x:.109375,y:.171875},{x:.140625,y:.171875},{x:.140625,y:.171875},{x:.171875,y:.171875},{x:.171875,y:.171875},{x:.203125,y:.171875},{x:.203125,y:.171875},{x:.234375,y:.171875},{x:.234375,y:.171875},{x:.265625,y:.171875},{x:.265625,y:.171875},{x:.296875,y:.171875},{x:.296875,y:.171875},{x:.328125,y:.171875},{x:.328125,y:.171875},{x:.359375,y:.171875},{x:.359375,y:.171875},{x:.390625,y:.171875},{x:.390625,y:.171875},{x:.421875,y:.171875},{x:.421875,y:.171875},{x:.453125,y:.171875},{x:.453125,y:.171875},{x:.484375,y:.171875},{x:.484375,y:.171875},{x:.515625,y:.171875},{x:.515625,y:.171875},{x:.546875,y:.171875},{x:.546875,y:.171875},{x:.578125,y:.171875},{x:.578125,y:.171875},{x:.609375,y:.171875},{x:.609375,y:.171875},{x:.640625,y:.171875},{x:.640625,y:.171875},{x:.671875,y:.171875},{x:.671875,y:.171875},{x:.703125,y:.171875},{x:.703125,y:.171875},{x:.734375,y:.171875},{x:.734375,y:.171875},{x:.765625,y:.171875},{x:.765625,y:.171875},{x:.796875,y:.171875},{x:.796875,y:.171875},{x:.828125,y:.171875},{x:.828125,y:.171875},{x:.859375,y:.171875},{x:.859375,y:.171875},{x:.890625,y:.171875},{x:.890625,y:.171875},{x:.921875,y:.171875},{x:.921875,y:.171875},{x:.953125,y:.171875},{x:.953125,y:.171875},{x:.984375,y:.171875},{x:.984375,y:.171875},{x:.015625,y:.203125},{x:.015625,y:.203125},{x:.046875,y:.203125},{x:.046875,y:.203125},{x:.078125,y:.203125},{x:.078125,y:.203125},{x:.109375,y:.203125},{x:.109375,y:.203125},{x:.140625,y:.203125},{x:.140625,y:.203125},{x:.171875,y:.203125},{x:.171875,y:.203125},{x:.203125,y:.203125},{x:.203125,y:.203125},{x:.234375,y:.203125},{x:.234375,y:.203125},{x:.265625,y:.203125},{x:.265625,y:.203125},{x:.296875,y:.203125},{x:.296875,y:.203125},{x:.328125,y:.203125},{x:.328125,y:.203125},{x:.359375,y:.203125},{x:.359375,y:.203125},{x:.390625,y:.203125},{x:.390625,y:.203125},{x:.421875,y:.203125},{x:.421875,y:.203125},{x:.453125,y:.203125},{x:.453125,y:.203125},{x:.484375,y:.203125},{x:.484375,y:.203125},{x:.515625,y:.203125},{x:.515625,y:.203125},{x:.546875,y:.203125},{x:.546875,y:.203125},{x:.578125,y:.203125},{x:.578125,y:.203125},{x:.609375,y:.203125},{x:.609375,y:.203125},{x:.640625,y:.203125},{x:.640625,y:.203125},{x:.671875,y:.203125},{x:.671875,y:.203125},{x:.703125,y:.203125},{x:.703125,y:.203125},{x:.734375,y:.203125},{x:.734375,y:.203125},{x:.765625,y:.203125},{x:.765625,y:.203125},{x:.796875,y:.203125},{x:.796875,y:.203125},{x:.828125,y:.203125},{x:.828125,y:.203125},{x:.859375,y:.203125},{x:.859375,y:.203125},{x:.890625,y:.203125},{x:.890625,y:.203125},{x:.921875,y:.203125},{x:.921875,y:.203125},{x:.953125,y:.203125},{x:.953125,y:.203125},{x:.984375,y:.203125},{x:.984375,y:.203125},{x:.015625,y:.234375},{x:.015625,y:.234375},{x:.046875,y:.234375},{x:.046875,y:.234375},{x:.078125,y:.234375},{x:.078125,y:.234375},{x:.109375,y:.234375},{x:.109375,y:.234375},{x:.140625,y:.234375},{x:.140625,y:.234375},{x:.171875,y:.234375},{x:.171875,y:.234375},{x:.203125,y:.234375},{x:.203125,y:.234375},{x:.234375,y:.234375},{x:.234375,y:.234375},{x:.265625,y:.234375},{x:.265625,y:.234375},{x:.296875,y:.234375},{x:.296875,y:.234375},{x:.328125,y:.234375},{x:.328125,y:.234375},{x:.359375,y:.234375},{x:.359375,y:.234375},{x:.390625,y:.234375},{x:.390625,y:.234375},{x:.421875,y:.234375},{x:.421875,y:.234375},{x:.453125,y:.234375},{x:.453125,y:.234375},{x:.484375,y:.234375},{x:.484375,y:.234375},{x:.515625,y:.234375},{x:.515625,y:.234375},{x:.546875,y:.234375},{x:.546875,y:.234375},{x:.578125,y:.234375},{x:.578125,y:.234375},{x:.609375,y:.234375},{x:.609375,y:.234375},{x:.640625,y:.234375},{x:.640625,y:.234375},{x:.671875,y:.234375},{x:.671875,y:.234375},{x:.703125,y:.234375},{x:.703125,y:.234375},{x:.734375,y:.234375},{x:.734375,y:.234375},{x:.765625,y:.234375},{x:.765625,y:.234375},{x:.796875,y:.234375},{x:.796875,y:.234375},{x:.828125,y:.234375},{x:.828125,y:.234375},{x:.859375,y:.234375},{x:.859375,y:.234375},{x:.890625,y:.234375},{x:.890625,y:.234375},{x:.921875,y:.234375},{x:.921875,y:.234375},{x:.953125,y:.234375},{x:.953125,y:.234375},{x:.984375,y:.234375},{x:.984375,y:.234375},{x:.015625,y:.265625},{x:.015625,y:.265625},{x:.046875,y:.265625},{x:.046875,y:.265625},{x:.078125,y:.265625},{x:.078125,y:.265625},{x:.109375,y:.265625},{x:.109375,y:.265625},{x:.140625,y:.265625},{x:.140625,y:.265625},{x:.171875,y:.265625},{x:.171875,y:.265625},{x:.203125,y:.265625},{x:.203125,y:.265625},{x:.234375,y:.265625},{x:.234375,y:.265625},{x:.265625,y:.265625},{x:.265625,y:.265625},{x:.296875,y:.265625},{x:.296875,y:.265625},{x:.328125,y:.265625},{x:.328125,y:.265625},{x:.359375,y:.265625},{x:.359375,y:.265625},{x:.390625,y:.265625},{x:.390625,y:.265625},{x:.421875,y:.265625},{x:.421875,y:.265625},{x:.453125,y:.265625},{x:.453125,y:.265625},{x:.484375,y:.265625},{x:.484375,y:.265625},{x:.515625,y:.265625},{x:.515625,y:.265625},{x:.546875,y:.265625},{x:.546875,y:.265625},{x:.578125,y:.265625},{x:.578125,y:.265625},{x:.609375,y:.265625},{x:.609375,y:.265625},{x:.640625,y:.265625},{x:.640625,y:.265625},{x:.671875,y:.265625},{x:.671875,y:.265625},{x:.703125,y:.265625},{x:.703125,y:.265625},{x:.734375,y:.265625},{x:.734375,y:.265625},{x:.765625,y:.265625},{x:.765625,y:.265625},{x:.796875,y:.265625},{x:.796875,y:.265625},{x:.828125,y:.265625},{x:.828125,y:.265625},{x:.859375,y:.265625},{x:.859375,y:.265625},{x:.890625,y:.265625},{x:.890625,y:.265625},{x:.921875,y:.265625},{x:.921875,y:.265625},{x:.953125,y:.265625},{x:.953125,y:.265625},{x:.984375,y:.265625},{x:.984375,y:.265625},{x:.015625,y:.296875},{x:.015625,y:.296875},{x:.046875,y:.296875},{x:.046875,y:.296875},{x:.078125,y:.296875},{x:.078125,y:.296875},{x:.109375,y:.296875},{x:.109375,y:.296875},{x:.140625,y:.296875},{x:.140625,y:.296875},{x:.171875,y:.296875},{x:.171875,y:.296875},{x:.203125,y:.296875},{x:.203125,y:.296875},{x:.234375,y:.296875},{x:.234375,y:.296875},{x:.265625,y:.296875},{x:.265625,y:.296875},{x:.296875,y:.296875},{x:.296875,y:.296875},{x:.328125,y:.296875},{x:.328125,y:.296875},{x:.359375,y:.296875},{x:.359375,y:.296875},{x:.390625,y:.296875},{x:.390625,y:.296875},{x:.421875,y:.296875},{x:.421875,y:.296875},{x:.453125,y:.296875},{x:.453125,y:.296875},{x:.484375,y:.296875},{x:.484375,y:.296875},{x:.515625,y:.296875},{x:.515625,y:.296875},{x:.546875,y:.296875},{x:.546875,y:.296875},{x:.578125,y:.296875},{x:.578125,y:.296875},{x:.609375,y:.296875},{x:.609375,y:.296875},{x:.640625,y:.296875},{x:.640625,y:.296875},{x:.671875,y:.296875},{x:.671875,y:.296875},{x:.703125,y:.296875},{x:.703125,y:.296875},{x:.734375,y:.296875},{x:.734375,y:.296875},{x:.765625,y:.296875},{x:.765625,y:.296875},{x:.796875,y:.296875},{x:.796875,y:.296875},{x:.828125,y:.296875},{x:.828125,y:.296875},{x:.859375,y:.296875},{x:.859375,y:.296875},{x:.890625,y:.296875},{x:.890625,y:.296875},{x:.921875,y:.296875},{x:.921875,y:.296875},{x:.953125,y:.296875},{x:.953125,y:.296875},{x:.984375,y:.296875},{x:.984375,y:.296875},{x:.015625,y:.328125},{x:.015625,y:.328125},{x:.046875,y:.328125},{x:.046875,y:.328125},{x:.078125,y:.328125},{x:.078125,y:.328125},{x:.109375,y:.328125},{x:.109375,y:.328125},{x:.140625,y:.328125},{x:.140625,y:.328125},{x:.171875,y:.328125},{x:.171875,y:.328125},{x:.203125,y:.328125},{x:.203125,y:.328125},{x:.234375,y:.328125},{x:.234375,y:.328125},{x:.265625,y:.328125},{x:.265625,y:.328125},{x:.296875,y:.328125},{x:.296875,y:.328125},{x:.328125,y:.328125},{x:.328125,y:.328125},{x:.359375,y:.328125},{x:.359375,y:.328125},{x:.390625,y:.328125},{x:.390625,y:.328125},{x:.421875,y:.328125},{x:.421875,y:.328125},{x:.453125,y:.328125},{x:.453125,y:.328125},{x:.484375,y:.328125},{x:.484375,y:.328125},{x:.515625,y:.328125},{x:.515625,y:.328125},{x:.546875,y:.328125},{x:.546875,y:.328125},{x:.578125,y:.328125},{x:.578125,y:.328125},{x:.609375,y:.328125},{x:.609375,y:.328125},{x:.640625,y:.328125},{x:.640625,y:.328125},{x:.671875,y:.328125},{x:.671875,y:.328125},{x:.703125,y:.328125},{x:.703125,y:.328125},{x:.734375,y:.328125},{x:.734375,y:.328125},{x:.765625,y:.328125},{x:.765625,y:.328125},{x:.796875,y:.328125},{x:.796875,y:.328125},{x:.828125,y:.328125},{x:.828125,y:.328125},{x:.859375,y:.328125},{x:.859375,y:.328125},{x:.890625,y:.328125},{x:.890625,y:.328125},{x:.921875,y:.328125},{x:.921875,y:.328125},{x:.953125,y:.328125},{x:.953125,y:.328125},{x:.984375,y:.328125},{x:.984375,y:.328125},{x:.015625,y:.359375},{x:.015625,y:.359375},{x:.046875,y:.359375},{x:.046875,y:.359375},{x:.078125,y:.359375},{x:.078125,y:.359375},{x:.109375,y:.359375},{x:.109375,y:.359375},{x:.140625,y:.359375},{x:.140625,y:.359375},{x:.171875,y:.359375},{x:.171875,y:.359375},{x:.203125,y:.359375},{x:.203125,y:.359375},{x:.234375,y:.359375},{x:.234375,y:.359375},{x:.265625,y:.359375},{x:.265625,y:.359375},{x:.296875,y:.359375},{x:.296875,y:.359375},{x:.328125,y:.359375},{x:.328125,y:.359375},{x:.359375,y:.359375},{x:.359375,y:.359375},{x:.390625,y:.359375},{x:.390625,y:.359375},{x:.421875,y:.359375},{x:.421875,y:.359375},{x:.453125,y:.359375},{x:.453125,y:.359375},{x:.484375,y:.359375},{x:.484375,y:.359375},{x:.515625,y:.359375},{x:.515625,y:.359375},{x:.546875,y:.359375},{x:.546875,y:.359375},{x:.578125,y:.359375},{x:.578125,y:.359375},{x:.609375,y:.359375},{x:.609375,y:.359375},{x:.640625,y:.359375},{x:.640625,y:.359375},{x:.671875,y:.359375},{x:.671875,y:.359375},{x:.703125,y:.359375},{x:.703125,y:.359375},{x:.734375,y:.359375},{x:.734375,y:.359375},{x:.765625,y:.359375},{x:.765625,y:.359375},{x:.796875,y:.359375},{x:.796875,y:.359375},{x:.828125,y:.359375},{x:.828125,y:.359375},{x:.859375,y:.359375},{x:.859375,y:.359375},{x:.890625,y:.359375},{x:.890625,y:.359375},{x:.921875,y:.359375},{x:.921875,y:.359375},{x:.953125,y:.359375},{x:.953125,y:.359375},{x:.984375,y:.359375},{x:.984375,y:.359375},{x:.015625,y:.390625},{x:.015625,y:.390625},{x:.046875,y:.390625},{x:.046875,y:.390625},{x:.078125,y:.390625},{x:.078125,y:.390625},{x:.109375,y:.390625},{x:.109375,y:.390625},{x:.140625,y:.390625},{x:.140625,y:.390625},{x:.171875,y:.390625},{x:.171875,y:.390625},{x:.203125,y:.390625},{x:.203125,y:.390625},{x:.234375,y:.390625},{x:.234375,y:.390625},{x:.265625,y:.390625},{x:.265625,y:.390625},{x:.296875,y:.390625},{x:.296875,y:.390625},{x:.328125,y:.390625},{x:.328125,y:.390625},{x:.359375,y:.390625},{x:.359375,y:.390625},{x:.390625,y:.390625},{x:.390625,y:.390625},{x:.421875,y:.390625},{x:.421875,y:.390625},{x:.453125,y:.390625},{x:.453125,y:.390625},{x:.484375,y:.390625},{x:.484375,y:.390625},{x:.515625,y:.390625},{x:.515625,y:.390625},{x:.546875,y:.390625},{x:.546875,y:.390625},{x:.578125,y:.390625},{x:.578125,y:.390625},{x:.609375,y:.390625},{x:.609375,y:.390625},{x:.640625,y:.390625},{x:.640625,y:.390625},{x:.671875,y:.390625},{x:.671875,y:.390625},{x:.703125,y:.390625},{x:.703125,y:.390625},{x:.734375,y:.390625},{x:.734375,y:.390625},{x:.765625,y:.390625},{x:.765625,y:.390625},{x:.796875,y:.390625},{x:.796875,y:.390625},{x:.828125,y:.390625},{x:.828125,y:.390625},{x:.859375,y:.390625},{x:.859375,y:.390625},{x:.890625,y:.390625},{x:.890625,y:.390625},{x:.921875,y:.390625},{x:.921875,y:.390625},{x:.953125,y:.390625},{x:.953125,y:.390625},{x:.984375,y:.390625},{x:.984375,y:.390625},{x:.015625,y:.421875},{x:.015625,y:.421875},{x:.046875,y:.421875},{x:.046875,y:.421875},{x:.078125,y:.421875},{x:.078125,y:.421875},{x:.109375,y:.421875},{x:.109375,y:.421875},{x:.140625,y:.421875},{x:.140625,y:.421875},{x:.171875,y:.421875},{x:.171875,y:.421875},{x:.203125,y:.421875},{x:.203125,y:.421875},{x:.234375,y:.421875},{x:.234375,y:.421875},{x:.265625,y:.421875},{x:.265625,y:.421875},{x:.296875,y:.421875},{x:.296875,y:.421875},{x:.328125,y:.421875},{x:.328125,y:.421875},{x:.359375,y:.421875},{x:.359375,y:.421875},{x:.390625,y:.421875},{x:.390625,y:.421875},{x:.421875,y:.421875},{x:.421875,y:.421875},{x:.453125,y:.421875},{x:.453125,y:.421875},{x:.484375,y:.421875},{x:.484375,y:.421875},{x:.515625,y:.421875},{x:.515625,y:.421875},{x:.546875,y:.421875},{x:.546875,y:.421875},{x:.578125,y:.421875},{x:.578125,y:.421875},{x:.609375,y:.421875},{x:.609375,y:.421875},{x:.640625,y:.421875},{x:.640625,y:.421875},{x:.671875,y:.421875},{x:.671875,y:.421875},{x:.703125,y:.421875},{x:.703125,y:.421875},{x:.734375,y:.421875},{x:.734375,y:.421875},{x:.765625,y:.421875},{x:.765625,y:.421875},{x:.796875,y:.421875},{x:.796875,y:.421875},{x:.828125,y:.421875},{x:.828125,y:.421875},{x:.859375,y:.421875},{x:.859375,y:.421875},{x:.890625,y:.421875},{x:.890625,y:.421875},{x:.921875,y:.421875},{x:.921875,y:.421875},{x:.953125,y:.421875},{x:.953125,y:.421875},{x:.984375,y:.421875},{x:.984375,y:.421875},{x:.015625,y:.453125},{x:.015625,y:.453125},{x:.046875,y:.453125},{x:.046875,y:.453125},{x:.078125,y:.453125},{x:.078125,y:.453125},{x:.109375,y:.453125},{x:.109375,y:.453125},{x:.140625,y:.453125},{x:.140625,y:.453125},{x:.171875,y:.453125},{x:.171875,y:.453125},{x:.203125,y:.453125},{x:.203125,y:.453125},{x:.234375,y:.453125},{x:.234375,y:.453125},{x:.265625,y:.453125},{x:.265625,y:.453125},{x:.296875,y:.453125},{x:.296875,y:.453125},{x:.328125,y:.453125},{x:.328125,y:.453125},{x:.359375,y:.453125},{x:.359375,y:.453125},{x:.390625,y:.453125},{x:.390625,y:.453125},{x:.421875,y:.453125},{x:.421875,y:.453125},{x:.453125,y:.453125},{x:.453125,y:.453125},{x:.484375,y:.453125},{x:.484375,y:.453125},{x:.515625,y:.453125},{x:.515625,y:.453125},{x:.546875,y:.453125},{x:.546875,y:.453125},{x:.578125,y:.453125},{x:.578125,y:.453125},{x:.609375,y:.453125},{x:.609375,y:.453125},{x:.640625,y:.453125},{x:.640625,y:.453125},{x:.671875,y:.453125},{x:.671875,y:.453125},{x:.703125,y:.453125},{x:.703125,y:.453125},{x:.734375,y:.453125},{x:.734375,y:.453125},{x:.765625,y:.453125},{x:.765625,y:.453125},{x:.796875,y:.453125},{x:.796875,y:.453125},{x:.828125,y:.453125},{x:.828125,y:.453125},{x:.859375,y:.453125},{x:.859375,y:.453125},{x:.890625,y:.453125},{x:.890625,y:.453125},{x:.921875,y:.453125},{x:.921875,y:.453125},{x:.953125,y:.453125},{x:.953125,y:.453125},{x:.984375,y:.453125},{x:.984375,y:.453125},{x:.015625,y:.484375},{x:.015625,y:.484375},{x:.046875,y:.484375},{x:.046875,y:.484375},{x:.078125,y:.484375},{x:.078125,y:.484375},{x:.109375,y:.484375},{x:.109375,y:.484375},{x:.140625,y:.484375},{x:.140625,y:.484375},{x:.171875,y:.484375},{x:.171875,y:.484375},{x:.203125,y:.484375},{x:.203125,y:.484375},{x:.234375,y:.484375},{x:.234375,y:.484375},{x:.265625,y:.484375},{x:.265625,y:.484375},{x:.296875,y:.484375},{x:.296875,y:.484375},{x:.328125,y:.484375},{x:.328125,y:.484375},{x:.359375,y:.484375},{x:.359375,y:.484375},{x:.390625,y:.484375},{x:.390625,y:.484375},{x:.421875,y:.484375},{x:.421875,y:.484375},{x:.453125,y:.484375},{x:.453125,y:.484375},{x:.484375,y:.484375},{x:.484375,y:.484375},{x:.515625,y:.484375},{x:.515625,y:.484375},{x:.546875,y:.484375},{x:.546875,y:.484375},{x:.578125,y:.484375},{x:.578125,y:.484375},{x:.609375,y:.484375},{x:.609375,y:.484375},{x:.640625,y:.484375},{x:.640625,y:.484375},{x:.671875,y:.484375},{x:.671875,y:.484375},{x:.703125,y:.484375},{x:.703125,y:.484375},{x:.734375,y:.484375},{x:.734375,y:.484375},{x:.765625,y:.484375},{x:.765625,y:.484375},{x:.796875,y:.484375},{x:.796875,y:.484375},{x:.828125,y:.484375},{x:.828125,y:.484375},{x:.859375,y:.484375},{x:.859375,y:.484375},{x:.890625,y:.484375},{x:.890625,y:.484375},{x:.921875,y:.484375},{x:.921875,y:.484375},{x:.953125,y:.484375},{x:.953125,y:.484375},{x:.984375,y:.484375},{x:.984375,y:.484375},{x:.015625,y:.515625},{x:.015625,y:.515625},{x:.046875,y:.515625},{x:.046875,y:.515625},{x:.078125,y:.515625},{x:.078125,y:.515625},{x:.109375,y:.515625},{x:.109375,y:.515625},{x:.140625,y:.515625},{x:.140625,y:.515625},{x:.171875,y:.515625},{x:.171875,y:.515625},{x:.203125,y:.515625},{x:.203125,y:.515625},{x:.234375,y:.515625},{x:.234375,y:.515625},{x:.265625,y:.515625},{x:.265625,y:.515625},{x:.296875,y:.515625},{x:.296875,y:.515625},{x:.328125,y:.515625},{x:.328125,y:.515625},{x:.359375,y:.515625},{x:.359375,y:.515625},{x:.390625,y:.515625},{x:.390625,y:.515625},{x:.421875,y:.515625},{x:.421875,y:.515625},{x:.453125,y:.515625},{x:.453125,y:.515625},{x:.484375,y:.515625},{x:.484375,y:.515625},{x:.515625,y:.515625},{x:.515625,y:.515625},{x:.546875,y:.515625},{x:.546875,y:.515625},{x:.578125,y:.515625},{x:.578125,y:.515625},{x:.609375,y:.515625},{x:.609375,y:.515625},{x:.640625,y:.515625},{x:.640625,y:.515625},{x:.671875,y:.515625},{x:.671875,y:.515625},{x:.703125,y:.515625},{x:.703125,y:.515625},{x:.734375,y:.515625},{x:.734375,y:.515625},{x:.765625,y:.515625},{x:.765625,y:.515625},{x:.796875,y:.515625},{x:.796875,y:.515625},{x:.828125,y:.515625},{x:.828125,y:.515625},{x:.859375,y:.515625},{x:.859375,y:.515625},{x:.890625,y:.515625},{x:.890625,y:.515625},{x:.921875,y:.515625},{x:.921875,y:.515625},{x:.953125,y:.515625},{x:.953125,y:.515625},{x:.984375,y:.515625},{x:.984375,y:.515625},{x:.015625,y:.546875},{x:.015625,y:.546875},{x:.046875,y:.546875},{x:.046875,y:.546875},{x:.078125,y:.546875},{x:.078125,y:.546875},{x:.109375,y:.546875},{x:.109375,y:.546875},{x:.140625,y:.546875},{x:.140625,y:.546875},{x:.171875,y:.546875},{x:.171875,y:.546875},{x:.203125,y:.546875},{x:.203125,y:.546875},{x:.234375,y:.546875},{x:.234375,y:.546875},{x:.265625,y:.546875},{x:.265625,y:.546875},{x:.296875,y:.546875},{x:.296875,y:.546875},{x:.328125,y:.546875},{x:.328125,y:.546875},{x:.359375,y:.546875},{x:.359375,y:.546875},{x:.390625,y:.546875},{x:.390625,y:.546875},{x:.421875,y:.546875},{x:.421875,y:.546875},{x:.453125,y:.546875},{x:.453125,y:.546875},{x:.484375,y:.546875},{x:.484375,y:.546875},{x:.515625,y:.546875},{x:.515625,y:.546875},{x:.546875,y:.546875},{x:.546875,y:.546875},{x:.578125,y:.546875},{x:.578125,y:.546875},{x:.609375,y:.546875},{x:.609375,y:.546875},{x:.640625,y:.546875},{x:.640625,y:.546875},{x:.671875,y:.546875},{x:.671875,y:.546875},{x:.703125,y:.546875},{x:.703125,y:.546875},{x:.734375,y:.546875},{x:.734375,y:.546875},{x:.765625,y:.546875},{x:.765625,y:.546875},{x:.796875,y:.546875},{x:.796875,y:.546875},{x:.828125,y:.546875},{x:.828125,y:.546875},{x:.859375,y:.546875},{x:.859375,y:.546875},{x:.890625,y:.546875},{x:.890625,y:.546875},{x:.921875,y:.546875},{x:.921875,y:.546875},{x:.953125,y:.546875},{x:.953125,y:.546875},{x:.984375,y:.546875},{x:.984375,y:.546875},{x:.015625,y:.578125},{x:.015625,y:.578125},{x:.046875,y:.578125},{x:.046875,y:.578125},{x:.078125,y:.578125},{x:.078125,y:.578125},{x:.109375,y:.578125},{x:.109375,y:.578125},{x:.140625,y:.578125},{x:.140625,y:.578125},{x:.171875,y:.578125},{x:.171875,y:.578125},{x:.203125,y:.578125},{x:.203125,y:.578125},{x:.234375,y:.578125},{x:.234375,y:.578125},{x:.265625,y:.578125},{x:.265625,y:.578125},{x:.296875,y:.578125},{x:.296875,y:.578125},{x:.328125,y:.578125},{x:.328125,y:.578125},{x:.359375,y:.578125},{x:.359375,y:.578125},{x:.390625,y:.578125},{x:.390625,y:.578125},{x:.421875,y:.578125},{x:.421875,y:.578125},{x:.453125,y:.578125},{x:.453125,y:.578125},{x:.484375,y:.578125},{x:.484375,y:.578125},{x:.515625,y:.578125},{x:.515625,y:.578125},{x:.546875,y:.578125},{x:.546875,y:.578125},{x:.578125,y:.578125},{x:.578125,y:.578125},{x:.609375,y:.578125},{x:.609375,y:.578125},{x:.640625,y:.578125},{x:.640625,y:.578125},{x:.671875,y:.578125},{x:.671875,y:.578125},{x:.703125,y:.578125},{x:.703125,y:.578125},{x:.734375,y:.578125},{x:.734375,y:.578125},{x:.765625,y:.578125},{x:.765625,y:.578125},{x:.796875,y:.578125},{x:.796875,y:.578125},{x:.828125,y:.578125},{x:.828125,y:.578125},{x:.859375,y:.578125},{x:.859375,y:.578125},{x:.890625,y:.578125},{x:.890625,y:.578125},{x:.921875,y:.578125},{x:.921875,y:.578125},{x:.953125,y:.578125},{x:.953125,y:.578125},{x:.984375,y:.578125},{x:.984375,y:.578125},{x:.015625,y:.609375},{x:.015625,y:.609375},{x:.046875,y:.609375},{x:.046875,y:.609375},{x:.078125,y:.609375},{x:.078125,y:.609375},{x:.109375,y:.609375},{x:.109375,y:.609375},{x:.140625,y:.609375},{x:.140625,y:.609375},{x:.171875,y:.609375},{x:.171875,y:.609375},{x:.203125,y:.609375},{x:.203125,y:.609375},{x:.234375,y:.609375},{x:.234375,y:.609375},{x:.265625,y:.609375},{x:.265625,y:.609375},{x:.296875,y:.609375},{x:.296875,y:.609375},{x:.328125,y:.609375},{x:.328125,y:.609375},{x:.359375,y:.609375},{x:.359375,y:.609375},{x:.390625,y:.609375},{x:.390625,y:.609375},{x:.421875,y:.609375},{x:.421875,y:.609375},{x:.453125,y:.609375},{x:.453125,y:.609375},{x:.484375,y:.609375},{x:.484375,y:.609375},{x:.515625,y:.609375},{x:.515625,y:.609375},{x:.546875,y:.609375},{x:.546875,y:.609375},{x:.578125,y:.609375},{x:.578125,y:.609375},{x:.609375,y:.609375},{x:.609375,y:.609375},{x:.640625,y:.609375},{x:.640625,y:.609375},{x:.671875,y:.609375},{x:.671875,y:.609375},{x:.703125,y:.609375},{x:.703125,y:.609375},{x:.734375,y:.609375},{x:.734375,y:.609375},{x:.765625,y:.609375},{x:.765625,y:.609375},{x:.796875,y:.609375},{x:.796875,y:.609375},{x:.828125,y:.609375},{x:.828125,y:.609375},{x:.859375,y:.609375},{x:.859375,y:.609375},{x:.890625,y:.609375},{x:.890625,y:.609375},{x:.921875,y:.609375},{x:.921875,y:.609375},{x:.953125,y:.609375},{x:.953125,y:.609375},{x:.984375,y:.609375},{x:.984375,y:.609375},{x:.015625,y:.640625},{x:.015625,y:.640625},{x:.046875,y:.640625},{x:.046875,y:.640625},{x:.078125,y:.640625},{x:.078125,y:.640625},{x:.109375,y:.640625},{x:.109375,y:.640625},{x:.140625,y:.640625},{x:.140625,y:.640625},{x:.171875,y:.640625},{x:.171875,y:.640625},{x:.203125,y:.640625},{x:.203125,y:.640625},{x:.234375,y:.640625},{x:.234375,y:.640625},{x:.265625,y:.640625},{x:.265625,y:.640625},{x:.296875,y:.640625},{x:.296875,y:.640625},{x:.328125,y:.640625},{x:.328125,y:.640625},{x:.359375,y:.640625},{x:.359375,y:.640625},{x:.390625,y:.640625},{x:.390625,y:.640625},{x:.421875,y:.640625},{x:.421875,y:.640625},{x:.453125,y:.640625},{x:.453125,y:.640625},{x:.484375,y:.640625},{x:.484375,y:.640625},{x:.515625,y:.640625},{x:.515625,y:.640625},{x:.546875,y:.640625},{x:.546875,y:.640625},{x:.578125,y:.640625},{x:.578125,y:.640625},{x:.609375,y:.640625},{x:.609375,y:.640625},{x:.640625,y:.640625},{x:.640625,y:.640625},{x:.671875,y:.640625},{x:.671875,y:.640625},{x:.703125,y:.640625},{x:.703125,y:.640625},{x:.734375,y:.640625},{x:.734375,y:.640625},{x:.765625,y:.640625},{x:.765625,y:.640625},{x:.796875,y:.640625},{x:.796875,y:.640625},{x:.828125,y:.640625},{x:.828125,y:.640625},{x:.859375,y:.640625},{x:.859375,y:.640625},{x:.890625,y:.640625},{x:.890625,y:.640625},{x:.921875,y:.640625},{x:.921875,y:.640625},{x:.953125,y:.640625},{x:.953125,y:.640625},{x:.984375,y:.640625},{x:.984375,y:.640625},{x:.015625,y:.671875},{x:.015625,y:.671875},{x:.046875,y:.671875},{x:.046875,y:.671875},{x:.078125,y:.671875},{x:.078125,y:.671875},{x:.109375,y:.671875},{x:.109375,y:.671875},{x:.140625,y:.671875},{x:.140625,y:.671875},{x:.171875,y:.671875},{x:.171875,y:.671875},{x:.203125,y:.671875},{x:.203125,y:.671875},{x:.234375,y:.671875},{x:.234375,y:.671875},{x:.265625,y:.671875},{x:.265625,y:.671875},{x:.296875,y:.671875},{x:.296875,y:.671875},{x:.328125,y:.671875},{x:.328125,y:.671875},{x:.359375,y:.671875},{x:.359375,y:.671875},{x:.390625,y:.671875},{x:.390625,y:.671875},{x:.421875,y:.671875},{x:.421875,y:.671875},{x:.453125,y:.671875},{x:.453125,y:.671875},{x:.484375,y:.671875},{x:.484375,y:.671875},{x:.515625,y:.671875},{x:.515625,y:.671875},{x:.546875,y:.671875},{x:.546875,y:.671875},{x:.578125,y:.671875},{x:.578125,y:.671875},{x:.609375,y:.671875},{x:.609375,y:.671875},{x:.640625,y:.671875},{x:.640625,y:.671875},{x:.671875,y:.671875},{x:.671875,y:.671875},{x:.703125,y:.671875},{x:.703125,y:.671875},{x:.734375,y:.671875},{x:.734375,y:.671875},{x:.765625,y:.671875},{x:.765625,y:.671875},{x:.796875,y:.671875},{x:.796875,y:.671875},{x:.828125,y:.671875},{x:.828125,y:.671875},{x:.859375,y:.671875},{x:.859375,y:.671875},{x:.890625,y:.671875},{x:.890625,y:.671875},{x:.921875,y:.671875},{x:.921875,y:.671875},{x:.953125,y:.671875},{x:.953125,y:.671875},{x:.984375,y:.671875},{x:.984375,y:.671875},{x:.015625,y:.703125},{x:.015625,y:.703125},{x:.046875,y:.703125},{x:.046875,y:.703125},{x:.078125,y:.703125},{x:.078125,y:.703125},{x:.109375,y:.703125},{x:.109375,y:.703125},{x:.140625,y:.703125},{x:.140625,y:.703125},{x:.171875,y:.703125},{x:.171875,y:.703125},{x:.203125,y:.703125},{x:.203125,y:.703125},{x:.234375,y:.703125},{x:.234375,y:.703125},{x:.265625,y:.703125},{x:.265625,y:.703125},{x:.296875,y:.703125},{x:.296875,y:.703125},{x:.328125,y:.703125},{x:.328125,y:.703125},{x:.359375,y:.703125},{x:.359375,y:.703125},{x:.390625,y:.703125},{x:.390625,y:.703125},{x:.421875,y:.703125},{x:.421875,y:.703125},{x:.453125,y:.703125},{x:.453125,y:.703125},{x:.484375,y:.703125},{x:.484375,y:.703125},{x:.515625,y:.703125},{x:.515625,y:.703125},{x:.546875,y:.703125},{x:.546875,y:.703125},{x:.578125,y:.703125},{x:.578125,y:.703125},{x:.609375,y:.703125},{x:.609375,y:.703125},{x:.640625,y:.703125},{x:.640625,y:.703125},{x:.671875,y:.703125},{x:.671875,y:.703125},{x:.703125,y:.703125},{x:.703125,y:.703125},{x:.734375,y:.703125},{x:.734375,y:.703125},{x:.765625,y:.703125},{x:.765625,y:.703125},{x:.796875,y:.703125},{x:.796875,y:.703125},{x:.828125,y:.703125},{x:.828125,y:.703125},{x:.859375,y:.703125},{x:.859375,y:.703125},{x:.890625,y:.703125},{x:.890625,y:.703125},{x:.921875,y:.703125},{x:.921875,y:.703125},{x:.953125,y:.703125},{x:.953125,y:.703125},{x:.984375,y:.703125},{x:.984375,y:.703125},{x:.015625,y:.734375},{x:.015625,y:.734375},{x:.046875,y:.734375},{x:.046875,y:.734375},{x:.078125,y:.734375},{x:.078125,y:.734375},{x:.109375,y:.734375},{x:.109375,y:.734375},{x:.140625,y:.734375},{x:.140625,y:.734375},{x:.171875,y:.734375},{x:.171875,y:.734375},{x:.203125,y:.734375},{x:.203125,y:.734375},{x:.234375,y:.734375},{x:.234375,y:.734375},{x:.265625,y:.734375},{x:.265625,y:.734375},{x:.296875,y:.734375},{x:.296875,y:.734375},{x:.328125,y:.734375},{x:.328125,y:.734375},{x:.359375,y:.734375},{x:.359375,y:.734375},{x:.390625,y:.734375},{x:.390625,y:.734375},{x:.421875,y:.734375},{x:.421875,y:.734375},{x:.453125,y:.734375},{x:.453125,y:.734375},{x:.484375,y:.734375},{x:.484375,y:.734375},{x:.515625,y:.734375},{x:.515625,y:.734375},{x:.546875,y:.734375},{x:.546875,y:.734375},{x:.578125,y:.734375},{x:.578125,y:.734375},{x:.609375,y:.734375},{x:.609375,y:.734375},{x:.640625,y:.734375},{x:.640625,y:.734375},{x:.671875,y:.734375},{x:.671875,y:.734375},{x:.703125,y:.734375},{x:.703125,y:.734375},{x:.734375,y:.734375},{x:.734375,y:.734375},{x:.765625,y:.734375},{x:.765625,y:.734375},{x:.796875,y:.734375},{x:.796875,y:.734375},{x:.828125,y:.734375},{x:.828125,y:.734375},{x:.859375,y:.734375},{x:.859375,y:.734375},{x:.890625,y:.734375},{x:.890625,y:.734375},{x:.921875,y:.734375},{x:.921875,y:.734375},{x:.953125,y:.734375},{x:.953125,y:.734375},{x:.984375,y:.734375},{x:.984375,y:.734375},{x:.015625,y:.765625},{x:.015625,y:.765625},{x:.046875,y:.765625},{x:.046875,y:.765625},{x:.078125,y:.765625},{x:.078125,y:.765625},{x:.109375,y:.765625},{x:.109375,y:.765625},{x:.140625,y:.765625},{x:.140625,y:.765625},{x:.171875,y:.765625},{x:.171875,y:.765625},{x:.203125,y:.765625},{x:.203125,y:.765625},{x:.234375,y:.765625},{x:.234375,y:.765625},{x:.265625,y:.765625},{x:.265625,y:.765625},{x:.296875,y:.765625},{x:.296875,y:.765625},{x:.328125,y:.765625},{x:.328125,y:.765625},{x:.359375,y:.765625},{x:.359375,y:.765625},{x:.390625,y:.765625},{x:.390625,y:.765625},{x:.421875,y:.765625},{x:.421875,y:.765625},{x:.453125,y:.765625},{x:.453125,y:.765625},{x:.484375,y:.765625},{x:.484375,y:.765625},{x:.515625,y:.765625},{x:.515625,y:.765625},{x:.546875,y:.765625},{x:.546875,y:.765625},{x:.578125,y:.765625},{x:.578125,y:.765625},{x:.609375,y:.765625},{x:.609375,y:.765625},{x:.640625,y:.765625},{x:.640625,y:.765625},{x:.671875,y:.765625},{x:.671875,y:.765625},{x:.703125,y:.765625},{x:.703125,y:.765625},{x:.734375,y:.765625},{x:.734375,y:.765625},{x:.765625,y:.765625},{x:.765625,y:.765625},{x:.796875,y:.765625},{x:.796875,y:.765625},{x:.828125,y:.765625},{x:.828125,y:.765625},{x:.859375,y:.765625},{x:.859375,y:.765625},{x:.890625,y:.765625},{x:.890625,y:.765625},{x:.921875,y:.765625},{x:.921875,y:.765625},{x:.953125,y:.765625},{x:.953125,y:.765625},{x:.984375,y:.765625},{x:.984375,y:.765625},{x:.015625,y:.796875},{x:.015625,y:.796875},{x:.046875,y:.796875},{x:.046875,y:.796875},{x:.078125,y:.796875},{x:.078125,y:.796875},{x:.109375,y:.796875},{x:.109375,y:.796875},{x:.140625,y:.796875},{x:.140625,y:.796875},{x:.171875,y:.796875},{x:.171875,y:.796875},{x:.203125,y:.796875},{x:.203125,y:.796875},{x:.234375,y:.796875},{x:.234375,y:.796875},{x:.265625,y:.796875},{x:.265625,y:.796875},{x:.296875,y:.796875},{x:.296875,y:.796875},{x:.328125,y:.796875},{x:.328125,y:.796875},{x:.359375,y:.796875},{x:.359375,y:.796875},{x:.390625,y:.796875},{x:.390625,y:.796875},{x:.421875,y:.796875},{x:.421875,y:.796875},{x:.453125,y:.796875},{x:.453125,y:.796875},{x:.484375,y:.796875},{x:.484375,y:.796875},{x:.515625,y:.796875},{x:.515625,y:.796875},{x:.546875,y:.796875},{x:.546875,y:.796875},{x:.578125,y:.796875},{x:.578125,y:.796875},{x:.609375,y:.796875},{x:.609375,y:.796875},{x:.640625,y:.796875},{x:.640625,y:.796875},{x:.671875,y:.796875},{x:.671875,y:.796875},{x:.703125,y:.796875},{x:.703125,y:.796875},{x:.734375,y:.796875},{x:.734375,y:.796875},{x:.765625,y:.796875},{x:.765625,y:.796875},{x:.796875,y:.796875},{x:.796875,y:.796875},{x:.828125,y:.796875},{x:.828125,y:.796875},{x:.859375,y:.796875},{x:.859375,y:.796875},{x:.890625,y:.796875},{x:.890625,y:.796875},{x:.921875,y:.796875},{x:.921875,y:.796875},{x:.953125,y:.796875},{x:.953125,y:.796875},{x:.984375,y:.796875},{x:.984375,y:.796875},{x:.015625,y:.828125},{x:.015625,y:.828125},{x:.046875,y:.828125},{x:.046875,y:.828125},{x:.078125,y:.828125},{x:.078125,y:.828125},{x:.109375,y:.828125},{x:.109375,y:.828125},{x:.140625,y:.828125},{x:.140625,y:.828125},{x:.171875,y:.828125},{x:.171875,y:.828125},{x:.203125,y:.828125},{x:.203125,y:.828125},{x:.234375,y:.828125},{x:.234375,y:.828125},{x:.265625,y:.828125},{x:.265625,y:.828125},{x:.296875,y:.828125},{x:.296875,y:.828125},{x:.328125,y:.828125},{x:.328125,y:.828125},{x:.359375,y:.828125},{x:.359375,y:.828125},{x:.390625,y:.828125},{x:.390625,y:.828125},{x:.421875,y:.828125},{x:.421875,y:.828125},{x:.453125,y:.828125},{x:.453125,y:.828125},{x:.484375,y:.828125},{x:.484375,y:.828125},{x:.515625,y:.828125},{x:.515625,y:.828125},{x:.546875,y:.828125},{x:.546875,y:.828125},{x:.578125,y:.828125},{x:.578125,y:.828125},{x:.609375,y:.828125},{x:.609375,y:.828125},{x:.640625,y:.828125},{x:.640625,y:.828125},{x:.671875,y:.828125},{x:.671875,y:.828125},{x:.703125,y:.828125},{x:.703125,y:.828125},{x:.734375,y:.828125},{x:.734375,y:.828125},{x:.765625,y:.828125},{x:.765625,y:.828125},{x:.796875,y:.828125},{x:.796875,y:.828125},{x:.828125,y:.828125},{x:.828125,y:.828125},{x:.859375,y:.828125},{x:.859375,y:.828125},{x:.890625,y:.828125},{x:.890625,y:.828125},{x:.921875,y:.828125},{x:.921875,y:.828125},{x:.953125,y:.828125},{x:.953125,y:.828125},{x:.984375,y:.828125},{x:.984375,y:.828125},{x:.015625,y:.859375},{x:.015625,y:.859375},{x:.046875,y:.859375},{x:.046875,y:.859375},{x:.078125,y:.859375},{x:.078125,y:.859375},{x:.109375,y:.859375},{x:.109375,y:.859375},{x:.140625,y:.859375},{x:.140625,y:.859375},{x:.171875,y:.859375},{x:.171875,y:.859375},{x:.203125,y:.859375},{x:.203125,y:.859375},{x:.234375,y:.859375},{x:.234375,y:.859375},{x:.265625,y:.859375},{x:.265625,y:.859375},{x:.296875,y:.859375},{x:.296875,y:.859375},{x:.328125,y:.859375},{x:.328125,y:.859375},{x:.359375,y:.859375},{x:.359375,y:.859375},{x:.390625,y:.859375},{x:.390625,y:.859375},{x:.421875,y:.859375},{x:.421875,y:.859375},{x:.453125,y:.859375},{x:.453125,y:.859375},{x:.484375,y:.859375},{x:.484375,y:.859375},{x:.515625,y:.859375},{x:.515625,y:.859375},{x:.546875,y:.859375},{x:.546875,y:.859375},{x:.578125,y:.859375},{x:.578125,y:.859375},{x:.609375,y:.859375},{x:.609375,y:.859375},{x:.640625,y:.859375},{x:.640625,y:.859375},{x:.671875,y:.859375},{x:.671875,y:.859375},{x:.703125,y:.859375},{x:.703125,y:.859375},{x:.734375,y:.859375},{x:.734375,y:.859375},{x:.765625,y:.859375},{x:.765625,y:.859375},{x:.796875,y:.859375},{x:.796875,y:.859375},{x:.828125,y:.859375},{x:.828125,y:.859375},{x:.859375,y:.859375},{x:.859375,y:.859375},{x:.890625,y:.859375},{x:.890625,y:.859375},{x:.921875,y:.859375},{x:.921875,y:.859375},{x:.953125,y:.859375},{x:.953125,y:.859375},{x:.984375,y:.859375},{x:.984375,y:.859375},{x:.015625,y:.890625},{x:.015625,y:.890625},{x:.046875,y:.890625},{x:.046875,y:.890625},{x:.078125,y:.890625},{x:.078125,y:.890625},{x:.109375,y:.890625},{x:.109375,y:.890625},{x:.140625,y:.890625},{x:.140625,y:.890625},{x:.171875,y:.890625},{x:.171875,y:.890625},{x:.203125,y:.890625},{x:.203125,y:.890625},{x:.234375,y:.890625},{x:.234375,y:.890625},{x:.265625,y:.890625},{x:.265625,y:.890625},{x:.296875,y:.890625},{x:.296875,y:.890625},{x:.328125,y:.890625},{x:.328125,y:.890625},{x:.359375,y:.890625},{x:.359375,y:.890625},{x:.390625,y:.890625},{x:.390625,y:.890625},{x:.421875,y:.890625},{x:.421875,y:.890625},{x:.453125,y:.890625},{x:.453125,y:.890625},{x:.484375,y:.890625},{x:.484375,y:.890625},{x:.515625,y:.890625},{x:.515625,y:.890625},{x:.546875,y:.890625},{x:.546875,y:.890625},{x:.578125,y:.890625},{x:.578125,y:.890625},{x:.609375,y:.890625},{x:.609375,y:.890625},{x:.640625,y:.890625},{x:.640625,y:.890625},{x:.671875,y:.890625},{x:.671875,y:.890625},{x:.703125,y:.890625},{x:.703125,y:.890625},{x:.734375,y:.890625},{x:.734375,y:.890625},{x:.765625,y:.890625},{x:.765625,y:.890625},{x:.796875,y:.890625},{x:.796875,y:.890625},{x:.828125,y:.890625},{x:.828125,y:.890625},{x:.859375,y:.890625},{x:.859375,y:.890625},{x:.890625,y:.890625},{x:.890625,y:.890625},{x:.921875,y:.890625},{x:.921875,y:.890625},{x:.953125,y:.890625},{x:.953125,y:.890625},{x:.984375,y:.890625},{x:.984375,y:.890625},{x:.015625,y:.921875},{x:.015625,y:.921875},{x:.046875,y:.921875},{x:.046875,y:.921875},{x:.078125,y:.921875},{x:.078125,y:.921875},{x:.109375,y:.921875},{x:.109375,y:.921875},{x:.140625,y:.921875},{x:.140625,y:.921875},{x:.171875,y:.921875},{x:.171875,y:.921875},{x:.203125,y:.921875},{x:.203125,y:.921875},{x:.234375,y:.921875},{x:.234375,y:.921875},{x:.265625,y:.921875},{x:.265625,y:.921875},{x:.296875,y:.921875},{x:.296875,y:.921875},{x:.328125,y:.921875},{x:.328125,y:.921875},{x:.359375,y:.921875},{x:.359375,y:.921875},{x:.390625,y:.921875},{x:.390625,y:.921875},{x:.421875,y:.921875},{x:.421875,y:.921875},{x:.453125,y:.921875},{x:.453125,y:.921875},{x:.484375,y:.921875},{x:.484375,y:.921875},{x:.515625,y:.921875},{x:.515625,y:.921875},{x:.546875,y:.921875},{x:.546875,y:.921875},{x:.578125,y:.921875},{x:.578125,y:.921875},{x:.609375,y:.921875},{x:.609375,y:.921875},{x:.640625,y:.921875},{x:.640625,y:.921875},{x:.671875,y:.921875},{x:.671875,y:.921875},{x:.703125,y:.921875},{x:.703125,y:.921875},{x:.734375,y:.921875},{x:.734375,y:.921875},{x:.765625,y:.921875},{x:.765625,y:.921875},{x:.796875,y:.921875},{x:.796875,y:.921875},{x:.828125,y:.921875},{x:.828125,y:.921875},{x:.859375,y:.921875},{x:.859375,y:.921875},{x:.890625,y:.921875},{x:.890625,y:.921875},{x:.921875,y:.921875},{x:.921875,y:.921875},{x:.953125,y:.921875},{x:.953125,y:.921875},{x:.984375,y:.921875},{x:.984375,y:.921875},{x:.015625,y:.953125},{x:.015625,y:.953125},{x:.046875,y:.953125},{x:.046875,y:.953125},{x:.078125,y:.953125},{x:.078125,y:.953125},{x:.109375,y:.953125},{x:.109375,y:.953125},{x:.140625,y:.953125},{x:.140625,y:.953125},{x:.171875,y:.953125},{x:.171875,y:.953125},{x:.203125,y:.953125},{x:.203125,y:.953125},{x:.234375,y:.953125},{x:.234375,y:.953125},{x:.265625,y:.953125},{x:.265625,y:.953125},{x:.296875,y:.953125},{x:.296875,y:.953125},{x:.328125,y:.953125},{x:.328125,y:.953125},{x:.359375,y:.953125},{x:.359375,y:.953125},{x:.390625,y:.953125},{x:.390625,y:.953125},{x:.421875,y:.953125},{x:.421875,y:.953125},{x:.453125,y:.953125},{x:.453125,y:.953125},{x:.484375,y:.953125},{x:.484375,y:.953125},{x:.515625,y:.953125},{x:.515625,y:.953125},{x:.546875,y:.953125},{x:.546875,y:.953125},{x:.578125,y:.953125},{x:.578125,y:.953125},{x:.609375,y:.953125},{x:.609375,y:.953125},{x:.640625,y:.953125},{x:.640625,y:.953125},{x:.671875,y:.953125},{x:.671875,y:.953125},{x:.703125,y:.953125},{x:.703125,y:.953125},{x:.734375,y:.953125},{x:.734375,y:.953125},{x:.765625,y:.953125},{x:.765625,y:.953125},{x:.796875,y:.953125},{x:.796875,y:.953125},{x:.828125,y:.953125},{x:.828125,y:.953125},{x:.859375,y:.953125},{x:.859375,y:.953125},{x:.890625,y:.953125},{x:.890625,y:.953125},{x:.921875,y:.953125},{x:.921875,y:.953125},{x:.953125,y:.953125},{x:.953125,y:.953125},{x:.984375,y:.953125},{x:.984375,y:.953125},{x:.015625,y:.984375},{x:.015625,y:.984375},{x:.046875,y:.984375},{x:.046875,y:.984375},{x:.078125,y:.984375},{x:.078125,y:.984375},{x:.109375,y:.984375},{x:.109375,y:.984375},{x:.140625,y:.984375},{x:.140625,y:.984375},{x:.171875,y:.984375},{x:.171875,y:.984375},{x:.203125,y:.984375},{x:.203125,y:.984375},{x:.234375,y:.984375},{x:.234375,y:.984375},{x:.265625,y:.984375},{x:.265625,y:.984375},{x:.296875,y:.984375},{x:.296875,y:.984375},{x:.328125,y:.984375},{x:.328125,y:.984375},{x:.359375,y:.984375},{x:.359375,y:.984375},{x:.390625,y:.984375},{x:.390625,y:.984375},{x:.421875,y:.984375},{x:.421875,y:.984375},{x:.453125,y:.984375},{x:.453125,y:.984375},{x:.484375,y:.984375},{x:.484375,y:.984375},{x:.515625,y:.984375},{x:.515625,y:.984375},{x:.546875,y:.984375},{x:.546875,y:.984375},{x:.578125,y:.984375},{x:.578125,y:.984375},{x:.609375,y:.984375},{x:.609375,y:.984375},{x:.640625,y:.984375},{x:.640625,y:.984375},{x:.671875,y:.984375},{x:.671875,y:.984375},{x:.703125,y:.984375},{x:.703125,y:.984375},{x:.734375,y:.984375},{x:.734375,y:.984375},{x:.765625,y:.984375},{x:.765625,y:.984375},{x:.796875,y:.984375},{x:.796875,y:.984375},{x:.828125,y:.984375},{x:.828125,y:.984375},{x:.859375,y:.984375},{x:.859375,y:.984375},{x:.890625,y:.984375},{x:.890625,y:.984375},{x:.921875,y:.984375},{x:.921875,y:.984375},{x:.953125,y:.984375},{x:.953125,y:.984375},{x:.984375,y:.984375},{x:.984375,y:.984375},{x:.03125,y:.03125},{x:.03125,y:.03125},{x:.09375,y:.03125},{x:.09375,y:.03125},{x:.15625,y:.03125},{x:.15625,y:.03125},{x:.21875,y:.03125},{x:.21875,y:.03125},{x:.28125,y:.03125},{x:.28125,y:.03125},{x:.34375,y:.03125},{x:.34375,y:.03125},{x:.40625,y:.03125},{x:.40625,y:.03125},{x:.46875,y:.03125},{x:.46875,y:.03125},{x:.53125,y:.03125},{x:.53125,y:.03125},{x:.59375,y:.03125},{x:.59375,y:.03125},{x:.65625,y:.03125},{x:.65625,y:.03125},{x:.71875,y:.03125},{x:.71875,y:.03125},{x:.78125,y:.03125},{x:.78125,y:.03125},{x:.84375,y:.03125},{x:.84375,y:.03125},{x:.90625,y:.03125},{x:.90625,y:.03125},{x:.96875,y:.03125},{x:.96875,y:.03125},{x:.03125,y:.09375},{x:.03125,y:.09375},{x:.09375,y:.09375},{x:.09375,y:.09375},{x:.15625,y:.09375},{x:.15625,y:.09375},{x:.21875,y:.09375},{x:.21875,y:.09375},{x:.28125,y:.09375},{x:.28125,y:.09375},{x:.34375,y:.09375},{x:.34375,y:.09375},{x:.40625,y:.09375},{x:.40625,y:.09375},{x:.46875,y:.09375},{x:.46875,y:.09375},{x:.53125,y:.09375},{x:.53125,y:.09375},{x:.59375,y:.09375},{x:.59375,y:.09375},{x:.65625,y:.09375},{x:.65625,y:.09375},{x:.71875,y:.09375},{x:.71875,y:.09375},{x:.78125,y:.09375},{x:.78125,y:.09375},{x:.84375,y:.09375},{x:.84375,y:.09375},{x:.90625,y:.09375},{x:.90625,y:.09375},{x:.96875,y:.09375},{x:.96875,y:.09375},{x:.03125,y:.15625},{x:.03125,y:.15625},{x:.09375,y:.15625},{x:.09375,y:.15625},{x:.15625,y:.15625},{x:.15625,y:.15625},{x:.21875,y:.15625},{x:.21875,y:.15625},{x:.28125,y:.15625},{x:.28125,y:.15625},{x:.34375,y:.15625},{x:.34375,y:.15625},{x:.40625,y:.15625},{x:.40625,y:.15625},{x:.46875,y:.15625},{x:.46875,y:.15625},{x:.53125,y:.15625},{x:.53125,y:.15625},{x:.59375,y:.15625},{x:.59375,y:.15625},{x:.65625,y:.15625},{x:.65625,y:.15625},{x:.71875,y:.15625},{x:.71875,y:.15625},{x:.78125,y:.15625},{x:.78125,y:.15625},{x:.84375,y:.15625},{x:.84375,y:.15625},{x:.90625,y:.15625},{x:.90625,y:.15625},{x:.96875,y:.15625},{x:.96875,y:.15625},{x:.03125,y:.21875},{x:.03125,y:.21875},{x:.09375,y:.21875},{x:.09375,y:.21875},{x:.15625,y:.21875},{x:.15625,y:.21875},{x:.21875,y:.21875},{x:.21875,y:.21875},{x:.28125,y:.21875},{x:.28125,y:.21875},{x:.34375,y:.21875},{x:.34375,y:.21875},{x:.40625,y:.21875},{x:.40625,y:.21875},{x:.46875,y:.21875},{x:.46875,y:.21875},{x:.53125,y:.21875},{x:.53125,y:.21875},{x:.59375,y:.21875},{x:.59375,y:.21875},{x:.65625,y:.21875},{x:.65625,y:.21875},{x:.71875,y:.21875},{x:.71875,y:.21875},{x:.78125,y:.21875},{x:.78125,y:.21875},{x:.84375,y:.21875},{x:.84375,y:.21875},{x:.90625,y:.21875},{x:.90625,y:.21875},{x:.96875,y:.21875},{x:.96875,y:.21875},{x:.03125,y:.28125},{x:.03125,y:.28125},{x:.09375,y:.28125},{x:.09375,y:.28125},{x:.15625,y:.28125},{x:.15625,y:.28125},{x:.21875,y:.28125},{x:.21875,y:.28125},{x:.28125,y:.28125},{x:.28125,y:.28125},{x:.34375,y:.28125},{x:.34375,y:.28125},{x:.40625,y:.28125},{x:.40625,y:.28125},{x:.46875,y:.28125},{x:.46875,y:.28125},{x:.53125,y:.28125},{x:.53125,y:.28125},{x:.59375,y:.28125},{x:.59375,y:.28125},{x:.65625,y:.28125},{x:.65625,y:.28125},{x:.71875,y:.28125},{x:.71875,y:.28125},{x:.78125,y:.28125},{x:.78125,y:.28125},{x:.84375,y:.28125},{x:.84375,y:.28125},{x:.90625,y:.28125},{x:.90625,y:.28125},{x:.96875,y:.28125},{x:.96875,y:.28125},{x:.03125,y:.34375},{x:.03125,y:.34375},{x:.09375,y:.34375},{x:.09375,y:.34375},{x:.15625,y:.34375},{x:.15625,y:.34375},{x:.21875,y:.34375},{x:.21875,y:.34375},{x:.28125,y:.34375},{x:.28125,y:.34375},{x:.34375,y:.34375},{x:.34375,y:.34375},{x:.40625,y:.34375},{x:.40625,y:.34375},{x:.46875,y:.34375},{x:.46875,y:.34375},{x:.53125,y:.34375},{x:.53125,y:.34375},{x:.59375,y:.34375},{x:.59375,y:.34375},{x:.65625,y:.34375},{x:.65625,y:.34375},{x:.71875,y:.34375},{x:.71875,y:.34375},{x:.78125,y:.34375},{x:.78125,y:.34375},{x:.84375,y:.34375},{x:.84375,y:.34375},{x:.90625,y:.34375},{x:.90625,y:.34375},{x:.96875,y:.34375},{x:.96875,y:.34375},{x:.03125,y:.40625},{x:.03125,y:.40625},{x:.09375,y:.40625},{x:.09375,y:.40625},{x:.15625,y:.40625},{x:.15625,y:.40625},{x:.21875,y:.40625},{x:.21875,y:.40625},{x:.28125,y:.40625},{x:.28125,y:.40625},{x:.34375,y:.40625},{x:.34375,y:.40625},{x:.40625,y:.40625},{x:.40625,y:.40625},{x:.46875,y:.40625},{x:.46875,y:.40625},{x:.53125,y:.40625},{x:.53125,y:.40625},{x:.59375,y:.40625},{x:.59375,y:.40625},{x:.65625,y:.40625},{x:.65625,y:.40625},{x:.71875,y:.40625},{x:.71875,y:.40625},{x:.78125,y:.40625},{x:.78125,y:.40625},{x:.84375,y:.40625},{x:.84375,y:.40625},{x:.90625,y:.40625},{x:.90625,y:.40625},{x:.96875,y:.40625},{x:.96875,y:.40625},{x:.03125,y:.46875},{x:.03125,y:.46875},{x:.09375,y:.46875},{x:.09375,y:.46875},{x:.15625,y:.46875},{x:.15625,y:.46875},{x:.21875,y:.46875},{x:.21875,y:.46875},{x:.28125,y:.46875},{x:.28125,y:.46875},{x:.34375,y:.46875},{x:.34375,y:.46875},{x:.40625,y:.46875},{x:.40625,y:.46875},{x:.46875,y:.46875},{x:.46875,y:.46875},{x:.53125,y:.46875},{x:.53125,y:.46875},{x:.59375,y:.46875},{x:.59375,y:.46875},{x:.65625,y:.46875},{x:.65625,y:.46875},{x:.71875,y:.46875},{x:.71875,y:.46875},{x:.78125,y:.46875},{x:.78125,y:.46875},{x:.84375,y:.46875},{x:.84375,y:.46875},{x:.90625,y:.46875},{x:.90625,y:.46875},{x:.96875,y:.46875},{x:.96875,y:.46875},{x:.03125,y:.53125},{x:.03125,y:.53125},{x:.09375,y:.53125},{x:.09375,y:.53125},{x:.15625,y:.53125},{x:.15625,y:.53125},{x:.21875,y:.53125},{x:.21875,y:.53125},{x:.28125,y:.53125},{x:.28125,y:.53125},{x:.34375,y:.53125},{x:.34375,y:.53125},{x:.40625,y:.53125},{x:.40625,y:.53125},{x:.46875,y:.53125},{x:.46875,y:.53125},{x:.53125,y:.53125},{x:.53125,y:.53125},{x:.59375,y:.53125},{x:.59375,y:.53125},{x:.65625,y:.53125},{x:.65625,y:.53125},{x:.71875,y:.53125},{x:.71875,y:.53125},{x:.78125,y:.53125},{x:.78125,y:.53125},{x:.84375,y:.53125},{x:.84375,y:.53125},{x:.90625,y:.53125},{x:.90625,y:.53125},{x:.96875,y:.53125},{x:.96875,y:.53125},{x:.03125,y:.59375},{x:.03125,y:.59375},{x:.09375,y:.59375},{x:.09375,y:.59375},{x:.15625,y:.59375},{x:.15625,y:.59375},{x:.21875,y:.59375},{x:.21875,y:.59375},{x:.28125,y:.59375},{x:.28125,y:.59375},{x:.34375,y:.59375},{x:.34375,y:.59375},{x:.40625,y:.59375},{x:.40625,y:.59375},{x:.46875,y:.59375},{x:.46875,y:.59375},{x:.53125,y:.59375},{x:.53125,y:.59375},{x:.59375,y:.59375},{x:.59375,y:.59375},{x:.65625,y:.59375},{x:.65625,y:.59375},{x:.71875,y:.59375},{x:.71875,y:.59375},{x:.78125,y:.59375},{x:.78125,y:.59375},{x:.84375,y:.59375},{x:.84375,y:.59375},{x:.90625,y:.59375},{x:.90625,y:.59375},{x:.96875,y:.59375},{x:.96875,y:.59375},{x:.03125,y:.65625},{x:.03125,y:.65625},{x:.09375,y:.65625},{x:.09375,y:.65625},{x:.15625,y:.65625},{x:.15625,y:.65625},{x:.21875,y:.65625},{x:.21875,y:.65625},{x:.28125,y:.65625},{x:.28125,y:.65625},{x:.34375,y:.65625},{x:.34375,y:.65625},{x:.40625,y:.65625},{x:.40625,y:.65625},{x:.46875,y:.65625},{x:.46875,y:.65625},{x:.53125,y:.65625},{x:.53125,y:.65625},{x:.59375,y:.65625},{x:.59375,y:.65625},{x:.65625,y:.65625},{x:.65625,y:.65625},{x:.71875,y:.65625},{x:.71875,y:.65625},{x:.78125,y:.65625},{x:.78125,y:.65625},{x:.84375,y:.65625},{x:.84375,y:.65625},{x:.90625,y:.65625},{x:.90625,y:.65625},{x:.96875,y:.65625},{x:.96875,y:.65625},{x:.03125,y:.71875},{x:.03125,y:.71875},{x:.09375,y:.71875},{x:.09375,y:.71875},{x:.15625,y:.71875},{x:.15625,y:.71875},{x:.21875,y:.71875},{x:.21875,y:.71875},{x:.28125,y:.71875},{x:.28125,y:.71875},{x:.34375,y:.71875},{x:.34375,y:.71875},{x:.40625,y:.71875},{x:.40625,y:.71875},{x:.46875,y:.71875},{x:.46875,y:.71875},{x:.53125,y:.71875},{x:.53125,y:.71875},{x:.59375,y:.71875},{x:.59375,y:.71875},{x:.65625,y:.71875},{x:.65625,y:.71875},{x:.71875,y:.71875},{x:.71875,y:.71875},{x:.78125,y:.71875},{x:.78125,y:.71875},{x:.84375,y:.71875},{x:.84375,y:.71875},{x:.90625,y:.71875},{x:.90625,y:.71875},{x:.96875,y:.71875},{x:.96875,y:.71875},{x:.03125,y:.78125},{x:.03125,y:.78125},{x:.09375,y:.78125},{x:.09375,y:.78125},{x:.15625,y:.78125},{x:.15625,y:.78125},{x:.21875,y:.78125},{x:.21875,y:.78125},{x:.28125,y:.78125},{x:.28125,y:.78125},{x:.34375,y:.78125},{x:.34375,y:.78125},{x:.40625,y:.78125},{x:.40625,y:.78125},{x:.46875,y:.78125},{x:.46875,y:.78125},{x:.53125,y:.78125},{x:.53125,y:.78125},{x:.59375,y:.78125},{x:.59375,y:.78125},{x:.65625,y:.78125},{x:.65625,y:.78125},{x:.71875,y:.78125},{x:.71875,y:.78125},{x:.78125,y:.78125},{x:.78125,y:.78125},{x:.84375,y:.78125},{x:.84375,y:.78125},{x:.90625,y:.78125},{x:.90625,y:.78125},{x:.96875,y:.78125},{x:.96875,y:.78125},{x:.03125,y:.84375},{x:.03125,y:.84375},{x:.09375,y:.84375},{x:.09375,y:.84375},{x:.15625,y:.84375},{x:.15625,y:.84375},{x:.21875,y:.84375},{x:.21875,y:.84375},{x:.28125,y:.84375},{x:.28125,y:.84375},{x:.34375,y:.84375},{x:.34375,y:.84375},{x:.40625,y:.84375},{x:.40625,y:.84375},{x:.46875,y:.84375},{x:.46875,y:.84375},{x:.53125,y:.84375},{x:.53125,y:.84375},{x:.59375,y:.84375},{x:.59375,y:.84375},{x:.65625,y:.84375},{x:.65625,y:.84375},{x:.71875,y:.84375},{x:.71875,y:.84375},{x:.78125,y:.84375},{x:.78125,y:.84375},{x:.84375,y:.84375},{x:.84375,y:.84375},{x:.90625,y:.84375},{x:.90625,y:.84375},{x:.96875,y:.84375},{x:.96875,y:.84375},{x:.03125,y:.90625},{x:.03125,y:.90625},{x:.09375,y:.90625},{x:.09375,y:.90625},{x:.15625,y:.90625},{x:.15625,y:.90625},{x:.21875,y:.90625},{x:.21875,y:.90625},{x:.28125,y:.90625},{x:.28125,y:.90625},{x:.34375,y:.90625},{x:.34375,y:.90625},{x:.40625,y:.90625},{x:.40625,y:.90625},{x:.46875,y:.90625},{x:.46875,y:.90625},{x:.53125,y:.90625},{x:.53125,y:.90625},{x:.59375,y:.90625},{x:.59375,y:.90625},{x:.65625,y:.90625},{x:.65625,y:.90625},{x:.71875,y:.90625},{x:.71875,y:.90625},{x:.78125,y:.90625},{x:.78125,y:.90625},{x:.84375,y:.90625},{x:.84375,y:.90625},{x:.90625,y:.90625},{x:.90625,y:.90625},{x:.96875,y:.90625},{x:.96875,y:.90625},{x:.03125,y:.96875},{x:.03125,y:.96875},{x:.09375,y:.96875},{x:.09375,y:.96875},{x:.15625,y:.96875},{x:.15625,y:.96875},{x:.21875,y:.96875},{x:.21875,y:.96875},{x:.28125,y:.96875},{x:.28125,y:.96875},{x:.34375,y:.96875},{x:.34375,y:.96875},{x:.40625,y:.96875},{x:.40625,y:.96875},{x:.46875,y:.96875},{x:.46875,y:.96875},{x:.53125,y:.96875},{x:.53125,y:.96875},{x:.59375,y:.96875},{x:.59375,y:.96875},{x:.65625,y:.96875},{x:.65625,y:.96875},{x:.71875,y:.96875},{x:.71875,y:.96875},{x:.78125,y:.96875},{x:.78125,y:.96875},{x:.84375,y:.96875},{x:.84375,y:.96875},{x:.90625,y:.96875},{x:.90625,y:.96875},{x:.96875,y:.96875},{x:.96875,y:.96875},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.0625,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.1875,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.3125,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.4375,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.5625,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.6875,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.8125,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.9375,y:.0625},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.0625,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.1875,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.3125,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.4375,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.5625,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.6875,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.8125,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.9375,y:.1875},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.0625,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.1875,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.3125,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.4375,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.5625,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.6875,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.8125,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.9375,y:.3125},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.0625,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.1875,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.3125,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.4375,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.5625,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.6875,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.8125,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.9375,y:.4375},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.0625,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.1875,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.3125,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.4375,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.5625,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.6875,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.8125,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.9375,y:.5625},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.0625,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.1875,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.3125,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.4375,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.5625,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.6875,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.8125,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.9375,y:.6875},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.0625,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.1875,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.3125,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.4375,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.5625,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.6875,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.8125,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.9375,y:.8125},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.0625,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.1875,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.3125,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.4375,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.5625,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.6875,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.8125,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375},{x:.9375,y:.9375}];var lg=class{constructor(t){var n;this.model=t,this.anchors=Ck.map(a=>[a.x,a.y]),this.anchorsTensor=ya(this.anchors),this.inputSize=(n=this.model)==null?void 0:n.inputs[0].shape[2],this.inputSizeTensor=Tt([this.inputSize,this.inputSize]),this.doubleInputSizeTensor=Tt([this.inputSize*2,this.inputSize*2])}normalizeBoxes(t){return W(()=>{let n=Re(t,[0,0],[-1,2]),a=Re(t,[0,2],[-1,2]),r=se(me(n,this.inputSizeTensor),this.anchorsTensor),s=me(a,this.doubleInputSizeTensor),i=_(ge(r,s),this.inputSizeTensor),o=_(se(r,s),this.inputSizeTensor);return hl([i,o],1)})}normalizeLandmarks(t,n){return W(()=>{let a=se(me(t.reshape([-1,7,2]),this.inputSizeTensor),this.anchors[n]);return _(a,this.inputSizeTensor)})}async getBoxes(t,n){let a=this.model.predict(t),r=a.squeeze();a.dispose();let s=W(()=>wn(Re(r,[0,0],[-1,1])).squeeze()),i=s.dataSync(),o=Re(r,[0,1],[-1,4]),l=this.normalizeBoxes(o);o.dispose();let d=await Ye.nonMaxSuppressionAsync(l,i,n.hand.maxDetected,n.hand.iouThreshold,n.hand.minConfidence),u=d.arraySync();s.dispose(),d.dispose();let p=[];for(let c of u)if(i[c]>=n.hand.minConfidence){let h=Re(l,[c,0],[1,-1]),m=Re(r,[c,5],[1,14]),f=W(()=>this.normalizeLandmarks(m,c).reshape([-1,2]));m.dispose(),p.push({box:h,palmLandmarks:f,confidence:i[c]})}return r.dispose(),l.dispose(),p}async estimateHandBounds(t,n){let a=t.shape[1],r=t.shape[2],s=W(()=>t.resizeBilinear([this.inputSize,this.inputSize]).div(127.5).sub(1)),i=await this.getBoxes(s,n);s.dispose();let o=[];if(!i||i.length===0)return o;for(let l of i){let d=l.box.dataSync(),u=d.slice(0,2),p=d.slice(2,4),c=l.palmLandmarks.arraySync();l.box.dispose(),l.palmLandmarks.dispose(),o.push(Ek({startPoint:u,endPoint:p,palmLandmarks:c,confidence:l.confidence},[r/this.inputSize,a/this.inputSize]))}return o}};function Bie(e){return e-2*Math.PI*Math.floor((e+Math.PI)/(2*Math.PI))}function Rk(e,t){let n=Math.PI/2-Math.atan2(-(t[1]-e[1]),t[0]-e[0]);return Bie(n)}var Mk=(e,t)=>[[1,0,e],[0,1,t],[0,0,1]];function Yr(e,t){let n=0;for(let a=0;ai[0]),a=t.map(i=>i[1]),r=[Math.min(...n),Math.min(...a)],s=[Math.max(...n),Math.max(...a)];return{startPoint:r,endPoint:s}}getBoxForPalmLandmarks(t,n){let a=t.map(s=>dg([...s,1],n)),r=this.calculateLandmarksBoundingBox(a);return T0(E0(r),jie)}getBoxForHandLandmarks(t){let n=this.calculateLandmarksBoundingBox(t),a=T0(E0(n),Dk);a.palmLandmarks=[];for(let r=0;r[i[0]*(h[0]-this.inputSize/2),i[1]*(h[1]-this.inputSize/2),i[2]*h[2]]),l=ug(a,[0,0]),d=o.map(h=>[...dg(h,l),h[2]]),u=$k(r),p=[...Yd(n),1],c=[Yr(p,u[0]),Yr(p,u[1])];return d.map(h=>[h[0]+c[0],h[1]+c[1],h[2]])}async estimateHands(t,n){let a=!1,r;(this.skipped===0||this.skipped>n.hand.skipFrames||!n.hand.landmarks||!n.videoOptimized)&&(r=await this.handDetector.estimateHandBounds(t,n),this.skipped=0),n.videoOptimized&&this.skipped++,r&&r.length>0&&(r.length!==this.detectedHands&&this.detectedHands!==n.hand.maxDetected||!n.hand.landmarks)&&(this.detectedHands=0,this.storedBoxes=[...r],this.storedBoxes.length>0&&(a=!0));let s=[];n.hand.skipInitial&&this.detectedHands===0&&(this.skipped=0);for(let i=0;i=n.hand.minConfidence){let x=H(y,[-1,3]),w=x.arraySync();y.dispose(),x.dispose();let b=this.transformRawCoords(w,h,l,c),v=this.getBoxForHandLandmarks(b);this.storedBoxes[i]=v;let N={landmarks:b,confidence:g,box:{topLeft:v.startPoint,bottomRight:v.endPoint}};s.push(N)}else this.storedBoxes[i]=null;y.dispose()}else{let l=T0(E0(o),Dk),d={confidence:o.confidence,box:{topLeft:l.startPoint,bottomRight:l.endPoint}};s.push(d)}}return this.storedBoxes=this.storedBoxes.filter(i=>i!==null),this.detectedHands=s.length,s}};var zk={thumb:[1,2,3,4],indexFinger:[5,6,7,8],middleFinger:[9,10,11,12],ringFinger:[13,14,15,16],pinky:[17,18,19,20],palmBase:[0]},Jr,Qr,_k;async function hg(e,t){let n=await _k.estimateHands(e,t);if(!n)return[];let a=[];for(let r of n){let s={};if(r.landmarks)for(let l of Object.keys(zk))s[l]=zk[l].map(d=>r.landmarks[d]);let i=r.box?[Math.max(0,r.box.topLeft[0]),Math.max(0,r.box.topLeft[1]),Math.min(e.shape[2],r.box.bottomRight[0])-Math.max(0,r.box.topLeft[0]),Math.min(e.shape[1],r.box.bottomRight[1])-Math.max(0,r.box.topLeft[1])]:[],o=[r.box.topLeft[0]/e.shape[2],r.box.topLeft[1]/e.shape[1],(r.box.bottomRight[0]-r.box.topLeft[0])/e.shape[2],(r.box.bottomRight[1]-r.box.topLeft[1])/e.shape[1]];a.push({confidence:Math.round(100*r.confidence)/100,box:i,boxRaw:o,landmarks:r.landmarks,annotations:s})}return a}async function fg(e){!Jr||!Qr?([Jr,Qr]=await Promise.all([e.hand.enabled?Gt(Yt(e.modelBasePath,e.hand.detector.modelPath),{fromTFHub:e.hand.detector.modelPath.includes("tfhub.dev")}):null,e.hand.landmarks?Gt(Yt(e.modelBasePath,e.hand.skeleton.modelPath),{fromTFHub:e.hand.skeleton.modelPath.includes("tfhub.dev")}):null]),e.hand.enabled&&(!Jr||!Jr.modelUrl?he("load model failed:",e.hand.detector.modelPath):e.debug&&he("load model:",Jr.modelUrl),!Qr||!Qr.modelUrl?he("load model failed:",e.hand.skeleton.modelPath):e.debug&&he("load model:",Qr.modelUrl))):(e.debug&&he("cached model:",Jr.modelUrl),e.debug&&he("cached model:",Qr.modelUrl));let t=new lg(Jr);return _k=new pg(t,Qr),[Jr,Qr]}var mg={};Ma(mg,{load:()=>Ag,predict:()=>yg});var Pk=["nose","leftEyeInside","leftEye","leftEyeOutside","rightEyeInside","rightEye","rightEyeOutside","leftEar","rightEar","leftMouth","rightMouth","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftPalm","rightPalm","leftIndex","rightIndex","leftPinky","rightPinky","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle","leftHeel","rightHeel","leftFoot","rightFoot","midHip","forehead","leftThumb","leftHand","rightThumb","rightHand"],Lk=["nose","leftEyeInside","leftEye","leftEyeOutside","rightEyeInside","rightEye","rightEyeOutside","leftEar","rightEar","leftMouth","rightMouth","leftShoulder","rightShoulder","leftElbow","rightElbow","left:15","right:16","left:17","right:18","left:19","right:20","left:21","right:22","leftChest","rightChest","neck","forehead","left:27","right:28","left:29","right:30"];var En;async function Ag(e){return En?e.debug&&he("cached model:",En.modelUrl):(En=await Gt(Yt(e.modelBasePath,e.body.modelPath)),En.width=parseInt(En.signature.inputs["input_1:0"].tensorShape.dim[2].size),En.height=parseInt(En.signature.inputs["input_1:0"].tensorShape.dim[1].size),!En||!En.modelUrl?he("load model failed:",e.body.modelPath):e.debug&&he("load model:",En.modelUrl)),En}async function yg(e,t){if(!En||!t.body.enabled)return null;let n={width:e.shape[2],height:e.shape[1]},a=Ye.resizeBilinear(e,[En.width,En.height],!1),r=me(a,[255]);a.dispose();let s=await En.predict(r),i=s.find(p=>p.size===195||p.size===155).dataSync();s.forEach(p=>p.dispose()),r.dispose();let o=[],l=i.length===195?Pk:Lk,d=5;for(let p=0;pc.score>p?c.score:p,0),keypoints:o}]}var gg={};Ma(gg,{load:()=>bg,predict:()=>vg});var C0=[{class:1,label:"person"},{class:2,label:"bicycle"},{class:3,label:"car"},{class:4,label:"motorcycle"},{class:5,label:"airplane"},{class:6,label:"bus"},{class:7,label:"train"},{class:8,label:"truck"},{class:9,label:"boat"},{class:10,label:"traffic light"},{class:11,label:"fire hydrant"},{class:12,label:"stop sign"},{class:13,label:"parking meter"},{class:14,label:"bench"},{class:15,label:"bird"},{class:16,label:"cat"},{class:17,label:"dog"},{class:18,label:"horse"},{class:19,label:"sheep"},{class:20,label:"cow"},{class:21,label:"elephant"},{class:22,label:"bear"},{class:23,label:"zebra"},{class:24,label:"giraffe"},{class:25,label:"backpack"},{class:26,label:"umbrella"},{class:27,label:"handbag"},{class:28,label:"tie"},{class:29,label:"suitcase"},{class:30,label:"frisbee"},{class:31,label:"skis"},{class:32,label:"snowboard"},{class:33,label:"sports ball"},{class:34,label:"kite"},{class:35,label:"baseball bat"},{class:36,label:"baseball glove"},{class:37,label:"skateboard"},{class:38,label:"surfboard"},{class:39,label:"tennis racket"},{class:40,label:"bottle"},{class:41,label:"wine glass"},{class:42,label:"cup"},{class:43,label:"fork"},{class:44,label:"knife"},{class:45,label:"spoon"},{class:46,label:"bowl"},{class:47,label:"banana"},{class:48,label:"apple"},{class:49,label:"sandwich"},{class:50,label:"orange"},{class:51,label:"broccoli"},{class:52,label:"carrot"},{class:53,label:"hot dog"},{class:54,label:"pizza"},{class:55,label:"donut"},{class:56,label:"cake"},{class:57,label:"chair"},{class:58,label:"couch"},{class:59,label:"potted plant"},{class:60,label:"bed"},{class:61,label:"dining table"},{class:62,label:"toilet"},{class:63,label:"tv"},{class:64,label:"laptop"},{class:65,label:"mouse"},{class:66,label:"remote"},{class:67,label:"keyboard"},{class:68,label:"cell phone"},{class:69,label:"microwave"},{class:70,label:"oven"},{class:71,label:"toaster"},{class:72,label:"sink"},{class:73,label:"refrigerator"},{class:74,label:"book"},{class:75,label:"clock"},{class:76,label:"vase"},{class:77,label:"scissors"},{class:78,label:"teddy bear"},{class:79,label:"hair drier"},{class:80,label:"toothbrush"}];var Cn,xg=[],R0=Number.MAX_SAFE_INTEGER,M0=2.5;async function bg(e){if(Cn)e.debug&&he("cached model:",Cn.modelUrl);else{Cn=await Gt(Yt(e.modelBasePath,e.object.modelPath));let t=Object.values(Cn.modelSignature.inputs);if(Cn.inputSize=Array.isArray(t)?parseInt(t[0].tensorShape.dim[2].size):null,!Cn.inputSize)throw new Error(`Human: Cannot determine model inputSize: ${e.object.modelPath}`);!Cn||!Cn.modelUrl?he("load model failed:",e.object.modelPath):e.debug&&he("load model:",Cn.modelUrl)}return Cn}async function Gie(e,t,n,a){let r=0,s=[];for(let d of[1,2,4])W(()=>{var A,y;let u=d*13,p=(A=e.find(g=>g.shape[1]===u**2&&g.shape[2]===C0.length))==null?void 0:A.squeeze(),c=(y=e.find(g=>g.shape[1]===u**2&&g.shape[2]a.object.minConfidence&&x!==61){let b=(.5+Math.trunc(g%u))/u,v=(.5+Math.trunc(g/u))/u,N=m[g].map(U=>U*(u/d/t)),[T,R]=[b-M0/d*N[0],v-M0/d*N[1]],[$,z]=[b+M0/d*N[2]-T,v+M0/d*N[3]-R],P=[T,R,$,z];P=P.map(U=>Math.max(0,Math.min(U,1)));let V=[P[0]*n[0],P[1]*n[1],P[2]*n[0],P[3]*n[1]],j={id:r++,strideSize:d,score:Math.round(100*w)/100,class:x+1,label:C0[x].label,center:[Math.trunc(n[0]*b),Math.trunc(n[1]*v)],centerRaw:[b,v],box:V.map(U=>Math.trunc(U)),boxRaw:P};s.push(j)}}});e.forEach(d=>Ee(d));let i=s.map(d=>d.boxRaw),o=s.map(d=>d.score),l=[];if(i&&i.length>0){let d=await Ye.nonMaxSuppressionAsync(i,o,a.object.maxDetected,a.object.iouThreshold,a.object.minConfidence);l=d.dataSync(),Ee(d)}return s=s.filter((d,u)=>l.includes(u)).sort((d,u)=>u.score-d.score),s}async function vg(e,t){return Cn?R00?(R0++,xg):(t.videoOptimized?R0=0:R0=Number.MAX_SAFE_INTEGER,new Promise(async n=>{let a=[e.shape[2],e.shape[1]],r=Ye.resizeBilinear(e,[Cn.inputSize,Cn.inputSize],!1),s=r.div(255),i=s.transpose([0,3,1,2]);s.dispose(),r.dispose();let o;t.object.enabled&&(o=await Cn.predict(i)),i.dispose();let l=await Gie(o,Cn.inputSize,a,t);xg=l,n(l)})):null}var Wk=e=>{if(!e)return[];let t=[];for(let n=0;nl.part==="leftWrist"),r=e[n].keypoints.find(l=>l.part==="rightWrist"),s=e[n].keypoints.find(l=>l.part==="nose");s&&a&&r&&a.position.yl.part==="leftShoulder"),o=e[n].keypoints.find(l=>l.part==="rightShoulder");i&&o&&t.push({body:n,gesture:`leaning ${i.position.y>o.position.y?"left":"right"}`})}return t},Bk=e=>{if(!e)return[];let t=[];for(let n=0;n0){let a=e[n].mesh[33][2]-e[n].mesh[263][2];Math.abs(a)<10?t.push({face:n,gesture:"facing center"}):t.push({face:n,gesture:`facing ${a<0?"left":"right"}`}),Math.abs(e[n].mesh[374][1]-e[n].mesh[386][1])/Math.abs(e[n].mesh[443][1]-e[n].mesh[450][1])<.2&&t.push({face:n,gesture:"blink left eye"}),Math.abs(e[n].mesh[145][1]-e[n].mesh[159][1])/Math.abs(e[n].mesh[223][1]-e[n].mesh[230][1])<.2&&t.push({face:n,gesture:"blink right eye"});let i=Math.min(100,500*Math.abs(e[n].mesh[13][1]-e[n].mesh[14][1])/Math.abs(e[n].mesh[10][1]-e[n].mesh[152][1]));i>10&&t.push({face:n,gesture:`mouth ${Math.trunc(i)}% open`});let o=e[n].mesh[152][2];Math.abs(o)>10&&t.push({face:n,gesture:`head ${o<0?"up":"down"}`})}return t},Vk=e=>{if(!e)return[];let t=[];for(let n=0;n.033||p>.033)&&(d=!1),c>.033&&t.push({iris:n,gesture:"looking right"}),p>.033&&t.push({iris:n,gesture:"looking left"});let h=Math.abs(e[n].mesh[145][1]-e[n].annotations.rightEyeIris[0][1])/e[n].annotations.rightEyeIris[0][1],m=Math.abs(e[n].mesh[374][1]-e[n].annotations.leftEyeIris[0][1])/e[n].annotations.leftEyeIris[0][1];(m<.015||h<.015||m>.03||h>.03)&&(d=!1),(m<.015||h<.015)&&t.push({iris:n,gesture:"looking down"}),(m>.03||h>.03)&&t.push({iris:n,gesture:"looking up"}),d&&t.push({iris:n,gesture:"looking center"})}return t},jk=e=>{if(!e)return[];let t=[];for(let n=0;n0){let r=a.reduce((i,o)=>i.position[2]i.position[1]kg});function qie(e,t,n){let a=function(o,l,d){let u=new RegExp("\\b"+l+" \\w+ (\\w+)","ig");o.replace(u,(p,c)=>(d[c]=0,p))},r=function(o,l){let d=e.createShader(l);if(e.shaderSource(d,o),e.compileShader(d),!e.getShaderParameter(d,e.COMPILE_STATUS))throw new Error("Filter: GL compile failed",e.getShaderInfoLog(d));return d};this.uniform={},this.attribute={};let s=r(t,e.VERTEX_SHADER),i=r(n,e.FRAGMENT_SHADER);if(this.id=e.createProgram(),e.attachShader(this.id,s),e.attachShader(this.id,i),e.linkProgram(this.id),!e.getProgramParameter(this.id,e.LINK_STATUS))throw new Error("Filter: GL link failed",e.getProgramInfoLog(this.id));e.useProgram(this.id),a(t,"attribute",this.attribute);for(let o in this.attribute)this.attribute[o]=e.getAttribLocation(this.id,o);a(t,"uniform",this.uniform),a(n,"uniform",this.uniform);for(let o in this.uniform)this.uniform[o]=e.getUniformLocation(this.id,o)}function Uk(e){e||(e={});let t=0,n=null,a=!1,r=-1,s=[null,null],i=[],o=-1,l=-1,d=null,u=null,p={},c=e.canvas||document.createElement("canvas"),h={},m={INTERMEDIATE:1},f=c.getContext("webgl");if(!f)throw new Error("Filter: getContext() failed");this.addFilter=function(b){let v=Array.prototype.slice.call(arguments,1),N=p[b];i.push({func:N,args:v})},this.reset=function(){i=[]};let A=function(b,v){if(!(b===o&&v===l)){if(c.width=b,o=b,c.height=v,l=v,!d){let N=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,-1,1,0,0,1,-1,1,1,1,1,1,0]);d=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,d),f.bufferData(f.ARRAY_BUFFER,N,f.STATIC_DRAW),f.pixelStorei(f.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0)}f.viewport(0,0,o,l),s=[null,null]}},y=function(b,v){let N=f.createFramebuffer();f.bindFramebuffer(f.FRAMEBUFFER,N);let T=f.createRenderbuffer();f.bindRenderbuffer(f.RENDERBUFFER,T);let R=f.createTexture();return f.bindTexture(f.TEXTURE_2D,R),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,b,v,0,f.RGBA,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.LINEAR),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.LINEAR),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,R,0),f.bindTexture(f.TEXTURE_2D,null),f.bindFramebuffer(f.FRAMEBUFFER,null),{fbo:N,texture:R}},g=function(b){return s[b]=s[b]||y(o,l),s[b]},x=function(b=null){var R,$;let v=null,N=null,T=!1;t===0?v=n:v=(R=g(r))==null?void 0:R.texture,t++,a&&!(b&m.INTERMEDIATE)?(N=null,T=t%2==0):(r=(r+1)%2,N=($=g(r))==null?void 0:$.fbo),f.bindTexture(f.TEXTURE_2D,v),f.bindFramebuffer(f.FRAMEBUFFER,N),f.uniform1f(u.uniform.flipY,T?-1:1),f.drawArrays(f.TRIANGLES,0,6)};this.apply=function(b){if(A(b.width,b.height),t=0,n||(n=f.createTexture()),f.bindTexture(f.TEXTURE_2D,n),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b),i.length===0)return x(),c;for(let v=0;v0,s=e.naturalHeight||e.videoHeight||e.height||e.shape&&e.shape[2]>0,i=r,o=s;if(i>M0&&(i=M0,o=i*s/r),o>M0&&(o=M0,i=o*r/s),t.filter.width>0?i=t.filter.width:t.filter.height>0&&(i=r*(t.filter.height/s)),t.filter.height>0?o=t.filter.height:t.filter.width>0&&(o=s*(t.filter.width/r)),!i||!o)throw new Error("Human: Input cannot determine dimension");(!Ce||(Ce==null?void 0:Ce.width)!==i||(Ce==null?void 0:Ce.height)!==o)&&(Ce=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(i,o):document.createElement("canvas"),(Ce==null?void 0:Ce.width)!==i&&(Ce.width=i),(Ce==null?void 0:Ce.height)!==o&&(Ce.height=o));let l=Ce.getContext("2d");if(e instanceof ImageData?l.putImageData(e,0,0):t.filter.flip&&typeof l.translate!="undefined"?(l.translate(r,0),l.scale(-1,1),l.drawImage(e,0,0,r,s,0,0,Ce==null?void 0:Ce.width,Ce==null?void 0:Ce.height),l.setTransform(1,0,0,1,0,0)):l.drawImage(e,0,0,r,s,0,0,Ce==null?void 0:Ce.width,Ce==null?void 0:Ce.height),t.filter.enabled){if((!Ft||!yt||Ce.width!==yt.width||(Ce==null?void 0:Ce.height)!==(yt==null?void 0:yt.height))&&(yt=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(Ce==null?void 0:Ce.width,Ce==null?void 0:Ce.height):document.createElement("canvas"),(yt==null?void 0:yt.width)!==(Ce==null?void 0:Ce.width)&&(yt.width=Ce==null?void 0:Ce.width),(yt==null?void 0:yt.height)!==(Ce==null?void 0:Ce.height)&&(yt.height=Ce==null?void 0:Ce.height),Ft=fa.flags.IS_BROWSER?new jk({canvas:yt}):null),!Ft)return{tensor:null,canvas:Ce};Ft.reset(),Ft.addFilter("brightness",t.filter.brightness),t.filter.contrast!==0&&Ft.addFilter("contrast",t.filter.contrast),t.filter.sharpness!==0&&Ft.addFilter("sharpen",t.filter.sharpness),t.filter.blur!==0&&Ft.addFilter("blur",t.filter.blur),t.filter.saturation!==0&&Ft.addFilter("saturation",t.filter.saturation),t.filter.hue!==0&&Ft.addFilter("hue",t.filter.hue),t.filter.negative&&Ft.addFilter("negative"),t.filter.sepia&&Ft.addFilter("sepia"),t.filter.vintage&&Ft.addFilter("brownie"),t.filter.sepia&&Ft.addFilter("sepia"),t.filter.kodachrome&&Ft.addFilter("kodachrome"),t.filter.technicolor&&Ft.addFilter("technicolor"),t.filter.polaroid&&Ft.addFilter("polaroid"),t.filter.pixelate!==0&&Ft.addFilter("pixelate",t.filter.pixelate),Ft.apply(Ce)}else yt=Ce,Ft&&(Ft=null);let d;if(yt.data){let p=[yt.height,yt.width,3];d=hc(yt.data,p,"int32")}else if(yt instanceof ImageData)d=oi.fromPixels(yt);else if(t.backend==="webgl"||t.backend==="humangl"){let p=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(i,o):document.createElement("canvas");p.width=i,p.height=o;let c=p.getContext("2d");c==null||c.drawImage(yt,0,0),d=oi.fromPixels(p)}else{let p=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(i,o):document.createElement("canvas");p.width=i,p.height=o;let c=p.getContext("2d");c==null||c.drawImage(yt,0,0);let h=c==null?void 0:c.getImageData(0,0,i,o);d=oi.fromPixels(h)}let u=d.toFloat();n=u.expandDims(0),d.dispose(),u.dispose()}let a=t.filter.return?yt:null;return{tensor:n,canvas:a}}var kg={};Ma(kg,{all:()=>Xie,body:()=>Gk,canvas:()=>qie,face:()=>Hk,gesture:()=>Uk,hand:()=>qk,object:()=>Xk,options:()=>zi});var zi={color:"rgba(173, 216, 230, 0.3)",labelColor:"rgba(173, 216, 230, 1)",shadowColor:"black",font:'small-caps 16px "Segoe UI"',lineHeight:24,lineWidth:6,pointSize:2,roundRect:28,drawPoints:!1,drawLabels:!0,drawBoxes:!1,drawPolygons:!0,fillPolygons:!1,useDepth:!0,useCurves:!1,bufferedOutput:!1,useRawBoxes:!1,calculateHandBox:!0};function F0(e,t,n,a=0,r){e.fillStyle=r.useDepth&&a?`rgba(${127.5+2*a}, ${127.5-2*a}, 255, 0.3)`:r.color,e.beginPath(),e.arc(t,n,r.pointSize,0,2*Math.PI),e.fill()}function _i(e,t,n,a,r,s){if(e.beginPath(),s.useCurves){let i=(t+t+a)/2,o=(n+n+r)/2;e.ellipse(i,o,a/2,r/2,0,0,2*Math.PI)}else e.lineWidth=s.lineWidth,e.moveTo(t+s.roundRect,n),e.lineTo(t+a-s.roundRect,n),e.quadraticCurveTo(t+a,n,t+a,n+s.roundRect),e.lineTo(t+a,n+r-s.roundRect),e.quadraticCurveTo(t+a,n+r,t+a-s.roundRect,n+r),e.lineTo(t+s.roundRect,n+r),e.quadraticCurveTo(t,n+r,t,n+r-s.roundRect),e.lineTo(t,n+s.roundRect),e.quadraticCurveTo(t,n,t+s.roundRect,n),e.closePath();e.stroke()}function Ig(e,t=[],n){if(!(t===void 0||t.length===0)){e.beginPath(),e.moveTo(t[0][0],t[0][1]);for(let a of t)e.strokeStyle=n.useDepth&&a[2]?`rgba(${127.5+2*a[2]}, ${127.5-2*a[2]}, 255, 0.3)`:n.color,e.fillStyle=n.useDepth&&a[2]?`rgba(${127.5+2*a[2]}, ${127.5-2*a[2]}, 255, 0.3)`:n.color,e.lineTo(a[0],parseInt(a[1]));e.stroke(),n.fillPolygons&&(e.closePath(),e.fill())}}function Yd(e,t=[],n){if(!(t===void 0||t.length===0)){if(!n.useCurves||t.length<=2){Ig(e,t,n);return}e.moveTo(t[0][0],t[0][1]);for(let a=0;a1&&l[1].length>0){let d=o[1]>0?`#${o[1]}`:"",u=`${o[0]} ${d}: ${l[1]}`;a.shadowColor&&a.shadowColor!==""&&(r.fillStyle=a.shadowColor,r.fillText(u,8,2+s*a.lineHeight)),r.fillStyle=a.labelColor,r.fillText(u,6,0+s*a.lineHeight),s+=1}}}async function Hk(e,t,n){let a=Hn(zi,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let r=e.getContext("2d");if(!!r)for(let s of t){r.font=a.font,r.strokeStyle=a.color,r.fillStyle=a.color,a.drawBoxes&&(a.useRawBoxes?_i(r,e.width*s.boxRaw[0],e.height*s.boxRaw[1],e.width*s.boxRaw[2],e.height*s.boxRaw[3],a):_i(r,s.box[0],s.box[1],s.box[2],s.box[3],a));let i=[];if(i.push(`face confidence: ${Math.trunc(100*s.confidence)}%`),s.genderConfidence&&i.push(`${s.gender||""} ${Math.trunc(100*s.genderConfidence)}% confident`),s.age&&i.push(`age: ${s.age||""}`),s.iris&&i.push(`iris distance: ${s.iris}`),s.emotion&&s.emotion.length>0){let o=s.emotion.map(l=>`${Math.trunc(100*l.score)}% ${l.emotion}`);i.push(o.join(" "))}s.rotation&&s.rotation.angle&&s.rotation.angle.roll&&i.push(`roll: ${Math.trunc(100*s.rotation.angle.roll)/100} yaw:${Math.trunc(100*s.rotation.angle.yaw)/100} pitch:${Math.trunc(100*s.rotation.angle.pitch)/100}`),i.length===0&&i.push("face"),r.fillStyle=a.color;for(let o=i.length-1;o>=0;o--){let l=Math.max(s.box[0],0),d=o*a.lineHeight+s.box[1];a.shadowColor&&a.shadowColor!==""&&(r.fillStyle=a.shadowColor,r.fillText(i[o],l+5,d+16)),r.fillStyle=a.labelColor,r.fillText(i[o],l+4,d+15)}if(r.lineWidth=1,s.mesh&&s.mesh.length>0){if(a.drawPoints)for(let o of s.mesh)F0(r,o[0],o[1],o[2],a);if(a.drawPolygons){r.lineWidth=1;for(let o=0;os.mesh[d]);Ig(r,l,a)}if(s.annotations&&s.annotations.leftEyeIris){r.strokeStyle=a.useDepth?"rgba(255, 200, 255, 0.3)":a.color,r.beginPath();let o=Math.abs(s.annotations.leftEyeIris[3][0]-s.annotations.leftEyeIris[1][0])/2,l=Math.abs(s.annotations.leftEyeIris[4][1]-s.annotations.leftEyeIris[2][1])/2;r.ellipse(s.annotations.leftEyeIris[0][0],s.annotations.leftEyeIris[0][1],o,l,0,0,2*Math.PI),r.stroke(),a.fillPolygons&&(r.fillStyle=a.useDepth?"rgba(255, 255, 200, 0.3)":a.color,r.fill())}if(s.annotations&&s.annotations.rightEyeIris){r.strokeStyle=a.useDepth?"rgba(255, 200, 255, 0.3)":a.color,r.beginPath();let o=Math.abs(s.annotations.rightEyeIris[3][0]-s.annotations.rightEyeIris[1][0])/2,l=Math.abs(s.annotations.rightEyeIris[4][1]-s.annotations.rightEyeIris[2][1])/2;r.ellipse(s.annotations.rightEyeIris[0][0],s.annotations.rightEyeIris[0][1],o,l,0,0,2*Math.PI),r.stroke(),a.fillPolygons&&(r.fillStyle=a.useDepth?"rgba(255, 255, 200, 0.3)":a.color,r.fill())}}}}}var Qr=[];async function Gk(e,t,n){let a=Hn(zi,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let r=e.getContext("2d");if(!!r){r.lineJoin="round";for(let s=0;sl.part==="leftShoulder"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightShoulder"),i&&o.push([i.position.x,i.position.y]),Yd(r,o,a),o.length=0,i=t[s].keypoints.find(l=>l.part==="rightShoulder"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightHip"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftHip"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftShoulder"),i&&o.push([i.position.x,i.position.y]),o.length===4&&Ig(r,o,a),o.length=0,i=t[s].keypoints.find(l=>l.part==="leftHip"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftKnee"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftAnkle"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftHeel"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftFoot"),i&&o.push([i.position.x,i.position.y]),Yd(r,o,a),o.length=0,i=t[s].keypoints.find(l=>l.part==="rightHip"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightKnee"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightAnkle"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightHeel"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightFoot"),i&&o.push([i.position.x,i.position.y]),Yd(r,o,a),o.length=0,i=t[s].keypoints.find(l=>l.part==="leftShoulder"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftElbow"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftWrist"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftPalm"),i&&o.push([i.position.x,i.position.y]),Yd(r,o,a),o.length=0,i=t[s].keypoints.find(l=>l.part==="rightShoulder"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightElbow"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightWrist"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightPalm"),i&&o.push([i.position.x,i.position.y]),Yd(r,o,a)}}}}async function qk(e,t,n){let a=Hn(zi,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let r=e.getContext("2d");if(!!r){r.lineJoin="round",r.font=a.font;for(let s of t){if(a.drawBoxes){r.strokeStyle=a.color,r.fillStyle=a.color;let i;if(!a.calculateHandBox)i=a.useRawBoxes?s.boxRaw:s.box;else if(i=[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,0,0],s.landmarks&&s.landmarks.length>0){for(let o of s.landmarks)o[0]i[2]&&(i[2]=o[0]),o[1]>i[3]&&(i[3]=o[1]);i[2]-=i[0],i[3]-=i[1]}a.useRawBoxes?_i(r,e.width*i[0],e.height*i[1],e.width*i[2],e.height*i[3],a):_i(r,i[0],i[1],i[2],i[3],a),a.drawLabels&&(a.shadowColor&&a.shadowColor!==""&&(r.fillStyle=a.shadowColor,r.fillText("hand",i[0]+3,1+i[1]+a.lineHeight,i[2])),r.fillStyle=a.labelColor,r.fillText("hand",i[0]+2,0+i[1]+a.lineHeight,i[2])),r.stroke()}if(a.drawPoints&&s.landmarks&&s.landmarks.length>0)for(let i of s.landmarks)r.fillStyle=a.useDepth?`rgba(${127.5+2*i[2]}, ${127.5-2*i[2]}, 255, 0.5)`:a.color,F0(r,i[0],i[1],0,a);if(a.drawLabels){let i=(o,l)=>{r.fillStyle=a.useDepth?`rgba(${127.5+2*o[o.length-1][2]}, ${127.5-2*o[o.length-1][2]}, 255, 0.5)`:a.color,r.fillText(l,o[o.length-1][0]+4,o[o.length-1][1]+4)};r.font=a.font,i(s.annotations.indexFinger,"index"),i(s.annotations.middleFinger,"middle"),i(s.annotations.ringFinger,"ring"),i(s.annotations.pinky,"pinky"),i(s.annotations.thumb,"thumb"),i(s.annotations.palmBase,"palm")}if(a.drawPolygons){let i=o=>{if(!!o)for(let l=0;l0?l-1:0][0],o[l>0?l-1:0][1]),r.lineTo(o[l][0],o[l][1]),r.stroke()};r.lineWidth=a.lineWidth,i(s.annotations.indexFinger),i(s.annotations.middleFinger),i(s.annotations.ringFinger),i(s.annotations.pinky),i(s.annotations.thumb)}}}}async function Xk(e,t,n){let a=Hn(zi,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let r=e.getContext("2d");if(!!r){r.lineJoin="round",r.font=a.font;for(let s of t)if(a.drawBoxes){if(r.strokeStyle=a.color,r.fillStyle=a.color,a.useRawBoxes?_i(r,e.width*s.boxRaw[0],e.height*s.boxRaw[1],e.width*s.boxRaw[2],e.height*s.boxRaw[3],a):_i(r,s.box[0],s.box[1],s.box[2],s.box[3],a),a.drawLabels){let i=`${Math.round(100*s.score)}% ${s.label}`;a.shadowColor&&a.shadowColor!==""&&(r.fillStyle=a.shadowColor,r.fillText(i,s.box[0]+3,1+s.box[1]+a.lineHeight,s.box[2])),r.fillStyle=a.labelColor,r.fillText(i,s.box[0]+2,0+s.box[1]+a.lineHeight,s.box[2])}r.stroke()}}}async function qie(e,t){if(!e||!t||!(e instanceof HTMLCanvasElement)||!(t instanceof HTMLCanvasElement))return;let n=e.getContext("2d");n==null||n.drawImage(e,0,0)}async function Xie(e,t,n){let a=Hn(zi,n);!t||!e||e instanceof HTMLCanvasElement&&(Hk(e,t.face,a),Gk(e,t.body,a),qk(e,t.hand,a),Uk(e,t.gesture,a),Xk(e,t.object,a))}var $0=` +`)}var F0=2048,Ce,yt,Ft;function kg(e,t){let n;if(!e)throw new Error("Human: Input is missing");if(!(e instanceof Le)&&!(typeof Image!="undefined"&&e instanceof Image)&&!(typeof ImageData!="undefined"&&e instanceof ImageData)&&!(typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap)&&!(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement)&&!(typeof HTMLMediaElement!="undefined"&&e instanceof HTMLMediaElement)&&!(typeof HTMLVideoElement!="undefined"&&e instanceof HTMLVideoElement)&&!(typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement)&&!(typeof OffscreenCanvas!="undefined"&&e instanceof OffscreenCanvas))throw new Error("Human: Input type is not recognized");if(e instanceof Le)if(e.shape&&e.shape.length===4&&e.shape[0]===1&&e.shape[3]===3)n=Oa(e);else throw new Error(`Human: Input tensor shape must be [1, height, width, 3] and instead was ${e.shape}`);else{let r=e.naturalWidth||e.videoWidth||e.width||e.shape&&e.shape[1]>0,s=e.naturalHeight||e.videoHeight||e.height||e.shape&&e.shape[2]>0,i=r,o=s;if(i>F0&&(i=F0,o=i*s/r),o>F0&&(o=F0,i=o*r/s),t.filter.width>0?i=t.filter.width:t.filter.height>0&&(i=r*(t.filter.height/s)),t.filter.height>0?o=t.filter.height:t.filter.width>0&&(o=s*(t.filter.width/r)),!i||!o)throw new Error("Human: Input cannot determine dimension");(!Ce||(Ce==null?void 0:Ce.width)!==i||(Ce==null?void 0:Ce.height)!==o)&&(Ce=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(i,o):document.createElement("canvas"),(Ce==null?void 0:Ce.width)!==i&&(Ce.width=i),(Ce==null?void 0:Ce.height)!==o&&(Ce.height=o));let l=Ce.getContext("2d");if(e instanceof ImageData?l.putImageData(e,0,0):t.filter.flip&&typeof l.translate!="undefined"?(l.translate(r,0),l.scale(-1,1),l.drawImage(e,0,0,r,s,0,0,Ce==null?void 0:Ce.width,Ce==null?void 0:Ce.height),l.setTransform(1,0,0,1,0,0)):l.drawImage(e,0,0,r,s,0,0,Ce==null?void 0:Ce.width,Ce==null?void 0:Ce.height),t.filter.enabled){if((!Ft||!yt||Ce.width!==yt.width||(Ce==null?void 0:Ce.height)!==(yt==null?void 0:yt.height))&&(yt=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(Ce==null?void 0:Ce.width,Ce==null?void 0:Ce.height):document.createElement("canvas"),(yt==null?void 0:yt.width)!==(Ce==null?void 0:Ce.width)&&(yt.width=Ce==null?void 0:Ce.width),(yt==null?void 0:yt.height)!==(Ce==null?void 0:Ce.height)&&(yt.height=Ce==null?void 0:Ce.height),Ft=fa.flags.IS_BROWSER?new Uk({canvas:yt}):null),!Ft)return{tensor:null,canvas:Ce};Ft.reset(),Ft.addFilter("brightness",t.filter.brightness),t.filter.contrast!==0&&Ft.addFilter("contrast",t.filter.contrast),t.filter.sharpness!==0&&Ft.addFilter("sharpen",t.filter.sharpness),t.filter.blur!==0&&Ft.addFilter("blur",t.filter.blur),t.filter.saturation!==0&&Ft.addFilter("saturation",t.filter.saturation),t.filter.hue!==0&&Ft.addFilter("hue",t.filter.hue),t.filter.negative&&Ft.addFilter("negative"),t.filter.sepia&&Ft.addFilter("sepia"),t.filter.vintage&&Ft.addFilter("brownie"),t.filter.sepia&&Ft.addFilter("sepia"),t.filter.kodachrome&&Ft.addFilter("kodachrome"),t.filter.technicolor&&Ft.addFilter("technicolor"),t.filter.polaroid&&Ft.addFilter("polaroid"),t.filter.pixelate!==0&&Ft.addFilter("pixelate",t.filter.pixelate),Ft.apply(Ce)}else yt=Ce,Ft&&(Ft=null);let d;if(yt.data){let p=[yt.height,yt.width,3];d=fc(yt.data,p,"int32")}else if(yt instanceof ImageData)d=li.fromPixels(yt);else if(t.backend==="webgl"||t.backend==="humangl"){let p=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(i,o):document.createElement("canvas");p.width=i,p.height=o;let c=p.getContext("2d");c==null||c.drawImage(yt,0,0),d=li.fromPixels(p)}else{let p=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(i,o):document.createElement("canvas");p.width=i,p.height=o;let c=p.getContext("2d");c==null||c.drawImage(yt,0,0);let h=c==null?void 0:c.getImageData(0,0,i,o);d=li.fromPixels(h)}let u=d.toFloat();n=u.expandDims(0),d.dispose(),u.dispose()}let a=t.filter.return?yt:null;return{tensor:n,canvas:a}}var Ig={};Ma(Ig,{all:()=>Kie,body:()=>qk,canvas:()=>Xie,face:()=>Gk,gesture:()=>Hk,hand:()=>Xk,object:()=>Kk,options:()=>_i});var _i={color:"rgba(173, 216, 230, 0.3)",labelColor:"rgba(173, 216, 230, 1)",shadowColor:"black",font:'small-caps 16px "Segoe UI"',lineHeight:24,lineWidth:6,pointSize:2,roundRect:28,drawPoints:!1,drawLabels:!0,drawBoxes:!1,drawPolygons:!0,fillPolygons:!1,useDepth:!0,useCurves:!1,bufferedOutput:!1,useRawBoxes:!1,calculateHandBox:!0};function $0(e,t,n,a=0,r){e.fillStyle=r.useDepth&&a?`rgba(${127.5+2*a}, ${127.5-2*a}, 255, 0.3)`:r.color,e.beginPath(),e.arc(t,n,r.pointSize,0,2*Math.PI),e.fill()}function Pi(e,t,n,a,r,s){if(e.beginPath(),s.useCurves){let i=(t+t+a)/2,o=(n+n+r)/2;e.ellipse(i,o,a/2,r/2,0,0,2*Math.PI)}else e.lineWidth=s.lineWidth,e.moveTo(t+s.roundRect,n),e.lineTo(t+a-s.roundRect,n),e.quadraticCurveTo(t+a,n,t+a,n+s.roundRect),e.lineTo(t+a,n+r-s.roundRect),e.quadraticCurveTo(t+a,n+r,t+a-s.roundRect,n+r),e.lineTo(t+s.roundRect,n+r),e.quadraticCurveTo(t,n+r,t,n+r-s.roundRect),e.lineTo(t,n+s.roundRect),e.quadraticCurveTo(t,n,t+s.roundRect,n),e.closePath();e.stroke()}function Sg(e,t=[],n){if(!(t===void 0||t.length===0)){e.beginPath(),e.moveTo(t[0][0],t[0][1]);for(let a of t)e.strokeStyle=n.useDepth&&a[2]?`rgba(${127.5+2*a[2]}, ${127.5-2*a[2]}, 255, 0.3)`:n.color,e.fillStyle=n.useDepth&&a[2]?`rgba(${127.5+2*a[2]}, ${127.5-2*a[2]}, 255, 0.3)`:n.color,e.lineTo(a[0],parseInt(a[1]));e.stroke(),n.fillPolygons&&(e.closePath(),e.fill())}}function Jd(e,t=[],n){if(!(t===void 0||t.length===0)){if(!n.useCurves||t.length<=2){Sg(e,t,n);return}e.moveTo(t[0][0],t[0][1]);for(let a=0;a1&&l[1].length>0){let d=o[1]>0?`#${o[1]}`:"",u=`${o[0]} ${d}: ${l[1]}`;a.shadowColor&&a.shadowColor!==""&&(r.fillStyle=a.shadowColor,r.fillText(u,8,2+s*a.lineHeight)),r.fillStyle=a.labelColor,r.fillText(u,6,0+s*a.lineHeight),s+=1}}}async function Gk(e,t,n){let a=Hn(_i,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let r=e.getContext("2d");if(!!r)for(let s of t){r.font=a.font,r.strokeStyle=a.color,r.fillStyle=a.color,a.drawBoxes&&(a.useRawBoxes?Pi(r,e.width*s.boxRaw[0],e.height*s.boxRaw[1],e.width*s.boxRaw[2],e.height*s.boxRaw[3],a):Pi(r,s.box[0],s.box[1],s.box[2],s.box[3],a));let i=[];if(i.push(`face confidence: ${Math.trunc(100*s.confidence)}%`),s.genderConfidence&&i.push(`${s.gender||""} ${Math.trunc(100*s.genderConfidence)}% confident`),s.age&&i.push(`age: ${s.age||""}`),s.iris&&i.push(`iris distance: ${s.iris}`),s.emotion&&s.emotion.length>0){let o=s.emotion.map(l=>`${Math.trunc(100*l.score)}% ${l.emotion}`);i.push(o.join(" "))}s.rotation&&s.rotation.angle&&s.rotation.angle.roll&&i.push(`roll: ${Math.trunc(100*s.rotation.angle.roll)/100} yaw:${Math.trunc(100*s.rotation.angle.yaw)/100} pitch:${Math.trunc(100*s.rotation.angle.pitch)/100}`),i.length===0&&i.push("face"),r.fillStyle=a.color;for(let o=i.length-1;o>=0;o--){let l=Math.max(s.box[0],0),d=o*a.lineHeight+s.box[1];a.shadowColor&&a.shadowColor!==""&&(r.fillStyle=a.shadowColor,r.fillText(i[o],l+5,d+16)),r.fillStyle=a.labelColor,r.fillText(i[o],l+4,d+15)}if(r.lineWidth=1,s.mesh&&s.mesh.length>0){if(a.drawPoints)for(let o of s.mesh)$0(r,o[0],o[1],o[2],a);if(a.drawPolygons){r.lineWidth=1;for(let o=0;os.mesh[d]);Sg(r,l,a)}if(s.annotations&&s.annotations.leftEyeIris){r.strokeStyle=a.useDepth?"rgba(255, 200, 255, 0.3)":a.color,r.beginPath();let o=Math.abs(s.annotations.leftEyeIris[3][0]-s.annotations.leftEyeIris[1][0])/2,l=Math.abs(s.annotations.leftEyeIris[4][1]-s.annotations.leftEyeIris[2][1])/2;r.ellipse(s.annotations.leftEyeIris[0][0],s.annotations.leftEyeIris[0][1],o,l,0,0,2*Math.PI),r.stroke(),a.fillPolygons&&(r.fillStyle=a.useDepth?"rgba(255, 255, 200, 0.3)":a.color,r.fill())}if(s.annotations&&s.annotations.rightEyeIris){r.strokeStyle=a.useDepth?"rgba(255, 200, 255, 0.3)":a.color,r.beginPath();let o=Math.abs(s.annotations.rightEyeIris[3][0]-s.annotations.rightEyeIris[1][0])/2,l=Math.abs(s.annotations.rightEyeIris[4][1]-s.annotations.rightEyeIris[2][1])/2;r.ellipse(s.annotations.rightEyeIris[0][0],s.annotations.rightEyeIris[0][1],o,l,0,0,2*Math.PI),r.stroke(),a.fillPolygons&&(r.fillStyle=a.useDepth?"rgba(255, 255, 200, 0.3)":a.color,r.fill())}}}}}var es=[];async function qk(e,t,n){let a=Hn(_i,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let r=e.getContext("2d");if(!!r){r.lineJoin="round";for(let s=0;sl.part==="leftShoulder"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightShoulder"),i&&o.push([i.position.x,i.position.y]),Jd(r,o,a),o.length=0,i=t[s].keypoints.find(l=>l.part==="rightShoulder"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightHip"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftHip"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftShoulder"),i&&o.push([i.position.x,i.position.y]),o.length===4&&Sg(r,o,a),o.length=0,i=t[s].keypoints.find(l=>l.part==="leftHip"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftKnee"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftAnkle"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftHeel"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftFoot"),i&&o.push([i.position.x,i.position.y]),Jd(r,o,a),o.length=0,i=t[s].keypoints.find(l=>l.part==="rightHip"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightKnee"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightAnkle"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightHeel"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightFoot"),i&&o.push([i.position.x,i.position.y]),Jd(r,o,a),o.length=0,i=t[s].keypoints.find(l=>l.part==="leftShoulder"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftElbow"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftWrist"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="leftPalm"),i&&o.push([i.position.x,i.position.y]),Jd(r,o,a),o.length=0,i=t[s].keypoints.find(l=>l.part==="rightShoulder"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightElbow"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightWrist"),i&&o.push([i.position.x,i.position.y]),i=t[s].keypoints.find(l=>l.part==="rightPalm"),i&&o.push([i.position.x,i.position.y]),Jd(r,o,a)}}}}async function Xk(e,t,n){let a=Hn(_i,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let r=e.getContext("2d");if(!!r){r.lineJoin="round",r.font=a.font;for(let s of t){if(a.drawBoxes){r.strokeStyle=a.color,r.fillStyle=a.color;let i;if(!a.calculateHandBox)i=a.useRawBoxes?s.boxRaw:s.box;else if(i=[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,0,0],s.landmarks&&s.landmarks.length>0){for(let o of s.landmarks)o[0]i[2]&&(i[2]=o[0]),o[1]>i[3]&&(i[3]=o[1]);i[2]-=i[0],i[3]-=i[1]}a.useRawBoxes?Pi(r,e.width*i[0],e.height*i[1],e.width*i[2],e.height*i[3],a):Pi(r,i[0],i[1],i[2],i[3],a),a.drawLabels&&(a.shadowColor&&a.shadowColor!==""&&(r.fillStyle=a.shadowColor,r.fillText("hand",i[0]+3,1+i[1]+a.lineHeight,i[2])),r.fillStyle=a.labelColor,r.fillText("hand",i[0]+2,0+i[1]+a.lineHeight,i[2])),r.stroke()}if(a.drawPoints&&s.landmarks&&s.landmarks.length>0)for(let i of s.landmarks)r.fillStyle=a.useDepth?`rgba(${127.5+2*i[2]}, ${127.5-2*i[2]}, 255, 0.5)`:a.color,$0(r,i[0],i[1],0,a);if(a.drawLabels){let i=(o,l)=>{r.fillStyle=a.useDepth?`rgba(${127.5+2*o[o.length-1][2]}, ${127.5-2*o[o.length-1][2]}, 255, 0.5)`:a.color,r.fillText(l,o[o.length-1][0]+4,o[o.length-1][1]+4)};r.font=a.font,i(s.annotations.indexFinger,"index"),i(s.annotations.middleFinger,"middle"),i(s.annotations.ringFinger,"ring"),i(s.annotations.pinky,"pinky"),i(s.annotations.thumb,"thumb"),i(s.annotations.palmBase,"palm")}if(a.drawPolygons){let i=o=>{if(!!o)for(let l=0;l0?l-1:0][0],o[l>0?l-1:0][1]),r.lineTo(o[l][0],o[l][1]),r.stroke()};r.lineWidth=a.lineWidth,i(s.annotations.indexFinger),i(s.annotations.middleFinger),i(s.annotations.ringFinger),i(s.annotations.pinky),i(s.annotations.thumb)}}}}async function Kk(e,t,n){let a=Hn(_i,n);if(!t||!e||!(e instanceof HTMLCanvasElement))return;let r=e.getContext("2d");if(!!r){r.lineJoin="round",r.font=a.font;for(let s of t)if(a.drawBoxes){if(r.strokeStyle=a.color,r.fillStyle=a.color,a.useRawBoxes?Pi(r,e.width*s.boxRaw[0],e.height*s.boxRaw[1],e.width*s.boxRaw[2],e.height*s.boxRaw[3],a):Pi(r,s.box[0],s.box[1],s.box[2],s.box[3],a),a.drawLabels){let i=`${Math.round(100*s.score)}% ${s.label}`;a.shadowColor&&a.shadowColor!==""&&(r.fillStyle=a.shadowColor,r.fillText(i,s.box[0]+3,1+s.box[1]+a.lineHeight,s.box[2])),r.fillStyle=a.labelColor,r.fillText(i,s.box[0]+2,0+s.box[1]+a.lineHeight,s.box[2])}r.stroke()}}}async function Xie(e,t){if(!e||!t||!(e instanceof HTMLCanvasElement)||!(t instanceof HTMLCanvasElement))return;let n=e.getContext("2d");n==null||n.drawImage(e,0,0)}async function Kie(e,t,n){let a=Hn(_i,n);!t||!e||e instanceof HTMLCanvasElement&&(Gk(e,t.face,a),qk(e,t.body,a),Xk(e,t.hand,a),Hk(e,t.gesture,a),Kk(e,t.object,a))}var D0=` /9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUA AAABAAAARgEoAAMAAAABAAIAAAExAAIAAAARAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQu bmV0IDQuMi4xMwAA/9sAQwAGBAUGBQQGBgUGBwcGCAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxob @@ -4406,7 +4406,7 @@ PQ4GJ+ashuK0MhWaoWcA0AaOmASMK7jRNPWYBmHyiuepO2x10qfcv6vYxCzYqoGK4HVYVTJrmb5l c6oaM5TUJ8EgGsG4kLNUHT0M64OaqMMikSRsuKbnFMRLG3zVehOaGNE445NNlnVFpDMu6uie9Vo1 8z5mOAOST2pDK91cNN+5tsrH3PrW54a06KxT7fdrlh/q1Pc+tJ6IUdZGvHPLezMcnBOWbsPap5r3 ylFtbdT1xUWNWzU0/Zbwlgfmx8zGsHWtRHmMqE59aAMyNifvHPc1f0gtPdqkY5JosJHeNci2tktY -euPnNY+oXWZEVJNrZ9aun8SIq/CzodHuriIokhDIR1ronbKZr0o6o8ipoz//2Q==`,D0=` +euPnNY+oXWZEVJNrZ9aun8SIq/CzodHuriIokhDIR1ronbKZr0o6o8ipoz//2Q==`,O0=` /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAsICAoIBwsKCQoNDAsNERwSEQ8PESIZGhQcKSQrKigk JyctMkA3LTA9MCcnOEw5PUNFSElIKzZPVU5GVEBHSEX/2wBDAQwNDREPESESEiFFLicuRUVFRUVF RUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUX/wAARCASwBLADASIA @@ -4974,7 +4974,7 @@ AAAAAAJAAAAAAAAAAAAAABAJEAAAAAAAAAAAAAAAIEoBKAAAAAAAAAAAAAAABAlAAAAAAAIAAAAA BAkBAkBAkBAlACEgMZjdjbFW8bWrEx8YWANb6Fp+bfwab+vLDKMFK9qxH5L0bAr8OPRPKz2AY7J2 SbAjYZAI2E7AIEgIEgIEgMdkSy2NgY7MdlmyNoBXsxmFuyNgVTVjNV3KjlBRNTlXTVHKCrlIqt5T lBhEMohlFerLlBjEMohMVTEARDKCITsAk2AEgAAAkAAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAD/ -2Q==`;var Kk="1.8.3";var Ql,Jd,Qd,Pi,O0,ep,z0,_0,P0,Zie=class{constructor(t={}){Ql.set(this,void 0);Jd.set(this,void 0);Qd.set(this,void 0);Pi.set(this,void 0);this.analyze=(...t)=>{if(!na(this,Jd))return;let n=this.tf.engine().state.numTensors,a=na(this,Ql);as(this,Ql,n);let r=n-a;r!==0&&he(...t,r)};O0.set(this,t=>{if(!na(this,Qd))return null;if(!t)return"input is not defined";if(this.tf.ENV.flags.IS_NODE&&!(t instanceof Le))return"input must be a tensor";try{this.tf.getBackend()}catch(n){return"backend not loaded"}return null});ep.set(this,async(t=!1)=>{var n;if(this.config.backend&&this.config.backend.length>0&&t||this.tf.getBackend()!==this.config.backend){let a=it();if(this.state="backend",this.config.backend&&this.config.backend.length>0){if(typeof window=="undefined"&&typeof WorkerGlobalScope!="undefined"&&this.config.debug&&he("running inside web worker"),this.tf.ENV.flags.IS_BROWSER&&this.config.backend==="tensorflow"&&(this.config.backend="webgl"),this.tf.ENV.flags.IS_NODE&&(this.config.backend==="webgl"||this.config.backend==="humangl")&&(this.config.backend="tensorflow"),this.config.debug&&he("setting backend:",this.config.backend),this.config.backend==="wasm"){if(this.config.debug&&he("wasm path:",this.config.wasmPath),typeof((n=this.tf)==null?void 0:n.setWasmPaths)!="undefined")this.tf.setWasmPaths(this.config.wasmPath);else throw new Error("Human: WASM backend is not loaded");let r=await this.tf.env().getAsync("WASM_HAS_SIMD_SUPPORT"),s=await this.tf.env().getAsync("WASM_HAS_MULTITHREAD_SUPPORT");this.config.debug&&he(`wasm execution: ${r?"SIMD":"no SIMD"} ${s?"multithreaded":"singlethreaded"}`),this.config.debug&&!r&&he("warning: wasm simd support is not enabled")}this.config.backend==="humangl"&&ak();try{await this.tf.setBackend(this.config.backend)}catch(r){he("error: cannot set backend:",this.config.backend,r)}}if(this.tf.enableProdMode(),this.tf.getBackend()==="webgl"||this.tf.getBackend()==="humangl"){this.tf.ENV.set("CHECK_COMPUTATION_FOR_ERRORS",!1),this.tf.ENV.set("WEBGL_PACK_DEPTHWISECONV",!0),typeof this.config.deallocate!="undefined"&&(he("changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:",!0),this.tf.ENV.set("WEBGL_DELETE_TEXTURE_THRESHOLD",0));let r=await this.tf.backend().getGPGPUContext().gl;this.config.debug&&he(`gl version:${r.getParameter(r.VERSION)} renderer:${r.getParameter(r.RENDERER)}`)}await this.tf.ready(),this.perf.backend=Math.trunc(it()-a)}});z0.set(this,async()=>{let t=(r,s="application/octet-stream")=>fetch(`data:${s};base64,${r}`).then(i=>i.blob()),n,a;switch(this.config.warmup){case"face":n=await t($0);break;case"full":n=await t(D0);break;default:n=null}if(n){let r=await createImageBitmap(n);a=await this.detect(r,this.config),r.close()}return a});_0.set(this,async()=>new Promise(t=>{let n,a=0;switch(this.config.warmup){case"face":a=256,n="data:image/jpeg;base64,"+$0;break;case"full":case"body":a=1200,n="data:image/jpeg;base64,"+D0;break;default:n=null}let r=new Image;r.onload=async()=>{let s=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(a,a):document.createElement("canvas");s.width=r.naturalWidth,s.height=r.naturalHeight;let i=s.getContext("2d");i==null||i.drawImage(r,0,0);let o=await this.detect(s,this.config);t(o)},n?r.src=n:t(null)}));P0.set(this,async()=>{let t=r=>Buffer.from(r,"base64"),n;if(this.config.warmup==="face"&&(n=t($0)),(this.config.warmup==="body"||this.config.warmup==="full")&&(n=t(D0)),!n)return null;let a;if(typeof void 0!="undefined"){let r=(void 0).decodeJpeg(n),s=r.expandDims(0);this.tf.dispose(r),a=await this.detect(s,this.config),this.tf.dispose(s)}else this.config.debug&&he("Warmup tfjs-node not loaded");return a});this.tf=pu,this.draw=kg,this.version=Kk,this.config=Hn(Pg,t),this.state="idle",as(this,Ql,0),as(this,Jd,!1),as(this,Qd,!1),as(this,Pi,!0),this.perf={},this.models={face:null,posenet:null,blazepose:null,efficientpose:null,handpose:null,iris:null,age:null,gender:null,emotion:null,embedding:null,nanodet:null,faceres:null},this.image=n=>wg(n,this.config),this.classes={facemesh:W2,emotion:U2,faceres:X2,body:this.config.body.modelPath.includes("posenet")?rg:fg,hand:pg,nanodet:yg},this.faceTriangulation=mk,this.faceUVMap=Ak,this.sysinfo=Lg()}similarity(t,n){return Z2(t,n)}enhance(t){return Y2(t)}match(t,n,a=0){return yk(t,n,a)}async load(t={}){this.state="load";let n=it();t&&(this.config=Hn(this.config,t)),na(this,Pi)&&(this.config.debug&&he(`version: ${this.version}`),this.config.debug&&he(`tfjs version: ${this.tf.version_core}`),this.config.debug&&he("platform:",this.sysinfo.platform),this.config.debug&&he("agent:",this.sysinfo.agent),await na(this,ep).call(this,!0),this.tf.ENV.flags.IS_BROWSER&&(this.config.debug&&he("configuration:",this.config),this.config.debug&&he("tf flags:",this.tf.ENV.flags))),this.config.async?[this.models.face,this.models.emotion,this.models.handpose,this.models.posenet,this.models.blazepose,this.models.nanodet,this.models.faceres]=await Promise.all([this.models.face||(this.config.face.enabled?j2(this.config):null),this.models.emotion||(this.config.face.enabled&&this.config.face.emotion.enabled?q2(this.config):null),this.models.handpose||(this.config.hand.enabled?hg(this.config):null),this.models.posenet||(this.config.body.enabled&&this.config.body.modelPath.includes("posenet")?ig(this.config):null),this.models.blazepose||(this.config.body.enabled&&this.config.body.modelPath.includes("blazepose")?mg(this.config):null),this.models.nanodet||(this.config.object.enabled?xg(this.config):null),this.models.faceres||(this.config.face.enabled&&this.config.face.description.enabled?K2(this.config):null)]):(this.config.face.enabled&&!this.models.face&&(this.models.face=await j2(this.config)),this.config.face.enabled&&this.config.face.emotion.enabled&&!this.models.emotion&&(this.models.emotion=await q2(this.config)),this.config.hand.enabled&&!this.models.handpose&&(this.models.handpose=await hg(this.config)),this.config.body.enabled&&!this.models.posenet&&this.config.body.modelPath.includes("posenet")&&(this.models.posenet=await ig(this.config)),this.config.body.enabled&&!this.models.blazepose&&this.config.body.modelPath.includes("blazepose")&&(this.models.blazepose=await mg(this.config)),this.config.object.enabled&&!this.models.nanodet&&(this.models.nanodet=await xg(this.config)),this.config.face.enabled&&this.config.face.description.enabled&&!this.models.faceres&&(this.models.faceres=await K2(this.config))),na(this,Pi)&&(this.config.debug&&he("tf engine state:",this.tf.engine().state.numBytes,"bytes",this.tf.engine().state.numTensors,"tensors"),as(this,Pi,!1));let a=Math.trunc(it()-n);a>(this.perf.load||0)&&(this.perf.load=a)}async detect(t,n={}){return new Promise(async a=>{this.state="config";let r;this.config=Hn(this.config,n),this.state="check";let s=na(this,O0).call(this,t);s&&(he(s,t),a({error:s}));let i=it();await na(this,ep).call(this),await this.load();let o;t&&this.config.videoOptimized&&typeof window!="undefined"&&typeof WorkerGlobalScope!="undefined"&&(typeof HTMLImageElement!="undefined"&&t instanceof HTMLImageElement||typeof Image!="undefined"&&t instanceof Image||typeof ImageData!="undefined"&&t instanceof ImageData||typeof ImageBitmap!="undefined"&&vg instanceof ImageBitmap)&&(he("disabling video optimization"),o=this.config.videoOptimized,this.config.videoOptimized=!1),r=it();let l=wg(t,this.config);if(!l||!l.tensor){he("could not convert input to tensor"),a({error:"could not convert input to tensor"});return}this.perf.image=Math.trunc(it()-r),this.analyze("Get Image:");let d,u,p,c,h;this.config.async?(p=this.config.face.enabled?J2(this,l.tensor):[],this.perf.face&&delete this.perf.face):(this.state="run:face",r=it(),p=this.config.face.enabled?await J2(this,l.tensor):[],h=Math.trunc(it()-r),h>0&&(this.perf.face=h)),this.analyze("Start Body:"),this.config.async?(this.config.body.modelPath.includes("posenet")?d=this.config.body.enabled?sg(l.tensor,this.config):[]:this.config.body.modelPath.includes("blazepose")&&(d=this.config.body.enabled?Ag(l.tensor,this.config):[]),this.perf.body&&delete this.perf.body):(this.state="run:body",r=it(),this.config.body.modelPath.includes("posenet")?d=this.config.body.enabled?await sg(l.tensor,this.config):[]:this.config.body.modelPath.includes("blazepose")&&(d=this.config.body.enabled?await Ag(l.tensor,this.config):[]),h=Math.trunc(it()-r),h>0&&(this.perf.body=h)),this.analyze("End Body:"),this.analyze("Start Hand:"),this.config.async?(u=this.config.hand.enabled?cg(l.tensor,this.config):[],this.perf.hand&&delete this.perf.hand):(this.state="run:hand",r=it(),u=this.config.hand.enabled?await cg(l.tensor,this.config):[],h=Math.trunc(it()-r),h>0&&(this.perf.hand=h)),this.analyze("End Hand:"),this.analyze("Start Object:"),this.config.async?(c=this.config.object.enabled?bg(l.tensor,this.config):[],this.perf.object&&delete this.perf.object):(this.state="run:object",r=it(),c=this.config.object.enabled?await bg(l.tensor,this.config):[],h=Math.trunc(it()-r),h>0&&(this.perf.object=h)),this.analyze("End Object:"),this.config.async&&([p,d,u,c]=await Promise.all([p,d,u,c])),Ee(l.tensor);let m=[];this.config.gesture.enabled&&(r=it(),m=[...Wk(p),...Lk(d),...Vk(u),...Bk(p)],this.config.async?this.perf.gesture&&delete this.perf.gesture:this.perf.gesture=Math.trunc(it()-r)),o&&(this.config.videoOptimized=o),this.perf.total=Math.trunc(it()-i),this.state="idle";let f={face:p,body:d,hand:u,gesture:m,object:c,performance:this.perf,canvas:l.canvas};a(f)})}async warmup(t={}){let n=it();if(t&&(this.config=Hn(this.config,t)),!this.config.warmup||this.config.warmup==="none")return{error:"null"};let a=this.config.videoOptimized;this.config.videoOptimized=!1;let r;typeof createImageBitmap=="function"?r=await na(this,z0).call(this):typeof Image!="undefined"?r=await na(this,_0).call(this):r=await na(this,P0).call(this),this.config.videoOptimized=a;let s=it();return this.config.debug&&he("Warmup",this.config.warmup,Math.round(s-n),"ms",r),r}};Ql=new WeakMap,Jd=new WeakMap,Qd=new WeakMap,Pi=new WeakMap,O0=new WeakMap,ep=new WeakMap,z0=new WeakMap,_0=new WeakMap,P0=new WeakMap;export{Zie as Human,Zie as default}; +2Q==`;var Zk="1.8.4";var eu,Qd,ep,Li,z0,tp,_0,P0,L0,Yie=class{constructor(t={}){Fa(this,eu,void 0);Fa(this,Qd,void 0);Fa(this,ep,void 0);Fa(this,Li,void 0);this.analyze=(...t)=>{if(!na(this,Qd))return;let n=this.tf.engine().state.numTensors,a=na(this,eu);rs(this,eu,n);let r=n-a;r!==0&&he(...t,r)};Fa(this,z0,t=>{if(!na(this,ep))return null;if(!t)return"input is not defined";if(this.tf.ENV.flags.IS_NODE&&!(t instanceof Le))return"input must be a tensor";try{this.tf.getBackend()}catch(n){return"backend not loaded"}return null});Fa(this,tp,async(t=!1)=>{var n;if(this.config.backend&&this.config.backend.length>0&&t||this.tf.getBackend()!==this.config.backend){let a=it();if(this.state="backend",this.config.backend&&this.config.backend.length>0){if(typeof window=="undefined"&&typeof WorkerGlobalScope!="undefined"&&this.config.debug&&he("running inside web worker"),this.tf.ENV.flags.IS_BROWSER&&this.config.backend==="tensorflow"&&(this.config.backend="webgl"),this.tf.ENV.flags.IS_NODE&&(this.config.backend==="webgl"||this.config.backend==="humangl")&&(this.config.backend="tensorflow"),this.config.debug&&he("setting backend:",this.config.backend),this.config.backend==="wasm"){if(this.config.debug&&he("wasm path:",this.config.wasmPath),typeof((n=this.tf)==null?void 0:n.setWasmPaths)!="undefined")this.tf.setWasmPaths(this.config.wasmPath);else throw new Error("Human: WASM backend is not loaded");let r=await this.tf.env().getAsync("WASM_HAS_SIMD_SUPPORT"),s=await this.tf.env().getAsync("WASM_HAS_MULTITHREAD_SUPPORT");this.config.debug&&he(`wasm execution: ${r?"SIMD":"no SIMD"} ${s?"multithreaded":"singlethreaded"}`),this.config.debug&&!r&&he("warning: wasm simd support is not enabled")}this.config.backend==="humangl"&&rk();try{await this.tf.setBackend(this.config.backend)}catch(r){he("error: cannot set backend:",this.config.backend,r)}}if(this.tf.enableProdMode(),this.tf.getBackend()==="webgl"||this.tf.getBackend()==="humangl"){this.tf.ENV.set("CHECK_COMPUTATION_FOR_ERRORS",!1),this.tf.ENV.set("WEBGL_PACK_DEPTHWISECONV",!0),typeof this.config.deallocate!="undefined"&&(he("changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:",!0),this.tf.ENV.set("WEBGL_DELETE_TEXTURE_THRESHOLD",0));let r=await this.tf.backend().getGPGPUContext().gl;this.config.debug&&he(`gl version:${r.getParameter(r.VERSION)} renderer:${r.getParameter(r.RENDERER)}`)}await this.tf.ready(),this.perf.backend=Math.trunc(it()-a)}});Fa(this,_0,async()=>{let t=(r,s="application/octet-stream")=>fetch(`data:${s};base64,${r}`).then(i=>i.blob()),n,a;switch(this.config.warmup){case"face":n=await t(D0);break;case"full":n=await t(O0);break;default:n=null}if(n){let r=await createImageBitmap(n);a=await this.detect(r,this.config),r.close()}return a});Fa(this,P0,async()=>new Promise(t=>{let n,a=0;switch(this.config.warmup){case"face":a=256,n="data:image/jpeg;base64,"+D0;break;case"full":case"body":a=1200,n="data:image/jpeg;base64,"+O0;break;default:n=null}let r=new Image;r.onload=async()=>{let s=typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(a,a):document.createElement("canvas");s.width=r.naturalWidth,s.height=r.naturalHeight;let i=s.getContext("2d");i==null||i.drawImage(r,0,0);let o=await this.detect(s,this.config);t(o)},n?r.src=n:t(null)}));Fa(this,L0,async()=>{let t=r=>Buffer.from(r,"base64"),n;if(this.config.warmup==="face"&&(n=t(D0)),(this.config.warmup==="body"||this.config.warmup==="full")&&(n=t(O0)),!n)return null;let a;if(typeof void 0!="undefined"){let r=(void 0).decodeJpeg(n),s=r.expandDims(0);this.tf.dispose(r),a=await this.detect(s,this.config),this.tf.dispose(s)}else this.config.debug&&he("Warmup tfjs-node not loaded");return a});this.tf=cu,this.draw=Ig,this.version=Zk,this.config=Hn(Lg,t),this.state="idle",rs(this,eu,0),rs(this,Qd,!1),rs(this,ep,!1),rs(this,Li,!0),this.perf={},this.models={face:null,posenet:null,blazepose:null,efficientpose:null,handpose:null,iris:null,age:null,gender:null,emotion:null,embedding:null,nanodet:null,faceres:null},this.image=n=>kg(n,this.config),this.classes={facemesh:B2,emotion:H2,faceres:K2,body:this.config.body.modelPath.includes("posenet")?sg:mg,hand:cg,nanodet:gg},this.faceTriangulation=Ak,this.faceUVMap=yk,this.sysinfo=Wg()}similarity(t,n){return Y2(t,n)}enhance(t){return J2(t)}match(t,n,a=0){return gk(t,n,a)}async load(t={}){this.state="load";let n=it();t&&(this.config=Hn(this.config,t)),na(this,Li)&&(this.config.debug&&he(`version: ${this.version}`),this.config.debug&&he(`tfjs version: ${this.tf.version_core}`),this.config.debug&&he("platform:",this.sysinfo.platform),this.config.debug&&he("agent:",this.sysinfo.agent),await na(this,tp).call(this,!0),this.tf.ENV.flags.IS_BROWSER&&(this.config.debug&&he("configuration:",this.config),this.config.debug&&he("tf flags:",this.tf.ENV.flags))),this.config.async?[this.models.face,this.models.emotion,this.models.handpose,this.models.posenet,this.models.blazepose,this.models.nanodet,this.models.faceres]=await Promise.all([this.models.face||(this.config.face.enabled?U2(this.config):null),this.models.emotion||(this.config.face.enabled&&this.config.face.emotion.enabled?X2(this.config):null),this.models.handpose||(this.config.hand.enabled?fg(this.config):null),this.models.posenet||(this.config.body.enabled&&this.config.body.modelPath.includes("posenet")?og(this.config):null),this.models.blazepose||(this.config.body.enabled&&this.config.body.modelPath.includes("blazepose")?Ag(this.config):null),this.models.nanodet||(this.config.object.enabled?bg(this.config):null),this.models.faceres||(this.config.face.enabled&&this.config.face.description.enabled?Z2(this.config):null)]):(this.config.face.enabled&&!this.models.face&&(this.models.face=await U2(this.config)),this.config.face.enabled&&this.config.face.emotion.enabled&&!this.models.emotion&&(this.models.emotion=await X2(this.config)),this.config.hand.enabled&&!this.models.handpose&&(this.models.handpose=await fg(this.config)),this.config.body.enabled&&!this.models.posenet&&this.config.body.modelPath.includes("posenet")&&(this.models.posenet=await og(this.config)),this.config.body.enabled&&!this.models.blazepose&&this.config.body.modelPath.includes("blazepose")&&(this.models.blazepose=await Ag(this.config)),this.config.object.enabled&&!this.models.nanodet&&(this.models.nanodet=await bg(this.config)),this.config.face.enabled&&this.config.face.description.enabled&&!this.models.faceres&&(this.models.faceres=await Z2(this.config))),na(this,Li)&&(this.config.debug&&he("tf engine state:",this.tf.engine().state.numBytes,"bytes",this.tf.engine().state.numTensors,"tensors"),rs(this,Li,!1));let a=Math.trunc(it()-n);a>(this.perf.load||0)&&(this.perf.load=a)}async detect(t,n={}){return new Promise(async a=>{this.state="config";let r;this.config=Hn(this.config,n),this.state="check";let s=na(this,z0).call(this,t);s&&(he(s,t),a({error:s}));let i=it();await na(this,tp).call(this),await this.load();let o;t&&this.config.videoOptimized&&typeof window!="undefined"&&typeof WorkerGlobalScope!="undefined"&&(typeof HTMLImageElement!="undefined"&&t instanceof HTMLImageElement||typeof Image!="undefined"&&t instanceof Image||typeof ImageData!="undefined"&&t instanceof ImageData||typeof ImageBitmap!="undefined"&&wg instanceof ImageBitmap)&&(he("disabling video optimization"),o=this.config.videoOptimized,this.config.videoOptimized=!1),r=it();let l=kg(t,this.config);if(!l||!l.tensor){he("could not convert input to tensor"),a({error:"could not convert input to tensor"});return}this.perf.image=Math.trunc(it()-r),this.analyze("Get Image:");let d,u,p,c,h;this.config.async?(p=this.config.face.enabled?Q2(this,l.tensor):[],this.perf.face&&delete this.perf.face):(this.state="run:face",r=it(),p=this.config.face.enabled?await Q2(this,l.tensor):[],h=Math.trunc(it()-r),h>0&&(this.perf.face=h)),this.analyze("Start Body:"),this.config.async?(this.config.body.modelPath.includes("posenet")?d=this.config.body.enabled?ig(l.tensor,this.config):[]:this.config.body.modelPath.includes("blazepose")&&(d=this.config.body.enabled?yg(l.tensor,this.config):[]),this.perf.body&&delete this.perf.body):(this.state="run:body",r=it(),this.config.body.modelPath.includes("posenet")?d=this.config.body.enabled?await ig(l.tensor,this.config):[]:this.config.body.modelPath.includes("blazepose")&&(d=this.config.body.enabled?await yg(l.tensor,this.config):[]),h=Math.trunc(it()-r),h>0&&(this.perf.body=h)),this.analyze("End Body:"),this.analyze("Start Hand:"),this.config.async?(u=this.config.hand.enabled?hg(l.tensor,this.config):[],this.perf.hand&&delete this.perf.hand):(this.state="run:hand",r=it(),u=this.config.hand.enabled?await hg(l.tensor,this.config):[],h=Math.trunc(it()-r),h>0&&(this.perf.hand=h)),this.analyze("End Hand:"),this.analyze("Start Object:"),this.config.async?(c=this.config.object.enabled?vg(l.tensor,this.config):[],this.perf.object&&delete this.perf.object):(this.state="run:object",r=it(),c=this.config.object.enabled?await vg(l.tensor,this.config):[],h=Math.trunc(it()-r),h>0&&(this.perf.object=h)),this.analyze("End Object:"),this.config.async&&([p,d,u,c]=await Promise.all([p,d,u,c])),Ee(l.tensor);let m=[];this.config.gesture.enabled&&(r=it(),m=[...Bk(p),...Wk(d),...jk(u),...Vk(p)],this.config.async?this.perf.gesture&&delete this.perf.gesture:this.perf.gesture=Math.trunc(it()-r)),o&&(this.config.videoOptimized=o),this.perf.total=Math.trunc(it()-i),this.state="idle";let f={face:p,body:d,hand:u,gesture:m,object:c,performance:this.perf,canvas:l.canvas};a(f)})}async warmup(t={}){let n=it();if(t&&(this.config=Hn(this.config,t)),!this.config.warmup||this.config.warmup==="none")return{error:"null"};let a=this.config.videoOptimized;this.config.videoOptimized=!1;let r;typeof createImageBitmap=="function"?r=await na(this,_0).call(this):typeof Image!="undefined"?r=await na(this,P0).call(this):r=await na(this,L0).call(this),this.config.videoOptimized=a;let s=it();return this.config.debug&&he("Warmup",this.config.warmup,Math.round(s-n),"ms",r),r}};eu=new WeakMap,Qd=new WeakMap,ep=new WeakMap,Li=new WeakMap,z0=new WeakMap,tp=new WeakMap,_0=new WeakMap,P0=new WeakMap,L0=new WeakMap;export{Yie as Human,Yie as default}; /** * @license * Copyright 2017 Google LLC. All Rights Reserved. diff --git a/dist/human.esm.js.map b/dist/human.esm.js.map index dbc0baf9..684f4533 100644 --- a/dist/human.esm.js.map +++ b/dist/human.esm.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/helpers.ts", "../src/config.ts", "../src/sysinfo.ts", "../node_modules/.pnpm/node-fetch@2.6.1/node_modules/node-fetch/browser.js", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/alea.js", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xor128.js", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xorwow.js", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xorshift7.js", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/xor4096.js", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/lib/tychei.js", "(disabled):crypto", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/seedrandom.js", "../node_modules/.pnpm/seedrandom@2.4.3/node_modules/seedrandom/index.js", "(disabled):path", "(disabled):worker_threads", "(disabled):perf_hooks", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/wasm-out/tfjs-backend-wasm-threaded-simd.js", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/wasm-out/tfjs-backend-wasm.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/alea.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xor128.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xorwow.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xorshift7.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/xor4096.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/lib/tychei.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/seedrandom.js", "../node_modules/.pnpm/seedrandom@3.0.5/node_modules/seedrandom/index.js", "../node_modules/.pnpm/string_decoder@1.1.1/node_modules/string_decoder/lib/string_decoder.js", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/backends/backend.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/util_base.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/environment.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/global_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/kernel_names.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/kernel_registry.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/profiler.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/tape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/tensor_format.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/tensor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/tensor_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/types.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/engine.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/device_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/flags.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/tensor_util_env.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/operation.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/complex.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor_ops_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/io/types.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/io/io_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/io/router_registry.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/io/indexed_db.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/io/local_storage.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/io/model_management.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/platforms/platform_browser.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/platforms/platform_node.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/buffer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/cast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/clone.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/print.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/base_side_effects.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/io/io.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/io/browser_files.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/io/progress.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/io/weights_loader.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/io/http.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/io/passthrough.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/math.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/mat_mul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/one_hot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/confusion_matrix.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/browser.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/gather_nd_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/scatter_nd_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/slice_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/serialization.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/test_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/globals.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/add.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/floorDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/div.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/mul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/abs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/acos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/acosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/add_n.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/all.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/any.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/arg_max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/arg_min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/asin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/asinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/atan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/atan2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/atanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/conv_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/avg_pool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/avg_pool_3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/concat.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/tanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/basic_lstm_cell.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/batch_to_space_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/batchnorm_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/batchnorm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/batchnorm2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/batchnorm3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/batchnorm4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/bincount.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/broadcast_to.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/ceil.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/clip_by_value.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/concat_1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/concat_2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/concat_3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/concat_4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/conv1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/conv2d_backprop_input.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/conv2d_transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/conv3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/conv3d_backprop_input.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/conv3d_transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/cos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/cosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/cumsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/dense_bincount.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/depth_to_space.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/depthwise_conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/diag.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/dilation2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/broadcast_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/where.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/zeros_like.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/div_no_nan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/dot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/einsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/elu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/erf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/expand_dims.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/expm1.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/tile.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/eye.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/fill.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/floor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/gather.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/greater.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/greater_equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/imag.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/is_finite.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/is_inf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/is_nan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/leaky_relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/less.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/less_equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/linspace.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/local_response_normalization.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/log.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/log1p.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/neg.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/softplus.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/log_sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/sub.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/log_softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/axis_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/log_sum_exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/logical_and.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/logical_not.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/logical_or.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/logical_xor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/max_pool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/max_pool_3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/max_pool_with_argmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/maximum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/mean.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/zeros.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/ones.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/meshgrid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/minimum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/mirror_pad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/mod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/square.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/moments.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/multi_rnn_cell.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/multinomial.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/not_equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/ones_like.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/outer_product.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/pad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/pad1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/pad2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/pad3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/pad4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/space_to_batch_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/pool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/pow.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/prelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/prod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/rand.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/rand_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/random_gamma.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/random_normal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/random_uniform.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/range.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/real.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/reciprocal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/relu6.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/reverse.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/reverse_1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/reverse_2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/reverse_3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/reverse_4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/round.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/rsqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/scalar.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/selu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/separable_conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/setdiff1d_async.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/sign.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/sin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/sinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/slice1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/slice2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/slice3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/slice4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/spectral/fft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/spectral/ifft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/spectral/irfft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/split.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/spectral/rfft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/sqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/squared_difference.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/squeeze.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/stack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/step.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/strided_slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/tan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor5d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/tensor6d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/topk.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/truncated_normal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/unique.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/unsorted_segment_sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/unstack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/variable.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/backends/where_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/where_async.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/boolean_mask.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/norm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/moving_average.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/scatter_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse_to_dense_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse_to_dense.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/gather_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/dropout_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/dropout.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/signal_ops_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/in_top_k.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/fused_ops.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/conv2d_backprop_filter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/fused_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/fused/conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/depthwise_conv2d_native_backprop_filter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/depthwise_conv2d_native_backprop_input.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/fused/depthwise_conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/fused/mat_mul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/signal/hamming_window.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/signal/hann_window.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/signal/frame.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/signal/stft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/image/crop_and_resize.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/image/flip_left_right.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/image/rotate_with_offset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/nonmax_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/backends/non_max_suppression_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/backends/non_max_suppression_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression_async.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression_with_score.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression_with_score_async.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression_padded.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/image/non_max_suppression_padded_async.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/image/resize_bilinear.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/image/resize_nearest_neighbor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/image/threshold.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/image/transform.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/linalg/band_part.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/linalg/gram_schmidt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/linalg/qr.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/loss_ops_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/compute_weighted_loss.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/absolute_difference.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/cosine_distance.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/hinge_loss.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/huber_loss.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/log_loss.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/mean_squared_error.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/sigmoid_cross_entropy.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/losses/softmax_cross_entropy.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse/sparse_fill_empty_rows.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/sparse/sparse_reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/ops.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/optimizers/optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/optimizers/adadelta_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/optimizers/adagrad_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/optimizers/adam_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/optimizers/adamax_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/optimizers/sgd_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/optimizers/momentum_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/optimizers/rmsprop_optimizer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/optimizers/optimizer_constructors.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/train.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/browser_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/backends/backend_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/concat_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/reduce_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/rotate_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/array_ops_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/selu_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/erf_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/log.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/backends/complex_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/backends/einsum_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/split_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/segment_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/backends/kernel_impls.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/base.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/index.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/cpu_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/backend_cpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/shared.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Abs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/binary_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Complex.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/zeros_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Identity.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Real.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Cast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/binary_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Add.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Bincount_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/unary_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/unary_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Ceil.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Concat_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Expm1.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Floor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/GatherV2_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Greater.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Less.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LinSpace_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Log.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Max_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Maximum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Minimum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Multiply.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Neg.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/NotEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Transpose_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Prod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Range_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Rsqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseFillEmptyRows_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseReshape_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SquaredDifference.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/StridedSlice_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Sub.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Tile_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/TopK_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Unique_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/base.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Elu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LeakyRelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Prelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Relu6.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/fused_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/BatchMatMul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/_FusedMatMul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Acos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Acosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/AddN.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/All.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Any.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ArgMax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ArgMin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Asin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Asinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Atan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Atan2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Atanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/pool_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/AvgPool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/AvgPool3D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/AvgPool3DGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/AvgPoolGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/BatchNorm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/BatchToSpaceND.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Bincount.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Clip.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ComplexAbs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Imag.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Concat.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Conv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Conv2DBackpropFilter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Conv2DBackpropInput.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Conv3D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Conv3DBackpropFilterV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Conv3DBackpropInputV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Cos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Cosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/CropAndResize.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Cumsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/DenseBincount.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/DepthToSpace.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/DepthwiseConv2dNative.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/DepthwiseConv2dNativeBackpropFilter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/DepthwiseConv2dNativeBackpropInput.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Diag.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Dilation2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Dilation2DBackpropFilter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Dilation2DBackpropInput.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Einsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/EluGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Erf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ExpandDims.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/RealDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/utils/fft_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/FFT.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Fill.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/FlipLeftRight.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/FloorDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/FusedConv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/FusedDepthwiseConv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/GatherNd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/GatherV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/GreaterEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/IFFT.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/IsFinite.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/IsInf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/IsNaN.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LessEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LinSpace.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Log1p.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LogicalAnd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LogicalNot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LogicalOr.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LRN.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/LRNGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/MaxPool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/MaxPool3D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/MaxPool3DGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/MaxPoolGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/MaxPoolWithArgmax_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/MaxPoolWithArgmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Mean.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/MirrorPad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Mod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Multinomial.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/NonMaxSuppressionV3.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/NonMaxSuppressionV4.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/NonMaxSuppressionV5.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/OneHot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ZerosLike.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/OnesLike.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Pack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/PadV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Pow.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Range.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Reciprocal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ResizeBilinear.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ResizeBilinearGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ResizeNearestNeighbor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ResizeNearestNeighborGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Reverse.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/RotateWithOffset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Round.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Scatter_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/ScatterNd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Select.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Selu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Sign.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Sin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Sinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Softplus.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SpaceToBatchND.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseFillEmptyRows.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseReshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SparseToDense.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/SplitV.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Sqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Square.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Step.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/StridedSlice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Tan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Tanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Tile.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/TopK.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Transform.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Unique.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/Unpack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/kernels/UnsortedSegmentSum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/register_all_kernels.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-cpu/src/index.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/webgl_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/canvas_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/tex_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/flags_webgl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/glsl_version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/shader_compiler_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/decode_matrix_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/decode_matrix_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/encode_float_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/encode_float_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/encode_matrix_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/encode_matrix_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/gpgpu_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/gpgpu_context.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/shader_compiler.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/gpgpu_math.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernel_utils/shared.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/packing_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/pack_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/reshape_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/texture_manager.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/unaryop_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/unaryop_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/unpack_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/backend_webgl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/webgl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/base.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/binaryop_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/binaryop_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Identity.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Complex.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LeakyRelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Prelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernel_utils/kernel_funcs_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/mulmat_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/binaryop_complex_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Multiply.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernel_utils/reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/mean_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/reduce_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernel_utils/reduce.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/transpose_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/transpose_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Transpose_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sum_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/BatchMatMul_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/_FusedMatMul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Abs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Acos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Acosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Add.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/addn_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/addn_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/AddN.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/All.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Any.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/argminmax_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/argminmax_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernel_utils/arg_min_max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ArgMax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ArgMin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Asin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Asinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Atan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Atan2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Atanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/pool_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/AvgPool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/AvgPool3D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/avg_pool_backprop_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/AvgPool3DGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/AvgPoolGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/BatchMatMul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/batchnorm_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/batchnorm_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/BatchNorm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/slice_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/slice_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/BatchToSpaceND.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Bincount.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/NotEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Real.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernel_utils/int.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Cast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Ceil.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/clip_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/clip_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ClipByValue.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/complex_abs_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ComplexAbs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/concat_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/concat_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Imag.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Concat_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Concat.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/conv_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/im2col_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Conv2D_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Conv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/conv_backprop_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Conv2DBackpropFilter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Conv2DBackpropInput.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Conv3D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Conv3DBackpropFilterV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Conv3DBackpropInputV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Cos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Cosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/crop_and_resize_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/CropAndResize.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/cumsum_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Cumsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/DenseBincount.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/depth_to_space_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/DepthToSpace.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/conv_gpu_depthwise.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/conv_packed_gpu_depthwise.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/DepthwiseConv2dNative.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/conv_backprop_gpu_depthwise.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/DepthwiseConv2dNativeBackpropFilter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/DepthwiseConv2dNativeBackpropInput.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/diag_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Diag.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/dilation_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Dilation2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Einsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Elu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/EluGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Erf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ExpandDims.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Expm1.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/fft_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FFT_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FFT.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/fill_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Fill.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/flip_left_right_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FlipLeftRight.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Floor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FloorDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FromPixels_utils/from_pixels_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FromPixels_utils/from_pixels_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FromPixels.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FusedConv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/FusedDepthwiseConv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/gather_nd_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/GatherNd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/gather_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/GatherV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Greater.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/GreaterEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/IFFT.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/IsFinite.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/IsInf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/IsNaN.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Less.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LessEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LinSpace.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Log.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Log1p.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LogicalAnd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LogicalNot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LogicalOr.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/lrn_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/lrn_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LRN.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/lrn_grad_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/LRNGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Max_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Maximum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/MaxPool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/MaxPool3D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/max_pool_backprop_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/MaxPool3DGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/MaxPoolGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/MaxPoolWithArgmax_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/MaxPoolWithArgmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Mean_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Mean.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Minimum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/mirror_pad_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/mirror_pad_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/MirrorPad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Mod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/multinomial_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/RealDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sub.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Multinomial.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Neg.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/NonMaxSuppressionV3.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/NonMaxSuppressionV4.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/NonMaxSuppressionV5.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/onehot_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/OneHot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ZerosLike.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/OnesLike.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Pack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/pad_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/pad_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/PadV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Pow.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Prod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Range.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Reciprocal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Relu6.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/resize_bilinear_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/resize_bilinear_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ResizeBilinear.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/resize_bilinear_backprop_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ResizeBilinearGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/resize_nearest_neighbor_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/resize_nearest_neighbor_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ResizeNearestNeighbor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/resize_nearest_neighbor_backprop_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ResizeNearestNeighborGrad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/reverse_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/reverse_packed_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Reverse.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/rotate_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/RotateWithOffset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Round.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Rsqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/scatter_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/ScatterNd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/select_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Select.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Selu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sign.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Softplus.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/SpaceToBatchND.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/SparseFillEmptyRows.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/SparseReshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/SparseToDense.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/SplitV.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Sqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Square.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/SquaredDifference.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Step.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/strided_slice_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/StridedSlice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Tan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Tanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/tile_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Tile.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/TopK.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/transform_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Transform.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Unique.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/Unpack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/segment_gpu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/kernels/UnsortedSegmentSum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/register_all_kernels.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-webgl/src/index.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/types.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/_FusedMatMul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/unary_kernel.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Abs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/binary_kernel.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Add.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/AddN.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Identity.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/kernel_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/All.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Any.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/ArgMax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/AvgPool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/BatchMatMul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Cast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Ceil.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/ClipByValue.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernel_utils/shared.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Concat.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Conv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Conv2DBackpropInput.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Cos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/CropAndResize.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Cumsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/DepthToSpace.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/DepthwiseConv2dNative.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/ExpandDims.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Fill.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/FlipLeftRight.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Floor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/FloorDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/FusedBatchNorm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/FusedConv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/FusedDepthwiseConv2D.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/GatherNd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/GatherV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Greater.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/GreaterEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/LeakyRelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Less.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/LessEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Log.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/LogicalAnd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Maximum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/MaxPool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Mean.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Minimum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/MirrorPad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Multiply.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Neg.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/NonMaxSuppression_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/NonMaxSuppressionV3.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/NonMaxSuppressionV4.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/NonMaxSuppressionV5.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/NotEqual.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/OneHot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/OnesLike.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Pack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/PadV2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Pow.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Prelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Prod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Range.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/RealDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Relu6.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/ResizeBilinear.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Reverse.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/RotateWithOffset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Round.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Rsqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/ScatterNd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Select.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Sin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/SplitV.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Sqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Square.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/SquaredDifference.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Step.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/StridedSlice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Sub.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Tan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Tanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Tile.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/TopK.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Transform.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/Unpack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/kernels/ZerosLike.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/register_all_kernels.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/flags_wasm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/backend_wasm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/wasm-out/tfjs-backend-wasm-threaded-simd.worker.js", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/base.ts", "../node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-backend-wasm/src/index.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/abs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/acos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/acosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/add.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/all.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/any.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/arg_max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/arg_min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/as_scalar.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/as_type.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/as1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/as2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/as3d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/as4d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/as5d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/asin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/asinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/atan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/atan2.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/atanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/avg_pool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/batch_to_space_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/batchnorm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/broadcast_to.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/cast.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/ceil.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/clip_by_value.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/concat.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/conv1d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/conv2d_transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/cos.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/cosh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/cumsum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/depth_to_space.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/depthwise_conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/dilation2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/div_no_nan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/div.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/dot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/elu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/erf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/expand_dims.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/expm1.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/fft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/flatten.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/floor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/floorDiv.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/gather.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/greater_equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/greater.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/ifft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/irfft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/is_finite.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/is_inf.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/is_nan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/leaky_relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/less_equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/less.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/local_response_normalization.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/log_sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/log_softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/log_sum_exp.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/log.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/log1p.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/logical_and.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/logical_not.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/logical_or.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/logical_xor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/mat_mul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/max_pool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/max.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/maximum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/mean.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/min.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/minimum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/mirror_pad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/mod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/mul.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/neg.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/norm.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/not_equal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/one_hot.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/ones_like.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/pad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/pool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/pow.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/prelu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/prod.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/reciprocal.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/relu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/relu6.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/reshape_as.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/reshape.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/resize_bilinear.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/resize_nearest_neighbor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/reverse.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/rfft.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/round.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/rsqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/selu.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/separable_conv2d.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/sigmoid.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/sign.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/sin.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/sinh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/softmax.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/softplus.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/space_to_batch_nd.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/split.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/sqrt.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/square.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/squared_difference.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/squeeze.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/stack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/step.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/strided_slice.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/sub.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/tan.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/tanh.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/tile.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/to_bool.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/to_float.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/to_int.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/topk.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/transpose.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/unique.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/unsorted_segment_sum.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/unstack.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/where.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/zeros_like.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/public/chained_ops/register_all_chained_ops.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Abs_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Acos_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Acosh_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Add_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/AddN_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/ArgMax_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/ArgMin_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Asin_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Asinh_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Atan2_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Atan_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Atanh_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/avg_pool_3d_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/AvgPool3D_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/avg_pool_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/AvgPool_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/BatchMatMul_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/BatchToSpaceND_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/BroadcastTo_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Cast_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Ceil_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/ClipByValue_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/ComplexAbs_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Concat_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Conv2D_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Conv2DBackpropInput_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/conv3d_backprop_filter.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Conv3D_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Cos_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Cosh_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Cumsum_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/DepthwiseConv2dNative_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Dilation2D_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Elu_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Erf_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Exp_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/ExpandDims_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Expm1_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Floor_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/FloorDiv_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/FusedBatchNorm_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/GatherV2_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/GreaterEqual_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Identity_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/IsFinite_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/IsInf_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/IsNan_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/LeakyRelu_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Log1p_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Log_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/LogSoftmax_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/local_response_normalization_backprop.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/LRN_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/min_max_grad_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Max_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Maximum_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/max_pool_3d_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/MaxPool3D_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/ops/max_pool_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/MaxPool_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Mean_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Min_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Minimum_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/MirrorPad_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Mod_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Multiply_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Neg_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/OneHot_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/OnesLike_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Pack_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/PadV2_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Pow_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Prelu_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/RealDiv_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Reciprocal_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Relu6_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Relu_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Reshape_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/ResizeBilinear_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/ResizeNearestNeighbor_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Reverse_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Round_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Rsqrt_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Select_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Selu_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Sigmoid_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Sign_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Sin_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Sinh_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Slice_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Softmax_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Softplus_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/SpaceToBatchND_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/SplitV_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Sqrt_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Square_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/SquaredDifference_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Step_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Sub_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Sum_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Tan_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Tanh_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Tile_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Transpose_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/Unpack_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/UnsortedSegmentSum_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/gradients/ZerosLike_grad.ts", "../node_modules/.pnpm/@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-core/src/register_all_gradients.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/exports_constraints.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/backend/common.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/errors.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/utils/generic_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/constraints.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/exports_initializers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/keras_format/common.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/common.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/utils/math_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/backend/tfjs_backend.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/keras_format/initializer_config.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/initializers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/exports_layers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/backend/state.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/utils/types_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/utils/variable_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/variables.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/engine/topology.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/engine/input_layer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/logs.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/base_callbacks.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/layers/serialization.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/losses.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/metrics.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/optimizers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/user_defined_metadata.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/utils/layer_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/utils/serialization_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/engine/executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/engine/container.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/engine/training_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/engine/training_dataset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/engine/training_tensors.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/engine/training.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/models.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/exports.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/activations.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/regularizers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/layers/advanced_activations.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/utils/conv_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/layers/convolutional.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/layers/convolutional_depthwise.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/layers/recurrent.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/layers/convolutional_recurrent.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/layers/core.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/layers/embeddings.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/layers/merge.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/layers/noise.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/layers/normalization.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/layers/padding.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/layers/pooling.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/layers/wrappers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/exports_metrics.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/exports_models.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/exports_regularizers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/callbacks.ts", "../node_modules/.pnpm/@tensorflow+tfjs-layers@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-layers/src/index.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/data/compiled_api.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/custom_op/register.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/arithmetic.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/basic_math.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/control.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/convolution.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/creation.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/dynamic.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/evaluation.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/graph.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/hash_table.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/image.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/logical.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/matrices.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/normalization.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/reduction.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/slice_join.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/spectral.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/op_list/transformation.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/operation_mapper.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/custom_op/node_value_impl.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/arithmetic_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/basic_math_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/executor/tensor_utils.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/executor/tensor_array.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/executor/tensor_list.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/control_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/convolution_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/creation_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/dynamic_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/evaluation_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/graph_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/executor/hash_table.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/hash_table_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/image_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/logical_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/matrices_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/normalization_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/reduction_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/slice_join_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/sparse_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/spectral_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/executors/transformation_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/operations/operation_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/executor/execution_context.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/executor/model_analysis.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/executor/graph_executor.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/executor/resource_manager.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/executor/graph_model.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/version.ts", "../node_modules/.pnpm/@tensorflow+tfjs-converter@3.6.0_@tensorflow+tfjs-core@3.6.0/node_modules/@tensorflow/tfjs-converter/src/index.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/index.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/dataset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/iterators/lazy_iterator.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/util/deep_map.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/util/deep_clone.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/util/ring_buffer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/util/growing_ring_buffer.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/datasets/text_line_dataset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/datasets/csv_dataset.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/iterators/microphone_iterator.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/iterators/webcam_iterator.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/datasource.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/iterators/string_iterator.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/iterators/byte_chunk_iterator.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/iterators/file_chunk_iterator.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/iterators/url_chunk_iterator.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/util/source_util.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/sources/file_data_source.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/sources/url_data_source.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/readers.ts", "../node_modules/.pnpm/@tensorflow+tfjs-data@3.6.0_5706159424f1774d88b030214a8dd243/node_modules/@tensorflow/tfjs-data/src/version.ts", "../src/tfjs/tf-browser.ts", "../src/tfjs/backend.ts", "../src/blazeface/facemesh.ts", "../src/blazeface/box.ts", "../src/blazeface/util.ts", "../src/blazeface/blazeface.ts", "../src/blazeface/coords.ts", "../src/blazeface/facepipeline.ts", "../src/emotion/emotion.ts", "../src/faceres/faceres.ts", "../src/faceall.ts", "../src/posenet/posenet.ts", "../src/posenet/keypoints.ts", "../src/posenet/utils.ts", "../src/posenet/poses.ts", "../src/handpose/handpose.ts", "../src/handpose/box.ts", "../src/handpose/anchors.ts", "../src/handpose/handdetector.ts", "../src/handpose/util.ts", "../src/handpose/handpipeline.ts", "../src/blazepose/blazepose.ts", "../src/blazepose/annotations.ts", "../src/nanodet/nanodet.ts", "../src/nanodet/labels.ts", "../src/gesture/gesture.ts", "../src/image/image.ts", "../src/image/imagefx.js", "../src/draw/draw.ts", "../src/sample.ts", "../src/human.ts"], - "sourcesContent": ["// helper function: join two paths\nexport function join(folder: string, file: string): string {\n const separator = folder.endsWith('/') ? '' : '/';\n const skipJoin = file.startsWith('.') || file.startsWith('/') || file.startsWith('http:') || file.startsWith('https:') || file.startsWith('file:');\n const path = skipJoin ? `${file}` : `${folder}${separator}${file}`;\n if (!path.toLocaleLowerCase().includes('.json')) throw new Error(`Human: ModelPath Error: ${path} Expecting JSON file`);\n return path;\n}\n\n// helper function: wrapper around console output\nexport function log(...msg) {\n const dt = new Date();\n const ts = `${dt.getHours().toString().padStart(2, '0')}:${dt.getMinutes().toString().padStart(2, '0')}:${dt.getSeconds().toString().padStart(2, '0')}.${dt.getMilliseconds().toString().padStart(3, '0')}`;\n // eslint-disable-next-line no-console\n if (msg) console.log(ts, 'Human:', ...msg);\n}\n\n// helper function: gets elapsed time on both browser and nodejs\nexport const now = () => {\n if (typeof performance !== 'undefined') return performance.now();\n return parseInt((Number(process.hrtime.bigint()) / 1000 / 1000).toString());\n};\n\n// helper function: perform deep merge of multiple objects so it allows full inheriance with overrides\nexport function mergeDeep(...objects) {\n const isObject = (obj) => obj && typeof obj === 'object';\n return objects.reduce((prev, obj) => {\n Object.keys(obj || {}).forEach((key) => {\n const pVal = prev[key];\n const oVal = obj[key];\n if (Array.isArray(pVal) && Array.isArray(oVal)) prev[key] = pVal.concat(...oVal);\n else if (isObject(pVal) && isObject(oVal)) prev[key] = mergeDeep(pVal, oVal);\n else prev[key] = oVal;\n });\n return prev;\n }, {});\n}\n", "/* eslint-disable indent */\n/* eslint-disable no-multi-spaces */\n\n/**\n * Configuration interface definition for **Human** library\n *\n * Contains all configurable parameters\n */\nexport interface Config {\n /** Backend used for TFJS operations */\n backend: null | '' | 'cpu' | 'wasm' | 'webgl' | 'humangl' | 'tensorflow',\n\n /** Path to *.wasm files if backend is set to `wasm` */\n wasmPath: string,\n\n /** Print debug statements to console */\n debug: boolean,\n\n /** Perform model loading and inference concurrently or sequentially */\n async: boolean,\n\n /** Perform additional optimizations when input is video,\n * - must be disabled for images\n * - automatically disabled for Image, ImageData, ImageBitmap and Tensor inputs\n * - skips boundary detection for every `skipFrames` frames specified for each model\n * - while maintaining in-box detection since objects don't change definition as fast */\n videoOptimized: boolean,\n\n /** What to use for `human.warmup()`\n * - warmup pre-initializes all models for faster inference but can take significant time on startup\n * - only used for `webgl` and `humangl` backends\n */\n warmup: 'none' | 'face' | 'full' | 'body',\n\n /** Base model path (typically starting with file://, http:// or https://) for all models\n * - individual modelPath values are relative to this path\n */\n modelBasePath: string,\n\n /** Run input through image filters before inference\n * - image filters run with near-zero latency as they are executed on the GPU\n */\n filter: {\n enabled: boolean,\n /** Resize input width\n * - if both width and height are set to 0, there is no resizing\n * - if just one is set, second one is scaled automatically\n * - if both are set, values are used as-is\n */\n width: number,\n /** Resize input height\n * - if both width and height are set to 0, there is no resizing\n * - if just one is set, second one is scaled automatically\n * - if both are set, values are used as-is\n */\n height: number,\n /** Return processed canvas imagedata in result */\n return: boolean,\n /** Flip input as mirror image */\n flip: boolean,\n /** Range: -1 (darken) to 1 (lighten) */\n brightness: number,\n /** Range: -1 (reduce contrast) to 1 (increase contrast) */\n contrast: number,\n /** Range: 0 (no sharpening) to 1 (maximum sharpening) */\n sharpness: number,\n /** Range: 0 (no blur) to N (blur radius in pixels) */\n blur: number\n /** Range: -1 (reduce saturation) to 1 (increase saturation) */\n saturation: number,\n /** Range: 0 (no change) to 360 (hue rotation in degrees) */\n hue: number,\n /** Image negative */\n negative: boolean,\n /** Image sepia colors */\n sepia: boolean,\n /** Image vintage colors */\n vintage: boolean,\n /** Image kodachrome colors */\n kodachrome: boolean,\n /** Image technicolor colors */\n technicolor: boolean,\n /** Image polaroid camera effect */\n polaroid: boolean,\n /** Range: 0 (no pixelate) to N (number of pixels to pixelate) */\n pixelate: number,\n },\n // type definition end\n\n /** Controlls gesture detection */\n gesture: {\n enabled: boolean,\n },\n\n /** Controlls and configures all face-specific options:\n * - face detection, face mesh detection, age, gender, emotion detection and face description\n * Parameters:\n * - enabled: true/false\n * - modelPath: path for each of face models\n * - minConfidence: threshold for discarding a prediction\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of faces detected in the input, should be set to the minimum number for performance\n * - rotation: use calculated rotated face image or just box with rotation as-is, false means higher performance, but incorrect mesh mapping on higher face angles\n * - skipFrames: how many frames to go without re-running the face detector and just run modified face mesh analysis, only valid if videoOptimized is set to true\n * - skipInitial: if previous detection resulted in no faces detected, should skipFrames be reset immediately to force new detection cycle\n * - return: return extracted face as tensor for futher user processing\n */\n face: {\n enabled: boolean,\n detector: {\n modelPath: string,\n rotation: boolean,\n maxDetected: number,\n skipFrames: number,\n skipInitial: boolean,\n minConfidence: number,\n iouThreshold: number,\n return: boolean,\n },\n mesh: {\n enabled: boolean,\n modelPath: string,\n },\n iris: {\n enabled: boolean,\n modelPath: string,\n },\n description: {\n enabled: boolean,\n modelPath: string,\n skipFrames: number,\n minConfidence: number,\n },\n emotion: {\n enabled: boolean,\n minConfidence: number,\n skipFrames: number,\n modelPath: string,\n },\n },\n\n /** Controlls and configures all body detection specific options\n * - enabled: true/false\n * - modelPath: body pose model, can be absolute path or relative to modelBasePath\n * - minConfidence: threshold for discarding a prediction\n * - maxDetected: maximum number of people detected in the input, should be set to the minimum number for performance\n */\n body: {\n enabled: boolean,\n modelPath: string,\n maxDetected: number,\n minConfidence: number,\n },\n\n /** Controlls and configures all hand detection specific options\n * - enabled: true/false\n * - landmarks: detect hand landmarks or just hand boundary box\n * - modelPath: paths for hand detector and hand skeleton models, can be absolute path or relative to modelBasePath\n * - minConfidence: threshold for discarding a prediction\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of hands detected in the input, should be set to the minimum number for performance\n * - rotation: use best-guess rotated hand image or just box with rotation as-is, false means higher performance, but incorrect finger mapping if hand is inverted\n * - skipFrames: how many frames to go without re-running the hand bounding box detector and just run modified hand skeleton detector, only valid if videoOptimized is set to true\n * - skipInitial: if previous detection resulted in no hands detected, should skipFrames be reset immediately to force new detection cycle\n */\n hand: {\n enabled: boolean,\n rotation: boolean,\n skipFrames: number,\n skipInitial: boolean,\n minConfidence: number,\n iouThreshold: number,\n maxDetected: number,\n landmarks: boolean,\n detector: {\n modelPath: string,\n },\n skeleton: {\n modelPath: string,\n },\n },\n\n /** Controlls and configures all object detection specific options\n * - enabled: true/false\n * - modelPath: object detection model, can be absolute path or relative to modelBasePath\n * - minConfidence: minimum score that detection must have to return as valid object\n * - iouThreshold: ammount of overlap between two detected objects before one object is removed\n * - maxDetected: maximum number of detections to return\n * - skipFrames: run object detection every n input frames, only valid if videoOptimized is set to true\n */\n object: {\n enabled: boolean,\n modelPath: string,\n minConfidence: number,\n iouThreshold: number,\n maxDetected: number,\n skipFrames: number,\n },\n}\n\nconst config: Config = {\n backend: 'webgl', // select tfjs backend to use, leave empty to use default backend\n // can be 'webgl', 'wasm', 'cpu', or 'humangl' which is a custom version of webgl\n modelBasePath: '../models/', // base path for all models\n wasmPath: '../assets/', // path for wasm binariesm, only used for backend: wasm\n debug: true, // print additional status messages to console\n async: true, // execute enabled models in parallel\n videoOptimized: true, // perform additional optimizations when input is video,\n // automatically disabled for Image, ImageData, ImageBitmap\n // skips boundary detection for every n frames\n // while maintaining in-box detection since objects cannot move that fast\n warmup: 'full', // what to use for human.warmup(), can be 'none', 'face', 'full'\n // warmup pre-initializes all models for faster inference but can take\n // significant time on startup\n // only used for `webgl` and `humangl` backends\n filter: { // run input through image filters before inference\n // image filters run with near-zero latency as they are executed on the GPU\n enabled: true, // enable image pre-processing filters\n width: 0, // resize input width\n height: 0, // resize input height\n // if both width and height are set to 0, there is no resizing\n // if just one is set, second one is scaled automatically\n // if both are set, values are used as-is\n flip: false, // flip input as mirror image\n return: true, // return processed canvas imagedata in result\n brightness: 0, // range: -1 (darken) to 1 (lighten)\n contrast: 0, // range: -1 (reduce contrast) to 1 (increase contrast)\n sharpness: 0, // range: 0 (no sharpening) to 1 (maximum sharpening)\n blur: 0, // range: 0 (no blur) to N (blur radius in pixels)\n saturation: 0, // range: -1 (reduce saturation) to 1 (increase saturation)\n hue: 0, // range: 0 (no change) to 360 (hue rotation in degrees)\n negative: false, // image negative\n sepia: false, // image sepia colors\n vintage: false, // image vintage colors\n kodachrome: false, // image kodachrome colors\n technicolor: false, // image technicolor colors\n polaroid: false, // image polaroid camera effect\n pixelate: 0, // range: 0 (no pixelate) to N (number of pixels to pixelate)\n },\n\n gesture: {\n enabled: true, // enable gesture recognition based on model results\n },\n\n face: {\n enabled: true, // controls if specified modul is enabled\n // face.enabled is required for all face models:\n // detector, mesh, iris, age, gender, emotion\n // (note: module is not loaded until it is required)\n detector: {\n modelPath: 'blazeface.json', // detector model, can be absolute path or relative to modelBasePath\n rotation: false, // use best-guess rotated face image or just box with rotation as-is\n // false means higher performance, but incorrect mesh mapping if face angle is above 20 degrees\n // this parameter is not valid in nodejs\n maxDetected: 10, // maximum number of faces detected in the input\n // should be set to the minimum number for performance\n skipFrames: 21, // how many frames to go without re-running the face bounding box detector\n // only used for video inputs\n // e.g., if model is running st 25 FPS, we can re-use existing bounding\n // box for updated face analysis as the head probably hasn't moved much\n // in short time (10 * 1/25 = 0.25 sec)\n skipInitial: false, // if previous detection resulted in no faces detected,\n // should skipFrames be reset immediately to force new detection cycle\n minConfidence: 0.2, // threshold for discarding a prediction\n iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed\n return: false, // return extracted face as tensor\n },\n\n mesh: {\n enabled: true,\n modelPath: 'facemesh.json', // facemesh model, can be absolute path or relative to modelBasePath\n },\n\n iris: {\n enabled: true,\n modelPath: 'iris.json', // face iris model\n // can be either absolute path or relative to modelBasePath\n },\n\n description: {\n enabled: true, // to improve accuracy of face description extraction it is\n // recommended to enable detector.rotation and mesh.enabled\n modelPath: 'faceres.json', // face description model\n // can be either absolute path or relative to modelBasePath\n skipFrames: 31, // how many frames to go without re-running the detector\n // only used for video inputs\n minConfidence: 0.1, // threshold for discarding a prediction\n },\n\n emotion: {\n enabled: true,\n minConfidence: 0.1, // threshold for discarding a prediction\n skipFrames: 32, // how many frames to go without re-running the detector\n modelPath: 'emotion.json', // face emotion model, can be absolute path or relative to modelBasePath\n },\n },\n\n body: {\n enabled: true,\n modelPath: 'posenet.json', // body model, can be absolute path or relative to modelBasePath\n // can be 'posenet' or 'blazepose'\n maxDetected: 1, // maximum number of people detected in the input\n // should be set to the minimum number for performance\n // only valid for posenet as blazepose only detects single pose\n minConfidence: 0.1, // threshold for discarding a prediction\n },\n\n hand: {\n enabled: true,\n rotation: false, // use best-guess rotated hand image or just box with rotation as-is\n // false means higher performance, but incorrect finger mapping if hand is inverted\n skipFrames: 12, // how many frames to go without re-running the hand bounding box detector\n // only used for video inputs\n // e.g., if model is running st 25 FPS, we can re-use existing bounding\n // box for updated hand skeleton analysis as the hand probably\n // hasn't moved much in short time (10 * 1/25 = 0.25 sec)\n skipInitial: false, // if previous detection resulted in no hands detected,\n // should skipFrames be reset immediately to force new detection cycle\n minConfidence: 0.1, // threshold for discarding a prediction\n iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed\n maxDetected: 2, // maximum number of hands detected in the input\n // should be set to the minimum number for performance\n landmarks: true, // detect hand landmarks or just hand boundary box\n detector: {\n modelPath: 'handdetect.json', // hand detector model, can be absolute path or relative to modelBasePath\n },\n skeleton: {\n modelPath: 'handskeleton.json', // hand skeleton model, can be absolute path or relative to modelBasePath\n },\n },\n\n object: {\n enabled: false,\n modelPath: 'nanodet.json', // experimental: object detection model, can be absolute path or relative to modelBasePath\n minConfidence: 0.2, // threshold for discarding a prediction\n iouThreshold: 0.4, // ammount of overlap between two detected objects before one object is removed\n maxDetected: 10, // maximum number of objects detected in the input\n skipFrames: 41, // how many frames to go without re-running the detector\n },\n};\nexport { config as defaults };\n", "export function info(): { platform: string, agent: string } {\n let platform;\n let agent;\n if (typeof navigator !== 'undefined') {\n const raw = navigator.userAgent.match(/\\(([^()]+)\\)/g);\n if (raw && raw[0]) {\n const platformMatch = raw[0].match(/\\(([^()]+)\\)/g);\n platform = platformMatch ? platformMatch[0].replace(/\\(|\\)/g, '') : '';\n agent = navigator.userAgent.replace(raw[0], '');\n if (platform[1]) agent = agent.replace(raw[1], '');\n agent = agent.replace(/ /g, ' ');\n }\n } else if (typeof process !== 'undefined') {\n platform = `${process.platform} ${process.arch}`;\n agent = `NodeJS ${process.version}`;\n }\n return { platform, agent };\n}\n", "", "// A port of an algorithm by Johannes Baag\u00F8e , 2010\n// http://baagoe.com/en/RandomMusings/javascript/\n// https://github.com/nquinlan/better-random-numbers-for-javascript-mirror\n// Original work is under MIT license -\n\n// Copyright (C) 2010 by Johannes Baag\u00F8e \n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n// \n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n// \n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n\n\n(function(global, module, define) {\n\nfunction Alea(seed) {\n var me = this, mash = Mash();\n\n me.next = function() {\n var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32\n me.s0 = me.s1;\n me.s1 = me.s2;\n return me.s2 = t - (me.c = t | 0);\n };\n\n // Apply the seeding algorithm from Baagoe.\n me.c = 1;\n me.s0 = mash(' ');\n me.s1 = mash(' ');\n me.s2 = mash(' ');\n me.s0 -= mash(seed);\n if (me.s0 < 0) { me.s0 += 1; }\n me.s1 -= mash(seed);\n if (me.s1 < 0) { me.s1 += 1; }\n me.s2 -= mash(seed);\n if (me.s2 < 0) { me.s2 += 1; }\n mash = null;\n}\n\nfunction copy(f, t) {\n t.c = f.c;\n t.s0 = f.s0;\n t.s1 = f.s1;\n t.s2 = f.s2;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new Alea(seed),\n state = opts && opts.state,\n prng = xg.next;\n prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }\n prng.double = function() {\n return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53\n };\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nfunction Mash() {\n var n = 0xefc8249d;\n\n var mash = function(data) {\n data = data.toString();\n for (var i = 0; i < data.length; i++) {\n n += data.charCodeAt(i);\n var h = 0.02519603282416938 * n;\n n = h >>> 0;\n h -= n;\n h *= n;\n n = h >>> 0;\n h -= n;\n n += h * 0x100000000; // 2^32\n }\n return (n >>> 0) * 2.3283064365386963e-10; // 2^-32\n };\n\n return mash;\n}\n\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.alea = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "// A Javascript implementaion of the \"xor128\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n\n // Set up generator function.\n me.next = function() {\n var t = me.x ^ (me.x << 11);\n me.x = me.y;\n me.y = me.z;\n me.z = me.w;\n return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8);\n };\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor128 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "// A Javascript implementaion of the \"xorwow\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var t = (me.x ^ (me.x >>> 2));\n me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;\n return (me.d = (me.d + 362437 | 0)) +\n (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;\n };\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n me.v = 0;\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n if (k == strseed.length) {\n me.d = me.x << 10 ^ me.x >>> 4;\n }\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n t.v = f.v;\n t.d = f.d;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorwow = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "// A Javascript implementaion of the \"xorshift7\" algorithm by\n// Fran\u00E7ois Panneton and Pierre L'ecuyer:\n// \"On the Xorgshift Random Number Generators\"\n// http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n // Update xor generator.\n var X = me.x, i = me.i, t, v, w;\n t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24);\n t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10);\n t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3);\n t = X[(i + 4) & 7]; v ^= t ^ (t << 7);\n t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9);\n X[i] = v;\n me.i = (i + 1) & 7;\n return v;\n };\n\n function init(me, seed) {\n var j, w, X = [];\n\n if (seed === (seed | 0)) {\n // Seed state array using a 32-bit integer.\n w = X[0] = seed;\n } else {\n // Seed state using a string.\n seed = '' + seed;\n for (j = 0; j < seed.length; ++j) {\n X[j & 7] = (X[j & 7] << 15) ^\n (seed.charCodeAt(j) + X[(j + 1) & 7] << 13);\n }\n }\n // Enforce an array length of 8, not all zeroes.\n while (X.length < 8) X.push(0);\n for (j = 0; j < 8 && X[j] === 0; ++j);\n if (j == 8) w = X[7] = -1; else w = X[j];\n\n me.x = X;\n me.i = 0;\n\n // Discard an initial 256 values.\n for (j = 256; j > 0; --j) {\n me.next();\n }\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.x = f.x.slice();\n t.i = f.i;\n return t;\n}\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.x) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorshift7 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n", "// A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm.\n//\n// This fast non-cryptographic random number generator is designed for\n// use in Monte-Carlo algorithms. It combines a long-period xorshift\n// generator with a Weyl generator, and it passes all common batteries\n// of stasticial tests for randomness while consuming only a few nanoseconds\n// for each prng generated. For background on the generator, see Brent's\n// paper: \"Some long-period random number generators using shifts and xors.\"\n// http://arxiv.org/pdf/1004.3115v1.pdf\n//\n// Usage:\n//\n// var xor4096 = require('xor4096');\n// random = xor4096(1); // Seed with int32 or string.\n// assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits.\n// assert.equal(random.int32(), 1806534897); // signed int32, 32 bits.\n//\n// For nonzero numeric keys, this impelementation provides a sequence\n// identical to that by Brent's xorgens 3 implementaion in C. This\n// implementation also provides for initalizing the generator with\n// string seeds, or for saving and restoring the state of the generator.\n//\n// On Chrome, this prng benchmarks about 2.1 times slower than\n// Javascript's built-in Math.random().\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n var w = me.w,\n X = me.X, i = me.i, t, v;\n // Update Weyl generator.\n me.w = w = (w + 0x61c88647) | 0;\n // Update xor generator.\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n // Update Xor generator array state.\n v = X[i] = v ^ t;\n me.i = i;\n // Result is the combination.\n return (v + (w ^ (w >>> 16))) | 0;\n };\n\n function init(me, seed) {\n var t, v, i, j, w, X = [], limit = 128;\n if (seed === (seed | 0)) {\n // Numeric seeds initialize v, which is used to generates X.\n v = seed;\n seed = null;\n } else {\n // String seeds are mixed into v and X one character at a time.\n seed = seed + '\\0';\n v = 0;\n limit = Math.max(limit, seed.length);\n }\n // Initialize circular array and weyl value.\n for (i = 0, j = -32; j < limit; ++j) {\n // Put the unicode characters into the array, and shuffle them.\n if (seed) v ^= seed.charCodeAt((j + 32) % seed.length);\n // After 32 shuffles, take v as the starting w value.\n if (j === 0) w = v;\n v ^= v << 10;\n v ^= v >>> 15;\n v ^= v << 4;\n v ^= v >>> 13;\n if (j >= 0) {\n w = (w + 0x61c88647) | 0; // Weyl.\n t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array.\n i = (0 == t) ? i + 1 : 0; // Count zeroes.\n }\n }\n // We have detected all zeroes; make the key nonzero.\n if (i >= 128) {\n X[(seed && seed.length || 0) & 127] = -1;\n }\n // Run the generator 512 times to further mix the state before using it.\n // Factoring this as a function slows the main generator, so it is just\n // unrolled here. The weyl generator is not advanced while warming up.\n i = 127;\n for (j = 4 * 128; j > 0; --j) {\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n X[i] = v ^ t;\n }\n // Storing state as object members is faster than using closure variables.\n me.w = w;\n me.X = X;\n me.i = i;\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.i = f.i;\n t.w = f.w;\n t.X = f.X.slice();\n return t;\n};\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.X) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor4096 = impl;\n}\n\n})(\n this, // window object or global\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n", "// A Javascript implementaion of the \"Tyche-i\" prng algorithm by\n// Samuel Neves and Filipe Araujo.\n// See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var b = me.b, c = me.c, d = me.d, a = me.a;\n b = (b << 25) ^ (b >>> 7) ^ c;\n c = (c - d) | 0;\n d = (d << 24) ^ (d >>> 8) ^ a;\n a = (a - b) | 0;\n me.b = b = (b << 20) ^ (b >>> 12) ^ c;\n me.c = c = (c - d) | 0;\n me.d = (d << 16) ^ (c >>> 16) ^ a;\n return me.a = (a - b) | 0;\n };\n\n /* The following is non-inverted tyche, which has better internal\n * bit diffusion, but which is about 25% slower than tyche-i in JS.\n me.next = function() {\n var a = me.a, b = me.b, c = me.c, d = me.d;\n a = (me.a + me.b | 0) >>> 0;\n d = me.d ^ a; d = d << 16 ^ d >>> 16;\n c = me.c + d | 0;\n b = me.b ^ c; b = b << 12 ^ d >>> 20;\n me.a = a = a + b | 0;\n d = d ^ a; me.d = d = d << 8 ^ d >>> 24;\n me.c = c = c + d | 0;\n b = b ^ c;\n return me.b = (b << 7 ^ b >>> 25);\n }\n */\n\n me.a = 0;\n me.b = 0;\n me.c = 2654435769 | 0;\n me.d = 1367130551;\n\n if (seed === Math.floor(seed)) {\n // Integer seed.\n me.a = (seed / 0x100000000) | 0;\n me.b = seed | 0;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 20; k++) {\n me.b ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.a = f.a;\n t.b = f.b;\n t.c = f.c;\n t.d = f.d;\n return t;\n};\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.tychei = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "", "/*\nCopyright 2014 David Bau.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\n\n(function (pool, math) {\n//\n// The following constants are related to IEEE 754 limits.\n//\nvar global = this,\n width = 256, // each RC4 output is 0 <= x < 256\n chunks = 6, // at least six RC4 outputs for each double\n digits = 52, // there are 52 significant digits in a double\n rngname = 'random', // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto; // node.js crypto module, initialized at the bottom.\n\n//\n// seedrandom()\n// This is the seedrandom function described above.\n//\nfunction seedrandom(seed, options, callback) {\n var key = [];\n options = (options == true) ? { entropy: true } : (options || {});\n\n // Flatten the seed string or build one from local entropy if needed.\n var shortseed = mixkey(flatten(\n options.entropy ? [seed, tostring(pool)] :\n (seed == null) ? autoseed() : seed, 3), key);\n\n // Use the seed to initialize an ARC4 generator.\n var arc4 = new ARC4(key);\n\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n var prng = function() {\n var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48\n d = startdenom, // and denominator d = 2 ^ 48.\n x = 0; // and no 'extra last byte'.\n while (n < significance) { // Fill up all significant digits by\n n = (n + x) * width; // shifting numerator and\n d *= width; // denominator and generating a\n x = arc4.g(1); // new least-significant-byte.\n }\n while (n >= overflow) { // To avoid rounding up, before adding\n n /= 2; // last byte, shift everything\n d /= 2; // right using integer math until\n x >>>= 1; // we have exactly the desired bits.\n }\n return (n + x) / d; // Form the number within [0, 1).\n };\n\n prng.int32 = function() { return arc4.g(4) | 0; }\n prng.quick = function() { return arc4.g(4) / 0x100000000; }\n prng.double = prng;\n\n // Mix the randomness into accumulated entropy.\n mixkey(tostring(arc4.S), pool);\n\n // Calling convention: what to return as a function of prng, seed, is_math.\n return (options.pass || callback ||\n function(prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) { copy(state, arc4); }\n // Only provide the .state method if requested via options.state.\n prng.state = function() { return copy(arc4, {}); }\n }\n\n // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n if (is_math_call) { math[rngname] = prng; return seed; }\n\n // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng;\n })(\n prng,\n shortseed,\n 'global' in options ? options.global : (this == math),\n options.state);\n}\nmath['seed' + rngname] = seedrandom;\n\n//\n// ARC4\n//\n// An ARC4 implementation. The constructor takes a key in the form of\n// an array of at most (width) integers that should be 0 <= x < (width).\n//\n// The g(count) method returns a pseudorandom integer that concatenates\n// the next (count) outputs from ARC4. Its return value is a number x\n// that is in the range 0 <= x < (width ^ count).\n//\nfunction ARC4(key) {\n var t, keylen = key.length,\n me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];\n\n // The empty key [] is treated as [0].\n if (!keylen) { key = [keylen++]; }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n s[i] = i++;\n }\n for (i = 0; i < width; i++) {\n s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];\n s[j] = t;\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n (me.g = function(count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t, r = 0,\n i = me.i, j = me.j, s = me.S;\n while (count--) {\n t = s[i = mask & (i + 1)];\n r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];\n }\n me.i = i; me.j = j;\n return r;\n // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n })(width);\n}\n\n//\n// copy()\n// Copies internal state of ARC4 to or from a plain object.\n//\nfunction copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n};\n\n//\n// flatten()\n// Converts an object tree to nested arrays of strings.\n//\nfunction flatten(obj, depth) {\n var result = [], typ = (typeof obj), prop;\n if (depth && typ == 'object') {\n for (prop in obj) {\n try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}\n }\n }\n return (result.length ? result : typ == 'string' ? obj : obj + '\\0');\n}\n\n//\n// mixkey()\n// Mixes a string seed into a key that is an array of integers, and\n// returns a shortened string seed that is equivalent to the result key.\n//\nfunction mixkey(seed, key) {\n var stringseed = seed + '', smear, j = 0;\n while (j < stringseed.length) {\n key[mask & j] =\n mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));\n }\n return tostring(key);\n}\n\n//\n// autoseed()\n// Returns an object for autoseeding, using window.crypto and Node crypto\n// module if available.\n//\nfunction autoseed() {\n try {\n var out;\n if (nodecrypto && (out = nodecrypto.randomBytes)) {\n // The use of 'out' to remember randomBytes makes tight minified code.\n out = out(width);\n } else {\n out = new Uint8Array(width);\n (global.crypto || global.msCrypto).getRandomValues(out);\n }\n return tostring(out);\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins;\n return [+new Date, global, plugins, global.screen, tostring(pool)];\n }\n}\n\n//\n// tostring()\n// Converts an array of charcodes to a string\n//\nfunction tostring(a) {\n return String.fromCharCode.apply(0, a);\n}\n\n//\n// When seedrandom.js is loaded, we immediately mix a few bits\n// from the built-in RNG into the entropy pool. Because we do\n// not want to interfere with deterministic PRNG state later,\n// seedrandom will not call math.random on its own again after\n// initialization.\n//\nmixkey(math.random(), pool);\n\n//\n// Nodejs and AMD support: export the implementation as a module using\n// either convention.\n//\nif ((typeof module) == 'object' && module.exports) {\n module.exports = seedrandom;\n // When in node.js, try using crypto package for autoseeding.\n try {\n nodecrypto = require('crypto');\n } catch (ex) {}\n} else if ((typeof define) == 'function' && define.amd) {\n define(function() { return seedrandom; });\n}\n\n// End anonymous scope, and pass initial values.\n})(\n [], // pool: entropy pool starts empty\n Math // math: package containing random, pow, and seedrandom\n);\n", "// A library of seedable RNGs implemented in Javascript.\n//\n// Usage:\n//\n// var seedrandom = require('seedrandom');\n// var random = seedrandom(1); // or any seed.\n// var x = random(); // 0 <= x < 1. Every bit is random.\n// var x = random.quick(); // 0 <= x < 1. 32 bits of randomness.\n\n// alea, a 53-bit multiply-with-carry generator by Johannes Baag\u00F8e.\n// Period: ~2^116\n// Reported to pass all BigCrush tests.\nvar alea = require('./lib/alea');\n\n// xor128, a pure xor-shift generator by George Marsaglia.\n// Period: 2^128-1.\n// Reported to fail: MatrixRank and LinearComp.\nvar xor128 = require('./lib/xor128');\n\n// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.\n// Period: 2^192-2^32\n// Reported to fail: CollisionOver, SimpPoker, and LinearComp.\nvar xorwow = require('./lib/xorwow');\n\n// xorshift7, by Fran\u00E7ois Panneton and Pierre L'ecuyer, takes\n// a different approach: it adds robustness by allowing more shifts\n// than Marsaglia's original three. It is a 7-shift generator\n// with 256 bits, that passes BigCrush with no systmatic failures.\n// Period 2^256-1.\n// No systematic BigCrush failures reported.\nvar xorshift7 = require('./lib/xorshift7');\n\n// xor4096, by Richard Brent, is a 4096-bit xor-shift with a\n// very long period that also adds a Weyl generator. It also passes\n// BigCrush with no systematic failures. Its long period may\n// be useful if you have many generators and need to avoid\n// collisions.\n// Period: 2^4128-2^32.\n// No systematic BigCrush failures reported.\nvar xor4096 = require('./lib/xor4096');\n\n// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random\n// number generator derived from ChaCha, a modern stream cipher.\n// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n// Period: ~2^127\n// No systematic BigCrush failures reported.\nvar tychei = require('./lib/tychei');\n\n// The original ARC4-based prng included in this library.\n// Period: ~2^1600\nvar sr = require('./seedrandom');\n\nsr.alea = alea;\nsr.xor128 = xor128;\nsr.xorwow = xorwow;\nsr.xorshift7 = xorshift7;\nsr.xor4096 = xor4096;\nsr.tychei = tychei;\n\nmodule.exports = sr;\n", "", "", "", "\nvar WasmBackendModuleThreadedSimd = (function() {\n var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;\n if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;\n return (\nfunction(WasmBackendModuleThreadedSimd) {\n WasmBackendModuleThreadedSimd = WasmBackendModuleThreadedSimd || {};\n\nfunction GROWABLE_HEAP_I8(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP8}function GROWABLE_HEAP_U8(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPU8}function GROWABLE_HEAP_I32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP32}function GROWABLE_HEAP_U32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPU32}function GROWABLE_HEAP_F64(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPF64}var Module=typeof WasmBackendModuleThreadedSimd!==\"undefined\"?WasmBackendModuleThreadedSimd:{};var readyPromiseResolve,readyPromiseReject;Module[\"ready\"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var arguments_=[];var thisProgram=\"./this.program\";var quit_=function(status,toThrow){throw toThrow};var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window===\"object\";ENVIRONMENT_IS_WORKER=typeof importScripts===\"function\";ENVIRONMENT_IS_NODE=typeof process===\"object\"&&typeof process.versions===\"object\"&&typeof process.versions.node===\"string\";ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_PTHREAD=Module[\"ENVIRONMENT_IS_PTHREAD\"]||false;if(ENVIRONMENT_IS_PTHREAD){buffer=Module[\"buffer\"]}var scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;var nodeFS;var nodePath;if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require(\"path\").dirname(scriptDirectory)+\"/\"}else{scriptDirectory=__dirname+\"/\"}read_=function shell_read(filename,binary){if(!nodeFS)nodeFS=require(\"fs\");if(!nodePath)nodePath=require(\"path\");filename=nodePath[\"normalize\"](filename);return nodeFS[\"readFileSync\"](filename,binary?null:\"utf8\")};readBinary=function readBinary(filename){var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process[\"argv\"].length>1){thisProgram=process[\"argv\"][1].replace(/\\\\/g,\"/\")}arguments_=process[\"argv\"].slice(2);process[\"on\"](\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process[\"on\"](\"unhandledRejection\",abort);quit_=function(status){process[\"exit\"](status)};Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"};var nodeWorkerThreads;try{nodeWorkerThreads=require(\"worker_threads\")}catch(e){console.error('The \"worker_threads\" module is not supported in this node.js build - perhaps a newer version is needed?');throw e}global.Worker=nodeWorkerThreads.Worker}else if(ENVIRONMENT_IS_SHELL){if(typeof read!=\"undefined\"){read_=function shell_read(f){return read(f)}}readBinary=function readBinary(f){var data;if(typeof readbuffer===\"function\"){return new Uint8Array(readbuffer(f))}data=read(f,\"binary\");assert(typeof data===\"object\");return data};if(typeof scriptArgs!=\"undefined\"){arguments_=scriptArgs}else if(typeof arguments!=\"undefined\"){arguments_=arguments}if(typeof quit===\"function\"){quit_=function(status){quit(status)}}if(typeof print!==\"undefined\"){if(typeof console===\"undefined\")console={};console.log=print;console.warn=console.error=typeof printErr!==\"undefined\"?printErr:print}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!==\"undefined\"&&document.currentScript){scriptDirectory=document.currentScript.src}if(typeof _scriptDir !== \"undefined\" && _scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf(\"blob:\")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.lastIndexOf(\"/\")+1)}else{scriptDirectory=\"\"}if(ENVIRONMENT_IS_NODE){read_=function shell_read(filename,binary){if(!nodeFS)nodeFS=require(\"fs\");if(!nodePath)nodePath=require(\"path\");filename=nodePath[\"normalize\"](filename);return nodeFS[\"readFileSync\"](filename,binary?null:\"utf8\")};readBinary=function readBinary(filename){var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret}}else{read_=function(url){var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=function(url){var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.responseType=\"arraybuffer\";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=function(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,true);xhr.responseType=\"arraybuffer\";xhr.onload=function(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=function(title){document.title=title}}else{}if(ENVIRONMENT_IS_NODE){if(typeof performance===\"undefined\"){global.performance=require(\"perf_hooks\").performance}}var out=Module[\"print\"]||console.log.bind(console);var err=Module[\"printErr\"]||console.warn.bind(console);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=null;if(Module[\"arguments\"])arguments_=Module[\"arguments\"];if(Module[\"thisProgram\"])thisProgram=Module[\"thisProgram\"];if(Module[\"quit\"])quit_=Module[\"quit\"];var Atomics_load=Atomics.load;var Atomics_store=Atomics.store;var Atomics_compareExchange=Atomics.compareExchange;var wasmBinary;if(Module[\"wasmBinary\"])wasmBinary=Module[\"wasmBinary\"];var noExitRuntime=Module[\"noExitRuntime\"]||true;if(typeof WebAssembly!==\"object\"){abort(\"no native wasm support detected\")}var wasmMemory;var wasmModule;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(\"Assertion failed: \"+text)}}function getCFunc(ident){var func=Module[\"_\"+ident];assert(func,\"Cannot call unknown function \"+ident+\", make sure it is exported\");return func}function ccall(ident,returnType,argTypes,args,opts){var toC={\"string\":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},\"array\":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType===\"string\")return UTF8ToString(ret);if(returnType===\"boolean\")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i=endIdx)){var u0=heap[idx++];if(!u0)return str;if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heap[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heap[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heap[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(GROWABLE_HEAP_U8(),ptr,maxBytesToRead):\"\"}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,GROWABLE_HEAP_U8(),outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}function writeArrayToMemory(array,buffer){GROWABLE_HEAP_I8().set(array,buffer)}function alignUp(x,multiple){if(x%multiple>0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module[\"HEAP8\"]=HEAP8=new Int8Array(buf);Module[\"HEAP16\"]=HEAP16=new Int16Array(buf);Module[\"HEAP32\"]=HEAP32=new Int32Array(buf);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(buf);Module[\"HEAPU16\"]=HEAPU16=new Uint16Array(buf);Module[\"HEAPU32\"]=HEAPU32=new Uint32Array(buf);Module[\"HEAPF32\"]=HEAPF32=new Float32Array(buf);Module[\"HEAPF64\"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module[\"INITIAL_MEMORY\"]||16777216;if(ENVIRONMENT_IS_PTHREAD){wasmMemory=Module[\"wasmMemory\"];buffer=Module[\"buffer\"]}else{if(Module[\"wasmMemory\"]){wasmMemory=Module[\"wasmMemory\"]}else{wasmMemory=new WebAssembly.Memory({\"initial\":INITIAL_MEMORY/65536,\"maximum\":2147483648/65536,\"shared\":true});if(!(wasmMemory.buffer instanceof SharedArrayBuffer)){err(\"requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag\");if(ENVIRONMENT_IS_NODE){console.log(\"(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)\")}throw Error(\"bad memory\")}}}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;if(!ENVIRONMENT_IS_PTHREAD)__ATINIT__.push({func:function(){___wasm_call_ctors()}});function preRun(){if(ENVIRONMENT_IS_PTHREAD)return;if(Module[\"preRun\"]){if(typeof Module[\"preRun\"]==\"function\")Module[\"preRun\"]=[Module[\"preRun\"]];while(Module[\"preRun\"].length){addOnPreRun(Module[\"preRun\"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(ENVIRONMENT_IS_PTHREAD)return;callRuntimeCallbacks(__ATINIT__)}function preMain(){if(ENVIRONMENT_IS_PTHREAD)return;callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){if(ENVIRONMENT_IS_PTHREAD)return;runtimeExited=true}function postRun(){if(ENVIRONMENT_IS_PTHREAD)return;if(Module[\"postRun\"]){if(typeof Module[\"postRun\"]==\"function\")Module[\"postRun\"]=[Module[\"postRun\"]];while(Module[\"postRun\"].length){addOnPostRun(Module[\"postRun\"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){assert(!ENVIRONMENT_IS_PTHREAD,\"addRunDependency cannot be used in a pthread worker\");runDependencies++;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module[\"preloadedImages\"]={};Module[\"preloadedAudios\"]={};function abort(what){if(Module[\"onAbort\"]){Module[\"onAbort\"](what)}if(ENVIRONMENT_IS_PTHREAD)console.error(\"Pthread aborting at \"+(new Error).stack);what+=\"\";err(what);ABORT=true;EXITSTATUS=1;what=\"abort(\"+what+\"). Build with -s ASSERTIONS=1 for more info.\";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}function hasPrefix(str,prefix){return String.prototype.startsWith?str.startsWith(prefix):str.indexOf(prefix)===0}var dataURIPrefix=\"data:application/octet-stream;base64,\";function isDataURI(filename){return hasPrefix(filename,dataURIPrefix)}var fileURIPrefix=\"file://\";function isFileURI(filename){return hasPrefix(filename,fileURIPrefix)}var wasmBinaryFile=\"tfjs-backend-wasm-threaded-simd.wasm\";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}else{throw\"both async and sync fetching of the wasm failed\"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch===\"function\"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){if(!response[\"ok\"]){throw\"failed to load wasm binary file at '\"+wasmBinaryFile+\"'\"}return response[\"arrayBuffer\"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={\"a\":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module[\"asm\"]=exports;wasmTable=Module[\"asm\"][\"F\"];wasmModule=module;if(!ENVIRONMENT_IS_PTHREAD){var numWorkersToLoad=PThread.unusedWorkers.length;PThread.unusedWorkers.forEach(function(w){PThread.loadWasmModuleToWorker(w,function(){if(!--numWorkersToLoad)removeRunDependency(\"wasm-instantiate\")})})}}if(!ENVIRONMENT_IS_PTHREAD){addRunDependency(\"wasm-instantiate\")}function receiveInstantiatedSource(output){receiveInstance(output[\"instance\"],output[\"module\"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err(\"failed to asynchronously prepare wasm: \"+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming===\"function\"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch===\"function\"){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiatedSource,function(reason){err(\"wasm streaming compile failed: \"+reason);err(\"falling back to ArrayBuffer instantiation\");return instantiateArrayBuffer(receiveInstantiatedSource)})})}else{return instantiateArrayBuffer(receiveInstantiatedSource)}}if(Module[\"instantiateWasm\"]){try{var exports=Module[\"instantiateWasm\"](info,receiveInstance);return exports}catch(e){err(\"Module.instantiateWasm callback failed with error: \"+e);return false}}instantiateAsync().catch(readyPromiseReject);return{}}var ASM_CONSTS={9816:function(){throw\"Canceled!\"},9834:function($0,$1){setTimeout(function(){__emscripten_do_dispatch_to_thread($0,$1)},0)}};function initPthreadsJS(){PThread.initRuntime()}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback==\"function\"){callback(Module);continue}var func=callback.func;if(typeof func===\"number\"){if(callback.arg===undefined){wasmTable.get(func)()}else{wasmTable.get(func)(callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}function _emscripten_futex_wake(addr,count){if(addr<=0||addr>GROWABLE_HEAP_I8().length||addr&3!=0||count<0)return-28;if(count==0)return 0;if(count>=2147483647)count=Infinity;var mainThreadWaitAddress=Atomics.load(GROWABLE_HEAP_I32(),__emscripten_main_thread_futex>>2);var mainThreadWoken=0;if(mainThreadWaitAddress==addr){var loadedAddr=Atomics.compareExchange(GROWABLE_HEAP_I32(),__emscripten_main_thread_futex>>2,mainThreadWaitAddress,0);if(loadedAddr==mainThreadWaitAddress){--count;mainThreadWoken=1;if(count<=0)return 1}}var ret=Atomics.notify(GROWABLE_HEAP_I32(),addr>>2,count);if(ret>=0)return ret+mainThreadWoken;throw\"Atomics.notify returned an unexpected value \"+ret}Module[\"_emscripten_futex_wake\"]=_emscripten_futex_wake;function killThread(pthread_ptr){if(ENVIRONMENT_IS_PTHREAD)throw\"Internal Error! killThread() can only ever be called from main application thread!\";if(!pthread_ptr)throw\"Internal Error! Null pthread_ptr in killThread!\";GROWABLE_HEAP_I32()[pthread_ptr+12>>2]=0;var pthread=PThread.pthreads[pthread_ptr];pthread.worker.terminate();PThread.freeThreadData(pthread);PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(pthread.worker),1);pthread.worker.pthread=undefined}function cancelThread(pthread_ptr){if(ENVIRONMENT_IS_PTHREAD)throw\"Internal Error! cancelThread() can only ever be called from main application thread!\";if(!pthread_ptr)throw\"Internal Error! Null pthread_ptr in cancelThread!\";var pthread=PThread.pthreads[pthread_ptr];pthread.worker.postMessage({\"cmd\":\"cancel\"})}function cleanupThread(pthread_ptr){if(ENVIRONMENT_IS_PTHREAD)throw\"Internal Error! cleanupThread() can only ever be called from main application thread!\";if(!pthread_ptr)throw\"Internal Error! Null pthread_ptr in cleanupThread!\";var pthread=PThread.pthreads[pthread_ptr];if(pthread){GROWABLE_HEAP_I32()[pthread_ptr+12>>2]=0;var worker=pthread.worker;PThread.returnWorkerToPool(worker)}}var PThread={unusedWorkers:[],runningWorkers:[],initMainThreadBlock:function(){var pthreadPoolSize=Math.min(4,Math.max(1,(navigator.hardwareConcurrency||1)/2));for(var i=0;i>2]=tb;var headPtr=tb+152;GROWABLE_HEAP_I32()[headPtr>>2]=headPtr;var tlsMemory=_malloc(512);for(var i=0;i<128;++i)GROWABLE_HEAP_U32()[tlsMemory/4+i]=0;Atomics.store(GROWABLE_HEAP_U32(),tb+100>>2,tlsMemory);Atomics.store(GROWABLE_HEAP_U32(),tb+40>>2,tb);__emscripten_thread_init(tb,!ENVIRONMENT_IS_WORKER,1);_emscripten_register_main_browser_thread_id(tb)},initWorker:function(){},pthreads:{},threadExitHandlers:[],setThreadStatus:function(){},runExitHandlers:function(){while(PThread.threadExitHandlers.length>0){PThread.threadExitHandlers.pop()()}if(ENVIRONMENT_IS_PTHREAD&&_pthread_self())___pthread_tsd_run_dtors()},runExitHandlersAndDeinitThread:function(tb,exitCode){Atomics.store(GROWABLE_HEAP_U32(),tb+56>>2,1);Atomics.store(GROWABLE_HEAP_U32(),tb+60>>2,0);PThread.runExitHandlers();Atomics.store(GROWABLE_HEAP_U32(),tb+4>>2,exitCode);Atomics.store(GROWABLE_HEAP_U32(),tb+0>>2,1);_emscripten_futex_wake(tb+0,2147483647);__emscripten_thread_init(0,0,0)},threadExit:function(exitCode){var tb=_pthread_self();if(tb){PThread.runExitHandlersAndDeinitThread(tb,exitCode);if(ENVIRONMENT_IS_PTHREAD){postMessage({\"cmd\":\"exit\"})}}},threadCancel:function(){PThread.runExitHandlersAndDeinitThread(_pthread_self(),-1);postMessage({\"cmd\":\"cancelDone\"})},terminateAllThreads:function(){for(var t in PThread.pthreads){var pthread=PThread.pthreads[t];if(pthread&&pthread.worker){PThread.returnWorkerToPool(pthread.worker)}}PThread.pthreads={};for(var i=0;i>2];GROWABLE_HEAP_I32()[pthread.threadInfoStruct+100>>2]=0;_free(tlsMemory);_free(pthread.threadInfoStruct)}pthread.threadInfoStruct=0;if(pthread.allocatedOwnStack&&pthread.stackBase)_free(pthread.stackBase);pthread.stackBase=0;if(pthread.worker)pthread.worker.pthread=null},returnWorkerToPool:function(worker){PThread.runWithoutMainThreadQueuedCalls(function(){delete PThread.pthreads[worker.pthread.threadInfoStruct];PThread.unusedWorkers.push(worker);PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(worker),1);PThread.freeThreadData(worker.pthread);worker.pthread=undefined})},runWithoutMainThreadQueuedCalls:function(func){GROWABLE_HEAP_I32()[__emscripten_allow_main_runtime_queued_calls>>2]=0;try{func()}finally{GROWABLE_HEAP_I32()[__emscripten_allow_main_runtime_queued_calls>>2]=1}},receiveObjectTransfer:function(data){},loadWasmModuleToWorker:function(worker,onFinishedLoading){worker.onmessage=function(e){var d=e[\"data\"];var cmd=d[\"cmd\"];if(worker.pthread)PThread.currentProxiedOperationCallerThread=worker.pthread.threadInfoStruct;if(d[\"targetThread\"]&&d[\"targetThread\"]!=_pthread_self()){var thread=PThread.pthreads[d.targetThread];if(thread){thread.worker.postMessage(e.data,d[\"transferList\"])}else{console.error('Internal error! Worker sent a message \"'+cmd+'\" to target pthread '+d[\"targetThread\"]+\", but that thread no longer exists!\")}PThread.currentProxiedOperationCallerThread=undefined;return}if(cmd===\"processQueuedMainThreadWork\"){_emscripten_main_thread_process_queued_calls()}else if(cmd===\"spawnThread\"){spawnThread(e.data)}else if(cmd===\"cleanupThread\"){cleanupThread(d[\"thread\"])}else if(cmd===\"killThread\"){killThread(d[\"thread\"])}else if(cmd===\"cancelThread\"){cancelThread(d[\"thread\"])}else if(cmd===\"loaded\"){worker.loaded=true;if(onFinishedLoading)onFinishedLoading(worker);if(worker.runPthread){worker.runPthread();delete worker.runPthread}}else if(cmd===\"print\"){out(\"Thread \"+d[\"threadId\"]+\": \"+d[\"text\"])}else if(cmd===\"printErr\"){err(\"Thread \"+d[\"threadId\"]+\": \"+d[\"text\"])}else if(cmd===\"alert\"){alert(\"Thread \"+d[\"threadId\"]+\": \"+d[\"text\"])}else if(cmd===\"exit\"){var detached=worker.pthread&&Atomics.load(GROWABLE_HEAP_U32(),worker.pthread.threadInfoStruct+64>>2);if(detached){PThread.returnWorkerToPool(worker)}}else if(cmd===\"exitProcess\"){try{exit(d[\"returnCode\"])}catch(e){if(e instanceof ExitStatus)return;throw e}}else if(cmd===\"cancelDone\"){PThread.returnWorkerToPool(worker)}else if(cmd===\"objectTransfer\"){PThread.receiveObjectTransfer(e.data)}else if(e.data.target===\"setimmediate\"){worker.postMessage(e.data)}else{err(\"worker sent an unknown command \"+cmd)}PThread.currentProxiedOperationCallerThread=undefined};worker.onerror=function(e){err(\"pthread sent an error! \"+e.filename+\":\"+e.lineno+\": \"+e.message)};if(ENVIRONMENT_IS_NODE){worker.on(\"message\",function(data){worker.onmessage({data:data})});worker.on(\"error\",function(data){worker.onerror(data)});worker.on(\"exit\",function(data){})}worker.postMessage({\"cmd\":\"load\",\"urlOrBlob\":Module[\"mainScriptUrlOrBlob\"]||_scriptDir,\"wasmMemory\":wasmMemory,\"wasmModule\":wasmModule})},allocateUnusedWorker:function(){var pthreadMainJs=locateFile(\"tfjs-backend-wasm-threaded-simd.worker.js\");PThread.unusedWorkers.push(new Worker(pthreadMainJs))},getNewWorker:function(){if(PThread.unusedWorkers.length==0){PThread.allocateUnusedWorker();PThread.loadWasmModuleToWorker(PThread.unusedWorkers[0])}if(PThread.unusedWorkers.length>0)return PThread.unusedWorkers.pop();else return null},busySpinWait:function(msecs){var t=performance.now()+msecs;while(performance.now()>2]=value;return value}function _atexit(func,arg){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(1,1,func,arg)}function __emscripten_notify_thread_queue(targetThreadId,mainThreadId){if(targetThreadId==mainThreadId){postMessage({\"cmd\":\"processQueuedMainThreadWork\"})}else if(ENVIRONMENT_IS_PTHREAD){postMessage({\"targetThread\":targetThreadId,\"cmd\":\"processThreadQueue\"})}else{var pthread=PThread.pthreads[targetThreadId];var worker=pthread&&pthread.worker;if(!worker){return}worker.postMessage({\"cmd\":\"processThreadQueue\"})}return 1}function _abort(){abort()}function _emscripten_asm_const_int(code,sigPtr,argbuf){var args=readAsmConstArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_conditional_set_current_thread_status(expectedStatus,newStatus){}function _emscripten_futex_wait(addr,val,timeout){if(addr<=0||addr>GROWABLE_HEAP_I8().length||addr&3!=0)return-28;if(!ENVIRONMENT_IS_WEB){var ret=Atomics.wait(GROWABLE_HEAP_I32(),addr>>2,val,timeout);if(ret===\"timed-out\")return-73;if(ret===\"not-equal\")return-6;if(ret===\"ok\")return 0;throw\"Atomics.wait returned an unexpected value \"+ret}else{if(Atomics.load(GROWABLE_HEAP_I32(),addr>>2)!=val){return-6}var tNow=performance.now();var tEnd=tNow+timeout;var lastAddr=Atomics.exchange(GROWABLE_HEAP_I32(),__emscripten_main_thread_futex>>2,addr);while(1){tNow=performance.now();if(tNow>tEnd){lastAddr=Atomics.exchange(GROWABLE_HEAP_I32(),__emscripten_main_thread_futex>>2,0);return-73}lastAddr=Atomics.exchange(GROWABLE_HEAP_I32(),__emscripten_main_thread_futex>>2,0);if(lastAddr==0){break}_emscripten_main_thread_process_queued_calls();if(Atomics.load(GROWABLE_HEAP_I32(),addr>>2)!=val){return-6}lastAddr=Atomics.exchange(GROWABLE_HEAP_I32(),__emscripten_main_thread_futex>>2,addr)}return 0}}function _emscripten_memcpy_big(dest,src,num){GROWABLE_HEAP_U8().copyWithin(dest,src,src+num)}function _emscripten_num_logical_cores(){if(ENVIRONMENT_IS_NODE)return require(\"os\").cpus().length;return navigator[\"hardwareConcurrency\"]}function _emscripten_proxy_to_main_thread_js(index,sync){var numCallArgs=arguments.length-2;var stack=stackSave();var serializedNumCallArgs=numCallArgs;var args=stackAlloc(serializedNumCallArgs*8);var b=args>>3;for(var i=0;i>=2;while(ch=GROWABLE_HEAP_U8()[sigPtr++]){var double=ch<105;if(double&&buf&1)buf++;readAsmConstArgsArray.push(double?GROWABLE_HEAP_F64()[buf++>>1]:GROWABLE_HEAP_I32()[buf]);++buf}return readAsmConstArgsArray}function _emscripten_receive_on_main_thread_js(index,numCallArgs,args){_emscripten_receive_on_main_thread_js_callArgs.length=numCallArgs;var b=args>>3;for(var i=0;i>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();if(requestedSize<=oldSize){return false}var maxHeapSize=2147483648;if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var JSEvents={inEventHandler:0,removeAllEventListeners:function(){for(var i=JSEvents.eventHandlers.length-1;i>=0;--i){JSEvents._removeHandler(i)}JSEvents.eventHandlers=[];JSEvents.deferredCalls=[]},registerRemoveEventListeners:function(){if(!JSEvents.removeEventListenersRegistered){__ATEXIT__.push(JSEvents.removeAllEventListeners);JSEvents.removeEventListenersRegistered=true}},deferredCalls:[],deferCall:function(targetFunction,precedence,argsList){function arraysHaveEqualContent(arrA,arrB){if(arrA.length!=arrB.length)return false;for(var i in arrA){if(arrA[i]!=arrB[i])return false}return true}for(var i in JSEvents.deferredCalls){var call=JSEvents.deferredCalls[i];if(call.targetFunction==targetFunction&&arraysHaveEqualContent(call.argsList,argsList)){return}}JSEvents.deferredCalls.push({targetFunction:targetFunction,precedence:precedence,argsList:argsList});JSEvents.deferredCalls.sort(function(x,y){return x.precedence>2]=eventTypeId;GROWABLE_HEAP_I32()[varargs+4>>2]=eventData;GROWABLE_HEAP_I32()[varargs+8>>2]=userData;__emscripten_call_on_thread(0,targetThread,637534208,eventHandlerFunc,eventData,varargs);stackRestore(stackTop)},getTargetThreadForEventCallback:function(targetThread){switch(targetThread){case 1:return 0;case 2:return PThread.currentProxiedOperationCallerThread;default:return targetThread}},getNodeNameForTarget:function(target){if(!target)return\"\";if(target==window)return\"#window\";if(target==screen)return\"#screen\";return target&&target.nodeName?target.nodeName:\"\"},fullscreenEnabled:function(){return document.fullscreenEnabled||document.webkitFullscreenEnabled}};function stringToNewUTF8(jsString){var length=lengthBytesUTF8(jsString)+1;var cString=_malloc(length);stringToUTF8(jsString,cString,length);return cString}function _emscripten_set_offscreencanvas_size_on_target_thread_js(targetThread,targetCanvas,width,height){var stackTop=stackSave();var varargs=stackAlloc(12);var targetCanvasPtr=0;if(targetCanvas){targetCanvasPtr=stringToNewUTF8(targetCanvas)}GROWABLE_HEAP_I32()[varargs>>2]=targetCanvasPtr;GROWABLE_HEAP_I32()[varargs+4>>2]=width;GROWABLE_HEAP_I32()[varargs+8>>2]=height;__emscripten_call_on_thread(0,targetThread,657457152,0,targetCanvasPtr,varargs);stackRestore(stackTop)}function _emscripten_set_offscreencanvas_size_on_target_thread(targetThread,targetCanvas,width,height){targetCanvas=targetCanvas?UTF8ToString(targetCanvas):\"\";_emscripten_set_offscreencanvas_size_on_target_thread_js(targetThread,targetCanvas,width,height)}function maybeCStringToJsString(cString){return cString>2?UTF8ToString(cString):cString}var specialHTMLTargets=[0,typeof document!==\"undefined\"?document:0,typeof window!==\"undefined\"?window:0];function findEventTarget(target){target=maybeCStringToJsString(target);var domElement=specialHTMLTargets[target]||(typeof document!==\"undefined\"?document.querySelector(target):undefined);return domElement}function findCanvasEventTarget(target){return findEventTarget(target)}function _emscripten_set_canvas_element_size_calling_thread(target,width,height){var canvas=findCanvasEventTarget(target);if(!canvas)return-4;if(canvas.canvasSharedPtr){GROWABLE_HEAP_I32()[canvas.canvasSharedPtr>>2]=width;GROWABLE_HEAP_I32()[canvas.canvasSharedPtr+4>>2]=height}if(canvas.offscreenCanvas||!canvas.controlTransferredOffscreen){if(canvas.offscreenCanvas)canvas=canvas.offscreenCanvas;var autoResizeViewport=false;if(canvas.GLctxObject&&canvas.GLctxObject.GLctx){var prevViewport=canvas.GLctxObject.GLctx.getParameter(2978);autoResizeViewport=prevViewport[0]===0&&prevViewport[1]===0&&prevViewport[2]===canvas.width&&prevViewport[3]===canvas.height}canvas.width=width;canvas.height=height;if(autoResizeViewport){canvas.GLctxObject.GLctx.viewport(0,0,width,height)}}else if(canvas.canvasSharedPtr){var targetThread=GROWABLE_HEAP_I32()[canvas.canvasSharedPtr+8>>2];_emscripten_set_offscreencanvas_size_on_target_thread(targetThread,target,width,height);return 1}else{return-4}return 0}function _emscripten_set_canvas_element_size_main_thread(target,width,height){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(2,1,target,width,height);return _emscripten_set_canvas_element_size_calling_thread(target,width,height)}function _emscripten_set_canvas_element_size(target,width,height){var canvas=findCanvasEventTarget(target);if(canvas){return _emscripten_set_canvas_element_size_calling_thread(target,width,height)}else{return _emscripten_set_canvas_element_size_main_thread(target,width,height)}}function _emscripten_set_current_thread_status(newStatus){}function _emscripten_set_thread_name(threadId,name){}function __webgl_enable_ANGLE_instanced_arrays(ctx){var ext=ctx.getExtension(\"ANGLE_instanced_arrays\");if(ext){ctx[\"vertexAttribDivisor\"]=function(index,divisor){ext[\"vertexAttribDivisorANGLE\"](index,divisor)};ctx[\"drawArraysInstanced\"]=function(mode,first,count,primcount){ext[\"drawArraysInstancedANGLE\"](mode,first,count,primcount)};ctx[\"drawElementsInstanced\"]=function(mode,count,type,indices,primcount){ext[\"drawElementsInstancedANGLE\"](mode,count,type,indices,primcount)};return 1}}function __webgl_enable_OES_vertex_array_object(ctx){var ext=ctx.getExtension(\"OES_vertex_array_object\");if(ext){ctx[\"createVertexArray\"]=function(){return ext[\"createVertexArrayOES\"]()};ctx[\"deleteVertexArray\"]=function(vao){ext[\"deleteVertexArrayOES\"](vao)};ctx[\"bindVertexArray\"]=function(vao){ext[\"bindVertexArrayOES\"](vao)};ctx[\"isVertexArray\"]=function(vao){return ext[\"isVertexArrayOES\"](vao)};return 1}}function __webgl_enable_WEBGL_draw_buffers(ctx){var ext=ctx.getExtension(\"WEBGL_draw_buffers\");if(ext){ctx[\"drawBuffers\"]=function(n,bufs){ext[\"drawBuffersWEBGL\"](n,bufs)};return 1}}function __webgl_enable_WEBGL_multi_draw(ctx){return!!(ctx.multiDrawWebgl=ctx.getExtension(\"WEBGL_multi_draw\"))}var GL={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],uniforms:[],shaders:[],vaos:[],contexts:{},offscreenCanvases:{},timerQueriesEXT:[],programInfos:{},stringCache:{},unpackAlignment:4,recordError:function recordError(errorCode){if(!GL.lastError){GL.lastError=errorCode}},getNewId:function(table){var ret=GL.counter++;for(var i=table.length;i>2]:-1;source+=UTF8ToString(GROWABLE_HEAP_I32()[string+i*4>>2],len<0?undefined:len)}return source},createContext:function(canvas,webGLContextAttributes){var ctx=canvas.getContext(\"webgl\",webGLContextAttributes);if(!ctx)return 0;var handle=GL.registerContext(ctx,webGLContextAttributes);return handle},registerContext:function(ctx,webGLContextAttributes){var handle=_malloc(8);GROWABLE_HEAP_I32()[handle+4>>2]=_pthread_self();var context={handle:handle,attributes:webGLContextAttributes,version:webGLContextAttributes.majorVersion,GLctx:ctx};if(ctx.canvas)ctx.canvas.GLctxObject=context;GL.contexts[handle]=context;if(typeof webGLContextAttributes.enableExtensionsByDefault===\"undefined\"||webGLContextAttributes.enableExtensionsByDefault){GL.initExtensions(context)}return handle},makeContextCurrent:function(contextHandle){GL.currentContext=GL.contexts[contextHandle];Module.ctx=GLctx=GL.currentContext&&GL.currentContext.GLctx;return!(contextHandle&&!GLctx)},getContext:function(contextHandle){return GL.contexts[contextHandle]},deleteContext:function(contextHandle){if(GL.currentContext===GL.contexts[contextHandle])GL.currentContext=null;if(typeof JSEvents===\"object\")JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas);if(GL.contexts[contextHandle]&&GL.contexts[contextHandle].GLctx.canvas)GL.contexts[contextHandle].GLctx.canvas.GLctxObject=undefined;_free(GL.contexts[contextHandle].handle);GL.contexts[contextHandle]=null},initExtensions:function(context){if(!context)context=GL.currentContext;if(context.initExtensionsDone)return;context.initExtensionsDone=true;var GLctx=context.GLctx;__webgl_enable_ANGLE_instanced_arrays(GLctx);__webgl_enable_OES_vertex_array_object(GLctx);__webgl_enable_WEBGL_draw_buffers(GLctx);GLctx.disjointTimerQueryExt=GLctx.getExtension(\"EXT_disjoint_timer_query\");__webgl_enable_WEBGL_multi_draw(GLctx);var exts=GLctx.getSupportedExtensions()||[];exts.forEach(function(ext){if(ext.indexOf(\"lose_context\")<0&&ext.indexOf(\"debug\")<0){GLctx.getExtension(ext)}})},populateUniformTable:function(program){var p=GL.programs[program];var ptable=GL.programInfos[program]={uniforms:{},maxUniformLength:0,maxAttributeLength:-1,maxUniformBlockNameLength:-1};var utable=ptable.uniforms;var numUniforms=GLctx.getProgramParameter(p,35718);for(var i=0;i>2;var powerPreference=GROWABLE_HEAP_I32()[a+(24>>2)];var contextAttributes={\"alpha\":!!GROWABLE_HEAP_I32()[a+(0>>2)],\"depth\":!!GROWABLE_HEAP_I32()[a+(4>>2)],\"stencil\":!!GROWABLE_HEAP_I32()[a+(8>>2)],\"antialias\":!!GROWABLE_HEAP_I32()[a+(12>>2)],\"premultipliedAlpha\":!!GROWABLE_HEAP_I32()[a+(16>>2)],\"preserveDrawingBuffer\":!!GROWABLE_HEAP_I32()[a+(20>>2)],\"powerPreference\":__emscripten_webgl_power_preferences[powerPreference],\"failIfMajorPerformanceCaveat\":!!GROWABLE_HEAP_I32()[a+(28>>2)],majorVersion:GROWABLE_HEAP_I32()[a+(32>>2)],minorVersion:GROWABLE_HEAP_I32()[a+(36>>2)],enableExtensionsByDefault:GROWABLE_HEAP_I32()[a+(40>>2)],explicitSwapControl:GROWABLE_HEAP_I32()[a+(44>>2)],proxyContextToMainThread:GROWABLE_HEAP_I32()[a+(48>>2)],renderViaOffscreenBackBuffer:GROWABLE_HEAP_I32()[a+(52>>2)]};var canvas=findCanvasEventTarget(target);if(!canvas){return 0}if(contextAttributes.explicitSwapControl){return 0}var contextHandle=GL.createContext(canvas,contextAttributes);return contextHandle}function _emscripten_webgl_create_context(a0,a1){return _emscripten_webgl_do_create_context(a0,a1)}var SYSCALLS={mappings:{},buffers:[null,[],[]],printChar:function(stream,curr){var buffer=SYSCALLS.buffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=GROWABLE_HEAP_I32()[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},get64:function(low,high){return low}};function _fd_close(fd){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(3,1,fd);return 0}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(4,1,fd,offset_low,offset_high,whence,newOffset)}function _fd_write(fd,iov,iovcnt,pnum){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(5,1,fd,iov,iovcnt,pnum);var num=0;for(var i=0;i>2];var len=GROWABLE_HEAP_I32()[iov+(i*8+4)>>2];for(var j=0;j>2]=num;return 0}function _pthread_cleanup_pop(execute){var routine=PThread.threadExitHandlers.pop();if(execute)routine()}function _pthread_cleanup_push(routine,arg){PThread.threadExitHandlers.push(function(){wasmTable.get(routine)(arg)})}function spawnThread(threadParams){if(ENVIRONMENT_IS_PTHREAD)throw\"Internal Error! spawnThread() can only ever be called from main application thread!\";var worker=PThread.getNewWorker();if(worker.pthread!==undefined)throw\"Internal error!\";if(!threadParams.pthread_ptr)throw\"Internal error, no pthread ptr!\";PThread.runningWorkers.push(worker);var tlsMemory=_malloc(128*4);for(var i=0;i<128;++i){GROWABLE_HEAP_I32()[tlsMemory+i*4>>2]=0}var stackHigh=threadParams.stackBase+threadParams.stackSize;var pthread=PThread.pthreads[threadParams.pthread_ptr]={worker:worker,stackBase:threadParams.stackBase,stackSize:threadParams.stackSize,allocatedOwnStack:threadParams.allocatedOwnStack,threadInfoStruct:threadParams.pthread_ptr};var tis=pthread.threadInfoStruct>>2;Atomics.store(GROWABLE_HEAP_U32(),tis+(64>>2),threadParams.detached);Atomics.store(GROWABLE_HEAP_U32(),tis+(100>>2),tlsMemory);Atomics.store(GROWABLE_HEAP_U32(),tis+(40>>2),pthread.threadInfoStruct);Atomics.store(GROWABLE_HEAP_U32(),tis+(80>>2),threadParams.stackSize);Atomics.store(GROWABLE_HEAP_U32(),tis+(76>>2),stackHigh);Atomics.store(GROWABLE_HEAP_U32(),tis+(104>>2),threadParams.stackSize);Atomics.store(GROWABLE_HEAP_U32(),tis+(104+8>>2),stackHigh);Atomics.store(GROWABLE_HEAP_U32(),tis+(104+12>>2),threadParams.detached);var global_libc=_emscripten_get_global_libc();var global_locale=global_libc+40;Atomics.store(GROWABLE_HEAP_U32(),tis+(172>>2),global_locale);worker.pthread=pthread;var msg={\"cmd\":\"run\",\"start_routine\":threadParams.startRoutine,\"arg\":threadParams.arg,\"threadInfoStruct\":threadParams.pthread_ptr,\"stackBase\":threadParams.stackBase,\"stackSize\":threadParams.stackSize};worker.runPthread=function(){msg.time=performance.now();worker.postMessage(msg,threadParams.transferList)};if(worker.loaded){worker.runPthread();delete worker.runPthread}}function _pthread_create(pthread_ptr,attr,start_routine,arg){if(typeof SharedArrayBuffer===\"undefined\"){err(\"Current environment does not support SharedArrayBuffer, pthreads are not available!\");return 6}if(!pthread_ptr){err(\"pthread_create called with a null thread pointer!\");return 28}var transferList=[];var error=0;if(ENVIRONMENT_IS_PTHREAD&&(transferList.length===0||error)){return _emscripten_sync_run_in_main_thread_4(687865856,pthread_ptr,attr,start_routine,arg)}if(error)return error;var stackSize=0;var stackBase=0;var detached=0;if(attr&&attr!=-1){stackSize=GROWABLE_HEAP_I32()[attr>>2];stackSize+=81920;stackBase=GROWABLE_HEAP_I32()[attr+8>>2];detached=GROWABLE_HEAP_I32()[attr+12>>2]!==0}else{stackSize=2097152}var allocatedOwnStack=stackBase==0;if(allocatedOwnStack){stackBase=_memalign(16,stackSize)}else{stackBase-=stackSize;assert(stackBase>0)}var threadInfoStruct=_malloc(228);for(var i=0;i<228>>2;++i)GROWABLE_HEAP_U32()[(threadInfoStruct>>2)+i]=0;GROWABLE_HEAP_I32()[pthread_ptr>>2]=threadInfoStruct;GROWABLE_HEAP_I32()[threadInfoStruct+12>>2]=threadInfoStruct;var headPtr=threadInfoStruct+152;GROWABLE_HEAP_I32()[headPtr>>2]=headPtr;var threadParams={stackBase:stackBase,stackSize:stackSize,allocatedOwnStack:allocatedOwnStack,detached:detached,startRoutine:start_routine,pthread_ptr:threadInfoStruct,arg:arg,transferList:transferList};if(ENVIRONMENT_IS_PTHREAD){threadParams.cmd=\"spawnThread\";postMessage(threadParams,transferList)}else{spawnThread(threadParams)}return 0}function _sysconf(name){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(6,1,name);switch(name){case 30:return 16384;case 85:var maxHeapSize=2147483648;return maxHeapSize/16384;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:{if(typeof navigator===\"object\")return navigator[\"hardwareConcurrency\"]||1;return 1}}setErrNo(28);return-1}if(!ENVIRONMENT_IS_PTHREAD)PThread.initMainThreadBlock();var GLctx;var proxiedFunctionTable=[null,_atexit,_emscripten_set_canvas_element_size_main_thread,_fd_close,_fd_seek,_fd_write,_sysconf];var asmLibraryArg={\"e\":___assert_fail,\"r\":___call_main,\"x\":__emscripten_notify_thread_queue,\"b\":_abort,\"y\":_emscripten_asm_const_int,\"j\":_emscripten_conditional_set_current_thread_status,\"c\":_emscripten_futex_wait,\"d\":_emscripten_futex_wake,\"f\":_emscripten_get_now,\"p\":_emscripten_memcpy_big,\"z\":_emscripten_num_logical_cores,\"u\":_emscripten_receive_on_main_thread_js,\"q\":_emscripten_resize_heap,\"v\":_emscripten_set_canvas_element_size,\"i\":_emscripten_set_current_thread_status,\"t\":_emscripten_set_thread_name,\"w\":_emscripten_webgl_create_context,\"m\":_fd_close,\"n\":_fd_seek,\"g\":_fd_write,\"o\":initPthreadsJS,\"a\":wasmMemory||Module[\"wasmMemory\"],\"k\":_pthread_cleanup_pop,\"l\":_pthread_cleanup_push,\"h\":_pthread_create,\"s\":_sysconf};var asm=createWasm();var ___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=function(){return(___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=Module[\"asm\"][\"A\"]).apply(null,arguments)};var _init=Module[\"_init\"]=function(){return(_init=Module[\"_init\"]=Module[\"asm\"][\"B\"]).apply(null,arguments)};var _register_tensor=Module[\"_register_tensor\"]=function(){return(_register_tensor=Module[\"_register_tensor\"]=Module[\"asm\"][\"C\"]).apply(null,arguments)};var _dispose_data=Module[\"_dispose_data\"]=function(){return(_dispose_data=Module[\"_dispose_data\"]=Module[\"asm\"][\"D\"]).apply(null,arguments)};var _dispose=Module[\"_dispose\"]=function(){return(_dispose=Module[\"_dispose\"]=Module[\"asm\"][\"E\"]).apply(null,arguments)};var _Abs=Module[\"_Abs\"]=function(){return(_Abs=Module[\"_Abs\"]=Module[\"asm\"][\"G\"]).apply(null,arguments)};var _Add=Module[\"_Add\"]=function(){return(_Add=Module[\"_Add\"]=Module[\"asm\"][\"H\"]).apply(null,arguments)};var _AddN=Module[\"_AddN\"]=function(){return(_AddN=Module[\"_AddN\"]=Module[\"asm\"][\"I\"]).apply(null,arguments)};var _All=Module[\"_All\"]=function(){return(_All=Module[\"_All\"]=Module[\"asm\"][\"J\"]).apply(null,arguments)};var _Any=Module[\"_Any\"]=function(){return(_Any=Module[\"_Any\"]=Module[\"asm\"][\"K\"]).apply(null,arguments)};var _ArgMax=Module[\"_ArgMax\"]=function(){return(_ArgMax=Module[\"_ArgMax\"]=Module[\"asm\"][\"L\"]).apply(null,arguments)};var _AvgPool=Module[\"_AvgPool\"]=function(){return(_AvgPool=Module[\"_AvgPool\"]=Module[\"asm\"][\"M\"]).apply(null,arguments)};var _BatchMatMul=Module[\"_BatchMatMul\"]=function(){return(_BatchMatMul=Module[\"_BatchMatMul\"]=Module[\"asm\"][\"N\"]).apply(null,arguments)};var _Ceil=Module[\"_Ceil\"]=function(){return(_Ceil=Module[\"_Ceil\"]=Module[\"asm\"][\"O\"]).apply(null,arguments)};var _ClipByValue=Module[\"_ClipByValue\"]=function(){return(_ClipByValue=Module[\"_ClipByValue\"]=Module[\"asm\"][\"P\"]).apply(null,arguments)};var _Conv2D=Module[\"_Conv2D\"]=function(){return(_Conv2D=Module[\"_Conv2D\"]=Module[\"asm\"][\"Q\"]).apply(null,arguments)};var _Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=function(){return(_Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=Module[\"asm\"][\"R\"]).apply(null,arguments)};var _Cos=Module[\"_Cos\"]=function(){return(_Cos=Module[\"_Cos\"]=Module[\"asm\"][\"S\"]).apply(null,arguments)};var _CropAndResize=Module[\"_CropAndResize\"]=function(){return(_CropAndResize=Module[\"_CropAndResize\"]=Module[\"asm\"][\"T\"]).apply(null,arguments)};var _Cumsum=Module[\"_Cumsum\"]=function(){return(_Cumsum=Module[\"_Cumsum\"]=Module[\"asm\"][\"U\"]).apply(null,arguments)};var _DepthToSpace=Module[\"_DepthToSpace\"]=function(){return(_DepthToSpace=Module[\"_DepthToSpace\"]=Module[\"asm\"][\"V\"]).apply(null,arguments)};var _DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=function(){return(_DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=Module[\"asm\"][\"W\"]).apply(null,arguments)};var _Equal=Module[\"_Equal\"]=function(){return(_Equal=Module[\"_Equal\"]=Module[\"asm\"][\"X\"]).apply(null,arguments)};var _Exp=Module[\"_Exp\"]=function(){return(_Exp=Module[\"_Exp\"]=Module[\"asm\"][\"Y\"]).apply(null,arguments)};var _FlipLeftRight=Module[\"_FlipLeftRight\"]=function(){return(_FlipLeftRight=Module[\"_FlipLeftRight\"]=Module[\"asm\"][\"Z\"]).apply(null,arguments)};var _Floor=Module[\"_Floor\"]=function(){return(_Floor=Module[\"_Floor\"]=Module[\"asm\"][\"_\"]).apply(null,arguments)};var _FloorDiv=Module[\"_FloorDiv\"]=function(){return(_FloorDiv=Module[\"_FloorDiv\"]=Module[\"asm\"][\"$\"]).apply(null,arguments)};var _FusedBatchNorm=Module[\"_FusedBatchNorm\"]=function(){return(_FusedBatchNorm=Module[\"_FusedBatchNorm\"]=Module[\"asm\"][\"aa\"]).apply(null,arguments)};var _FusedConv2D=Module[\"_FusedConv2D\"]=function(){return(_FusedConv2D=Module[\"_FusedConv2D\"]=Module[\"asm\"][\"ba\"]).apply(null,arguments)};var _FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=function(){return(_FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=Module[\"asm\"][\"ca\"]).apply(null,arguments)};var _Gather=Module[\"_Gather\"]=function(){return(_Gather=Module[\"_Gather\"]=Module[\"asm\"][\"da\"]).apply(null,arguments)};var _GatherNd=Module[\"_GatherNd\"]=function(){return(_GatherNd=Module[\"_GatherNd\"]=Module[\"asm\"][\"ea\"]).apply(null,arguments)};var _Greater=Module[\"_Greater\"]=function(){return(_Greater=Module[\"_Greater\"]=Module[\"asm\"][\"fa\"]).apply(null,arguments)};var _GreaterEqual=Module[\"_GreaterEqual\"]=function(){return(_GreaterEqual=Module[\"_GreaterEqual\"]=Module[\"asm\"][\"ga\"]).apply(null,arguments)};var _LeakyRelu=Module[\"_LeakyRelu\"]=function(){return(_LeakyRelu=Module[\"_LeakyRelu\"]=Module[\"asm\"][\"ha\"]).apply(null,arguments)};var _Less=Module[\"_Less\"]=function(){return(_Less=Module[\"_Less\"]=Module[\"asm\"][\"ia\"]).apply(null,arguments)};var _LessEqual=Module[\"_LessEqual\"]=function(){return(_LessEqual=Module[\"_LessEqual\"]=Module[\"asm\"][\"ja\"]).apply(null,arguments)};var _Log=Module[\"_Log\"]=function(){return(_Log=Module[\"_Log\"]=Module[\"asm\"][\"ka\"]).apply(null,arguments)};var _LogicalAnd=Module[\"_LogicalAnd\"]=function(){return(_LogicalAnd=Module[\"_LogicalAnd\"]=Module[\"asm\"][\"la\"]).apply(null,arguments)};var _Max=Module[\"_Max\"]=function(){return(_Max=Module[\"_Max\"]=Module[\"asm\"][\"ma\"]).apply(null,arguments)};var _MaxPool=Module[\"_MaxPool\"]=function(){return(_MaxPool=Module[\"_MaxPool\"]=Module[\"asm\"][\"na\"]).apply(null,arguments)};var _Maximum=Module[\"_Maximum\"]=function(){return(_Maximum=Module[\"_Maximum\"]=Module[\"asm\"][\"oa\"]).apply(null,arguments)};var _Mean=Module[\"_Mean\"]=function(){return(_Mean=Module[\"_Mean\"]=Module[\"asm\"][\"pa\"]).apply(null,arguments)};var _Min=Module[\"_Min\"]=function(){return(_Min=Module[\"_Min\"]=Module[\"asm\"][\"qa\"]).apply(null,arguments)};var _Minimum=Module[\"_Minimum\"]=function(){return(_Minimum=Module[\"_Minimum\"]=Module[\"asm\"][\"ra\"]).apply(null,arguments)};var _MirrorPad=Module[\"_MirrorPad\"]=function(){return(_MirrorPad=Module[\"_MirrorPad\"]=Module[\"asm\"][\"sa\"]).apply(null,arguments)};var _Multiply=Module[\"_Multiply\"]=function(){return(_Multiply=Module[\"_Multiply\"]=Module[\"asm\"][\"ta\"]).apply(null,arguments)};var _Neg=Module[\"_Neg\"]=function(){return(_Neg=Module[\"_Neg\"]=Module[\"asm\"][\"ua\"]).apply(null,arguments)};var _NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=function(){return(_NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=Module[\"asm\"][\"va\"]).apply(null,arguments)};var _NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=function(){return(_NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=Module[\"asm\"][\"wa\"]).apply(null,arguments)};var _NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=function(){return(_NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=Module[\"asm\"][\"xa\"]).apply(null,arguments)};var _NotEqual=Module[\"_NotEqual\"]=function(){return(_NotEqual=Module[\"_NotEqual\"]=Module[\"asm\"][\"ya\"]).apply(null,arguments)};var _OneHot=Module[\"_OneHot\"]=function(){return(_OneHot=Module[\"_OneHot\"]=Module[\"asm\"][\"za\"]).apply(null,arguments)};var _PadV2=Module[\"_PadV2\"]=function(){return(_PadV2=Module[\"_PadV2\"]=Module[\"asm\"][\"Aa\"]).apply(null,arguments)};var _Pow=Module[\"_Pow\"]=function(){return(_Pow=Module[\"_Pow\"]=Module[\"asm\"][\"Ba\"]).apply(null,arguments)};var _Prelu=Module[\"_Prelu\"]=function(){return(_Prelu=Module[\"_Prelu\"]=Module[\"asm\"][\"Ca\"]).apply(null,arguments)};var _Prod=Module[\"_Prod\"]=function(){return(_Prod=Module[\"_Prod\"]=Module[\"asm\"][\"Da\"]).apply(null,arguments)};var _RealDiv=Module[\"_RealDiv\"]=function(){return(_RealDiv=Module[\"_RealDiv\"]=Module[\"asm\"][\"Ea\"]).apply(null,arguments)};var _Relu=Module[\"_Relu\"]=function(){return(_Relu=Module[\"_Relu\"]=Module[\"asm\"][\"Fa\"]).apply(null,arguments)};var _Relu6=Module[\"_Relu6\"]=function(){return(_Relu6=Module[\"_Relu6\"]=Module[\"asm\"][\"Ga\"]).apply(null,arguments)};var _ResizeBilinear=Module[\"_ResizeBilinear\"]=function(){return(_ResizeBilinear=Module[\"_ResizeBilinear\"]=Module[\"asm\"][\"Ha\"]).apply(null,arguments)};var _Reverse=Module[\"_Reverse\"]=function(){return(_Reverse=Module[\"_Reverse\"]=Module[\"asm\"][\"Ia\"]).apply(null,arguments)};var _RotateWithOffset=Module[\"_RotateWithOffset\"]=function(){return(_RotateWithOffset=Module[\"_RotateWithOffset\"]=Module[\"asm\"][\"Ja\"]).apply(null,arguments)};var _Round=Module[\"_Round\"]=function(){return(_Round=Module[\"_Round\"]=Module[\"asm\"][\"Ka\"]).apply(null,arguments)};var _Rsqrt=Module[\"_Rsqrt\"]=function(){return(_Rsqrt=Module[\"_Rsqrt\"]=Module[\"asm\"][\"La\"]).apply(null,arguments)};var _ScatterNd=Module[\"_ScatterNd\"]=function(){return(_ScatterNd=Module[\"_ScatterNd\"]=Module[\"asm\"][\"Ma\"]).apply(null,arguments)};var _SelectV2=Module[\"_SelectV2\"]=function(){return(_SelectV2=Module[\"_SelectV2\"]=Module[\"asm\"][\"Na\"]).apply(null,arguments)};var _Sigmoid=Module[\"_Sigmoid\"]=function(){return(_Sigmoid=Module[\"_Sigmoid\"]=Module[\"asm\"][\"Oa\"]).apply(null,arguments)};var _Sin=Module[\"_Sin\"]=function(){return(_Sin=Module[\"_Sin\"]=Module[\"asm\"][\"Pa\"]).apply(null,arguments)};var _Softmax=Module[\"_Softmax\"]=function(){return(_Softmax=Module[\"_Softmax\"]=Module[\"asm\"][\"Qa\"]).apply(null,arguments)};var _Sqrt=Module[\"_Sqrt\"]=function(){return(_Sqrt=Module[\"_Sqrt\"]=Module[\"asm\"][\"Ra\"]).apply(null,arguments)};var _Square=Module[\"_Square\"]=function(){return(_Square=Module[\"_Square\"]=Module[\"asm\"][\"Sa\"]).apply(null,arguments)};var _SquaredDifference=Module[\"_SquaredDifference\"]=function(){return(_SquaredDifference=Module[\"_SquaredDifference\"]=Module[\"asm\"][\"Ta\"]).apply(null,arguments)};var _Step=Module[\"_Step\"]=function(){return(_Step=Module[\"_Step\"]=Module[\"asm\"][\"Ua\"]).apply(null,arguments)};var _StridedSlice=Module[\"_StridedSlice\"]=function(){return(_StridedSlice=Module[\"_StridedSlice\"]=Module[\"asm\"][\"Va\"]).apply(null,arguments)};var _Sub=Module[\"_Sub\"]=function(){return(_Sub=Module[\"_Sub\"]=Module[\"asm\"][\"Wa\"]).apply(null,arguments)};var _Sum=Module[\"_Sum\"]=function(){return(_Sum=Module[\"_Sum\"]=Module[\"asm\"][\"Xa\"]).apply(null,arguments)};var _Tan=Module[\"_Tan\"]=function(){return(_Tan=Module[\"_Tan\"]=Module[\"asm\"][\"Ya\"]).apply(null,arguments)};var _Tanh=Module[\"_Tanh\"]=function(){return(_Tanh=Module[\"_Tanh\"]=Module[\"asm\"][\"Za\"]).apply(null,arguments)};var _Tile=Module[\"_Tile\"]=function(){return(_Tile=Module[\"_Tile\"]=Module[\"asm\"][\"_a\"]).apply(null,arguments)};var _TopK=Module[\"_TopK\"]=function(){return(_TopK=Module[\"_TopK\"]=Module[\"asm\"][\"$a\"]).apply(null,arguments)};var _Transform=Module[\"_Transform\"]=function(){return(_Transform=Module[\"_Transform\"]=Module[\"asm\"][\"ab\"]).apply(null,arguments)};var _Transpose=Module[\"_Transpose\"]=function(){return(_Transpose=Module[\"_Transpose\"]=Module[\"asm\"][\"bb\"]).apply(null,arguments)};var __FusedMatMul=Module[\"__FusedMatMul\"]=function(){return(__FusedMatMul=Module[\"__FusedMatMul\"]=Module[\"asm\"][\"cb\"]).apply(null,arguments)};var _malloc=Module[\"_malloc\"]=function(){return(_malloc=Module[\"_malloc\"]=Module[\"asm\"][\"db\"]).apply(null,arguments)};var _free=Module[\"_free\"]=function(){return(_free=Module[\"_free\"]=Module[\"asm\"][\"eb\"]).apply(null,arguments)};var ___errno_location=Module[\"___errno_location\"]=function(){return(___errno_location=Module[\"___errno_location\"]=Module[\"asm\"][\"fb\"]).apply(null,arguments)};var _emscripten_get_global_libc=Module[\"_emscripten_get_global_libc\"]=function(){return(_emscripten_get_global_libc=Module[\"_emscripten_get_global_libc\"]=Module[\"asm\"][\"gb\"]).apply(null,arguments)};var _pthread_self=Module[\"_pthread_self\"]=function(){return(_pthread_self=Module[\"_pthread_self\"]=Module[\"asm\"][\"hb\"]).apply(null,arguments)};var ___pthread_tsd_run_dtors=Module[\"___pthread_tsd_run_dtors\"]=function(){return(___pthread_tsd_run_dtors=Module[\"___pthread_tsd_run_dtors\"]=Module[\"asm\"][\"ib\"]).apply(null,arguments)};var _emscripten_main_thread_process_queued_calls=Module[\"_emscripten_main_thread_process_queued_calls\"]=function(){return(_emscripten_main_thread_process_queued_calls=Module[\"_emscripten_main_thread_process_queued_calls\"]=Module[\"asm\"][\"jb\"]).apply(null,arguments)};var _emscripten_current_thread_process_queued_calls=Module[\"_emscripten_current_thread_process_queued_calls\"]=function(){return(_emscripten_current_thread_process_queued_calls=Module[\"_emscripten_current_thread_process_queued_calls\"]=Module[\"asm\"][\"kb\"]).apply(null,arguments)};var _emscripten_register_main_browser_thread_id=Module[\"_emscripten_register_main_browser_thread_id\"]=function(){return(_emscripten_register_main_browser_thread_id=Module[\"_emscripten_register_main_browser_thread_id\"]=Module[\"asm\"][\"lb\"]).apply(null,arguments)};var __emscripten_do_dispatch_to_thread=Module[\"__emscripten_do_dispatch_to_thread\"]=function(){return(__emscripten_do_dispatch_to_thread=Module[\"__emscripten_do_dispatch_to_thread\"]=Module[\"asm\"][\"mb\"]).apply(null,arguments)};var _emscripten_sync_run_in_main_thread_4=Module[\"_emscripten_sync_run_in_main_thread_4\"]=function(){return(_emscripten_sync_run_in_main_thread_4=Module[\"_emscripten_sync_run_in_main_thread_4\"]=Module[\"asm\"][\"nb\"]).apply(null,arguments)};var _emscripten_run_in_main_runtime_thread_js=Module[\"_emscripten_run_in_main_runtime_thread_js\"]=function(){return(_emscripten_run_in_main_runtime_thread_js=Module[\"_emscripten_run_in_main_runtime_thread_js\"]=Module[\"asm\"][\"ob\"]).apply(null,arguments)};var __emscripten_call_on_thread=Module[\"__emscripten_call_on_thread\"]=function(){return(__emscripten_call_on_thread=Module[\"__emscripten_call_on_thread\"]=Module[\"asm\"][\"pb\"]).apply(null,arguments)};var _emscripten_tls_init=Module[\"_emscripten_tls_init\"]=function(){return(_emscripten_tls_init=Module[\"_emscripten_tls_init\"]=Module[\"asm\"][\"qb\"]).apply(null,arguments)};var __emscripten_thread_init=Module[\"__emscripten_thread_init\"]=function(){return(__emscripten_thread_init=Module[\"__emscripten_thread_init\"]=Module[\"asm\"][\"rb\"]).apply(null,arguments)};var stackSave=Module[\"stackSave\"]=function(){return(stackSave=Module[\"stackSave\"]=Module[\"asm\"][\"sb\"]).apply(null,arguments)};var stackRestore=Module[\"stackRestore\"]=function(){return(stackRestore=Module[\"stackRestore\"]=Module[\"asm\"][\"tb\"]).apply(null,arguments)};var stackAlloc=Module[\"stackAlloc\"]=function(){return(stackAlloc=Module[\"stackAlloc\"]=Module[\"asm\"][\"ub\"]).apply(null,arguments)};var _emscripten_stack_set_limits=Module[\"_emscripten_stack_set_limits\"]=function(){return(_emscripten_stack_set_limits=Module[\"_emscripten_stack_set_limits\"]=Module[\"asm\"][\"vb\"]).apply(null,arguments)};var _memalign=Module[\"_memalign\"]=function(){return(_memalign=Module[\"_memalign\"]=Module[\"asm\"][\"wb\"]).apply(null,arguments)};var __emscripten_allow_main_runtime_queued_calls=Module[\"__emscripten_allow_main_runtime_queued_calls\"]=9808;var __emscripten_main_thread_futex=Module[\"__emscripten_main_thread_futex\"]=11432;Module[\"cwrap\"]=cwrap;Module[\"PThread\"]=PThread;Module[\"PThread\"]=PThread;Module[\"wasmMemory\"]=wasmMemory;Module[\"ExitStatus\"]=ExitStatus;var calledRun;function ExitStatus(status){this.name=\"ExitStatus\";this.message=\"Program terminated with exit(\"+status+\")\";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}if(ENVIRONMENT_IS_PTHREAD){readyPromiseResolve(Module);initRuntime();postMessage({\"cmd\":\"loaded\"});return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module[\"calledRun\"]=true;if(ABORT)return;initRuntime();preMain();readyPromiseResolve(Module);if(Module[\"onRuntimeInitialized\"])Module[\"onRuntimeInitialized\"]();postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}}Module[\"run\"]=run;function exit(status,implicit){if(implicit&&noExitRuntime&&status===0){return}if(!implicit){if(ENVIRONMENT_IS_PTHREAD){postMessage({\"cmd\":\"exitProcess\",\"returnCode\":status});throw new ExitStatus(status)}else{}}if(noExitRuntime){}else{PThread.terminateAllThreads();EXITSTATUS=status;exitRuntime();if(Module[\"onExit\"])Module[\"onExit\"](status);ABORT=true}quit_(status,new ExitStatus(status))}if(Module[\"preInit\"]){if(typeof Module[\"preInit\"]==\"function\")Module[\"preInit\"]=[Module[\"preInit\"]];while(Module[\"preInit\"].length>0){Module[\"preInit\"].pop()()}}if(ENVIRONMENT_IS_PTHREAD){noExitRuntime=false;PThread.initWorker()}run();\n\n\n return WasmBackendModuleThreadedSimd.ready\n}\n);\n})();\nif (typeof exports === 'object' && typeof module === 'object')\n module.exports = WasmBackendModuleThreadedSimd;\nelse if (typeof define === 'function' && define['amd'])\n define([], function() { return WasmBackendModuleThreadedSimd; });\nelse if (typeof exports === 'object')\n exports[\"WasmBackendModuleThreadedSimd\"] = WasmBackendModuleThreadedSimd;\n", "\nvar WasmBackendModule = (function() {\n var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;\n if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;\n return (\nfunction(WasmBackendModule) {\n WasmBackendModule = WasmBackendModule || {};\n\nvar Module=typeof WasmBackendModule!==\"undefined\"?WasmBackendModule:{};var readyPromiseResolve,readyPromiseReject;Module[\"ready\"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var arguments_=[];var thisProgram=\"./this.program\";var quit_=function(status,toThrow){throw toThrow};var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window===\"object\";ENVIRONMENT_IS_WORKER=typeof importScripts===\"function\";ENVIRONMENT_IS_NODE=typeof process===\"object\"&&typeof process.versions===\"object\"&&typeof process.versions.node===\"string\";ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;var nodeFS;var nodePath;if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require(\"path\").dirname(scriptDirectory)+\"/\"}else{scriptDirectory=__dirname+\"/\"}read_=function shell_read(filename,binary){if(!nodeFS)nodeFS=require(\"fs\");if(!nodePath)nodePath=require(\"path\");filename=nodePath[\"normalize\"](filename);return nodeFS[\"readFileSync\"](filename,binary?null:\"utf8\")};readBinary=function readBinary(filename){var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process[\"argv\"].length>1){thisProgram=process[\"argv\"][1].replace(/\\\\/g,\"/\")}arguments_=process[\"argv\"].slice(2);process[\"on\"](\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process[\"on\"](\"unhandledRejection\",abort);quit_=function(status){process[\"exit\"](status)};Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"}}else if(ENVIRONMENT_IS_SHELL){if(typeof read!=\"undefined\"){read_=function shell_read(f){return read(f)}}readBinary=function readBinary(f){var data;if(typeof readbuffer===\"function\"){return new Uint8Array(readbuffer(f))}data=read(f,\"binary\");assert(typeof data===\"object\");return data};if(typeof scriptArgs!=\"undefined\"){arguments_=scriptArgs}else if(typeof arguments!=\"undefined\"){arguments_=arguments}if(typeof quit===\"function\"){quit_=function(status){quit(status)}}if(typeof print!==\"undefined\"){if(typeof console===\"undefined\")console={};console.log=print;console.warn=console.error=typeof printErr!==\"undefined\"?printErr:print}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!==\"undefined\"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf(\"blob:\")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.lastIndexOf(\"/\")+1)}else{scriptDirectory=\"\"}{read_=function(url){var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=function(url){var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.responseType=\"arraybuffer\";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=function(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,true);xhr.responseType=\"arraybuffer\";xhr.onload=function(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=function(title){document.title=title}}else{}var out=Module[\"print\"]||console.log.bind(console);var err=Module[\"printErr\"]||console.warn.bind(console);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=null;if(Module[\"arguments\"])arguments_=Module[\"arguments\"];if(Module[\"thisProgram\"])thisProgram=Module[\"thisProgram\"];if(Module[\"quit\"])quit_=Module[\"quit\"];var wasmBinary;if(Module[\"wasmBinary\"])wasmBinary=Module[\"wasmBinary\"];var noExitRuntime=Module[\"noExitRuntime\"]||true;if(typeof WebAssembly!==\"object\"){abort(\"no native wasm support detected\")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(\"Assertion failed: \"+text)}}function getCFunc(ident){var func=Module[\"_\"+ident];assert(func,\"Cannot call unknown function \"+ident+\", make sure it is exported\");return func}function ccall(ident,returnType,argTypes,args,opts){var toC={\"string\":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},\"array\":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType===\"string\")return UTF8ToString(ret);if(returnType===\"boolean\")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i=endIdx))++endPtr;if(endPtr-idx>16&&heap.subarray&&UTF8Decoder){return UTF8Decoder.decode(heap.subarray(idx,endPtr))}else{var str=\"\";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):\"\"}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function alignUp(x,multiple){if(x%multiple>0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module[\"HEAP8\"]=HEAP8=new Int8Array(buf);Module[\"HEAP16\"]=HEAP16=new Int16Array(buf);Module[\"HEAP32\"]=HEAP32=new Int32Array(buf);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(buf);Module[\"HEAPU16\"]=HEAPU16=new Uint16Array(buf);Module[\"HEAPU32\"]=HEAPU32=new Uint32Array(buf);Module[\"HEAPF32\"]=HEAPF32=new Float32Array(buf);Module[\"HEAPF64\"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module[\"INITIAL_MEMORY\"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;__ATINIT__.push({func:function(){___wasm_call_ctors()}});function preRun(){if(Module[\"preRun\"]){if(typeof Module[\"preRun\"]==\"function\")Module[\"preRun\"]=[Module[\"preRun\"]];while(Module[\"preRun\"].length){addOnPreRun(Module[\"preRun\"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module[\"postRun\"]){if(typeof Module[\"postRun\"]==\"function\")Module[\"postRun\"]=[Module[\"postRun\"]];while(Module[\"postRun\"].length){addOnPostRun(Module[\"postRun\"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module[\"preloadedImages\"]={};Module[\"preloadedAudios\"]={};function abort(what){if(Module[\"onAbort\"]){Module[\"onAbort\"](what)}what+=\"\";err(what);ABORT=true;EXITSTATUS=1;what=\"abort(\"+what+\"). Build with -s ASSERTIONS=1 for more info.\";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}function hasPrefix(str,prefix){return String.prototype.startsWith?str.startsWith(prefix):str.indexOf(prefix)===0}var dataURIPrefix=\"data:application/octet-stream;base64,\";function isDataURI(filename){return hasPrefix(filename,dataURIPrefix)}var fileURIPrefix=\"file://\";function isFileURI(filename){return hasPrefix(filename,fileURIPrefix)}var wasmBinaryFile=\"tfjs-backend-wasm.wasm\";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}else{throw\"both async and sync fetching of the wasm failed\"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch===\"function\"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){if(!response[\"ok\"]){throw\"failed to load wasm binary file at '\"+wasmBinaryFile+\"'\"}return response[\"arrayBuffer\"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={\"a\":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module[\"asm\"]=exports;wasmMemory=Module[\"asm\"][\"i\"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module[\"asm\"][\"o\"];removeRunDependency(\"wasm-instantiate\")}addRunDependency(\"wasm-instantiate\");function receiveInstantiatedSource(output){receiveInstance(output[\"instance\"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err(\"failed to asynchronously prepare wasm: \"+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming===\"function\"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch===\"function\"){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiatedSource,function(reason){err(\"wasm streaming compile failed: \"+reason);err(\"falling back to ArrayBuffer instantiation\");return instantiateArrayBuffer(receiveInstantiatedSource)})})}else{return instantiateArrayBuffer(receiveInstantiatedSource)}}if(Module[\"instantiateWasm\"]){try{var exports=Module[\"instantiateWasm\"](info,receiveInstance);return exports}catch(e){err(\"Module.instantiateWasm callback failed with error: \"+e);return false}}instantiateAsync().catch(readyPromiseReject);return{}}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback==\"function\"){callback(Module);continue}var func=callback.func;if(typeof func===\"number\"){if(callback.arg===undefined){wasmTable.get(func)()}else{wasmTable.get(func)(callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}function _abort(){abort()}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function _emscripten_get_heap_size(){return HEAPU8.length}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();var maxHeapSize=2147483648;if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var SYSCALLS={mappings:{},buffers:[null,[],[]],printChar:function(stream,curr){var buffer=SYSCALLS.buffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},get64:function(low,high){return low}};function _fd_close(fd){return 0}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){}function _fd_write(fd,iov,iovcnt,pnum){var num=0;for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];for(var j=0;j>2]=num;return 0}function _pthread_create(){return 6}function setErrNo(value){HEAP32[___errno_location()>>2]=value;return value}function _sysconf(name){switch(name){case 30:return 16384;case 85:var maxHeapSize=2147483648;return maxHeapSize/16384;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:case 80:case 81:case 79:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:{if(typeof navigator===\"object\")return navigator[\"hardwareConcurrency\"]||1;return 1}}setErrNo(28);return-1}var asmLibraryArg={\"a\":_abort,\"d\":_emscripten_memcpy_big,\"e\":_emscripten_resize_heap,\"f\":_fd_close,\"c\":_fd_seek,\"b\":_fd_write,\"g\":_pthread_create,\"h\":_sysconf};var asm=createWasm();var ___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=function(){return(___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=Module[\"asm\"][\"j\"]).apply(null,arguments)};var _init=Module[\"_init\"]=function(){return(_init=Module[\"_init\"]=Module[\"asm\"][\"k\"]).apply(null,arguments)};var _register_tensor=Module[\"_register_tensor\"]=function(){return(_register_tensor=Module[\"_register_tensor\"]=Module[\"asm\"][\"l\"]).apply(null,arguments)};var _dispose_data=Module[\"_dispose_data\"]=function(){return(_dispose_data=Module[\"_dispose_data\"]=Module[\"asm\"][\"m\"]).apply(null,arguments)};var _dispose=Module[\"_dispose\"]=function(){return(_dispose=Module[\"_dispose\"]=Module[\"asm\"][\"n\"]).apply(null,arguments)};var _Abs=Module[\"_Abs\"]=function(){return(_Abs=Module[\"_Abs\"]=Module[\"asm\"][\"p\"]).apply(null,arguments)};var _Add=Module[\"_Add\"]=function(){return(_Add=Module[\"_Add\"]=Module[\"asm\"][\"q\"]).apply(null,arguments)};var _AddN=Module[\"_AddN\"]=function(){return(_AddN=Module[\"_AddN\"]=Module[\"asm\"][\"r\"]).apply(null,arguments)};var _All=Module[\"_All\"]=function(){return(_All=Module[\"_All\"]=Module[\"asm\"][\"s\"]).apply(null,arguments)};var _Any=Module[\"_Any\"]=function(){return(_Any=Module[\"_Any\"]=Module[\"asm\"][\"t\"]).apply(null,arguments)};var _ArgMax=Module[\"_ArgMax\"]=function(){return(_ArgMax=Module[\"_ArgMax\"]=Module[\"asm\"][\"u\"]).apply(null,arguments)};var _AvgPool=Module[\"_AvgPool\"]=function(){return(_AvgPool=Module[\"_AvgPool\"]=Module[\"asm\"][\"v\"]).apply(null,arguments)};var _BatchMatMul=Module[\"_BatchMatMul\"]=function(){return(_BatchMatMul=Module[\"_BatchMatMul\"]=Module[\"asm\"][\"w\"]).apply(null,arguments)};var _Ceil=Module[\"_Ceil\"]=function(){return(_Ceil=Module[\"_Ceil\"]=Module[\"asm\"][\"x\"]).apply(null,arguments)};var _ClipByValue=Module[\"_ClipByValue\"]=function(){return(_ClipByValue=Module[\"_ClipByValue\"]=Module[\"asm\"][\"y\"]).apply(null,arguments)};var _Conv2D=Module[\"_Conv2D\"]=function(){return(_Conv2D=Module[\"_Conv2D\"]=Module[\"asm\"][\"z\"]).apply(null,arguments)};var _Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=function(){return(_Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=Module[\"asm\"][\"A\"]).apply(null,arguments)};var _Cos=Module[\"_Cos\"]=function(){return(_Cos=Module[\"_Cos\"]=Module[\"asm\"][\"B\"]).apply(null,arguments)};var _CropAndResize=Module[\"_CropAndResize\"]=function(){return(_CropAndResize=Module[\"_CropAndResize\"]=Module[\"asm\"][\"C\"]).apply(null,arguments)};var _Cumsum=Module[\"_Cumsum\"]=function(){return(_Cumsum=Module[\"_Cumsum\"]=Module[\"asm\"][\"D\"]).apply(null,arguments)};var _DepthToSpace=Module[\"_DepthToSpace\"]=function(){return(_DepthToSpace=Module[\"_DepthToSpace\"]=Module[\"asm\"][\"E\"]).apply(null,arguments)};var _DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=function(){return(_DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=Module[\"asm\"][\"F\"]).apply(null,arguments)};var _Equal=Module[\"_Equal\"]=function(){return(_Equal=Module[\"_Equal\"]=Module[\"asm\"][\"G\"]).apply(null,arguments)};var _Exp=Module[\"_Exp\"]=function(){return(_Exp=Module[\"_Exp\"]=Module[\"asm\"][\"H\"]).apply(null,arguments)};var _FlipLeftRight=Module[\"_FlipLeftRight\"]=function(){return(_FlipLeftRight=Module[\"_FlipLeftRight\"]=Module[\"asm\"][\"I\"]).apply(null,arguments)};var _Floor=Module[\"_Floor\"]=function(){return(_Floor=Module[\"_Floor\"]=Module[\"asm\"][\"J\"]).apply(null,arguments)};var _FloorDiv=Module[\"_FloorDiv\"]=function(){return(_FloorDiv=Module[\"_FloorDiv\"]=Module[\"asm\"][\"K\"]).apply(null,arguments)};var _FusedBatchNorm=Module[\"_FusedBatchNorm\"]=function(){return(_FusedBatchNorm=Module[\"_FusedBatchNorm\"]=Module[\"asm\"][\"L\"]).apply(null,arguments)};var _FusedConv2D=Module[\"_FusedConv2D\"]=function(){return(_FusedConv2D=Module[\"_FusedConv2D\"]=Module[\"asm\"][\"M\"]).apply(null,arguments)};var _FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=function(){return(_FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=Module[\"asm\"][\"N\"]).apply(null,arguments)};var _Gather=Module[\"_Gather\"]=function(){return(_Gather=Module[\"_Gather\"]=Module[\"asm\"][\"O\"]).apply(null,arguments)};var _GatherNd=Module[\"_GatherNd\"]=function(){return(_GatherNd=Module[\"_GatherNd\"]=Module[\"asm\"][\"P\"]).apply(null,arguments)};var _Greater=Module[\"_Greater\"]=function(){return(_Greater=Module[\"_Greater\"]=Module[\"asm\"][\"Q\"]).apply(null,arguments)};var _GreaterEqual=Module[\"_GreaterEqual\"]=function(){return(_GreaterEqual=Module[\"_GreaterEqual\"]=Module[\"asm\"][\"R\"]).apply(null,arguments)};var _LeakyRelu=Module[\"_LeakyRelu\"]=function(){return(_LeakyRelu=Module[\"_LeakyRelu\"]=Module[\"asm\"][\"S\"]).apply(null,arguments)};var _Less=Module[\"_Less\"]=function(){return(_Less=Module[\"_Less\"]=Module[\"asm\"][\"T\"]).apply(null,arguments)};var _LessEqual=Module[\"_LessEqual\"]=function(){return(_LessEqual=Module[\"_LessEqual\"]=Module[\"asm\"][\"U\"]).apply(null,arguments)};var _Log=Module[\"_Log\"]=function(){return(_Log=Module[\"_Log\"]=Module[\"asm\"][\"V\"]).apply(null,arguments)};var _LogicalAnd=Module[\"_LogicalAnd\"]=function(){return(_LogicalAnd=Module[\"_LogicalAnd\"]=Module[\"asm\"][\"W\"]).apply(null,arguments)};var _Max=Module[\"_Max\"]=function(){return(_Max=Module[\"_Max\"]=Module[\"asm\"][\"X\"]).apply(null,arguments)};var _MaxPool=Module[\"_MaxPool\"]=function(){return(_MaxPool=Module[\"_MaxPool\"]=Module[\"asm\"][\"Y\"]).apply(null,arguments)};var _Maximum=Module[\"_Maximum\"]=function(){return(_Maximum=Module[\"_Maximum\"]=Module[\"asm\"][\"Z\"]).apply(null,arguments)};var _Mean=Module[\"_Mean\"]=function(){return(_Mean=Module[\"_Mean\"]=Module[\"asm\"][\"_\"]).apply(null,arguments)};var _Min=Module[\"_Min\"]=function(){return(_Min=Module[\"_Min\"]=Module[\"asm\"][\"$\"]).apply(null,arguments)};var _Minimum=Module[\"_Minimum\"]=function(){return(_Minimum=Module[\"_Minimum\"]=Module[\"asm\"][\"aa\"]).apply(null,arguments)};var _MirrorPad=Module[\"_MirrorPad\"]=function(){return(_MirrorPad=Module[\"_MirrorPad\"]=Module[\"asm\"][\"ba\"]).apply(null,arguments)};var _Multiply=Module[\"_Multiply\"]=function(){return(_Multiply=Module[\"_Multiply\"]=Module[\"asm\"][\"ca\"]).apply(null,arguments)};var _Neg=Module[\"_Neg\"]=function(){return(_Neg=Module[\"_Neg\"]=Module[\"asm\"][\"da\"]).apply(null,arguments)};var _NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=function(){return(_NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=Module[\"asm\"][\"ea\"]).apply(null,arguments)};var _NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=function(){return(_NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=Module[\"asm\"][\"fa\"]).apply(null,arguments)};var _NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=function(){return(_NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=Module[\"asm\"][\"ga\"]).apply(null,arguments)};var _NotEqual=Module[\"_NotEqual\"]=function(){return(_NotEqual=Module[\"_NotEqual\"]=Module[\"asm\"][\"ha\"]).apply(null,arguments)};var _OneHot=Module[\"_OneHot\"]=function(){return(_OneHot=Module[\"_OneHot\"]=Module[\"asm\"][\"ia\"]).apply(null,arguments)};var _PadV2=Module[\"_PadV2\"]=function(){return(_PadV2=Module[\"_PadV2\"]=Module[\"asm\"][\"ja\"]).apply(null,arguments)};var _Pow=Module[\"_Pow\"]=function(){return(_Pow=Module[\"_Pow\"]=Module[\"asm\"][\"ka\"]).apply(null,arguments)};var _Prelu=Module[\"_Prelu\"]=function(){return(_Prelu=Module[\"_Prelu\"]=Module[\"asm\"][\"la\"]).apply(null,arguments)};var _Prod=Module[\"_Prod\"]=function(){return(_Prod=Module[\"_Prod\"]=Module[\"asm\"][\"ma\"]).apply(null,arguments)};var _RealDiv=Module[\"_RealDiv\"]=function(){return(_RealDiv=Module[\"_RealDiv\"]=Module[\"asm\"][\"na\"]).apply(null,arguments)};var _Relu=Module[\"_Relu\"]=function(){return(_Relu=Module[\"_Relu\"]=Module[\"asm\"][\"oa\"]).apply(null,arguments)};var _Relu6=Module[\"_Relu6\"]=function(){return(_Relu6=Module[\"_Relu6\"]=Module[\"asm\"][\"pa\"]).apply(null,arguments)};var _ResizeBilinear=Module[\"_ResizeBilinear\"]=function(){return(_ResizeBilinear=Module[\"_ResizeBilinear\"]=Module[\"asm\"][\"qa\"]).apply(null,arguments)};var _Reverse=Module[\"_Reverse\"]=function(){return(_Reverse=Module[\"_Reverse\"]=Module[\"asm\"][\"ra\"]).apply(null,arguments)};var _RotateWithOffset=Module[\"_RotateWithOffset\"]=function(){return(_RotateWithOffset=Module[\"_RotateWithOffset\"]=Module[\"asm\"][\"sa\"]).apply(null,arguments)};var _Round=Module[\"_Round\"]=function(){return(_Round=Module[\"_Round\"]=Module[\"asm\"][\"ta\"]).apply(null,arguments)};var _Rsqrt=Module[\"_Rsqrt\"]=function(){return(_Rsqrt=Module[\"_Rsqrt\"]=Module[\"asm\"][\"ua\"]).apply(null,arguments)};var _ScatterNd=Module[\"_ScatterNd\"]=function(){return(_ScatterNd=Module[\"_ScatterNd\"]=Module[\"asm\"][\"va\"]).apply(null,arguments)};var _SelectV2=Module[\"_SelectV2\"]=function(){return(_SelectV2=Module[\"_SelectV2\"]=Module[\"asm\"][\"wa\"]).apply(null,arguments)};var _Sigmoid=Module[\"_Sigmoid\"]=function(){return(_Sigmoid=Module[\"_Sigmoid\"]=Module[\"asm\"][\"xa\"]).apply(null,arguments)};var _Sin=Module[\"_Sin\"]=function(){return(_Sin=Module[\"_Sin\"]=Module[\"asm\"][\"ya\"]).apply(null,arguments)};var _Softmax=Module[\"_Softmax\"]=function(){return(_Softmax=Module[\"_Softmax\"]=Module[\"asm\"][\"za\"]).apply(null,arguments)};var _Sqrt=Module[\"_Sqrt\"]=function(){return(_Sqrt=Module[\"_Sqrt\"]=Module[\"asm\"][\"Aa\"]).apply(null,arguments)};var _Square=Module[\"_Square\"]=function(){return(_Square=Module[\"_Square\"]=Module[\"asm\"][\"Ba\"]).apply(null,arguments)};var _SquaredDifference=Module[\"_SquaredDifference\"]=function(){return(_SquaredDifference=Module[\"_SquaredDifference\"]=Module[\"asm\"][\"Ca\"]).apply(null,arguments)};var _Step=Module[\"_Step\"]=function(){return(_Step=Module[\"_Step\"]=Module[\"asm\"][\"Da\"]).apply(null,arguments)};var _StridedSlice=Module[\"_StridedSlice\"]=function(){return(_StridedSlice=Module[\"_StridedSlice\"]=Module[\"asm\"][\"Ea\"]).apply(null,arguments)};var _Sub=Module[\"_Sub\"]=function(){return(_Sub=Module[\"_Sub\"]=Module[\"asm\"][\"Fa\"]).apply(null,arguments)};var _Sum=Module[\"_Sum\"]=function(){return(_Sum=Module[\"_Sum\"]=Module[\"asm\"][\"Ga\"]).apply(null,arguments)};var _Tan=Module[\"_Tan\"]=function(){return(_Tan=Module[\"_Tan\"]=Module[\"asm\"][\"Ha\"]).apply(null,arguments)};var _Tanh=Module[\"_Tanh\"]=function(){return(_Tanh=Module[\"_Tanh\"]=Module[\"asm\"][\"Ia\"]).apply(null,arguments)};var _Tile=Module[\"_Tile\"]=function(){return(_Tile=Module[\"_Tile\"]=Module[\"asm\"][\"Ja\"]).apply(null,arguments)};var _TopK=Module[\"_TopK\"]=function(){return(_TopK=Module[\"_TopK\"]=Module[\"asm\"][\"Ka\"]).apply(null,arguments)};var _Transform=Module[\"_Transform\"]=function(){return(_Transform=Module[\"_Transform\"]=Module[\"asm\"][\"La\"]).apply(null,arguments)};var _Transpose=Module[\"_Transpose\"]=function(){return(_Transpose=Module[\"_Transpose\"]=Module[\"asm\"][\"Ma\"]).apply(null,arguments)};var __FusedMatMul=Module[\"__FusedMatMul\"]=function(){return(__FusedMatMul=Module[\"__FusedMatMul\"]=Module[\"asm\"][\"Na\"]).apply(null,arguments)};var _malloc=Module[\"_malloc\"]=function(){return(_malloc=Module[\"_malloc\"]=Module[\"asm\"][\"Oa\"]).apply(null,arguments)};var _free=Module[\"_free\"]=function(){return(_free=Module[\"_free\"]=Module[\"asm\"][\"Pa\"]).apply(null,arguments)};var ___errno_location=Module[\"___errno_location\"]=function(){return(___errno_location=Module[\"___errno_location\"]=Module[\"asm\"][\"Qa\"]).apply(null,arguments)};var stackSave=Module[\"stackSave\"]=function(){return(stackSave=Module[\"stackSave\"]=Module[\"asm\"][\"Ra\"]).apply(null,arguments)};var stackRestore=Module[\"stackRestore\"]=function(){return(stackRestore=Module[\"stackRestore\"]=Module[\"asm\"][\"Sa\"]).apply(null,arguments)};var stackAlloc=Module[\"stackAlloc\"]=function(){return(stackAlloc=Module[\"stackAlloc\"]=Module[\"asm\"][\"Ta\"]).apply(null,arguments)};Module[\"cwrap\"]=cwrap;var calledRun;function ExitStatus(status){this.name=\"ExitStatus\";this.message=\"Program terminated with exit(\"+status+\")\";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module[\"calledRun\"]=true;if(ABORT)return;initRuntime();preMain();readyPromiseResolve(Module);if(Module[\"onRuntimeInitialized\"])Module[\"onRuntimeInitialized\"]();postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}}Module[\"run\"]=run;if(Module[\"preInit\"]){if(typeof Module[\"preInit\"]==\"function\")Module[\"preInit\"]=[Module[\"preInit\"]];while(Module[\"preInit\"].length>0){Module[\"preInit\"].pop()()}}run();\n\n\n return WasmBackendModule.ready\n}\n);\n})();\nif (typeof exports === 'object' && typeof module === 'object')\n module.exports = WasmBackendModule;\nelse if (typeof define === 'function' && define['amd'])\n define([], function() { return WasmBackendModule; });\nelse if (typeof exports === 'object')\n exports[\"WasmBackendModule\"] = WasmBackendModule;\n", "// A port of an algorithm by Johannes Baag\u00F8e , 2010\n// http://baagoe.com/en/RandomMusings/javascript/\n// https://github.com/nquinlan/better-random-numbers-for-javascript-mirror\n// Original work is under MIT license -\n\n// Copyright (C) 2010 by Johannes Baag\u00F8e \n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n\n\n(function(global, module, define) {\n\nfunction Alea(seed) {\n var me = this, mash = Mash();\n\n me.next = function() {\n var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32\n me.s0 = me.s1;\n me.s1 = me.s2;\n return me.s2 = t - (me.c = t | 0);\n };\n\n // Apply the seeding algorithm from Baagoe.\n me.c = 1;\n me.s0 = mash(' ');\n me.s1 = mash(' ');\n me.s2 = mash(' ');\n me.s0 -= mash(seed);\n if (me.s0 < 0) { me.s0 += 1; }\n me.s1 -= mash(seed);\n if (me.s1 < 0) { me.s1 += 1; }\n me.s2 -= mash(seed);\n if (me.s2 < 0) { me.s2 += 1; }\n mash = null;\n}\n\nfunction copy(f, t) {\n t.c = f.c;\n t.s0 = f.s0;\n t.s1 = f.s1;\n t.s2 = f.s2;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new Alea(seed),\n state = opts && opts.state,\n prng = xg.next;\n prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }\n prng.double = function() {\n return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53\n };\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nfunction Mash() {\n var n = 0xefc8249d;\n\n var mash = function(data) {\n data = String(data);\n for (var i = 0; i < data.length; i++) {\n n += data.charCodeAt(i);\n var h = 0.02519603282416938 * n;\n n = h >>> 0;\n h -= n;\n h *= n;\n n = h >>> 0;\n h -= n;\n n += h * 0x100000000; // 2^32\n }\n return (n >>> 0) * 2.3283064365386963e-10; // 2^-32\n };\n\n return mash;\n}\n\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.alea = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "// A Javascript implementaion of the \"xor128\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n\n // Set up generator function.\n me.next = function() {\n var t = me.x ^ (me.x << 11);\n me.x = me.y;\n me.y = me.z;\n me.z = me.w;\n return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8);\n };\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor128 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "// A Javascript implementaion of the \"xorwow\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var t = (me.x ^ (me.x >>> 2));\n me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;\n return (me.d = (me.d + 362437 | 0)) +\n (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;\n };\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n me.v = 0;\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n if (k == strseed.length) {\n me.d = me.x << 10 ^ me.x >>> 4;\n }\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n t.v = f.v;\n t.d = f.d;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorwow = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "// A Javascript implementaion of the \"xorshift7\" algorithm by\n// Fran\u00E7ois Panneton and Pierre L'ecuyer:\n// \"On the Xorgshift Random Number Generators\"\n// http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n // Update xor generator.\n var X = me.x, i = me.i, t, v, w;\n t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24);\n t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10);\n t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3);\n t = X[(i + 4) & 7]; v ^= t ^ (t << 7);\n t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9);\n X[i] = v;\n me.i = (i + 1) & 7;\n return v;\n };\n\n function init(me, seed) {\n var j, w, X = [];\n\n if (seed === (seed | 0)) {\n // Seed state array using a 32-bit integer.\n w = X[0] = seed;\n } else {\n // Seed state using a string.\n seed = '' + seed;\n for (j = 0; j < seed.length; ++j) {\n X[j & 7] = (X[j & 7] << 15) ^\n (seed.charCodeAt(j) + X[(j + 1) & 7] << 13);\n }\n }\n // Enforce an array length of 8, not all zeroes.\n while (X.length < 8) X.push(0);\n for (j = 0; j < 8 && X[j] === 0; ++j);\n if (j == 8) w = X[7] = -1; else w = X[j];\n\n me.x = X;\n me.i = 0;\n\n // Discard an initial 256 values.\n for (j = 256; j > 0; --j) {\n me.next();\n }\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.x = f.x.slice();\n t.i = f.i;\n return t;\n}\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.x) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorshift7 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n", "// A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm.\n//\n// This fast non-cryptographic random number generator is designed for\n// use in Monte-Carlo algorithms. It combines a long-period xorshift\n// generator with a Weyl generator, and it passes all common batteries\n// of stasticial tests for randomness while consuming only a few nanoseconds\n// for each prng generated. For background on the generator, see Brent's\n// paper: \"Some long-period random number generators using shifts and xors.\"\n// http://arxiv.org/pdf/1004.3115v1.pdf\n//\n// Usage:\n//\n// var xor4096 = require('xor4096');\n// random = xor4096(1); // Seed with int32 or string.\n// assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits.\n// assert.equal(random.int32(), 1806534897); // signed int32, 32 bits.\n//\n// For nonzero numeric keys, this impelementation provides a sequence\n// identical to that by Brent's xorgens 3 implementaion in C. This\n// implementation also provides for initalizing the generator with\n// string seeds, or for saving and restoring the state of the generator.\n//\n// On Chrome, this prng benchmarks about 2.1 times slower than\n// Javascript's built-in Math.random().\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n var w = me.w,\n X = me.X, i = me.i, t, v;\n // Update Weyl generator.\n me.w = w = (w + 0x61c88647) | 0;\n // Update xor generator.\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n // Update Xor generator array state.\n v = X[i] = v ^ t;\n me.i = i;\n // Result is the combination.\n return (v + (w ^ (w >>> 16))) | 0;\n };\n\n function init(me, seed) {\n var t, v, i, j, w, X = [], limit = 128;\n if (seed === (seed | 0)) {\n // Numeric seeds initialize v, which is used to generates X.\n v = seed;\n seed = null;\n } else {\n // String seeds are mixed into v and X one character at a time.\n seed = seed + '\\0';\n v = 0;\n limit = Math.max(limit, seed.length);\n }\n // Initialize circular array and weyl value.\n for (i = 0, j = -32; j < limit; ++j) {\n // Put the unicode characters into the array, and shuffle them.\n if (seed) v ^= seed.charCodeAt((j + 32) % seed.length);\n // After 32 shuffles, take v as the starting w value.\n if (j === 0) w = v;\n v ^= v << 10;\n v ^= v >>> 15;\n v ^= v << 4;\n v ^= v >>> 13;\n if (j >= 0) {\n w = (w + 0x61c88647) | 0; // Weyl.\n t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array.\n i = (0 == t) ? i + 1 : 0; // Count zeroes.\n }\n }\n // We have detected all zeroes; make the key nonzero.\n if (i >= 128) {\n X[(seed && seed.length || 0) & 127] = -1;\n }\n // Run the generator 512 times to further mix the state before using it.\n // Factoring this as a function slows the main generator, so it is just\n // unrolled here. The weyl generator is not advanced while warming up.\n i = 127;\n for (j = 4 * 128; j > 0; --j) {\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n X[i] = v ^ t;\n }\n // Storing state as object members is faster than using closure variables.\n me.w = w;\n me.X = X;\n me.i = i;\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.i = f.i;\n t.w = f.w;\n t.X = f.X.slice();\n return t;\n};\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.X) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor4096 = impl;\n}\n\n})(\n this, // window object or global\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n", "// A Javascript implementaion of the \"Tyche-i\" prng algorithm by\n// Samuel Neves and Filipe Araujo.\n// See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var b = me.b, c = me.c, d = me.d, a = me.a;\n b = (b << 25) ^ (b >>> 7) ^ c;\n c = (c - d) | 0;\n d = (d << 24) ^ (d >>> 8) ^ a;\n a = (a - b) | 0;\n me.b = b = (b << 20) ^ (b >>> 12) ^ c;\n me.c = c = (c - d) | 0;\n me.d = (d << 16) ^ (c >>> 16) ^ a;\n return me.a = (a - b) | 0;\n };\n\n /* The following is non-inverted tyche, which has better internal\n * bit diffusion, but which is about 25% slower than tyche-i in JS.\n me.next = function() {\n var a = me.a, b = me.b, c = me.c, d = me.d;\n a = (me.a + me.b | 0) >>> 0;\n d = me.d ^ a; d = d << 16 ^ d >>> 16;\n c = me.c + d | 0;\n b = me.b ^ c; b = b << 12 ^ d >>> 20;\n me.a = a = a + b | 0;\n d = d ^ a; me.d = d = d << 8 ^ d >>> 24;\n me.c = c = c + d | 0;\n b = b ^ c;\n return me.b = (b << 7 ^ b >>> 25);\n }\n */\n\n me.a = 0;\n me.b = 0;\n me.c = 2654435769 | 0;\n me.d = 1367130551;\n\n if (seed === Math.floor(seed)) {\n // Integer seed.\n me.a = (seed / 0x100000000) | 0;\n me.b = seed | 0;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 20; k++) {\n me.b ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.a = f.a;\n t.b = f.b;\n t.c = f.c;\n t.d = f.d;\n return t;\n};\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.tychei = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n", "/*\nCopyright 2019 David Bau.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\n\n(function (global, pool, math) {\n//\n// The following constants are related to IEEE 754 limits.\n//\n\nvar width = 256, // each RC4 output is 0 <= x < 256\n chunks = 6, // at least six RC4 outputs for each double\n digits = 52, // there are 52 significant digits in a double\n rngname = 'random', // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto; // node.js crypto module, initialized at the bottom.\n\n//\n// seedrandom()\n// This is the seedrandom function described above.\n//\nfunction seedrandom(seed, options, callback) {\n var key = [];\n options = (options == true) ? { entropy: true } : (options || {});\n\n // Flatten the seed string or build one from local entropy if needed.\n var shortseed = mixkey(flatten(\n options.entropy ? [seed, tostring(pool)] :\n (seed == null) ? autoseed() : seed, 3), key);\n\n // Use the seed to initialize an ARC4 generator.\n var arc4 = new ARC4(key);\n\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n var prng = function() {\n var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48\n d = startdenom, // and denominator d = 2 ^ 48.\n x = 0; // and no 'extra last byte'.\n while (n < significance) { // Fill up all significant digits by\n n = (n + x) * width; // shifting numerator and\n d *= width; // denominator and generating a\n x = arc4.g(1); // new least-significant-byte.\n }\n while (n >= overflow) { // To avoid rounding up, before adding\n n /= 2; // last byte, shift everything\n d /= 2; // right using integer math until\n x >>>= 1; // we have exactly the desired bits.\n }\n return (n + x) / d; // Form the number within [0, 1).\n };\n\n prng.int32 = function() { return arc4.g(4) | 0; }\n prng.quick = function() { return arc4.g(4) / 0x100000000; }\n prng.double = prng;\n\n // Mix the randomness into accumulated entropy.\n mixkey(tostring(arc4.S), pool);\n\n // Calling convention: what to return as a function of prng, seed, is_math.\n return (options.pass || callback ||\n function(prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) { copy(state, arc4); }\n // Only provide the .state method if requested via options.state.\n prng.state = function() { return copy(arc4, {}); }\n }\n\n // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n if (is_math_call) { math[rngname] = prng; return seed; }\n\n // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng;\n })(\n prng,\n shortseed,\n 'global' in options ? options.global : (this == math),\n options.state);\n}\n\n//\n// ARC4\n//\n// An ARC4 implementation. The constructor takes a key in the form of\n// an array of at most (width) integers that should be 0 <= x < (width).\n//\n// The g(count) method returns a pseudorandom integer that concatenates\n// the next (count) outputs from ARC4. Its return value is a number x\n// that is in the range 0 <= x < (width ^ count).\n//\nfunction ARC4(key) {\n var t, keylen = key.length,\n me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];\n\n // The empty key [] is treated as [0].\n if (!keylen) { key = [keylen++]; }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n s[i] = i++;\n }\n for (i = 0; i < width; i++) {\n s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];\n s[j] = t;\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n (me.g = function(count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t, r = 0,\n i = me.i, j = me.j, s = me.S;\n while (count--) {\n t = s[i = mask & (i + 1)];\n r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];\n }\n me.i = i; me.j = j;\n return r;\n // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n })(width);\n}\n\n//\n// copy()\n// Copies internal state of ARC4 to or from a plain object.\n//\nfunction copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n};\n\n//\n// flatten()\n// Converts an object tree to nested arrays of strings.\n//\nfunction flatten(obj, depth) {\n var result = [], typ = (typeof obj), prop;\n if (depth && typ == 'object') {\n for (prop in obj) {\n try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}\n }\n }\n return (result.length ? result : typ == 'string' ? obj : obj + '\\0');\n}\n\n//\n// mixkey()\n// Mixes a string seed into a key that is an array of integers, and\n// returns a shortened string seed that is equivalent to the result key.\n//\nfunction mixkey(seed, key) {\n var stringseed = seed + '', smear, j = 0;\n while (j < stringseed.length) {\n key[mask & j] =\n mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));\n }\n return tostring(key);\n}\n\n//\n// autoseed()\n// Returns an object for autoseeding, using window.crypto and Node crypto\n// module if available.\n//\nfunction autoseed() {\n try {\n var out;\n if (nodecrypto && (out = nodecrypto.randomBytes)) {\n // The use of 'out' to remember randomBytes makes tight minified code.\n out = out(width);\n } else {\n out = new Uint8Array(width);\n (global.crypto || global.msCrypto).getRandomValues(out);\n }\n return tostring(out);\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins;\n return [+new Date, global, plugins, global.screen, tostring(pool)];\n }\n}\n\n//\n// tostring()\n// Converts an array of charcodes to a string\n//\nfunction tostring(a) {\n return String.fromCharCode.apply(0, a);\n}\n\n//\n// When seedrandom.js is loaded, we immediately mix a few bits\n// from the built-in RNG into the entropy pool. Because we do\n// not want to interfere with deterministic PRNG state later,\n// seedrandom will not call math.random on its own again after\n// initialization.\n//\nmixkey(math.random(), pool);\n\n//\n// Nodejs and AMD support: export the implementation as a module using\n// either convention.\n//\nif ((typeof module) == 'object' && module.exports) {\n module.exports = seedrandom;\n // When in node.js, try using crypto package for autoseeding.\n try {\n nodecrypto = require('crypto');\n } catch (ex) {}\n} else if ((typeof define) == 'function' && define.amd) {\n define(function() { return seedrandom; });\n} else {\n // When included as a plain script, set up Math.seedrandom global.\n math['seed' + rngname] = seedrandom;\n}\n\n\n// End anonymous scope, and pass initial values.\n})(\n // global: `self` in browsers (including strict mode and web workers),\n // otherwise `this` in Node and other environments\n (typeof self !== 'undefined') ? self : this,\n [], // pool: entropy pool starts empty\n Math // math: package containing random, pow, and seedrandom\n);\n", "// A library of seedable RNGs implemented in Javascript.\n//\n// Usage:\n//\n// var seedrandom = require('seedrandom');\n// var random = seedrandom(1); // or any seed.\n// var x = random(); // 0 <= x < 1. Every bit is random.\n// var x = random.quick(); // 0 <= x < 1. 32 bits of randomness.\n\n// alea, a 53-bit multiply-with-carry generator by Johannes Baag\u00F8e.\n// Period: ~2^116\n// Reported to pass all BigCrush tests.\nvar alea = require('./lib/alea');\n\n// xor128, a pure xor-shift generator by George Marsaglia.\n// Period: 2^128-1.\n// Reported to fail: MatrixRank and LinearComp.\nvar xor128 = require('./lib/xor128');\n\n// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.\n// Period: 2^192-2^32\n// Reported to fail: CollisionOver, SimpPoker, and LinearComp.\nvar xorwow = require('./lib/xorwow');\n\n// xorshift7, by Fran\u00E7ois Panneton and Pierre L'ecuyer, takes\n// a different approach: it adds robustness by allowing more shifts\n// than Marsaglia's original three. It is a 7-shift generator\n// with 256 bits, that passes BigCrush with no systmatic failures.\n// Period 2^256-1.\n// No systematic BigCrush failures reported.\nvar xorshift7 = require('./lib/xorshift7');\n\n// xor4096, by Richard Brent, is a 4096-bit xor-shift with a\n// very long period that also adds a Weyl generator. It also passes\n// BigCrush with no systematic failures. Its long period may\n// be useful if you have many generators and need to avoid\n// collisions.\n// Period: 2^4128-2^32.\n// No systematic BigCrush failures reported.\nvar xor4096 = require('./lib/xor4096');\n\n// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random\n// number generator derived from ChaCha, a modern stream cipher.\n// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n// Period: ~2^127\n// No systematic BigCrush failures reported.\nvar tychei = require('./lib/tychei');\n\n// The original ARC4-based prng included in this library.\n// Period: ~2^1600\nvar sr = require('./seedrandom');\n\nsr.alea = alea;\nsr.xor128 = xor128;\nsr.xorwow = xorwow;\nsr.xorshift7 = xorshift7;\nsr.xor4096 = xor4096;\nsr.tychei = tychei;\n\nmodule.exports = sr;\n", "", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Backend, DataId} from '../tensor';\nimport {BackendValues, DataType} from '../types';\n\nexport const EPSILON_FLOAT32 = 1e-7;\nexport const EPSILON_FLOAT16 = 1e-4;\n\n// Required information for all backends.\nexport interface BackendTimingInfo {\n kernelMs: number|{error: string};\n getExtraProfileInfo?(): string; // a field for additional timing information\n // e.g. packing / unpacking for WebGL backend\n}\n\nexport interface TensorStorage {\n read(dataId: DataId): Promise;\n readSync(dataId: DataId): BackendValues;\n disposeData(dataId: DataId, force?: boolean): boolean;\n write(values: BackendValues, shape: number[], dtype: DataType): DataId;\n move(\n dataId: DataId, values: BackendValues, shape: number[], dtype: DataType,\n refCount: number): void;\n memory(): {unreliable: boolean;}; // Backend-specific information.\n /** Returns number of data ids currently in the storage. */\n numDataIds(): number;\n refCount(dataId: DataId): number;\n}\n\n/** Convenient class for storing tensor-related data. */\nexport class DataStorage {\n private data = new WeakMap();\n private dataIdsCount = 0;\n\n constructor(private backend: KernelBackend, private dataMover: DataMover) {}\n\n get(dataId: DataId) {\n if (!this.data.has(dataId)) {\n this.dataMover.moveData(this.backend, dataId);\n }\n return this.data.get(dataId);\n }\n\n set(dataId: DataId, value: T): void {\n this.dataIdsCount++;\n this.data.set(dataId, value);\n }\n\n has(dataId: DataId): boolean {\n return this.data.has(dataId);\n }\n\n delete(dataId: DataId): boolean {\n this.dataIdsCount--;\n return this.data.delete(dataId);\n }\n\n numDataIds(): number {\n return this.dataIdsCount;\n }\n}\n\nexport interface DataMover {\n /**\n * To be called by backends whenever they see a dataId that they don't own.\n * Upon calling this method, the mover will fetch the tensor from another\n * backend and register it with the current active backend.\n */\n moveData(backend: KernelBackend, dataId: DataId): void;\n}\n\nexport interface BackendTimer {\n // check if backend timer is available\n timerAvailable(): boolean;\n time(f: () => void): Promise;\n}\n\n/**\n * The interface that defines the kernels that should be implemented when\n * adding a new backend. New backends don't need to implement every one of the\n * methods, this can be done gradually (throw an error for unimplemented\n * methods).\n */\nexport class KernelBackend implements TensorStorage, Backend, BackendTimer {\n refCount(dataId: DataId): number {\n return notYetImplemented('refCount');\n }\n incRef(dataId: DataId): void {\n return notYetImplemented('incRef');\n }\n timerAvailable(): boolean {\n return true;\n }\n time(f: () => void): Promise {\n return notYetImplemented('time');\n }\n read(dataId: object): Promise {\n return notYetImplemented('read');\n }\n readSync(dataId: object): BackendValues {\n return notYetImplemented('readSync');\n }\n numDataIds(): number {\n return notYetImplemented('numDataIds');\n }\n disposeData(dataId: object, force?: boolean): boolean {\n return notYetImplemented('disposeData');\n }\n write(values: BackendValues, shape: number[], dtype: DataType): DataId {\n return notYetImplemented('write');\n }\n move(\n dataId: DataId, values: BackendValues, shape: number[], dtype: DataType,\n refCount: number): void {\n return notYetImplemented('move');\n }\n memory(): {unreliable: boolean; reasons?: string[]} {\n return notYetImplemented('memory');\n }\n /** Returns the highest precision for floats in bits (e.g. 16 or 32) */\n floatPrecision(): 16|32 {\n return notYetImplemented('floatPrecision');\n }\n /** Returns the smallest representable number. */\n epsilon(): number {\n return this.floatPrecision() === 32 ? EPSILON_FLOAT32 : EPSILON_FLOAT16;\n }\n dispose(): void {\n return notYetImplemented('dispose');\n }\n}\n\nfunction notYetImplemented(kernelName: string): never {\n throw new Error(\n `'${kernelName}' not yet implemented or not found in the registry. ` +\n `This kernel may not be supported by the tfjs backend you have chosen`);\n}\n", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, DataTypeMap, FlatVector, NumericDataType, RecursiveArray, TensorLike, TypedArray} from './types';\n\n/**\n * Shuffles the array in-place using Fisher-Yates algorithm.\n *\n * ```js\n * const a = [1, 2, 3, 4, 5];\n * tf.util.shuffle(a);\n * console.log(a);\n * ```\n *\n * @param array The array to shuffle in-place.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\n// tslint:disable-next-line:no-any\nexport function shuffle(array: any[]|Uint32Array|Int32Array|\n Float32Array): void {\n let counter = array.length;\n let temp = 0;\n let index = 0;\n // While there are elements in the array\n while (counter > 0) {\n // Pick a random index\n index = (Math.random() * counter) | 0;\n // Decrease counter by 1\n counter--;\n // And swap the last element with it\n temp = array[counter];\n array[counter] = array[index];\n array[index] = temp;\n }\n}\n\n/**\n * Shuffles two arrays in-place the same way using Fisher-Yates algorithm.\n *\n * ```js\n * const a = [1,2,3,4,5];\n * const b = [11,22,33,44,55];\n * tf.util.shuffleCombo(a, b);\n * console.log(a, b);\n * ```\n *\n * @param array The first array to shuffle in-place.\n * @param array2 The second array to shuffle in-place with the same permutation\n * as the first array.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function shuffleCombo(\n // tslint:disable-next-line:no-any\n array: any[]|Uint32Array|Int32Array|Float32Array,\n // tslint:disable-next-line:no-any\n array2: any[]|Uint32Array|Int32Array|Float32Array): void {\n if (array.length !== array2.length) {\n throw new Error(\n `Array sizes must match to be shuffled together ` +\n `First array length was ${array.length}` +\n `Second array length was ${array2.length}`);\n }\n let counter = array.length;\n let temp, temp2;\n let index = 0;\n // While there are elements in the array\n while (counter > 0) {\n // Pick a random index\n index = (Math.random() * counter) | 0;\n // Decrease counter by 1\n counter--;\n // And swap the last element of each array with it\n temp = array[counter];\n temp2 = array2[counter];\n array[counter] = array[index];\n array2[counter] = array2[index];\n array[index] = temp;\n array2[index] = temp2;\n }\n}\n\n/** Clamps a value to a specified range. */\nexport function clamp(min: number, x: number, max: number): number {\n return Math.max(min, Math.min(x, max));\n}\n\nexport function nearestLargerEven(val: number): number {\n return val % 2 === 0 ? val : val + 1;\n}\n\nexport function sum(arr: number[]): number {\n let sum = 0;\n for (let i = 0; i < arr.length; i++) {\n sum += arr[i];\n }\n return sum;\n}\n\n/**\n * Returns a sample from a uniform [a, b) distribution.\n *\n * @param a The minimum support (inclusive).\n * @param b The maximum support (exclusive).\n * @return A pseudorandom number on the half-open interval [a,b).\n */\nexport function randUniform(a: number, b: number) {\n const r = Math.random();\n return (b * r) + (1 - r) * a;\n}\n\n/** Returns the squared Euclidean distance between two vectors. */\nexport function distSquared(a: FlatVector, b: FlatVector): number {\n let result = 0;\n for (let i = 0; i < a.length; i++) {\n const diff = Number(a[i]) - Number(b[i]);\n result += diff * diff;\n }\n return result;\n}\n\n/**\n * Asserts that the expression is true. Otherwise throws an error with the\n * provided message.\n *\n * ```js\n * const x = 2;\n * tf.util.assert(x === 2, 'x is not 2');\n * ```\n *\n * @param expr The expression to assert (as a boolean).\n * @param msg A function that returns the message to report when throwing an\n * error. We use a function for performance reasons.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function assert(expr: boolean, msg: () => string) {\n if (!expr) {\n throw new Error(typeof msg === 'string' ? msg : msg());\n }\n}\n\nexport function assertShapesMatch(\n shapeA: number[], shapeB: number[], errorMessagePrefix = ''): void {\n assert(\n arraysEqual(shapeA, shapeB),\n () => errorMessagePrefix + ` Shapes ${shapeA} and ${shapeB} must match`);\n}\n\nexport function assertNonNull(a: TensorLike): void {\n assert(\n a != null,\n () => `The input to the tensor constructor must be a non-null value.`);\n}\n\n// NOTE: We explicitly type out what T extends instead of any so that\n// util.flatten on a nested array of number doesn't try to infer T as a\n// number[][], causing us to explicitly type util.flatten().\n/**\n * Flattens an arbitrarily nested array.\n *\n * ```js\n * const a = [[1, 2], [3, 4], [5, [6, [7]]]];\n * const flat = tf.util.flatten(a);\n * console.log(flat);\n * ```\n *\n * @param arr The nested array to flatten.\n * @param result The destination array which holds the elements.\n * @param skipTypedArray If true, avoids flattening the typed arrays. Defaults\n * to false.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function\nflatten|TypedArray>(\n arr: T|RecursiveArray, result: T[] = [], skipTypedArray = false): T[] {\n if (result == null) {\n result = [];\n }\n if (Array.isArray(arr) || isTypedArray(arr) && !skipTypedArray) {\n for (let i = 0; i < arr.length; ++i) {\n flatten(arr[i], result, skipTypedArray);\n }\n } else {\n result.push(arr as T);\n }\n return result;\n}\n\n/**\n * Returns the size (number of elements) of the tensor given its shape.\n *\n * ```js\n * const shape = [3, 4, 2];\n * const size = tf.util.sizeFromShape(shape);\n * console.log(size);\n * ```\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function sizeFromShape(shape: number[]): number {\n if (shape.length === 0) {\n // Scalar.\n return 1;\n }\n let size = shape[0];\n for (let i = 1; i < shape.length; i++) {\n size *= shape[i];\n }\n return size;\n}\n\nexport function isScalarShape(shape: number[]): boolean {\n return shape.length === 0;\n}\n\nexport function arraysEqual(n1: FlatVector, n2: FlatVector) {\n if (n1 === n2) {\n return true;\n }\n if (n1 == null || n2 == null) {\n return false;\n }\n\n if (n1.length !== n2.length) {\n return false;\n }\n for (let i = 0; i < n1.length; i++) {\n if (n1[i] !== n2[i]) {\n return false;\n }\n }\n return true;\n}\n\nexport function isInt(a: number): boolean {\n return a % 1 === 0;\n}\n\nexport function tanh(x: number): number {\n // tslint:disable-next-line:no-any\n if ((Math as any).tanh != null) {\n // tslint:disable-next-line:no-any\n return (Math as any).tanh(x);\n }\n if (x === Infinity) {\n return 1;\n } else if (x === -Infinity) {\n return -1;\n } else {\n const e2x = Math.exp(2 * x);\n return (e2x - 1) / (e2x + 1);\n }\n}\n\nexport function sizeToSquarishShape(size: number): [number, number] {\n const width = Math.ceil(Math.sqrt(size));\n return [width, Math.ceil(size / width)];\n}\n\n/**\n * Creates a new array with randomized indicies to a given quantity.\n *\n * ```js\n * const randomTen = tf.util.createShuffledIndices(10);\n * console.log(randomTen);\n * ```\n *\n * @param number Quantity of how many shuffled indicies to create.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function createShuffledIndices(n: number): Uint32Array {\n const shuffledIndices = new Uint32Array(n);\n for (let i = 0; i < n; ++i) {\n shuffledIndices[i] = i;\n }\n shuffle(shuffledIndices);\n return shuffledIndices;\n}\n\nexport function rightPad(a: string, size: number): string {\n if (size <= a.length) {\n return a;\n }\n return a + ' '.repeat(size - a.length);\n}\n\nexport function repeatedTry(\n checkFn: () => boolean, delayFn = (counter: number) => 0,\n maxCounter?: number): Promise {\n return new Promise((resolve, reject) => {\n let tryCount = 0;\n\n const tryFn = () => {\n if (checkFn()) {\n resolve();\n return;\n }\n\n tryCount++;\n\n const nextBackoff = delayFn(tryCount);\n\n if (maxCounter != null && tryCount >= maxCounter) {\n reject();\n return;\n }\n setTimeout(tryFn, nextBackoff);\n };\n\n tryFn();\n });\n}\n\n/**\n * Given the full size of the array and a shape that may contain -1 as the\n * implicit dimension, returns the inferred shape where -1 is replaced.\n * E.g. For shape=[2, -1, 3] and size=24, it will return [2, 4, 3].\n *\n * @param shape The shape, which may contain -1 in some dimension.\n * @param size The full size (number of elements) of the array.\n * @return The inferred shape where -1 is replaced with the inferred size.\n */\nexport function inferFromImplicitShape(\n shape: number[], size: number): number[] {\n let shapeProd = 1;\n let implicitIdx = -1;\n\n for (let i = 0; i < shape.length; ++i) {\n if (shape[i] >= 0) {\n shapeProd *= shape[i];\n } else if (shape[i] === -1) {\n if (implicitIdx !== -1) {\n throw Error(\n `Shapes can only have 1 implicit size. ` +\n `Found -1 at dim ${implicitIdx} and dim ${i}`);\n }\n implicitIdx = i;\n } else if (shape[i] < 0) {\n throw Error(`Shapes can not be < 0. Found ${shape[i]} at dim ${i}`);\n }\n }\n\n if (implicitIdx === -1) {\n if (size > 0 && size !== shapeProd) {\n throw Error(`Size(${size}) must match the product of shape ${shape}`);\n }\n return shape;\n }\n\n if (shapeProd === 0) {\n throw Error(\n `Cannot infer the missing size in [${shape}] when ` +\n `there are 0 elements`);\n }\n if (size % shapeProd !== 0) {\n throw Error(\n `The implicit shape can't be a fractional number. ` +\n `Got ${size} / ${shapeProd}`);\n }\n\n const newShape = shape.slice();\n newShape[implicitIdx] = size / shapeProd;\n return newShape;\n}\n\nexport function parseAxisParam(\n axis: number|number[], shape: number[]): number[] {\n const rank = shape.length;\n\n // Normalize input\n axis = axis == null ? shape.map((s, i) => i) : [].concat(axis);\n\n // Check for valid range\n assert(\n axis.every(ax => ax >= -rank && ax < rank),\n () =>\n `All values in axis param must be in range [-${rank}, ${rank}) but ` +\n `got axis ${axis}`);\n\n // Check for only integers\n assert(\n axis.every(ax => isInt(ax)),\n () => `All values in axis param must be integers but ` +\n `got axis ${axis}`);\n\n // Handle negative axis.\n return axis.map(a => a < 0 ? rank + a : a);\n}\n\n/** Reduces the shape by removing all dimensions of shape 1. */\nexport function squeezeShape(shape: number[], axis?: number[]):\n {newShape: number[], keptDims: number[]} {\n const newShape: number[] = [];\n const keptDims: number[] = [];\n const isEmptyArray = axis != null && Array.isArray(axis) && axis.length === 0;\n const axes = (axis == null || isEmptyArray) ?\n null :\n parseAxisParam(axis, shape).sort();\n let j = 0;\n for (let i = 0; i < shape.length; ++i) {\n if (axes != null) {\n if (axes[j] === i && shape[i] !== 1) {\n throw new Error(\n `Can't squeeze axis ${i} since its dim '${shape[i]}' is not 1`);\n }\n if ((axes[j] == null || axes[j] > i) && shape[i] === 1) {\n newShape.push(shape[i]);\n keptDims.push(i);\n }\n if (axes[j] <= i) {\n j++;\n }\n }\n if (shape[i] !== 1) {\n newShape.push(shape[i]);\n keptDims.push(i);\n }\n }\n return {newShape, keptDims};\n}\n\nexport function getTypedArrayFromDType(\n dtype: D, size: number): DataTypeMap[D] {\n let values = null;\n if (dtype == null || dtype === 'float32') {\n values = new Float32Array(size);\n } else if (dtype === 'int32') {\n values = new Int32Array(size);\n } else if (dtype === 'bool') {\n values = new Uint8Array(size);\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n return values as DataTypeMap[D];\n}\n\nexport function getArrayFromDType(\n dtype: D, size: number): DataTypeMap[D] {\n let values = null;\n if (dtype == null || dtype === 'float32') {\n values = new Float32Array(size);\n } else if (dtype === 'int32') {\n values = new Int32Array(size);\n } else if (dtype === 'bool') {\n values = new Uint8Array(size);\n } else if (dtype === 'string') {\n values = new Array<'string'>(size);\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n return values as DataTypeMap[D];\n}\n\nexport function checkConversionForErrors(\n vals: DataTypeMap[D]|number[], dtype: D): void {\n for (let i = 0; i < vals.length; i++) {\n const num = vals[i] as number;\n if (isNaN(num) || !isFinite(num)) {\n throw Error(`A tensor of type ${dtype} being uploaded contains ${num}.`);\n }\n }\n}\n\n/** Returns true if the dtype is valid. */\nexport function isValidDtype(dtype: DataType): boolean {\n return dtype === 'bool' || dtype === 'complex64' || dtype === 'float32' ||\n dtype === 'int32' || dtype === 'string';\n}\n\n/**\n * Returns true if the new type can't encode the old type without loss of\n * precision.\n */\nexport function hasEncodingLoss(oldType: DataType, newType: DataType): boolean {\n if (newType === 'complex64') {\n return false;\n }\n if (newType === 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'int32' && oldType !== 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'bool' && oldType === 'bool') {\n return false;\n }\n return true;\n}\n\nexport function isTypedArray(a: {}): a is Float32Array|Int32Array|Uint8Array {\n return a instanceof Float32Array || a instanceof Int32Array ||\n a instanceof Uint8Array;\n}\n\nexport function bytesPerElement(dtype: DataType): number {\n if (dtype === 'float32' || dtype === 'int32') {\n return 4;\n } else if (dtype === 'complex64') {\n return 8;\n } else if (dtype === 'bool') {\n return 1;\n } else {\n throw new Error(`Unknown dtype ${dtype}`);\n }\n}\n\n/**\n * Returns the approximate number of bytes allocated in the string array - 2\n * bytes per character. Computing the exact bytes for a native string in JS is\n * not possible since it depends on the encoding of the html page that serves\n * the website.\n */\nexport function bytesFromStringArray(arr: Uint8Array[]): number {\n if (arr == null) {\n return 0;\n }\n let bytes = 0;\n arr.forEach(x => bytes += x.length);\n return bytes;\n}\n\n/** Returns true if the value is a string. */\nexport function isString(value: {}): value is string {\n return typeof value === 'string' || value instanceof String;\n}\n\nexport function isBoolean(value: {}): boolean {\n return typeof value === 'boolean';\n}\n\nexport function isNumber(value: {}): boolean {\n return typeof value === 'number';\n}\n\nexport function inferDtype(values: TensorLike): DataType {\n if (Array.isArray(values)) {\n return inferDtype(values[0]);\n }\n if (values instanceof Float32Array) {\n return 'float32';\n } else if (values instanceof Int32Array || values instanceof Uint8Array) {\n return 'int32';\n } else if (isNumber(values)) {\n return 'float32';\n } else if (isString(values)) {\n return 'string';\n } else if (isBoolean(values)) {\n return 'bool';\n }\n return 'float32';\n}\n\nexport function isFunction(f: Function) {\n return !!(f && f.constructor && f.call && f.apply);\n}\n\nexport function nearestDivisor(size: number, start: number): number {\n for (let i = start; i < size; ++i) {\n if (size % i === 0) {\n return i;\n }\n }\n return size;\n}\n\nexport function computeStrides(shape: number[]): number[] {\n const rank = shape.length;\n if (rank < 2) {\n return [];\n }\n\n // Last dimension has implicit stride of 1, thus having D-1 (instead of D)\n // strides.\n const strides = new Array(rank - 1);\n strides[rank - 2] = shape[rank - 1];\n for (let i = rank - 3; i >= 0; --i) {\n strides[i] = strides[i + 1] * shape[i + 1];\n }\n return strides;\n}\n\nfunction createNestedArray(\n offset: number, shape: number[], a: TypedArray, isComplex = false) {\n const ret = new Array();\n if (shape.length === 1) {\n const d = shape[0] * (isComplex ? 2 : 1);\n for (let i = 0; i < d; i++) {\n ret[i] = a[offset + i];\n }\n } else {\n const d = shape[0];\n const rest = shape.slice(1);\n const len = rest.reduce((acc, c) => acc * c) * (isComplex ? 2 : 1);\n for (let i = 0; i < d; i++) {\n ret[i] = createNestedArray(offset + i * len, rest, a, isComplex);\n }\n }\n return ret;\n}\n\n// Provide a nested array of TypedArray in given shape.\nexport function toNestedArray(\n shape: number[], a: TypedArray, isComplex = false) {\n if (shape.length === 0) {\n // Scalar type should return a single number.\n return a[0];\n }\n const size = shape.reduce((acc, c) => acc * c) * (isComplex ? 2 : 1);\n if (size === 0) {\n // A tensor with shape zero should be turned into empty list.\n return [];\n }\n if (size !== a.length) {\n throw new Error(`[${shape}] does not match the input size ${a.length}${\n isComplex ? ' for a complex tensor' : ''}.`);\n }\n\n return createNestedArray(0, shape, a, isComplex);\n}\n\nexport function makeOnesTypedArray(\n size: number, dtype: D): DataTypeMap[D] {\n const array = makeZerosTypedArray(size, dtype);\n for (let i = 0; i < array.length; i++) {\n array[i] = 1;\n }\n return array;\n}\n\nexport function makeZerosTypedArray(\n size: number, dtype: D): DataTypeMap[D] {\n if (dtype == null || dtype === 'float32' || dtype === 'complex64') {\n return new Float32Array(size) as DataTypeMap[D];\n } else if (dtype === 'int32') {\n return new Int32Array(size) as DataTypeMap[D];\n } else if (dtype === 'bool') {\n return new Uint8Array(size) as DataTypeMap[D];\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n}\n\n/**\n * Make nested `TypedArray` filled with zeros.\n * @param shape The shape information for the nested array.\n * @param dtype dtype of the array element.\n */\nexport function makeZerosNestedTypedArray(\n shape: number[], dtype: D) {\n const size = shape.reduce((prev, curr) => prev * curr, 1);\n if (dtype == null || dtype === 'float32') {\n return toNestedArray(shape, new Float32Array(size));\n } else if (dtype === 'int32') {\n return toNestedArray(shape, new Int32Array(size));\n } else if (dtype === 'bool') {\n return toNestedArray(shape, new Uint8Array(size));\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n}\n\nexport function assertNonNegativeIntegerDimensions(shape: number[]) {\n shape.forEach(dimSize => {\n assert(\n Number.isInteger(dimSize) && dimSize >= 0,\n () =>\n `Tensor must have a shape comprised of positive integers but got ` +\n `shape [${shape}].`);\n });\n}\n\n/**\n * Computes flat index for a given location (multidimentionsal index) in a\n * Tensor/multidimensional array.\n *\n * @param locs Location in the tensor.\n * @param rank Rank of the tensor.\n * @param strides Tensor strides.\n */\nexport function locToIndex(\n locs: number[], rank: number, strides: number[]): number {\n if (rank === 0) {\n return 0;\n } else if (rank === 1) {\n return locs[0];\n }\n let index = locs[locs.length - 1];\n for (let i = 0; i < locs.length - 1; ++i) {\n index += strides[i] * locs[i];\n }\n return index;\n}\n\n/**\n * Computes the location (multidimensional index) in a tensor/multidimentional\n * array for a given flat index.\n *\n * @param index Index in flat array.\n * @param rank Rank of tensor.\n * @param strides Strides of tensor.\n */\nexport function indexToLoc(\n index: number, rank: number, strides: number[]): number[] {\n if (rank === 0) {\n return [];\n } else if (rank === 1) {\n return [index];\n }\n const locs: number[] = new Array(rank);\n for (let i = 0; i < locs.length - 1; ++i) {\n locs[i] = Math.floor(index / strides[i]);\n index -= locs[i] * strides[i];\n }\n locs[locs.length - 1] = index;\n return locs;\n}\n\n/**\n * This method asserts whether an object is a Promise instance.\n * @param object\n */\n// tslint:disable-next-line: no-any\nexport function isPromise(object: any) {\n // We chose to not use 'obj instanceOf Promise' for two reasons:\n // 1. It only reliably works for es6 Promise, not other Promise\n // implementations.\n // 2. It doesn't work with framework that uses zone.js. zone.js monkey patch\n // the async calls, so it is possible the obj (patched) is comparing to a\n // pre-patched Promise.\n return object && object.then && typeof object.then === 'function';\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Platform} from './platforms/platform';\nimport {isPromise} from './util_base';\n\n// Expects flags from URL in the format ?tfjsflags=FLAG1:1,FLAG2:true.\nconst TENSORFLOWJS_FLAGS_PREFIX = 'tfjsflags';\n\ntype FlagValue = number|boolean;\ntype FlagEvaluationFn = (() => FlagValue)|(() => Promise);\nexport type Flags = {\n [featureName: string]: FlagValue\n};\nexport type FlagRegistryEntry = {\n evaluationFn: FlagEvaluationFn;\n setHook?: (value: FlagValue) => void;\n};\n\n/**\n * The environment contains evaluated flags as well as the registered platform.\n * This is always used as a global singleton and can be retrieved with\n * `tf.env()`.\n *\n * @doc {heading: 'Environment'}\n */\nexport class Environment {\n private flags: Flags = {};\n private flagRegistry: {[flagName: string]: FlagRegistryEntry} = {};\n\n private urlFlags: Flags = {};\n\n platformName: string;\n platform: Platform;\n\n // Jasmine spies on this in 'environment_test.ts'\n getQueryParams = getQueryParams;\n\n // tslint:disable-next-line: no-any\n constructor(public global: any) {\n this.populateURLFlags();\n }\n\n setPlatform(platformName: string, platform: Platform) {\n if (this.platform != null) {\n console.warn(\n `Platform ${this.platformName} has already been set. ` +\n `Overwriting the platform with ${platform}.`);\n }\n this.platformName = platformName;\n this.platform = platform;\n }\n\n registerFlag(\n flagName: string, evaluationFn: FlagEvaluationFn,\n setHook?: (value: FlagValue) => void) {\n this.flagRegistry[flagName] = {evaluationFn, setHook};\n\n // Override the flag value from the URL. This has to happen here because the\n // environment is initialized before flags get registered.\n if (this.urlFlags[flagName] != null) {\n const flagValue = this.urlFlags[flagName];\n console.warn(\n `Setting feature override from URL ${flagName}: ${flagValue}.`);\n this.set(flagName, flagValue);\n }\n }\n\n async getAsync(flagName: string): Promise {\n if (flagName in this.flags) {\n return this.flags[flagName];\n }\n\n this.flags[flagName] = await this.evaluateFlag(flagName);\n return this.flags[flagName];\n }\n\n get(flagName: string): FlagValue {\n if (flagName in this.flags) {\n return this.flags[flagName];\n }\n\n const flagValue = this.evaluateFlag(flagName);\n if (isPromise(flagValue)) {\n throw new Error(\n `Flag ${flagName} cannot be synchronously evaluated. ` +\n `Please use getAsync() instead.`);\n }\n\n this.flags[flagName] = flagValue as number | boolean;\n\n return this.flags[flagName];\n }\n\n getNumber(flagName: string): number {\n return this.get(flagName) as number;\n }\n\n getBool(flagName: string): boolean {\n return this.get(flagName) as boolean;\n }\n\n getFlags(): Flags {\n return this.flags;\n }\n // For backwards compatibility.\n get features(): Flags {\n return this.flags;\n }\n\n set(flagName: string, value: FlagValue): void {\n if (this.flagRegistry[flagName] == null) {\n throw new Error(\n `Cannot set flag ${flagName} as it has not been registered.`);\n }\n this.flags[flagName] = value;\n if (this.flagRegistry[flagName].setHook != null) {\n this.flagRegistry[flagName].setHook(value);\n }\n }\n\n private evaluateFlag(flagName: string): FlagValue|Promise {\n if (this.flagRegistry[flagName] == null) {\n throw new Error(\n `Cannot evaluate flag '${flagName}': no evaluation function found.`);\n }\n return this.flagRegistry[flagName].evaluationFn();\n }\n\n setFlags(flags: Flags) {\n this.flags = Object.assign({}, flags);\n }\n\n reset() {\n this.flags = {};\n this.urlFlags = {};\n this.populateURLFlags();\n }\n\n private populateURLFlags(): void {\n if (typeof this.global === 'undefined' ||\n typeof this.global.location === 'undefined' ||\n typeof this.global.location.search === 'undefined') {\n return;\n }\n\n const urlParams = this.getQueryParams(this.global.location.search);\n if (TENSORFLOWJS_FLAGS_PREFIX in urlParams) {\n const keyValues = urlParams[TENSORFLOWJS_FLAGS_PREFIX].split(',');\n keyValues.forEach(keyValue => {\n const [key, value] = keyValue.split(':') as [string, string];\n this.urlFlags[key] = parseValue(key, value);\n });\n }\n }\n}\n\nexport function getQueryParams(queryString: string): {[key: string]: string} {\n const params = {};\n queryString.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g, (s, ...t) => {\n decodeParam(params, t[0], t[1]);\n return t.join('=');\n });\n return params;\n}\n\nfunction decodeParam(\n params: {[key: string]: string}, name: string, value?: string) {\n params[decodeURIComponent(name)] = decodeURIComponent(value || '');\n}\n\nfunction parseValue(flagName: string, value: string): FlagValue {\n value = value.toLowerCase();\n if (value === 'true' || value === 'false') {\n return value === 'true';\n } else if (`${+ value}` === value) {\n return +value;\n }\n throw new Error(\n `Could not parse value flag value ${value} for flag ${flagName}.`);\n}\n\n/**\n * Returns the current environment (a global singleton).\n *\n * The environment object contains the evaluated feature values as well as the\n * active platform.\n *\n * @doc {heading: 'Environment'}\n */\nexport function env() {\n return ENV;\n}\n\nexport let ENV: Environment = null;\nexport function setEnvironmentGlobal(environment: Environment) {\n ENV = environment;\n}\n", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Note that the identifier globalNameSpace is scoped to this module, but will\n// always resolve to the same global object regardless of how the module is\n// resolved.\n// tslint:disable-next-line:no-any\nlet globalNameSpace: {_tfGlobals: Map};\n// tslint:disable-next-line:no-any\nexport function getGlobalNamespace(): {_tfGlobals: Map} {\n if (globalNameSpace == null) {\n // tslint:disable-next-line:no-any\n let ns: any;\n if (typeof (window) !== 'undefined') {\n ns = window;\n } else if (typeof (global) !== 'undefined') {\n ns = global;\n } else if (typeof (process) !== 'undefined') {\n ns = process;\n } else if (typeof (self) !== 'undefined') {\n ns = self;\n } else {\n throw new Error('Could not find a global object');\n }\n globalNameSpace = ns;\n }\n return globalNameSpace;\n}\n\n// tslint:disable-next-line:no-any\nfunction getGlobalMap(): Map {\n const ns = getGlobalNamespace();\n if (ns._tfGlobals == null) {\n ns._tfGlobals = new Map();\n }\n return ns._tfGlobals;\n}\n\n/**\n * Returns a globally accessible 'singleton' object.\n *\n * @param key the name of the object\n * @param init a function to initialize to initialize this object\n * the first time it is fetched.\n */\nexport function getGlobal(key: string, init: () => T): T {\n const globalMap = getGlobalMap();\n if (globalMap.has(key)) {\n return globalMap.get(key);\n } else {\n const singleton = init();\n globalMap.set(key, singleton);\n return globalMap.get(key);\n }\n}\n", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n// Allow UpperCamelCase variable names\n// tslint:disable: variable-name\n// Unfortunately just enabling PascalCase per file (tslint:enable:\n// allow-pascal-case) doesn't work.\nimport {NamedTensorInfoMap, TensorInfo} from './kernel_registry';\nimport {ExplicitPadding} from './ops/conv_util';\nimport {Activation} from './ops/fused_types';\nimport {DataType, PixelData} from './types';\n\nexport const Abs = 'Abs';\nexport type AbsInputs = UnaryInputs;\n\nexport const Acos = 'Acos';\nexport type AcosInputs = UnaryInputs;\n\nexport const Acosh = 'Acosh';\nexport type AcoshInputs = UnaryInputs;\n\nexport const Add = 'Add';\nexport type AddInputs = BinaryInputs;\n\nexport const AddN = 'AddN';\nexport type AddNInputs = TensorInfo[];\n\nexport const All = 'All';\nexport type AllInputs = Pick;\nexport interface AllAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const Any = 'Any';\nexport type AnyInputs = Pick;\nexport interface AnyAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const ArgMax = 'ArgMax';\nexport type ArgMaxInputs = Pick;\nexport interface ArgMaxAttrs {\n axis: number;\n}\n\nexport const ArgMin = 'ArgMin';\nexport type ArgMinInputs = Pick;\nexport interface ArgMinAttrs {\n axis: number;\n}\n\nexport const Asin = 'Asin';\nexport type AsinInputs = UnaryInputs;\n\nexport const Asinh = 'Asinh';\nexport type AsinhInputs = UnaryInputs;\n\nexport const Atan = 'Atan';\nexport type AtanInputs = UnaryInputs;\n\nexport const Atanh = 'Atanh';\nexport type AtanhInputs = UnaryInputs;\n\nexport const Atan2 = 'Atan2';\nexport type Atan2Inputs = BinaryInputs;\n\nexport const AvgPool = 'AvgPool';\nexport type AvgPoolInputs = Pick;\nexport interface AvgPoolAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const AvgPoolGrad = 'AvgPoolGrad';\nexport type AvgPoolGradInputs = Pick;\nexport interface AvgPoolGradAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n}\n\nexport const AvgPool3D = 'AvgPool3D';\nexport type AvgPool3DInputs = Pick;\nexport interface AvgPool3DAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n dataFormat: 'NDHWC'|'NCDHW';\n}\n\nexport const AvgPool3DGrad = 'AvgPool3DGrad';\nexport type AvgPool3DGradInputs = Pick;\nexport interface AvgPool3DGradAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const BatchMatMul = 'BatchMatMul';\nexport type BatchMatMulInputs = Pick;\nexport interface BatchMatMulAttrs {\n transposeA: boolean;\n transposeB: boolean;\n}\n\nexport const BatchToSpaceND = 'BatchToSpaceND';\nexport type BatchToSpaceNDInputs = Pick;\nexport interface BatchToSpaceNDAttrs {\n blockShape: number[];\n crops: number[][];\n}\n\nexport type BinaryInputs = Pick;\n\nexport const Bincount = 'Bincount';\nexport type BincountInputs = Pick;\nexport interface BincountAttrs {\n size: number;\n}\n\nexport const BroadcastTo = 'BroadcastTo';\nexport type BroadcastToInputs = Pick;\nexport interface BroadCastToAttrs {\n shape: number[];\n inputShape: number[]; // for gradient\n}\n\nexport const Cast = 'Cast';\nexport type CastInputs = UnaryInputs;\nexport interface CastAttrs {\n dtype: DataType;\n}\n\nexport const Ceil = 'Ceil';\nexport type CeilInputs = UnaryInputs;\n\nexport const ClipByValue = 'ClipByValue';\nexport type ClipByValueInputs = UnaryInputs;\nexport interface ClipByValueAttrs {\n clipValueMin: number;\n clipValueMax: number;\n}\n\nexport const Complex = 'Complex';\nexport type ComplexInputs = Pick;\n\nexport const ComplexAbs = 'ComplexAbs';\nexport type ComplexAbsInputs = UnaryInputs;\n\nexport const Concat = 'Concat';\nexport type ConcatInputs = TensorInfo[];\nexport interface ConcatAttrs {\n axis: number;\n}\n\nexport const Conv2D = 'Conv2D';\nexport type Conv2DInputs = Pick;\nexport interface Conv2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const Conv2DBackpropFilter = 'Conv2DBackpropFilter';\nexport type Conv2DBackpropFilterInputs = Pick;\nexport interface Conv2DBackpropFilterAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dimRoundingMode?: 'floor'|'round'|'ceil';\n filterShape: [number, number, number, number];\n}\n\nexport const Conv2DBackpropInput = 'Conv2DBackpropInput';\nexport type Conv2DBackpropInputInputs = Pick;\nexport interface Conv2DBackpropInputAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dimRoundingMode?: 'floor'|'round'|'ceil';\n inputShape: [number, number, number, number];\n}\n\nexport const Conv3D = 'Conv3D';\nexport type Conv3DInputs = Pick;\nexport interface Conv3DAttrs {\n strides: [number, number, number]|number;\n pad: 'valid'|'same';\n dataFormat: 'NDHWC'|'NCDHW';\n dilations: [number, number, number]|number;\n}\n\nexport const Conv3DBackpropFilterV2 = 'Conv3DBackpropFilterV2';\nexport type Conv3DBackpropFilterV2Inputs = Pick;\n\nexport interface Conv3DBackpropFilterV2Attrs {\n strides: [number, number, number]|number;\n pad: 'valid'|'same';\n filterShape: [number, number, number, number, number];\n}\n\nexport const Conv3DBackpropInputV2 = 'Conv3DBackpropInputV2';\nexport type Conv3DBackpropInputV2Inputs =\n Pick;\nexport interface Conv3DBackpropInputV2Attrs {\n strides: [number, number, number]|number;\n pad: 'valid'|'same';\n inputShape: [number, number, number, number, number];\n}\n\nexport const Cos = 'Cos';\nexport type CosInputs = UnaryInputs;\n\nexport const Cosh = 'Cosh';\nexport type CoshInputs = UnaryInputs;\n\nexport const Cumsum = 'Cumsum';\nexport type CumsumInputs = Pick;\nexport interface CumsumAttrs {\n axis: number;\n exclusive: boolean;\n reverse: boolean;\n}\n\nexport const CropAndResize = 'CropAndResize';\nexport type CropAndResizeInputs =\n Pick;\nexport interface CropAndResizeAttrs {\n cropSize: [number, number];\n method: 'bilinear'|'nearest';\n extrapolationValue: number;\n}\n\nexport const DenseBincount = 'DenseBincount';\nexport type DenseBincountInputs = Pick;\nexport interface DenseBincountAttrs {\n size: number;\n binaryOutput?: boolean;\n}\n\nexport const DepthToSpace = 'DepthToSpace';\nexport type DepthToSpaceInputs = Pick;\nexport interface DepthToSpaceAttrs {\n blockSize: number;\n dataFormat: 'NHWC'|'NCHW';\n}\n\nexport const DepthwiseConv2dNative = 'DepthwiseConv2dNative';\nexport type DepthwiseConv2dNativeInputs =\n Pick;\nexport interface DepthwiseConv2dNativeAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const DepthwiseConv2dNativeBackpropFilter =\n 'DepthwiseConv2dNativeBackpropFilter';\nexport type DepthwiseConv2dNativeBackpropFilterInputs =\n Pick;\nexport interface DepthwiseConv2dNativeBackpropFilterAttrs {\n strides: [number, number]|number;\n dilations: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n filterShape: [number, number, number, number];\n}\n\nexport const DepthwiseConv2dNativeBackpropInput =\n 'DepthwiseConv2dNativeBackpropInput';\nexport type DepthwiseConv2dNativeBackpropInputInputs =\n Pick;\nexport interface DepthwiseConv2dNativeBackpropInputAttrs {\n strides: [number, number]|number;\n dilations: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n inputShape: [number, number, number, number];\n}\n\nexport const Diag = 'Diag';\nexport type DiagInputs = Pick;\n\nexport const Dilation2D = 'Dilation2D';\nexport type Dilation2DInputs = Pick;\nexport interface Dilation2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n dilations: [number, number]|number;\n}\n\nexport const Dilation2DBackpropInput = 'Dilation2DBackpropInput';\nexport type Dilation2DBackpropInputInputs =\n Pick;\n\nexport const Dilation2DBackpropFilter = 'Dilation2DBackpropFilter';\nexport type Dilation2DBackpropFilterInputs =\n Pick;\n\nexport const RealDiv = 'RealDiv';\nexport type RealDivInputs = BinaryInputs;\n\nexport const Einsum = 'Einsum';\nexport type EinsumInputs = TensorInfo[];\nexport interface EinsumAttrs {\n equation: string;\n}\n\nexport const Elu = 'Elu';\nexport type EluInputs = Pick;\n\nexport const EluGrad = 'EluGrad';\nexport type EluGradInputs = Pick;\n\nexport const Erf = 'Erf';\nexport type ErfInputs = UnaryInputs;\n\nexport const Equal = 'Equal';\nexport type EqualInputs = BinaryInputs;\n\nexport const Exp = 'Exp';\nexport type ExpInputs = UnaryInputs;\n\nexport const ExpandDims = 'ExpandDims';\nexport type ExpandDimsInputs = Pick;\nexport interface ExpandDimsAttrs {\n dim: number;\n}\n\nexport const Expm1 = 'Expm1';\nexport type Expm1Inputs = UnaryInputs;\n\nexport const FFT = 'FFT';\nexport type FFTInputs = Pick;\n\nexport const Fill = 'Fill';\nexport interface FillAttrs {\n shape: number[];\n value: number|string;\n dtype: DataType;\n}\n\nexport const FlipLeftRight = 'FlipLeftRight';\nexport type FlipLeftRightInputs = Pick;\n\nexport const Floor = 'Floor';\nexport type FloorInputs = UnaryInputs;\n\nexport const FloorDiv = 'FloorDiv';\nexport type FloorDivInputs = BinaryInputs;\n\nexport const FusedBatchNorm = 'FusedBatchNorm';\nexport type FusedBatchNormInputs =\n Pick;\nexport interface FusedBatchNormAttrs {\n varianceEpsilon: number;\n}\n\nexport const GatherV2 = 'GatherV2';\nexport type GatherV2Inputs = Pick;\nexport interface GatherV2Attrs {\n axis: number;\n batchDims: number;\n}\n\nexport const GatherNd = 'GatherNd';\nexport type GatherNdInputs = Pick;\n\nexport const Greater = 'Greater';\nexport type GreaterInputs = BinaryInputs;\n\nexport const GreaterEqual = 'GreaterEqual';\nexport type GreaterEqualInputs = BinaryInputs;\n\nexport const Identity = 'Identity';\nexport type IdentityInputs = Pick;\n\nexport const IFFT = 'IFFT';\nexport type IFFTInputs = Pick;\n\nexport const Imag = 'Imag';\nexport type ImagInputs = Pick;\n\nexport const IsFinite = 'IsFinite';\nexport type IsFiniteInputs = UnaryInputs;\n\nexport const IsInf = 'IsInf';\nexport type IsInfInputs = UnaryInputs;\n\nexport const IsNan = 'IsNan';\nexport type IsNanInputs = UnaryInputs;\n\nexport const LeakyRelu = 'LeakyRelu';\nexport type LeakyReluInputs = Pick;\nexport interface LeakyReluAttrs {\n alpha: number;\n}\n\nexport const Less = 'Less';\nexport type LessInputs = BinaryInputs;\n\nexport const LessEqual = 'LessEqual';\nexport type LessEqualInputs = BinaryInputs;\n\nexport const LinSpace = 'LinSpace';\nexport interface LinSpaceAttrs {\n start: number;\n stop: number;\n num: number;\n}\nexport const Log = 'Log';\nexport type LogInputs = UnaryInputs;\n\nexport const Log1p = 'Log1p';\nexport type Log1pInputs = UnaryInputs;\n\nexport const LogicalAnd = 'LogicalAnd';\nexport type LogicalAndInputs = BinaryInputs;\n\nexport const LogicalNot = 'LogicalNot';\nexport type LogicalNotInputs = Pick;\n\nexport const LogicalOr = 'LogicalOr';\nexport type LogicalOrInputs = BinaryInputs;\n\nexport const LogSoftmax = 'LogSoftmax';\nexport type LogSoftmaxInputs = Pick;\nexport interface LogSoftmaxAttrs {\n axis: number;\n}\n\nexport const LRN = 'LRN';\nexport type LRNInputs = Pick;\nexport interface LRNAttrs {\n depthRadius: number;\n bias: number;\n alpha: number;\n beta: number;\n}\n\nexport const LRNGrad = 'LRNGrad';\nexport type LRNGradInputs = Pick;\nexport interface LRNGradAttrs {\n depthRadius: number;\n bias: number;\n alpha: number;\n beta: number;\n}\n\nexport const Max = 'Max';\nexport type MaxInputs = Pick;\nexport interface MaxAttrs {\n reductionIndices: number|number[];\n keepDims: boolean;\n}\n\nexport const Maximum = 'Maximum';\nexport type MaximumInputs = BinaryInputs;\n\nexport const MaxPool = 'MaxPool';\nexport type MaxPoolInputs = Pick;\nexport interface MaxPoolAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPoolGrad = 'MaxPoolGrad';\nexport type MaxPoolGradInputs = Pick;\nexport interface MaxPoolGradAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPool3D = 'MaxPool3D';\nexport type MaxPool3DInputs = Pick;\nexport interface MaxPool3DAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dataFormat: 'NDHWC'|'NCDHW';\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPool3DGrad = 'MaxPool3DGrad';\nexport type MaxPool3DGradInputs =\n Pick;\nexport interface MaxPool3DGradAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPoolWithArgmax = 'MaxPoolWithArgmax';\nexport type MaxPoolWithArgmaxInputs = Pick;\nexport interface MaxPoolWithArgmaxAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n includeBatchInIndex: boolean;\n}\n\nexport const Mean = 'Mean';\nexport type MeanInputs = Pick;\nexport interface MeanAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const Min = 'Min';\nexport type MinInputs = Pick;\nexport interface MinAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const Minimum = 'Minimum';\nexport type MinimumInputs = BinaryInputs;\n\nexport const MirrorPad = 'MirrorPad';\nexport type MirrorPadInputs = Pick;\nexport interface MirrorPadAttrs {\n paddings: Array<[number, number]>;\n mode: 'reflect'|'symmetric';\n}\n\nexport const Mod = 'Mod';\nexport type ModInputs = BinaryInputs;\n\nexport const Multinomial = 'Multinomial';\nexport type MultinomialInputs = Pick;\nexport interface MultinomialAttrs {\n numSamples: number;\n seed: number;\n normalized: boolean;\n}\n\nexport const Multiply = 'Multiply';\nexport type MultiplyInputs = BinaryInputs;\n\nexport const Neg = 'Neg';\nexport type NegInputs = UnaryInputs;\n\nexport const NotEqual = 'NotEqual';\nexport type NotEqualInputs = BinaryInputs;\n\nexport const NonMaxSuppressionV3 = 'NonMaxSuppressionV3';\nexport type NonMaxSuppressionV3Inputs =\n Pick;\nexport interface NonMaxSuppressionV3Attrs {\n maxOutputSize: number;\n iouThreshold: number;\n scoreThreshold: number;\n}\n\nexport const NonMaxSuppressionV4 = 'NonMaxSuppressionV4';\nexport type NonMaxSuppressionV4Inputs =\n Pick;\nexport interface NonMaxSuppressionV4Attrs {\n maxOutputSize: number;\n iouThreshold: number;\n scoreThreshold: number;\n padToMaxOutputSize: boolean;\n}\n\nexport const NonMaxSuppressionV5 = 'NonMaxSuppressionV5';\nexport type NonMaxSuppressionV5Inputs =\n Pick;\nexport interface NonMaxSuppressionV5Attrs {\n maxOutputSize: number;\n iouThreshold: number;\n scoreThreshold: number;\n softNmsSigma: number;\n}\n\nexport const OnesLike = 'OnesLike';\nexport type OnesLikeInputs = UnaryInputs;\n\nexport const OneHot = 'OneHot';\nexport type OneHotInputs = Pick;\nexport interface OneHotAttrs {\n depth: number;\n onValue: number;\n offValue: number;\n}\n\nexport const Pack = 'Pack';\nexport type PackInputs = TensorInfo[];\nexport interface PackAttrs {\n axis: number;\n}\n\nexport const PadV2 = 'PadV2';\nexport type PadV2Inputs = Pick;\nexport interface PadV2Attrs {\n paddings: Array<[number, number]>;\n constantValue: number;\n}\n\nexport const Pool = 'Pool';\nexport type PoolInputs = Pick;\n\nexport const Pow = 'Pow';\nexport type PowInputs = BinaryInputs;\n\nexport const Prelu = 'Prelu';\nexport type PreluInputs = Pick;\n\nexport const Prod = 'Prod';\nexport type ProdInputs = Pick;\nexport interface ProdAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const Range = 'Range';\nexport interface RangeAttrs {\n start: number;\n stop: number;\n step: number;\n dtype: 'float32'|'int32';\n}\n\nexport const Real = 'Real';\nexport type RealInputs = Pick;\n\nexport const Reciprocal = 'Reciprocal';\nexport type ReciprocalInputs = UnaryInputs;\n\nexport const Relu = 'Relu';\nexport type ReluInputs = Pick;\n\nexport const Reshape = 'Reshape';\nexport type ReshapeInputs = Pick;\nexport interface ReshapeAttrs {\n shape: number[];\n}\n\nexport const ResizeNearestNeighbor = 'ResizeNearestNeighbor';\nexport type ResizeNearestNeighborInputs = Pick;\nexport interface ResizeNearestNeighborAttrs {\n alignCorners: boolean;\n halfPixelCenters: boolean;\n size: [number, number];\n}\n\nexport const ResizeNearestNeighborGrad = 'ResizeNearestNeighborGrad';\nexport type ResizeNearestNeighborGradInputs =\n Pick;\nexport type ResizeNearestNeighborGradAttrs = ResizeNearestNeighborAttrs;\n\nexport const ResizeBilinear = 'ResizeBilinear';\nexport type ResizeBilinearInputs = Pick;\nexport interface ResizeBilinearAttrs {\n alignCorners: boolean;\n halfPixelCenters: boolean;\n size: [number, number];\n}\n\nexport const ResizeBilinearGrad = 'ResizeBilinearGrad';\nexport type ResizeBilinearGradInputs = Pick;\nexport type ResizeBilinearGradAttrs = ResizeBilinearAttrs;\n\nexport const Relu6 = 'Relu6';\nexport type Relu6Inputs = Pick;\n\nexport const Reverse = 'Reverse';\nexport type ReverseInputs = Pick;\nexport interface ReverseAttrs {\n dims: number|number[];\n}\n\nexport const Round = 'Round';\nexport type RoundInputs = UnaryInputs;\n\nexport const Rsqrt = 'Rsqrt';\nexport type RsqrtInputs = UnaryInputs;\n\nexport const ScatterNd = 'ScatterNd';\nexport type ScatterNdInputs = Pick;\nexport interface ScatterNdAttrs {\n shape: number[];\n}\n\nexport const Select = 'Select';\nexport type SelectInputs = Pick;\n\nexport const Selu = 'Selu';\nexport type SeluInputs = Pick;\n\nexport const Slice = 'Slice';\nexport type SliceInputs = Pick;\nexport interface SliceAttrs {\n begin: number|number[];\n size: number|number[];\n}\nexport const Sin = 'Sin';\nexport type SinInputs = UnaryInputs;\n\nexport const Sinh = 'Sinh';\nexport type SinhInputs = UnaryInputs;\n\nexport const Sign = 'Sign';\nexport type SignInputs = UnaryInputs;\n\nexport const Sigmoid = 'Sigmoid';\nexport type SigmoidInputs = UnaryInputs;\n\nexport const Softplus = 'Softplus';\nexport type SoftplusInputs = UnaryInputs;\n\nexport const Sqrt = 'Sqrt';\nexport type SqrtInputs = UnaryInputs;\n\nexport const Sum = 'Sum';\nexport type SumInputs = Pick;\nexport interface SumAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const SpaceToBatchND = 'SpaceToBatchND';\nexport type SpaceToBatchNDInputs = Pick;\nexport interface SpaceToBatchNDAttrs {\n blockShape: number[];\n paddings: number[][];\n}\n\nexport const SplitV = 'SplitV';\nexport type SplitVInputs = Pick;\nexport interface SplitVAttrs {\n numOrSizeSplits: number[]|number;\n axis: number;\n}\n\nexport const Softmax = 'Softmax';\nexport type SoftmaxInputs = Pick;\nexport interface SoftmaxAttrs {\n dim: number;\n}\n\nexport const SparseFillEmptyRows = 'SparseFillEmptyRows';\nexport type SparseFillEmptyRowsInputs =\n Pick;\n\nexport const SparseReshape = 'SparseReshape';\nexport type SparseReshapeInputs =\n Pick;\n\nexport const SparseToDense = 'SparseToDense';\nexport type SparseToDenseInputs =\n Pick;\nexport interface SparseToDenseAttrs {\n outputShape: number[];\n}\n\nexport const SquaredDifference = 'SquaredDifference';\nexport type SquaredDifferenceInputs = BinaryInputs;\n\nexport const Square = 'Square';\nexport type SquareInputs = Pick;\n\nexport const StridedSlice = 'StridedSlice';\nexport type StridedSliceInputs = Pick;\nexport interface StridedSliceAttrs {\n begin: number[];\n end: number[];\n strides: number[];\n beginMask: number;\n endMask: number;\n ellipsisMask: number;\n newAxisMask: number;\n shrinkAxisMask: number;\n}\n\nexport const Sub = 'Sub';\nexport type SubInputs = BinaryInputs;\n\nexport const Tan = 'Tan';\nexport type TanInputs = UnaryInputs;\n\nexport const Tanh = 'Tanh';\nexport type TanhInputs = UnaryInputs;\n\nexport const Tile = 'Tile';\nexport type TileInputs = Pick;\nexport interface TileAttrs {\n reps: number[];\n}\n\nexport const TopK = 'TopK';\nexport type TopKInputs = Pick;\nexport interface TopKAttrs {\n k: number;\n sorted: boolean;\n}\n\nexport const Transform = 'Transform';\nexport type TransformInputs = Pick;\nexport interface TransformAttrs {\n interpolation: 'nearest'|'bilinear';\n fillMode: 'constant'|'reflect'|'wrap'|'nearest';\n fillValue: number;\n outputShape?: [number, number];\n}\n\nexport const Transpose = 'Transpose';\nexport type TransposeInputs = Pick;\nexport interface TransposeAttrs {\n perm: number[];\n}\n\nexport const Unique = 'Unique';\nexport type UniqueInputs = Pick;\nexport interface UniqueAttrs {\n axis: number;\n}\n\nexport type UnaryInputs = Pick;\n\nexport const Unpack = 'Unpack';\nexport type UnpackInputs = Pick;\nexport interface UnpackAttrs {\n axis: number;\n}\n\nexport const UnsortedSegmentSum = 'UnsortedSegmentSum';\nexport type UnsortedSegmentSumInputs =\n Pick;\nexport interface UnsortedSegmentSumAttrs {\n numSegments: number;\n}\n\nexport const ZerosLike = 'ZerosLike';\nexport type ZerosLikeInputs = UnaryInputs;\n\n/**\n * TensorFlow.js-only kernels\n */\nexport const Step = 'Step';\nexport type StepInputs = UnaryInputs;\nexport interface StepAttrs {\n alpha: number;\n}\n\nexport const FromPixels = 'FromPixels';\nexport interface FromPixelsInputs {\n pixels: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap;\n}\nexport interface FromPixelsAttrs {\n numChannels: number;\n}\n\nexport const RotateWithOffset = 'RotateWithOffset';\nexport type RotateWithOffsetInputs = Pick;\nexport interface RotateWithOffsetAttrs {\n radians: number;\n fillValue: number|[number, number, number];\n center: number|[number, number];\n}\n\nexport const _FusedMatMul = '_FusedMatMul';\n// tslint:disable-next-line: class-name\nexport interface _FusedMatMulInputs extends NamedTensorInfoMap {\n a: TensorInfo;\n b: TensorInfo;\n bias?: TensorInfo;\n preluActivationWeights?: TensorInfo;\n}\n// tslint:disable-next-line: class-name\nexport interface _FusedMatMulAttrs {\n transposeA: boolean;\n transposeB: boolean;\n activation: Activation;\n leakyreluAlpha?: number;\n}\n\nexport const FusedConv2D = 'FusedConv2D';\nexport interface FusedConv2DInputs extends NamedTensorInfoMap {\n x: TensorInfo;\n filter: TensorInfo;\n bias?: TensorInfo;\n preluActivationWeights?: TensorInfo;\n}\nexport interface FusedConv2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode: 'floor'|'round'|'ceil';\n activation: Activation;\n leakyreluAlpha?: number;\n}\n\nexport const FusedDepthwiseConv2D = 'FusedDepthwiseConv2D';\nexport interface FusedDepthwiseConv2DInputs extends NamedTensorInfoMap {\n x: TensorInfo;\n filter: TensorInfo;\n bias?: TensorInfo;\n preluActivationWeights?: TensorInfo;\n}\nexport interface FusedDepthwiseConv2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode: 'floor'|'round'|'ceil';\n activation: Activation;\n leakyreluAlpha?: number;\n}\n", "/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {env} from './environment';\n\nimport {getGlobal} from './global_util';\nimport {NamedGradientMap} from './tape';\nimport {Tensor} from './tensor';\nimport {DataType, RecursiveArray} from './types';\n\nconst kernelRegistry =\n getGlobal('kernelRegistry', () => new Map());\nconst gradRegistry =\n getGlobal('gradRegistry', () => new Map());\n\nexport type DataId = object;\n\ntype AttributeValue =\n number|number[]|boolean|boolean[]|string|string[]|NamedAttrMap;\n\n/** These are extra non-tensor/primitive params passed to kernel functions. */\nexport type Attribute = AttributeValue|RecursiveArray;\n\n/** Specifies the code to run when executing a kernel. */\nexport type KernelFunc = (params: {\n inputs: NamedTensorInfoMap,\n backend: {},\n attrs?: NamedAttrMap,\n}) => TensorInfo|TensorInfo[];\n\n/** The function to run when computing a gradient during backprop. */\nexport type GradFunc =\n (dy: Tensor|Tensor[], saved: Tensor[], attrs: NamedAttrMap) =>\n NamedGradientMap;\n\n/** Function that gets called after the backend initializes. */\nexport type KernelSetupFunc = (backend: {}) => void;\n/** Function that gets called right before the backend is disposed. */\nexport type KernelDisposeFunc = KernelSetupFunc;\n\n/** Config object for registering a kernel in the global registry. */\nexport interface KernelConfig {\n kernelName: string;\n backendName: string;\n kernelFunc: KernelFunc;\n setupFunc?: KernelSetupFunc;\n disposeFunc?: KernelDisposeFunc;\n}\n\n/** Config object for registering a gradient in the global registry. */\nexport interface GradConfig {\n kernelName: string;\n inputsToSave?: string[];\n // When saveAllInputs is true, all inputs will be saved. Only use this flag\n // if inputs is an array of Tensors.\n saveAllInputs?: boolean;\n outputsToSave?: boolean[];\n gradFunc: GradFunc;\n}\n\n/** Holds metadata for a given tensor. */\nexport interface TensorInfo {\n dataId: DataId;\n shape: number[];\n dtype: DataType;\n}\n\nexport interface NamedTensorInfoMap {\n [name: string]: TensorInfo;\n}\n\nexport interface NamedAttrMap {\n [name: string]: Attribute;\n}\n\n/**\n * Returns the kernel function (code) associated with the provided names.\n *\n * @param kernelName The official name of the kernel.\n * @param backendName The official name of the backend.\n */\nexport function getKernel(\n kernelName: string, backendName: string): KernelConfig {\n const key = makeKey(kernelName, backendName);\n return kernelRegistry.get(key);\n}\n\n/**\n * Returns the registered gradient info associated with the provided kernel.\n * @param kernelName The official TF kernel name.\n */\nexport function getGradient(kernelName: string): GradConfig {\n return gradRegistry.get(kernelName);\n}\n\nexport function getKernelsForBackend(backendName: string): KernelConfig[] {\n const it = kernelRegistry.entries();\n const result: KernelConfig[] = [];\n\n while (true) {\n const {done, value} = it.next();\n if (done) {\n break;\n }\n const [key, config] = value;\n const [backend, ] = key.split('_');\n if (backend === backendName) {\n result.push(config);\n }\n }\n return result;\n}\n\n/**\n * Registers the function (forward pass) for the kernel in a global registry.\n *\n * @param config A config object with the following properties:\n * - `kernelName` The official name of the kernel.\n * - `backendName` The official name of the backend.\n * - `kernelFunc` The function to run during the forward pass of the kernel.\n * - `setupFunc` Optional. Gets called once, after the backend initializes.\n * - `disposeFunc` Optional. Gets called once, right before the backend is\n * disposed.\n */\nexport function registerKernel(config: KernelConfig) {\n const {kernelName, backendName} = config;\n const key = makeKey(kernelName, backendName);\n if (kernelRegistry.has(key)) {\n console.warn(\n `The kernel '${kernelName}' for backend ` +\n `'${backendName}' is already registered`);\n }\n kernelRegistry.set(key, config);\n}\n\n/**\n * Registers a gradient function for a given kernel in the global registry,\n * to be used during the back-propagation of that kernel.\n *\n * @param config An object with the following properties:\n * - `kernelName` The name of the kernel that the gradient function is for.\n * - `gradFunc` The function to run during back-propagation.\n */\nexport function registerGradient(config: GradConfig) {\n const {kernelName} = config;\n\n if (gradRegistry.has(kernelName)) {\n // TODO (yassogba) after 3.0 assess whether we need to keep this gated\n // to debug mode.\n if (env().getBool('DEBUG')) {\n console.warn(`Overriding the gradient for '${kernelName}'`);\n }\n }\n gradRegistry.set(kernelName, config);\n}\n\n/**\n * Removes the kernel function from the registry.\n *\n * @param kernelName The official name of the kernel.\n * @param backendName The official name of the backend.\n *\n */\nexport function unregisterKernel(\n kernelName: string, backendName: string): void {\n const key = makeKey(kernelName, backendName);\n if (!kernelRegistry.has(key)) {\n throw new Error(\n `The kernel '${kernelName}' for backend ` +\n `'${backendName}' is not registered`);\n }\n kernelRegistry.delete(key);\n}\n\n/** Removes the registered gradient from the global registry. */\nexport function unregisterGradient(kernelName: string): void {\n if (!gradRegistry.has(kernelName)) {\n throw new Error(\n `The gradient '${kernelName}' for backend is not registered`);\n }\n gradRegistry.delete(kernelName);\n}\n\n/**\n * Finds kernels that have already been registered to a backend and re-registers\n * them for a new backend. Useful for registering custom backends.\n * @param registeredBackendName Already registered backend.\n * @param newBackendName New backend.\n */\nexport function copyRegisteredKernels(\n registeredBackendName: string, newBackendName: string): void {\n const kernels = getKernelsForBackend(registeredBackendName);\n kernels.forEach(kernelConfig => {\n const newKernelConfig =\n Object.assign({}, kernelConfig, {backendName: newBackendName});\n registerKernel(newKernelConfig);\n });\n}\n\nfunction makeKey(kernelName: string, backendName: string) {\n return `${backendName}_${kernelName}`;\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from './environment';\nimport {BackendValues, DataType, TensorLike, TypedArray} from './types';\nimport * as base from './util_base';\nexport * from './util_base';\n\n/**\n * Create typed array for scalar value. Used for storing in `DataStorage`.\n */\nexport function createScalarValue(\n value: DataType, dtype: DataType): BackendValues {\n if (dtype === 'string') {\n return encodeString(value);\n }\n\n return toTypedArray([value], dtype);\n}\n\nfunction noConversionNeeded(a: TensorLike, dtype: DataType): boolean {\n return (a instanceof Float32Array && dtype === 'float32') ||\n (a instanceof Int32Array && dtype === 'int32') ||\n (a instanceof Uint8Array && dtype === 'bool');\n}\n\nexport function toTypedArray(a: TensorLike, dtype: DataType): TypedArray {\n if (dtype === 'string') {\n throw new Error('Cannot convert a string[] to a TypedArray');\n }\n if (Array.isArray(a)) {\n a = base.flatten(a);\n }\n\n if (env().getBool('DEBUG')) {\n base.checkConversionForErrors(a as number[], dtype);\n }\n if (noConversionNeeded(a, dtype)) {\n return a as TypedArray;\n }\n if (dtype == null || dtype === 'float32' || dtype === 'complex64') {\n return new Float32Array(a as number[]);\n } else if (dtype === 'int32') {\n return new Int32Array(a as number[]);\n } else if (dtype === 'bool') {\n const bool = new Uint8Array((a as number[]).length);\n for (let i = 0; i < bool.length; ++i) {\n if (Math.round((a as number[])[i]) !== 0) {\n bool[i] = 1;\n }\n }\n return bool;\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n}\n\n/**\n * Returns the current high-resolution time in milliseconds relative to an\n * arbitrary time in the past. It works across different platforms (node.js,\n * browsers).\n *\n * ```js\n * console.log(tf.util.now());\n * ```\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function now(): number {\n return env().platform.now();\n}\n\n/**\n * Returns a platform-specific implementation of\n * [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n *\n * If `fetch` is defined on the global object (`window`, `process`, etc.),\n * `tf.util.fetch` returns that function.\n *\n * If not, `tf.util.fetch` returns a platform-specific solution.\n *\n * ```js\n * const resource = await tf.util.fetch('https://unpkg.com/@tensorflow/tfjs');\n * // handle response\n * ```\n *\n * @doc {heading: 'Util'}\n */\nexport function fetch(\n path: string, requestInits?: RequestInit): Promise {\n return env().platform.fetch(path, requestInits);\n}\n\n/**\n * Encodes the provided string into bytes using the provided encoding scheme.\n *\n * @param s The string to encode.\n * @param encoding The encoding scheme. Defaults to utf-8.\n *\n * @doc {heading: 'Util'}\n */\nexport function encodeString(s: string, encoding = 'utf-8'): Uint8Array {\n encoding = encoding || 'utf-8';\n return env().platform.encode(s, encoding);\n}\n\n/**\n * Decodes the provided bytes into a string using the provided encoding scheme.\n * @param bytes The bytes to decode.\n *\n * @param encoding The encoding scheme. Defaults to utf-8.\n *\n * @doc {heading: 'Util'}\n */\nexport function decodeString(bytes: Uint8Array, encoding = 'utf-8'): string {\n encoding = encoding || 'utf-8';\n return env().platform.decode(bytes, encoding);\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BackendTimer, BackendTimingInfo} from './backends/backend';\nimport {env} from './environment';\nimport {Tensor} from './tensor';\nimport {NamedTensorMap} from './tensor_types';\nimport {DataType, DataTypeMap, TypedArray} from './types';\nimport * as util from './util';\n\nexport type KernelProfile = {\n kernelName: string,\n outputs: Tensor[],\n inputs: NamedTensorMap,\n timeMs: Promise,\n extraInfo: Promise\n};\n\nexport class Profiler {\n constructor(private backendTimer: BackendTimer, private logger?: Logger) {\n if (logger == null) {\n this.logger = new Logger();\n }\n }\n\n profileKernel(kernelName: string, inputs: NamedTensorMap, f: () => Tensor[]):\n KernelProfile {\n let outputs: Tensor[];\n const holdResultWrapperFn = () => {\n outputs = f();\n };\n let timer: Promise;\n const start = util.now();\n if (this.backendTimer.timerAvailable()) {\n timer = this.backendTimer.time(holdResultWrapperFn);\n } else {\n holdResultWrapperFn();\n for (const output of outputs) {\n output.dataSync();\n }\n timer = Promise.resolve({kernelMs: util.now() - start});\n }\n if (env().getBool('CHECK_COMPUTATION_FOR_ERRORS')) {\n for (let i = 0; i < outputs.length; i++) {\n const output = outputs[i];\n // Dangling promise here because we don't want to propagate up\n // asynchronicity.\n output.data().then(tensorVals => {\n checkComputationForErrors(tensorVals, output.dtype, kernelName);\n });\n }\n }\n\n const kernelProfile = {\n kernelName,\n outputs,\n inputs,\n timeMs: timer.then(timing => timing.kernelMs),\n extraInfo: timer.then(\n timing => timing.getExtraProfileInfo != null ?\n timing.getExtraProfileInfo() :\n '')\n };\n return kernelProfile;\n }\n\n logKernelProfile(kernelProfile: KernelProfile): void {\n const {kernelName, outputs, timeMs, inputs, extraInfo} = kernelProfile;\n\n outputs.forEach(result => {\n Promise.all([result.data(), timeMs, extraInfo]).then(valueContainer => {\n this.logger.logKernelProfile(\n kernelName, result, valueContainer[0], valueContainer[1], inputs,\n valueContainer[2]);\n });\n });\n }\n}\n\nexport function checkComputationForErrors(\n vals: DataTypeMap[D], dtype: D, kernelName: string): boolean {\n if (dtype !== 'float32') {\n // Only floating point computations will generate NaN values\n return false;\n }\n for (let i = 0; i < vals.length; i++) {\n const num = vals[i] as number;\n if (isNaN(num) || !isFinite(num)) {\n // Throwing custom exception so behavior is testable.\n console.warn(`Found ${num} in the result of '${kernelName}'`);\n return true;\n }\n }\n return false;\n}\n\nexport class Logger {\n logKernelProfile(\n name: string, result: Tensor, vals: TypedArray,\n timeMs: number|{error: string}, inputs: NamedTensorMap,\n extraInfo?: string) {\n const time = typeof timeMs === 'number' ? util.rightPad(`${timeMs}ms`, 9) :\n timeMs['error'];\n const paddedName = util.rightPad(name, 25);\n const rank = result.rank;\n const size = result.size;\n const shape = util.rightPad(result.shape.toString(), 14);\n let inputShapesDescription = '';\n\n for (const name in inputs) {\n const input = inputs[name];\n if (input != null) {\n // The input might be a non-tensor (e.g HTMLImageElement), in which case\n // we claim the output shape as input shape.\n const inputShape = input.shape || result.shape;\n const inputRank = inputShape.length;\n inputShapesDescription +=\n `${name}: ${inputRank}D ${inputRank > 0 ? inputShape : ''} `;\n }\n }\n\n console.log(\n `%c${paddedName}\\t%c${time}\\t%c${rank}D ${shape}\\t%c${size}\\t%c${\n inputShapesDescription}\\t%c${extraInfo}`,\n 'font-weight:bold', 'color:red', 'color:blue', 'color: orange',\n 'color: green', 'color: steelblue');\n }\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from './tensor';\nimport {NamedTensorMap} from './tensor_types';\nimport * as util from './util';\n\nexport interface TapeNode {\n id: number;\n kernelName: string;\n outputs: Tensor[];\n inputs: NamedTensorMap;\n // Optional params, defined only for ops with gradient impl.\n gradient?: (dys: Tensor[]) => NamedGradientMap;\n saved?: Tensor[];\n}\n\nexport type NamedGradientMap = {\n [inputName: string]: () => Tensor;\n};\n\n/**\n * Computes a list of TapeNodes that connect x to y, filtering everything else\n * out and preserving the order of the original tape elements.\n *\n * @param tape The tape elements to filter.\n * @param xs The input Tensors.\n * @param y The output Tensor.\n */\nexport function getFilteredNodesXToY(\n tape: TapeNode[], xs: Tensor[], y: Tensor): TapeNode[] {\n // Forward pass to compute all the nodes and Tensors that are transitively a\n // function of x.\n const tensorsFromX: {[tensorId: number]: boolean} = {};\n const nodesFromX: {[nodeId: number]: boolean} = {};\n for (let i = 0; i < xs.length; i++) {\n tensorsFromX[xs[i].id] = true;\n }\n\n for (let i = 0; i < tape.length; i++) {\n const node = tape[i];\n const nodeInputs = node.inputs;\n for (const inputName in nodeInputs) {\n const input = nodeInputs[inputName];\n\n let anyInputFromX = false;\n for (let j = 0; j < xs.length; j++) {\n if (tensorsFromX[input.id]) {\n node.outputs.forEach(output => tensorsFromX[output.id] = true);\n anyInputFromX = true;\n nodesFromX[node.id] = true;\n break;\n }\n }\n\n if (anyInputFromX) {\n break;\n }\n }\n }\n\n // Backward pass to find all of the nodes and Tensors that lead to y.\n const tensorsLeadToY: {[tensorId: number]: boolean} = {};\n tensorsLeadToY[y.id] = true;\n const nodesToY: {[nodeId: number]: boolean} = {};\n\n for (let i = tape.length - 1; i >= 0; i--) {\n const node = tape[i];\n const nodeInputs = node.inputs;\n\n // If any of the outputs lead to y, mark all of the inputs as leading to y.\n for (let j = 0; j < node.outputs.length; j++) {\n if (tensorsLeadToY[node.outputs[j].id]) {\n for (const inputName in nodeInputs) {\n tensorsLeadToY[nodeInputs[inputName].id] = true;\n nodesToY[node.id] = true;\n }\n break;\n }\n }\n }\n\n // Return the paths that come from x and lead to y.\n const filteredTape: TapeNode[] = [];\n for (let i = 0; i < tape.length; i++) {\n const node = tape[i];\n\n if (nodesFromX[node.id] && nodesToY[node.id]) {\n // Prune the inputs from the node that aren't a function of x.\n const prunedInputs: {[inputName: string]: Tensor} = {};\n for (const inputName in node.inputs) {\n const nodeInput = node.inputs[inputName];\n if (tensorsFromX[nodeInput.id]) {\n prunedInputs[inputName] = nodeInput;\n }\n }\n\n // Copy the node and overwrite inputsAndArgs to the pruned version.\n const prunedNode = Object.assign({}, node);\n prunedNode.inputs = prunedInputs;\n prunedNode.outputs = node.outputs;\n\n filteredTape.push(prunedNode);\n }\n }\n\n return filteredTape;\n}\n\n/**\n * Backpropagate gradients through the filtered TapeNodes.\n *\n * @param tensorAccumulatedGradientMap A map of Tensor to its gradient. This map\n * is mutated by this method.\n * @param filteredTape The filtered TapeNodes to backprop through.\n */\nexport function backpropagateGradients(\n tensorAccumulatedGradientMap: {[tensorId: number]: Tensor},\n filteredTape: TapeNode[], tidy: (f: Function) => Tensor,\n add: (a: Tensor, b: Tensor) => Tensor) {\n // Walk the tape backward and keep a map of Tensor to its gradient.\n for (let i = filteredTape.length - 1; i >= 0; i--) {\n const node = filteredTape[i];\n\n const dys: Tensor[] = [];\n node.outputs.forEach(o => {\n const gradTensor = tensorAccumulatedGradientMap[o.id];\n if (gradTensor != null) {\n dys.push(gradTensor);\n } else {\n // This particular output is not in the back-propagation subgraph, so it\n // does not affect the final output, thus we put null for its dy.\n dys.push(null);\n }\n });\n\n if (node.gradient == null) {\n throw new Error(\n `Cannot compute gradient: gradient function not found ` +\n `for ${node.kernelName}.`);\n }\n\n // Backprop dy through this node and accumulate gradients over the inputs.\n const inputGradients = node.gradient(dys);\n\n for (const inputName in node.inputs) {\n if (!(inputName in inputGradients)) {\n throw new Error(\n `Cannot backprop through input ${inputName}. ` +\n `Available gradients found: ${Object.keys(inputGradients)}.`);\n }\n\n // Call the gradient function.\n const dx = tidy(() => inputGradients[inputName]());\n if (dx.dtype !== 'float32') {\n throw new Error(\n `Error in gradient for op ${\n node.kernelName}. The gradient of input ` +\n `${inputName} must have 'float32' dtype, but has '${dx.dtype}'`);\n }\n const x = node.inputs[inputName];\n if (!util.arraysEqual(dx.shape, x.shape)) {\n throw new Error(\n `Error in gradient for op ${\n node.kernelName}. The gradient of input ` +\n `'${inputName}' has shape '${dx.shape}', which does not match ` +\n `the shape of the input '${x.shape}'`);\n }\n\n if (tensorAccumulatedGradientMap[x.id] == null) {\n tensorAccumulatedGradientMap[x.id] = dx;\n } else {\n const curGradient = tensorAccumulatedGradientMap[x.id];\n tensorAccumulatedGradientMap[x.id] = add(curGradient, dx);\n curGradient.dispose();\n }\n }\n }\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, TypedArray} from './types';\nimport {computeStrides, isString, rightPad, sizeFromShape} from './util';\n\n// Maximum number of values before we decide to show ellipsis.\nconst FORMAT_LIMIT_NUM_VALS = 20;\n// Number of first and last values to show when displaying a, b,...,y, z.\nconst FORMAT_NUM_FIRST_LAST_VALS = 3;\n// Number of significant digits to show.\nconst FORMAT_NUM_SIG_DIGITS = 7;\n\nexport function tensorToString(\n vals: TypedArray|string[], shape: number[], dtype: DataType,\n verbose: boolean) {\n const strides = computeStrides(shape);\n const padPerCol = computeMaxSizePerColumn(vals, shape, dtype, strides);\n const rank = shape.length;\n const valsLines = subTensorToString(vals, shape, dtype, strides, padPerCol);\n const lines = ['Tensor'];\n if (verbose) {\n lines.push(` dtype: ${dtype}`);\n lines.push(` rank: ${rank}`);\n lines.push(` shape: [${shape}]`);\n lines.push(` values:`);\n }\n lines.push(valsLines.map(l => ' ' + l).join('\\n'));\n return lines.join('\\n');\n}\n\nfunction computeMaxSizePerColumn(\n vals: TypedArray|string[], shape: number[], dtype: DataType,\n strides: number[]): number[] {\n const n = sizeFromShape(shape);\n const numCols = strides[strides.length - 1];\n const padPerCol = new Array(numCols).fill(0);\n const rank = shape.length;\n const valuesOrTuples =\n dtype === 'complex64' ? createComplexTuples(vals) : vals;\n\n if (rank > 1) {\n for (let row = 0; row < n / numCols; row++) {\n const offset = row * numCols;\n for (let j = 0; j < numCols; j++) {\n padPerCol[j] = Math.max(\n padPerCol[j],\n valToString(valuesOrTuples[offset + j], 0, dtype).length);\n }\n }\n }\n return padPerCol;\n}\n\nfunction valToString(\n val: number|string|[number, number], pad: number, dtype: DataType) {\n let valStr: string;\n if (Array.isArray(val)) {\n valStr = `${parseFloat(val[0].toFixed(FORMAT_NUM_SIG_DIGITS))} + ` +\n `${parseFloat(val[1].toFixed(FORMAT_NUM_SIG_DIGITS))}j`;\n } else if (isString(val)) {\n valStr = `'${val}'`;\n } else if (dtype === 'bool') {\n valStr = boolNumToString(val);\n } else {\n valStr = parseFloat(val.toFixed(FORMAT_NUM_SIG_DIGITS)).toString();\n }\n\n return rightPad(valStr, pad);\n}\n\nfunction boolNumToString(v: number): string {\n return v === 0 ? 'false' : 'true';\n}\n\nfunction subTensorToString(\n vals: TypedArray|string[], shape: number[], dtype: DataType,\n strides: number[], padPerCol: number[], isLast = true): string[] {\n const storagePerElement = dtype === 'complex64' ? 2 : 1;\n\n const size = shape[0];\n const rank = shape.length;\n if (rank === 0) {\n if (dtype === 'complex64') {\n const complexTuple = createComplexTuples(vals);\n return [valToString(complexTuple[0], 0, dtype)];\n }\n if (dtype === 'bool') {\n return [boolNumToString(vals[0] as number)];\n }\n return [vals[0].toString()];\n }\n\n if (rank === 1) {\n if (size > FORMAT_LIMIT_NUM_VALS) {\n const firstValsSize = FORMAT_NUM_FIRST_LAST_VALS * storagePerElement;\n\n let firstVals = Array.from(\n vals.slice(0, firstValsSize));\n let lastVals = Array.from(vals.slice(\n (size - FORMAT_NUM_FIRST_LAST_VALS) * storagePerElement,\n size * storagePerElement));\n if (dtype === 'complex64') {\n firstVals = createComplexTuples(firstVals);\n lastVals = createComplexTuples(lastVals);\n }\n return [\n '[' +\n firstVals.map((x, i) => valToString(x, padPerCol[i], dtype))\n .join(', ') +\n ', ..., ' +\n lastVals\n .map(\n (x, i) => valToString(\n x, padPerCol[size - FORMAT_NUM_FIRST_LAST_VALS + i], dtype))\n .join(', ') +\n ']'\n ];\n }\n const displayVals: Array =\n dtype === 'complex64' ? createComplexTuples(vals) :\n Array.from(vals);\n\n return [\n '[' +\n displayVals.map((x, i) => valToString(x, padPerCol[i], dtype))\n .join(', ') +\n ']'\n ];\n }\n\n // The array is rank 2 or more.\n const subshape = shape.slice(1);\n const substrides = strides.slice(1);\n const stride = strides[0] * storagePerElement;\n const lines: string[] = [];\n if (size > FORMAT_LIMIT_NUM_VALS) {\n for (let i = 0; i < FORMAT_NUM_FIRST_LAST_VALS; i++) {\n const start = i * stride;\n const end = start + stride;\n lines.push(...subTensorToString(\n vals.slice(start, end), subshape, dtype, substrides, padPerCol,\n false /* isLast */));\n }\n lines.push('...');\n for (let i = size - FORMAT_NUM_FIRST_LAST_VALS; i < size; i++) {\n const start = i * stride;\n const end = start + stride;\n lines.push(...subTensorToString(\n vals.slice(start, end), subshape, dtype, substrides, padPerCol,\n i === size - 1 /* isLast */));\n }\n } else {\n for (let i = 0; i < size; i++) {\n const start = i * stride;\n const end = start + stride;\n lines.push(...subTensorToString(\n vals.slice(start, end), subshape, dtype, substrides, padPerCol,\n i === size - 1 /* isLast */));\n }\n }\n const sep = rank === 2 ? ',' : '';\n lines[0] = '[' + lines[0] + sep;\n for (let i = 1; i < lines.length - 1; i++) {\n lines[i] = ' ' + lines[i] + sep;\n }\n let newLineSep = ',\\n';\n for (let i = 2; i < rank; i++) {\n newLineSep += '\\n';\n }\n lines[lines.length - 1] =\n ' ' + lines[lines.length - 1] + ']' + (isLast ? '' : newLineSep);\n return lines;\n}\n\nfunction createComplexTuples(vals: Array<{}>|\n TypedArray): Array<[number, number]> {\n const complexTuples: Array<[number, number]> = [];\n for (let i = 0; i < vals.length; i += 2) {\n complexTuples.push([vals[i], vals[i + 1]] as [number, number]);\n }\n return complexTuples;\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlobal} from './global_util';\nimport {tensorToString} from './tensor_format';\nimport {ArrayMap, BackendValues, DataType, DataTypeMap, DataValues, NumericDataType, Rank, ShapeMap, SingleValueMap, TypedArray} from './types';\nimport * as util from './util';\nimport {computeStrides, toNestedArray} from './util';\n\nexport interface TensorData {\n dataId?: DataId;\n values?: DataTypeMap[D];\n}\n\n// This interface mimics KernelBackend (in backend.ts), which would create a\n// circular dependency if imported.\nexport interface Backend {}\n\n/**\n * A mutable object, similar to `tf.Tensor`, that allows users to set values\n * at locations before converting to an immutable `tf.Tensor`.\n *\n * See `tf.buffer` for creating a tensor buffer.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\nexport class TensorBuffer {\n size: number;\n shape: ShapeMap[R];\n strides: number[];\n values: DataTypeMap[D];\n\n constructor(shape: ShapeMap[R], public dtype: D, values?: DataTypeMap[D]) {\n this.shape = shape.slice() as ShapeMap[R];\n this.size = util.sizeFromShape(shape);\n\n if (values != null) {\n const n = values.length;\n util.assert(\n n === this.size,\n () => `Length of values '${n}' does not match the size ` +\n `inferred by the shape '${this.size}'.`);\n }\n if (dtype === 'complex64') {\n throw new Error(\n `complex64 dtype TensorBuffers are not supported. Please create ` +\n `a TensorBuffer for the real and imaginary parts separately and ` +\n `call tf.complex(real, imag).`);\n }\n this.values = values || util.getArrayFromDType(dtype, this.size);\n this.strides = computeStrides(shape);\n }\n\n /**\n * Sets a value in the buffer at a given location.\n *\n * @param value The value to set.\n * @param locs The location indices.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\n set(value: SingleValueMap[D], ...locs: number[]): void {\n if (locs.length === 0) {\n locs = [0];\n }\n util.assert(\n locs.length === this.rank,\n () => `The number of provided coordinates (${locs.length}) must ` +\n `match the rank (${this.rank})`);\n\n const index = this.locToIndex(locs);\n this.values[index] = value as number;\n }\n\n /**\n * Returns the value in the buffer at the provided location.\n *\n * @param locs The location indices.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\n get(...locs: number[]): SingleValueMap[D] {\n if (locs.length === 0) {\n locs = [0];\n }\n let i = 0;\n for (const loc of locs) {\n if (loc < 0 || loc >= this.shape[i]) {\n const msg = `Requested out of range element at ${locs}. ` +\n ` Buffer shape=${this.shape}`;\n throw new Error(msg);\n }\n i++;\n }\n let index = locs[locs.length - 1];\n for (let i = 0; i < locs.length - 1; ++i) {\n index += this.strides[i] * locs[i];\n }\n return this.values[index] as SingleValueMap[D];\n }\n\n locToIndex(locs: number[]): number {\n if (this.rank === 0) {\n return 0;\n } else if (this.rank === 1) {\n return locs[0];\n }\n let index = locs[locs.length - 1];\n for (let i = 0; i < locs.length - 1; ++i) {\n index += this.strides[i] * locs[i];\n }\n return index;\n }\n\n indexToLoc(index: number): number[] {\n if (this.rank === 0) {\n return [];\n } else if (this.rank === 1) {\n return [index];\n }\n const locs: number[] = new Array(this.shape.length);\n for (let i = 0; i < locs.length - 1; ++i) {\n locs[i] = Math.floor(index / this.strides[i]);\n index -= locs[i] * this.strides[i];\n }\n locs[locs.length - 1] = index;\n return locs;\n }\n\n get rank() {\n return this.shape.length;\n }\n\n /**\n * Creates an immutable `tf.Tensor` object from the buffer.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\n toTensor(): Tensor {\n return trackerFn().makeTensor(this.values, this.shape, this.dtype) as\n Tensor;\n }\n}\n\nexport interface TensorTracker {\n makeTensor(\n values: DataValues, shape: number[], dtype: DataType,\n backend?: Backend): Tensor;\n makeVariable(\n initialValue: Tensor, trainable?: boolean, name?: string,\n dtype?: DataType): Variable;\n incRef(a: Tensor, backend: Backend): void;\n disposeTensor(t: Tensor): void;\n disposeVariable(v: Variable): void;\n read(dataId: DataId): Promise;\n readSync(dataId: DataId): BackendValues;\n}\n\n/**\n * The Tensor class calls into this handler to delegate chaining operations.\n */\nexport interface OpHandler {\n cast(x: T, dtype: DataType): T;\n buffer(\n shape: ShapeMap[R], dtype: D,\n values?: DataTypeMap[D]): TensorBuffer;\n print(x: T, verbose: boolean): void;\n clone(x: T): T;\n // TODO(yassogba) bring reshape back?\n}\n\n// For tracking tensor creation and disposal.\nlet trackerFn: () => TensorTracker = null;\n// Used by chaining methods to call into ops.\nlet opHandler: OpHandler = null;\n// Used to warn about deprecated methods.\nlet deprecationWarningFn: (msg: string) => void = null;\n// This here so that we can use this method on dev branches and keep the\n// functionality at master.\n// tslint:disable-next-line:no-unused-expression\n[deprecationWarningFn];\n\n/**\n * An external consumer can register itself as the tensor tracker. This way\n * the Tensor class can notify the tracker for every tensor created and\n * disposed.\n */\nexport function setTensorTracker(fn: () => TensorTracker) {\n trackerFn = fn;\n}\n\n/**\n * An external consumer can register itself as the op handler. This way the\n * Tensor class can have chaining methods that call into ops via the op\n * handler.\n */\nexport function setOpHandler(handler: OpHandler) {\n opHandler = handler;\n}\n\n/**\n * Sets the deprecation warning function to be used by this file. This way the\n * Tensor class can be a leaf but still use the environment.\n */\nexport function setDeprecationWarningFn(fn: (msg: string) => void) {\n deprecationWarningFn = fn;\n}\n\n/**\n * We wrap data id since we use weak map to avoid memory leaks.\n * Since we have our own memory management, we have a reference counter\n * mapping a tensor to its data, so there is always a pointer (even if that\n * data is otherwise garbage collectable).\n * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/\n * Global_Objects/WeakMap\n */\nexport type DataId = object; // object instead of {} to force non-primitive.\n\n// Declare this namespace to make Tensor class augmentation work in google3.\nexport declare namespace Tensor {}\n/**\n * A `tf.Tensor` object represents an immutable, multidimensional array of\n * numbers that has a shape and a data type.\n *\n * For performance reasons, functions that create tensors do not necessarily\n * perform a copy of the data passed to them (e.g. if the data is passed as a\n * `Float32Array`), and changes to the data will change the tensor. This is not\n * a feature and is not supported. To avoid this behavior, use the tensor before\n * changing the input data or create a copy with `copy = tf.add(yourTensor, 0)`.\n *\n * See `tf.tensor` for details on how to create a `tf.Tensor`.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\nexport class Tensor {\n /** Unique id of this tensor. */\n readonly id: number;\n /**\n * Id of the bucket holding the data for this tensor. Multiple arrays can\n * point to the same bucket (e.g. when calling array.reshape()).\n */\n dataId: DataId;\n /** The shape of the tensor. */\n readonly shape: ShapeMap[R];\n /** Number of elements in the tensor. */\n readonly size: number;\n /** The data type for the array. */\n readonly dtype: DataType;\n /** The rank type for the array (see `Rank` enum). */\n readonly rankType: R;\n\n /** Whether this tensor has been globally kept. */\n kept = false;\n /** The id of the scope this tensor is being tracked in. */\n scopeId: number;\n\n /**\n * Number of elements to skip in each dimension when indexing. See\n * https://docs.scipy.org/doc/numpy/reference/generated/\\\n * numpy.ndarray.strides.html\n */\n readonly strides: number[];\n\n constructor(shape: ShapeMap[R], dtype: DataType, dataId: DataId, id: number) {\n this.shape = shape.slice() as ShapeMap[R];\n this.dtype = dtype || 'float32';\n this.size = util.sizeFromShape(shape);\n this.strides = computeStrides(shape);\n this.dataId = dataId;\n this.id = id;\n this.rankType = (this.rank < 5 ? this.rank.toString() : 'higher') as R;\n }\n\n get rank(): number {\n return this.shape.length;\n }\n\n /**\n * Returns a promise of `tf.TensorBuffer` that holds the underlying data.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n async buffer(): Promise> {\n const vals = await this.data();\n return opHandler.buffer(this.shape, this.dtype as D, vals);\n }\n\n /**\n * Returns a `tf.TensorBuffer` that holds the underlying data.\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n bufferSync(): TensorBuffer {\n return opHandler.buffer(this.shape, this.dtype as D, this.dataSync());\n }\n\n /**\n * Returns the tensor data as a nested array. The transfer of data is done\n * asynchronously.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n async array(): Promise {\n const vals = await this.data();\n return toNestedArray(this.shape, vals, this.dtype === 'complex64') as\n ArrayMap[R];\n }\n\n /**\n * Returns the tensor data as a nested array. The transfer of data is done\n * synchronously.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n arraySync(): ArrayMap[R] {\n return toNestedArray(\n this.shape, this.dataSync(), this.dtype === 'complex64') as\n ArrayMap[R];\n }\n\n /**\n * Asynchronously downloads the values from the `tf.Tensor`. Returns a\n * promise of `TypedArray` that resolves when the computation has finished.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n async data(): Promise {\n this.throwIfDisposed();\n const data = trackerFn().read(this.dataId);\n if (this.dtype === 'string') {\n const bytes = await data as Uint8Array[];\n try {\n return bytes.map(b => util.decodeString(b)) as DataTypeMap[D];\n } catch {\n throw new Error(\n 'Failed to decode the string bytes into utf-8. ' +\n 'To get the original bytes, call tensor.bytes().');\n }\n }\n return data as Promise;\n }\n\n /**\n * Synchronously downloads the values from the `tf.Tensor`. This blocks the\n * UI thread until the values are ready, which can cause performance issues.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n dataSync(): DataTypeMap[D] {\n this.throwIfDisposed();\n const data = trackerFn().readSync(this.dataId);\n if (this.dtype === 'string') {\n try {\n return (data as Uint8Array[]).map(b => util.decodeString(b)) as\n DataTypeMap[D];\n } catch {\n throw new Error(\n 'Failed to decode the string bytes into utf-8. ' +\n 'To get the original bytes, call tensor.bytes().');\n }\n }\n return data as DataTypeMap[D];\n }\n\n /** Returns the underlying bytes of the tensor's data. */\n async bytes(): Promise {\n this.throwIfDisposed();\n const data = await trackerFn().read(this.dataId);\n if (this.dtype === 'string') {\n return data as Uint8Array[];\n } else {\n return new Uint8Array((data as TypedArray).buffer);\n }\n }\n\n /**\n * Disposes `tf.Tensor` from memory.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n trackerFn().disposeTensor(this);\n this.isDisposedInternal = true;\n }\n\n protected isDisposedInternal = false;\n get isDisposed(): boolean {\n return this.isDisposedInternal;\n }\n\n throwIfDisposed() {\n if (this.isDisposed) {\n throw new Error(`Tensor is disposed.`);\n }\n }\n\n /**\n * Prints the `tf.Tensor`. See `tf.print` for details.\n *\n * @param verbose Whether to print verbose information about the tensor,\n * including dtype and size.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n print(verbose = false): void {\n return opHandler.print(this, verbose);\n }\n\n /**\n * Returns a copy of the tensor. See `tf.clone` for details.\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n clone(this: T): T {\n this.throwIfDisposed();\n return opHandler.clone(this);\n }\n\n /**\n * Returns a human-readable description of the tensor. Useful for logging.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n toString(verbose = false): string {\n const vals = this.dataSync();\n return tensorToString(vals, this.shape, this.dtype, verbose);\n }\n\n cast(dtype: DataType): T {\n this.throwIfDisposed();\n return opHandler.cast(this as T, dtype);\n }\n variable(trainable = true, name?: string, dtype?: DataType): Variable {\n this.throwIfDisposed();\n return trackerFn().makeVariable(this, trainable, name, dtype) as\n Variable;\n }\n}\nObject.defineProperty(Tensor, Symbol.hasInstance, {\n value: (instance: Tensor) => {\n // Implementation note: we should use properties of the object that will be\n // defined before the constructor body has finished executing (methods).\n // This is because when this code is transpiled by babel, babel will call\n // classCallCheck before the constructor body is run.\n // See https://github.com/tensorflow/tfjs/issues/3384 for backstory.\n return !!instance && instance.data != null && instance.dataSync != null &&\n instance.throwIfDisposed != null;\n }\n});\n\nexport function getGlobalTensorClass() {\n // Use getGlobal so that we can augment the Tensor class across package\n // boundaries becase the node resolution alg may result in different modules\n // being returned for this file depending on the path they are loaded from.\n return getGlobal('Tensor', () => {\n return Tensor;\n });\n}\n\n// Global side effect. Cache global reference to Tensor class\ngetGlobalTensorClass();\n\nexport interface NumericTensor extends Tensor {\n dtype: NumericDataType;\n dataSync(): DataTypeMap[D];\n data(): Promise;\n}\n\nexport interface StringTensor extends Tensor {\n dtype: 'string';\n dataSync(): DataTypeMap[D];\n data(): Promise;\n}\n\n/** @doclink Tensor */\nexport type Scalar = Tensor;\n/** @doclink Tensor */\nexport type Tensor1D = Tensor;\n/** @doclink Tensor */\nexport type Tensor2D = Tensor;\n/** @doclink Tensor */\nexport type Tensor3D = Tensor;\n/** @doclink Tensor */\nexport type Tensor4D = Tensor;\n/** @doclink Tensor */\nexport type Tensor5D = Tensor;\n/** @doclink Tensor */\nexport type Tensor6D = Tensor;\n\n/**\n * A mutable `tf.Tensor`, useful for persisting state, e.g. for training.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\nexport class Variable extends Tensor {\n name: string;\n\n constructor(\n initialValue: Tensor, public trainable: boolean, name: string,\n tensorId: number) {\n super(\n initialValue.shape, initialValue.dtype, initialValue.dataId, tensorId);\n this.name = name;\n }\n\n /**\n * Assign a new `tf.Tensor` to this variable. The new `tf.Tensor` must have\n * the same shape and dtype as the old `tf.Tensor`.\n *\n * @param newValue New tensor to be assigned to this variable.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n assign(newValue: Tensor): void {\n if (newValue.dtype !== this.dtype) {\n throw new Error(\n `dtype of the new value (${newValue.dtype}) and ` +\n `previous value (${this.dtype}) must match`);\n }\n if (!util.arraysEqual(newValue.shape, this.shape)) {\n throw new Error(\n `shape of the new value (${newValue.shape}) and ` +\n `previous value (${this.shape}) must match`);\n }\n trackerFn().disposeTensor(this);\n this.dataId = newValue.dataId;\n trackerFn().incRef(this, null /* backend */);\n }\n\n dispose(): void {\n trackerFn().disposeVariable(this);\n this.isDisposedInternal = true;\n }\n}\n\nObject.defineProperty(Variable, Symbol.hasInstance, {\n value: (instance: Variable) => {\n return instance instanceof Tensor && instance.assign != null &&\n instance.assign instanceof Function;\n }\n});\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from './tensor';\nimport {TensorContainer, TensorContainerArray} from './tensor_types';\nimport {upcastType} from './types';\nimport {assert} from './util';\n\nexport function makeTypesMatch(a: T, b: T): [T, T] {\n if (a.dtype === b.dtype) {\n return [a, b];\n }\n const dtype = upcastType(a.dtype, b.dtype);\n return [a.cast(dtype), b.cast(dtype)];\n}\n\nexport function assertTypesMatch(a: Tensor, b: Tensor): void {\n assert(\n a.dtype === b.dtype,\n () => `The dtypes of the first(${a.dtype}) and` +\n ` second(${b.dtype}) input must match`);\n}\n\nexport function isTensorInList(tensor: Tensor, tensorList: Tensor[]): boolean {\n return tensorList.some(x => x.id === tensor.id);\n}\n\n/**\n * Extracts any `Tensor`s found within the provided object.\n *\n * @param container an object that may be a `Tensor` or may directly contain\n * `Tensor`s, such as a `Tensor[]` or `{key: Tensor, ...}`. In general it\n * is safe to pass any object here, except that `Promise`s are not\n * supported.\n * @returns An array of `Tensors` found within the passed object. If the\n * argument is simply a `Tensor', a list containing that `Tensor` is\n * returned. If the object is not a `Tensor` or does not\n * contain `Tensors`, an empty list is returned.\n */\nexport function getTensorsInContainer(result: TensorContainer): Tensor[] {\n const list: Tensor[] = [];\n const seen = new Set<{}|void>();\n walkTensorContainer(result, list, seen);\n return list;\n}\n\nfunction walkTensorContainer(\n container: TensorContainer, list: Tensor[], seen: Set<{}|void>): void {\n if (container == null) {\n return;\n }\n if (container instanceof Tensor) {\n list.push(container);\n return;\n }\n if (!isIterable(container)) {\n return;\n }\n // Iteration over keys works also for arrays.\n const iterable = container as TensorContainerArray;\n for (const k in iterable) {\n const val = iterable[k];\n if (!seen.has(val)) {\n seen.add(val);\n walkTensorContainer(val, list, seen);\n }\n }\n}\n\n// tslint:disable-next-line:no-any\nfunction isIterable(obj: any): boolean {\n return Array.isArray(obj) || typeof obj === 'object';\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/** @docalias number[] */\nexport interface ShapeMap {\n R0: number[];\n R1: [number];\n R2: [number, number];\n R3: [number, number, number];\n R4: [number, number, number, number];\n R5: [number, number, number, number, number];\n R6: [number, number, number, number, number, number];\n}\n\n/** @docalias number[] */\nexport interface ArrayMap {\n R0: number;\n R1: number[];\n R2: number[][];\n R3: number[][][];\n R4: number[][][][];\n R5: number[][][][][];\n R6: number[][][][][][];\n}\n\nexport interface DataTypeMap {\n float32: Float32Array;\n int32: Int32Array;\n bool: Uint8Array;\n complex64: Float32Array;\n string: string[];\n}\n\nexport interface SingleValueMap {\n bool: boolean;\n int32: number;\n float32: number;\n complex64: number;\n string: string;\n}\n\n/** @docalias 'float32'|'int32'|'bool'|'complex64'|'string' */\nexport type DataType = keyof DataTypeMap;\nexport type NumericDataType = 'float32'|'int32'|'bool'|'complex64';\nexport type TypedArray = Float32Array|Int32Array|Uint8Array;\n/** Tensor data used in tensor creation and user-facing API. */\nexport type DataValues = DataTypeMap[DataType];\n/** The underlying tensor data that gets stored in a backend. */\nexport type BackendValues = Float32Array|Int32Array|Uint8Array|Uint8Array[];\n\nexport enum Rank {\n R0 = 'R0',\n R1 = 'R1',\n R2 = 'R2',\n R3 = 'R3',\n R4 = 'R4',\n R5 = 'R5',\n R6 = 'R6'\n}\n\nexport type FlatVector = boolean[]|number[]|TypedArray;\nexport type RegularArray =\n T[]|T[][]|T[][][]|T[][][][]|T[][][][][]|T[][][][][][];\n\n// tslint:disable-next-line:no-any\nexport interface RecursiveArray {\n [index: number]: T|RecursiveArray;\n}\n\n// Looks for upcasting types. Used, for example, in operations with mixed dtype\n// inputs.\nenum UpcastInt32AndMap {\n 'float32' = 'float32',\n 'int32' = 'int32',\n 'bool' = 'int32',\n 'complex64' = 'complex64'\n}\n\nenum UpcastBoolAndMap {\n 'float32' = 'float32',\n 'int32' = 'int32',\n 'bool' = 'bool',\n 'complex64' = 'complex64'\n}\n\nenum UpcastFloat32AndMap {\n 'float32' = 'float32',\n 'int32' = 'float32',\n 'bool' = 'float32',\n 'complex64' = 'complex64'\n}\n\nenum UpcastComplex64AndMap {\n 'float32' = 'complex64',\n 'int32' = 'complex64',\n 'bool' = 'complex64',\n 'complex64' = 'complex64'\n}\n\nconst upcastTypeMap = {\n 'float32': UpcastFloat32AndMap,\n 'int32': UpcastInt32AndMap,\n 'bool': UpcastBoolAndMap,\n 'complex64': UpcastComplex64AndMap\n};\n\nexport function upcastType(typeA: DataType, typeB: DataType): DataType {\n if (typeA === 'string' || typeB === 'string') {\n if (typeA === 'string' && typeB === 'string') {\n return 'string';\n }\n throw new Error(`Can not upcast ${typeA} with ${typeB}`);\n }\n return upcastTypeMap[typeA][typeB];\n}\n\n/** Returns the output type after summation. */\nexport function sumOutType(type: DataType): DataType {\n return upcastType(type, 'int32');\n}\n\n/** @docalias TypedArray|Array */\nexport type TensorLike =\n TypedArray|number|boolean|string|RecursiveArray|\n RecursiveArray|RecursiveArray|Uint8Array[];\nexport type ScalarLike = number|boolean|string|Uint8Array;\n/** @docalias TypedArray|Array */\nexport type TensorLike1D = TypedArray|number[]|boolean[]|string[]|Uint8Array[];\n/** @docalias TypedArray|Array */\nexport type TensorLike2D = TypedArray|number[]|number[][]|boolean[]|boolean[][]|\n string[]|string[][]|Uint8Array[]|Uint8Array[][];\n/** @docalias TypedArray|Array */\nexport type TensorLike3D = TypedArray|number[]|number[][][]|boolean[]|\n boolean[][][]|string[]|string[][][]|Uint8Array[]|Uint8Array[][][];\n/** @docalias TypedArray|Array */\nexport type TensorLike4D = TypedArray|number[]|number[][][][]|boolean[]|\n boolean[][][][]|string[]|string[][][][]|Uint8Array[]|Uint8Array[][][][];\n/** @docalias TypedArray|Array */\nexport type TensorLike5D =\n TypedArray|number[]|number[][][][][]|boolean[]|boolean[][][][][]|string[]|\n string[][][][][]|Uint8Array[]|Uint8Array[][][][][];\n/** @docalias TypedArray|Array */\nexport type TensorLike6D =\n TypedArray|number[]|number[][][][][][]|boolean[]|boolean[][][][][][]|\n string[]|string[][][][][][]|Uint8Array[]|Uint8Array[][][][][];\n\n/** Type for representing image data in Uint8Array type. */\nexport interface PixelData {\n width: number;\n height: number;\n data: Uint8Array;\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BackendTimingInfo, DataMover, KernelBackend} from './backends/backend';\nimport {Environment, setEnvironmentGlobal} from './environment';\nimport {getGlobalNamespace} from './global_util';\nimport {Add, Cast, Identity} from './kernel_names';\nimport {getGradient, getKernel, getKernelsForBackend, GradFunc, NamedAttrMap, TensorInfo} from './kernel_registry';\nimport {KernelProfile, Profiler} from './profiler';\nimport {backpropagateGradients, getFilteredNodesXToY, TapeNode} from './tape';\nimport {DataId, setTensorTracker, Tensor, TensorTracker, Variable} from './tensor';\nimport {GradSaveFunc, NamedTensorMap, NamedVariableMap, TensorContainer} from './tensor_types';\nimport {getTensorsInContainer} from './tensor_util';\nimport {BackendValues, DataType, DataValues} from './types';\nimport * as util from './util';\nimport {bytesFromStringArray, makeOnesTypedArray, now, sizeFromShape} from './util';\n\n/**\n * A function that computes an output. The save function is for saving tensors\n * computed in the forward pass, that we need in the backward pass.\n */\nexport type ForwardFunc = (backend: KernelBackend, save?: GradSaveFunc) => T;\n\n/**\n * @docalias (a: Tensor, b: Tensor,..., save?: Function) => {\n * value: Tensor,\n * gradFunc: (dy: Tensor, saved?: NamedTensorMap) => Tensor | Tensor[]\n * }\n */\nexport type CustomGradientFunc =\n (...inputs: Array) => {\n value: T;\n gradFunc: (dy: T, saved: Tensor[]) => Tensor | Tensor[];\n };\n\nexport type MemoryInfo = {\n numTensors: number; numDataBuffers: number; numBytes: number;\n unreliable?: boolean; reasons: string[];\n};\n\ntype KernelInfo = {\n name: string; bytesAdded: number; totalBytesSnapshot: number;\n tensorsAdded: number;\n totalTensorsSnapshot: number;\n inputShapes: number[][];\n outputShapes: number[][];\n kernelTimeMs: number | {error: string} | Promise;\n extraInfo: string | Promise;\n};\n\nexport type ProfileInfo = {\n newBytes: number; newTensors: number; peakBytes: number;\n kernels: KernelInfo[];\n result: TensorContainer;\n kernelNames: string[];\n};\n\nexport interface TimingInfo extends BackendTimingInfo {\n wallMs: number;\n}\n\n/** @docalias Function */\nexport type ScopeFn = () => T;\n\ninterface ScopeState {\n track: Tensor[];\n name: string;\n id: number;\n}\n\ninterface RegisteredKernelInvocation {\n kernelName: string;\n inputs: I;\n attrs?: NamedAttrMap;\n}\n\ninterface CustomGradKernelInvocation {\n forwardFunc: ForwardFunc;\n backwardsFunc: (dy: T, saved: Tensor[]) => {\n [P in keyof I]: () => I[P]\n };\n inputs: I;\n attrs?: NamedAttrMap;\n}\n\nfunction isRegisteredKernelInvocation(\n kernelInvocation: RegisteredKernelInvocation|\n CustomGradKernelInvocation):\n kernelInvocation is RegisteredKernelInvocation {\n return (kernelInvocation as RegisteredKernelInvocation).kernelName != null;\n}\n\nclass EngineState {\n // Public since optimizers will use it.\n registeredVariables: NamedVariableMap = {};\n\n nextTapeNodeId = 0;\n numBytes = 0;\n numTensors = 0;\n numStringTensors = 0;\n numDataBuffers = 0;\n\n activeTape: TapeNode[];\n // Number of nested tf.grad() statements when computing higher-order\n // gradients. E.g. `1` for first-order gradients and `2` for second-order\n // gradients. Used to track if the tape should be removed after a backprop.\n gradientDepth = 0;\n // Number of nested kernel calls. When kernel depth is greater than 1, we turn\n // off the tape.\n kernelDepth = 0;\n\n // Keep Tensors that parallel the tapes.\n activeScope: ScopeState;\n scopeStack: ScopeState[] = [];\n /**\n * Keeps track of the number of data moves during a kernel execution. We\n * maintain a stack since kernels can call other kernels, recursively.\n */\n numDataMovesStack: number[] = [];\n nextScopeId = 0;\n\n tensorInfo = new WeakMap();\n\n profiling = false;\n activeProfile: ProfileInfo = {\n newBytes: 0,\n newTensors: 0,\n peakBytes: 0,\n kernels: [],\n result: null,\n get kernelNames():\n string[] {\n return Array.from(new Set(this.kernels.map(k => k.name)));\n }\n };\n\n dispose() {\n for (const variableName in this.registeredVariables) {\n this.registeredVariables[variableName].dispose();\n }\n }\n}\n\nexport class Engine implements TensorTracker, DataMover {\n state: EngineState;\n backendName: string;\n registry: {[id: string]: KernelBackend} = {};\n registryFactory: {\n [id: string]: {\n factory: () => KernelBackend | Promise,\n priority: number\n }\n } = {};\n\n private profiler: Profiler;\n private backendInstance: KernelBackend;\n private pendingBackendInit: Promise;\n private pendingBackendInitId = 0;\n\n constructor(public ENV: Environment) {\n this.state = new EngineState();\n }\n\n async ready(): Promise {\n if (this.pendingBackendInit != null) {\n return this.pendingBackendInit.then(() => {});\n }\n if (this.backendInstance != null) {\n return;\n }\n const sortedBackends = this.getSortedBackends();\n\n for (let i = 0; i < sortedBackends.length; i++) {\n const backendName = sortedBackends[i];\n const success = await this.initializeBackend(backendName).success;\n if (success) {\n await this.setBackend(backendName);\n return;\n }\n }\n\n throw new Error(\n `Could not initialize any backends, all backend initializations ` +\n `failed.`);\n }\n\n get backend(): KernelBackend {\n if (this.pendingBackendInit != null) {\n throw new Error(\n `Backend '${this.backendName}' has not yet been initialized. Make ` +\n `sure to await tf.ready() or await tf.setBackend() before calling ` +\n `other methods`);\n }\n if (this.backendInstance == null) {\n const {name, asyncInit} = this.initializeBackendsAndReturnBest();\n if (asyncInit) {\n throw new Error(\n `The highest priority backend '${name}' has not yet been ` +\n `initialized. Make sure to await tf.ready() or ` +\n `await tf.setBackend() before calling other methods`);\n }\n this.setBackend(name);\n }\n return this.backendInstance;\n }\n\n backendNames(): string[] {\n return Object.keys(this.registryFactory);\n }\n\n findBackend(backendName: string): KernelBackend {\n if (!(backendName in this.registry)) {\n // If the backend hasn't been initialized but we have a registry entry for\n // it, initialize it and return it.\n if (backendName in this.registryFactory) {\n const {asyncInit} = this.initializeBackend(backendName);\n if (asyncInit) {\n // Backend is not ready yet.\n return null;\n }\n } else {\n return null;\n }\n }\n return this.registry[backendName];\n }\n\n findBackendFactory(backendName: string):\n () => KernelBackend | Promise {\n if (!(backendName in this.registryFactory)) {\n return null;\n }\n return this.registryFactory[backendName].factory;\n }\n\n registerBackend(\n backendName: string,\n factory: () => KernelBackend | Promise,\n priority = 1): boolean {\n if (backendName in this.registryFactory) {\n console.warn(\n `${backendName} backend was already registered. ` +\n `Reusing existing backend factory.`);\n return false;\n }\n this.registryFactory[backendName] = {factory, priority};\n return true;\n }\n\n async setBackend(backendName: string): Promise {\n if (this.registryFactory[backendName] == null) {\n throw new Error(`Backend name '${backendName}' not found in registry`);\n }\n this.backendName = backendName;\n if (this.registry[backendName] == null) {\n this.backendInstance = null;\n const {success, asyncInit} = this.initializeBackend(backendName);\n const result = asyncInit ? await success : success;\n if (!result) {\n return false;\n }\n }\n this.backendInstance = this.registry[backendName];\n this.setupRegisteredKernels();\n // Reset the profiler.\n this.profiler = new Profiler(this.backendInstance);\n\n return true;\n }\n\n private setupRegisteredKernels(): void {\n const kernels = getKernelsForBackend(this.backendName);\n kernels.forEach(kernel => {\n if (kernel.setupFunc != null) {\n kernel.setupFunc(this.backendInstance);\n }\n });\n }\n\n private disposeRegisteredKernels(backendName: string): void {\n const kernels = getKernelsForBackend(backendName);\n kernels.forEach(kernel => {\n if (kernel.disposeFunc != null) {\n kernel.disposeFunc(this.registry[backendName]);\n }\n });\n }\n\n /**\n * Initializes a backend by looking up the backend name in the factory\n * registry and calling the factory method. Returns a boolean representing\n * whether the initialization of the backend suceeded. Throws an error if\n * there is no backend in the factory registry.\n */\n private initializeBackend(backendName: string):\n {success: boolean|Promise, asyncInit: boolean} {\n const registryFactoryEntry = this.registryFactory[backendName];\n if (registryFactoryEntry == null) {\n throw new Error(\n `Cannot initialize backend ${backendName}, no registration found.`);\n }\n\n try {\n const backend = registryFactoryEntry.factory();\n /* Test if the factory returns a promise.\n Done in a more liberal way than\n previous 'Promise.resolve(backend)===backend'\n as we needed to account for custom Promise\n implementations (e.g. Angular) */\n if (backend && !(backend instanceof KernelBackend) &&\n typeof backend.then === 'function') {\n const promiseId = ++this.pendingBackendInitId;\n const success =\n backend\n .then(backendInstance => {\n // Outdated promise. Another backend was set in the meantime.\n if (promiseId < this.pendingBackendInitId) {\n return false;\n }\n this.registry[backendName] = backendInstance;\n this.pendingBackendInit = null;\n return true;\n })\n .catch(err => {\n // Outdated promise. Another backend was set in the meantime.\n if (promiseId < this.pendingBackendInitId) {\n return false;\n }\n this.pendingBackendInit = null;\n console.warn(\n `Initialization of backend ${backendName} failed`);\n console.warn(err.stack || err.message);\n return false;\n });\n this.pendingBackendInit = success;\n return {success, asyncInit: true};\n } else {\n this.registry[backendName] = backend as KernelBackend;\n return {success: true, asyncInit: false};\n }\n } catch (err) {\n console.warn(`Initialization of backend ${backendName} failed`);\n console.warn(err.stack || err.message);\n return {success: false, asyncInit: false};\n }\n }\n\n removeBackend(backendName: string): void {\n if (!(backendName in this.registryFactory)) {\n throw new Error(`${backendName} backend not found in registry`);\n }\n if (this.backendName === backendName && this.pendingBackendInit != null) {\n // There is a pending promise of the backend we want to remove. Make it\n // obsolete.\n this.pendingBackendInitId++;\n }\n\n if (backendName in this.registry) {\n this.disposeRegisteredKernels(backendName);\n this.registry[backendName].dispose();\n delete this.registry[backendName];\n }\n\n delete this.registryFactory[backendName];\n\n // Unset the backend if it is active.\n if (this.backendName === backendName) {\n this.pendingBackendInit = null;\n this.backendName = null;\n this.backendInstance = null;\n }\n }\n\n private getSortedBackends(): string[] {\n if (Object.keys(this.registryFactory).length === 0) {\n throw new Error('No backend found in registry.');\n }\n return Object.keys(this.registryFactory).sort((a: string, b: string) => {\n // Highest priority comes first.\n return this.registryFactory[b].priority -\n this.registryFactory[a].priority;\n });\n }\n\n private initializeBackendsAndReturnBest():\n {name: string, asyncInit: boolean} {\n const sortedBackends = this.getSortedBackends();\n\n for (let i = 0; i < sortedBackends.length; i++) {\n const backendName = sortedBackends[i];\n const {success, asyncInit} = this.initializeBackend(backendName);\n if (asyncInit || success) {\n return {name: backendName, asyncInit};\n }\n }\n throw new Error(\n `Could not initialize any backends, all backend initializations ` +\n `failed.`);\n }\n\n moveData(backend: KernelBackend, dataId: DataId) {\n const info = this.state.tensorInfo.get(dataId);\n const srcBackend = info.backend;\n const values = this.readSync(dataId);\n const refCount = srcBackend.refCount(dataId);\n // Delete the tensor from the old backend and move it to the new\n // backend.\n srcBackend.disposeData(dataId, true);\n info.backend = backend;\n backend.move(dataId, values, info.shape, info.dtype, refCount);\n if (this.shouldCheckForMemLeaks()) {\n // Track the number of moves during a kernel execution to correctly\n // detect memory leaks.\n this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1]++;\n }\n }\n\n tidy(nameOrFn: string|ScopeFn, fn?: ScopeFn):\n T {\n let name: string = null;\n if (fn == null) {\n // Called with only 1 argument.\n if (typeof nameOrFn !== 'function') {\n throw new Error('Please provide a function to tidy()');\n }\n fn = nameOrFn;\n } else {\n // Called with 2 arguments.\n if (typeof nameOrFn !== 'string' && !(nameOrFn instanceof String)) {\n throw new Error(\n 'When calling with two arguments, the first argument ' +\n 'to tidy() must be a string');\n }\n if (typeof fn !== 'function') {\n throw new Error(\n 'When calling with two arguments, the 2nd argument ' +\n 'to tidy() must be a function');\n }\n name = nameOrFn as string;\n // TODO(nsthorat,smilkov): Do operation logging and performance\n // profiling.\n }\n let result: T;\n return this.scopedRun(\n () => this.startScope(name), () => this.endScope(result), () => {\n result = fn();\n if (result instanceof Promise) {\n console.error('Cannot return a Promise inside of tidy.');\n }\n return result;\n });\n }\n\n private scopedRun(start: () => void, end: () => void, f: () => T): T {\n start();\n try {\n const res = f();\n end();\n return res;\n } catch (ex) {\n end();\n throw ex;\n }\n }\n\n private static nextTensorId = 0;\n private nextTensorId(): number {\n return Engine.nextTensorId++;\n }\n\n private static nextVariableId = 0;\n private nextVariableId(): number {\n return Engine.nextVariableId++;\n }\n\n /**\n * This method is called instead of the public-facing tensor.clone() when\n * saving a tensor for backwards pass. It makes sure to add the clone\n * operation to the tape regardless of being called inside a kernel\n * execution.\n */\n private clone(x: Tensor): Tensor {\n const y: Tensor = ENGINE.runKernel(Identity, {x} as {} as NamedTensorMap);\n const inputs = {x};\n const grad = (dy: Tensor) => ({\n x: () => {\n const dtype = 'float32';\n const gradInputs = {x: dy};\n const attrs = {dtype};\n\n return ENGINE.runKernel(\n Cast, gradInputs as {} as NamedTensorMap,\n // tslint:disable-next-line: no-unnecessary-type-assertion\n attrs as {} as NamedAttrMap) as Tensor;\n }\n });\n const saved: Tensor[] = [];\n this.addTapeNode(this.state.activeScope.name, inputs, [y], grad, saved, {});\n return y;\n }\n\n /**\n * Execute a kernel with the given name and return the output tensor.\n *\n * @param kernelName The name of the kernel to execute.\n * @param inputs A map of input names to tensors.\n * @param attrs A map of attribute names to their values. An attribute is a\n * primitive (non-tensor) input to the kernel.\n * @param inputsToSave A list of tensors, inputs to save for the backprop\n * computation.\n * @param outputsToSave A list of booleans, specifying which output to save\n * for the backprop computation. These are booleans since the output\n * tensors are not visible to the user.\n */\n runKernel(\n kernelName: string, inputs: NamedTensorMap, attrs?: NamedAttrMap): T {\n const hasKernel = getKernel(kernelName, this.backendName) != null;\n if (!hasKernel) {\n throw new Error(`Kernel '${kernelName}' not registered for backend '${\n this.backendName}'`);\n }\n return this.runKernelFunc({kernelName, inputs, attrs});\n }\n\n private shouldCheckForMemLeaks(): boolean {\n return this.ENV.getBool('IS_TEST');\n }\n\n private checkKernelForMemLeak(\n kernelName: string, numDataIdsBefore: number,\n outInfos: TensorInfo[]): void {\n const numDataIdsAfter = this.backend.numDataIds();\n\n // Count the number of data ids associated with the result of the kernel.\n let numOutputDataIds = 0;\n outInfos.forEach(info => {\n // Complex numbers allocate 3 data ids, one for 'real', one for\n // 'imaginary', and one for the container that holds the former two.\n numOutputDataIds += (info.dtype === 'complex64' ? 3 : 1);\n });\n\n // Account for the number of moves during kernel execution. A \"data move\"\n // can happen in the middle of a kernel execution, placing a new (key,value)\n // pair in the data storage. Since data moves have net zero effect (we\n // always remove the data from the old backend), we have to cancel them out\n // when detecting memory leaks.\n const numMoves =\n this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1];\n const dataIdsLeaked =\n numDataIdsAfter - numDataIdsBefore - numOutputDataIds - numMoves;\n if (dataIdsLeaked > 0) {\n throw new Error(\n `Backend '${this.backendName}' has an internal memory leak ` +\n `(${dataIdsLeaked} data ids) after running '${kernelName}'`);\n }\n }\n\n /**\n * Internal helper method to execute a kernel Func\n *\n * Use `runKernel` to execute kernels from outside of engine.\n */\n private runKernelFunc(\n kernelParams: RegisteredKernelInvocation|\n CustomGradKernelInvocation): T {\n let outputs: Tensor[];\n let saved: Tensor[] = [];\n const isTapeOn = this.isTapeOn();\n\n const startingBytecount = this.state.numBytes;\n const startingNumTensors = this.state.numTensors;\n\n if (this.shouldCheckForMemLeaks()) {\n this.state.numDataMovesStack.push(0);\n }\n\n let kernelFunc: () => Tensor[];\n if (this.backendName == null) {\n // backend has not been initialized yet (backend initialization is lazy\n // can be deferred until an op/ kernel is run).\n // The below getter has side effects that will try to initialize the\n // backend and set properties like this.backendName\n // tslint:disable-next-line: no-unused-expression\n this.backend;\n }\n\n let out: TensorInfo|TensorInfo[];\n\n const kernelOrScopeName = isRegisteredKernelInvocation(kernelParams) ?\n kernelParams.kernelName :\n this.state.activeScope != null ? this.state.activeScope.name : '';\n\n // Create the kernelFunc from either a registered kernel OR passed in\n // forward/backward functions (used by custom grad). In this context a\n // kernelFunc wraps a kernel implementation with some bookkeeping.\n\n if (isRegisteredKernelInvocation(kernelParams)) {\n const {kernelName, inputs, attrs} = kernelParams;\n if (this.backendName == null) {\n // backend has not been initialized yet (backend initialization is lazy\n // can be deferred until an op/ kernel is run).\n // The below getter has side effects that will try to initialize the\n // backend and set properties like this.backendName\n // tslint:disable-next-line: no-unused-expression\n this.backend;\n }\n const kernel = getKernel(kernelName, this.backendName);\n util.assert(\n kernel != null,\n () => `Cannot find registered kernel '${kernelName}' for backend '${\n this.backendName}'`);\n\n kernelFunc = () => {\n const numDataIdsBefore = this.backend.numDataIds();\n out = kernel.kernelFunc({inputs, attrs, backend: this.backend});\n const outInfos = Array.isArray(out) ? out : [out];\n if (this.shouldCheckForMemLeaks()) {\n this.checkKernelForMemLeak(kernelName, numDataIdsBefore, outInfos);\n }\n\n const outTensors = outInfos.map((outInfo: TensorInfo|Tensor) => {\n // todo (yassogba) remove this option (Tensor) when node backend\n // methods have been modularized and they all return tensorInfo.\n // TensorInfos do not have a rank attribute.\n if ((outInfo as Tensor).rank != null) {\n return outInfo as Tensor;\n }\n const {dataId, shape, dtype} = outInfo as TensorInfo;\n return this.makeTensorFromDataId(dataId, shape, dtype);\n });\n\n // Save any required inputs and outputs.\n\n // Do not save unless we are recording to the tape. Otherwise it would\n // cause a mem leak since there would be no backprop for these tensors\n // (which would otherwise dispose them).\n if (isTapeOn) {\n const tensorsToSave =\n this.getTensorsForGradient(kernelName, inputs, outTensors);\n saved = this.saveTensorsForBackwardMode(tensorsToSave);\n }\n return outTensors;\n };\n } else {\n const {forwardFunc} = kernelParams;\n // Running a customGrad op.\n const saveFunc: GradSaveFunc = (tensors) => {\n // Do not save unless we are recording to the tape. Otherwise it would\n // cause a mem leak since we would never run backprop, which disposes\n // the kept tensors.\n if (!isTapeOn) {\n return;\n }\n saved = tensors.map(tensor => this.keep(this.clone(tensor)));\n };\n\n kernelFunc = () => {\n const numDataIdsBefore = this.backend.numDataIds();\n out = this.tidy(() => forwardFunc(this.backend, saveFunc));\n const outs = (Array.isArray(out) ? out : [out]) as Tensor[];\n if (this.shouldCheckForMemLeaks()) {\n // Scope name is used to print a more helpful error message if needed.\n this.checkKernelForMemLeak(kernelOrScopeName, numDataIdsBefore, outs);\n }\n return outs;\n };\n }\n\n //\n // Run the kernelFunc. Optionally profiling it.\n //\n const {inputs, attrs} = kernelParams;\n const backwardsFunc = isRegisteredKernelInvocation(kernelParams) ?\n null :\n kernelParams.backwardsFunc;\n\n let kernelProfile: KernelProfile;\n this.scopedRun(\n // Stop recording to a tape when running a kernel.\n () => this.state.kernelDepth++, () => this.state.kernelDepth--, () => {\n if (!this.ENV.getBool('DEBUG') && !this.state.profiling) {\n outputs = kernelFunc();\n } else {\n kernelProfile = this.profiler.profileKernel(\n kernelOrScopeName, inputs, () => kernelFunc());\n if (this.ENV.getBool('DEBUG')) {\n this.profiler.logKernelProfile(kernelProfile);\n }\n outputs = kernelProfile.outputs;\n }\n });\n\n if (isTapeOn) {\n this.addTapeNode(\n kernelOrScopeName, inputs, outputs, backwardsFunc, saved, attrs);\n }\n\n if (this.state.profiling) {\n this.state.activeProfile.kernels.push({\n name: kernelOrScopeName,\n bytesAdded: this.state.numBytes - startingBytecount,\n totalBytesSnapshot: this.state.numBytes,\n tensorsAdded: this.state.numTensors - startingNumTensors,\n totalTensorsSnapshot: this.state.numTensors,\n inputShapes: Object.keys(inputs).map(\n key => inputs[key] != null ? inputs[key].shape : null),\n outputShapes: outputs.map(item => item.shape),\n kernelTimeMs: kernelProfile.timeMs,\n extraInfo: kernelProfile.extraInfo\n });\n }\n return (Array.isArray(out) ? outputs : outputs[0]) as T;\n }\n\n /**\n * Saves tensors used in forward mode for use in backward mode.\n *\n * @param tensors the list of tensors to save.\n */\n private saveTensorsForBackwardMode(tensors: Tensor[]): Tensor[] {\n const saved = tensors.map(tensor => this.keep(this.clone(tensor)));\n return saved;\n }\n\n /**\n * Returns a list of tensors to save for a given gradient calculation.\n *\n * @param kernelName name of kernel to look up gradient for.\n * @param inputs a map of input tensors.\n * @param outputs an array of output tensors from forward mode of kernel.\n */\n private getTensorsForGradient(\n kernelName: string, inputs: NamedTensorMap,\n outputs: Tensor[]): Tensor[]|null {\n const gradConfig = getGradient(kernelName);\n if (gradConfig != null) {\n const inputsToSave: string[] = gradConfig.inputsToSave || [];\n const outputsToSave: boolean[] = gradConfig.outputsToSave || [];\n\n // If saveAllInputs is true, all inputs will be saved. Otherwise, inputs\n // specified in inputsToSave will be saved.\n let inputTensorsToSave: Tensor[];\n if (gradConfig.saveAllInputs) {\n util.assert(\n Array.isArray(inputs),\n () => 'saveAllInputs is true, expected inputs to be an array.');\n\n inputTensorsToSave = Object.keys(inputs).map((key) => inputs[key]);\n } else {\n inputTensorsToSave = inputsToSave.map((inputName) => inputs[inputName]);\n }\n\n const outputTensorsToSave: Tensor[] =\n outputs.filter((_, i) => outputsToSave[i]);\n\n return inputTensorsToSave.concat(outputTensorsToSave);\n }\n // We return an empty list rather than throw an error because the kernel we\n // are looking up may not actually be relevant to backproping through the\n // overall function\n //\n // See 'does not error if irrelevant (pruned) ops are missing grads' test\n // in gradients_test.ts for an example.\n return [];\n }\n\n /**\n * Internal method used by public APIs for tensor creation. Makes a new\n * tensor with the provided shape, dtype and values. It always\n * creates a new data id and writes the values to the underlying backend.\n */\n makeTensor(\n values: DataValues, shape: number[], dtype: DataType,\n backend?: KernelBackend): Tensor {\n if (values == null) {\n throw new Error('Values passed to engine.makeTensor() are null');\n }\n dtype = dtype || 'float32';\n backend = backend || this.backend;\n let backendVals = values as BackendValues;\n if (dtype === 'string' && util.isString(values[0])) {\n backendVals = (values as string[]).map(d => util.encodeString(d));\n }\n const dataId = backend.write(backendVals, shape, dtype);\n const t = new Tensor(shape, dtype, dataId, this.nextTensorId());\n this.trackTensor(t, backend);\n\n // Count bytes for string tensors.\n if (dtype === 'string') {\n const info = this.state.tensorInfo.get(dataId);\n const newBytes = bytesFromStringArray(backendVals as Uint8Array[]);\n this.state.numBytes += newBytes - info.bytes;\n info.bytes = newBytes;\n }\n return t;\n }\n\n /**\n * Internal method used by backends. Makes a new tensor\n * that is a wrapper around an existing data id. It doesn't create\n * a new data id, only increments the ref count used in memory tracking.\n */\n makeTensorFromDataId(\n dataId: DataId, shape: number[], dtype: DataType,\n backend?: KernelBackend): Tensor {\n dtype = dtype || 'float32';\n const t = new Tensor(shape, dtype, dataId, this.nextTensorId());\n this.trackTensor(t, backend);\n return t;\n }\n\n makeVariable(\n initialValue: Tensor, trainable = true, name?: string,\n dtype?: DataType): Variable {\n name = name || this.nextVariableId().toString();\n if (dtype != null && dtype !== initialValue.dtype) {\n initialValue = initialValue.cast(dtype);\n }\n const v = new Variable(initialValue, trainable, name, this.nextTensorId());\n if (this.state.registeredVariables[v.name] != null) {\n throw new Error(`Variable with name ${v.name} was already registered`);\n }\n this.state.registeredVariables[v.name] = v;\n this.incRef(v, this.backend);\n return v;\n }\n\n trackTensor(a: Tensor, backend: KernelBackend): void {\n this.state.numTensors++;\n if (a.dtype === 'string') {\n this.state.numStringTensors++;\n }\n // Bytes for complex numbers are counted by their components. Bytes for\n // string tensors are counted when writing values.\n let bytes = 0;\n if (a.dtype !== 'complex64' && a.dtype !== 'string') {\n bytes = a.size * util.bytesPerElement(a.dtype);\n }\n this.state.numBytes += bytes;\n\n if (!this.state.tensorInfo.has(a.dataId)) {\n this.state.numDataBuffers++;\n this.state.tensorInfo.set(a.dataId, {\n backend: backend || this.backend,\n dtype: a.dtype,\n shape: a.shape,\n bytes\n });\n }\n\n if (!(a instanceof Variable)) {\n this.track(a);\n }\n }\n\n // Track the tensor by dataId and increase the refCount for the dataId in the\n // backend.\n // TODO(pyu10055): This is currently used by makeVariable method, to increase\n // refCount on the backend for the dataId. It can potentially be replaced with\n // Identity op indead of calling backend directly.\n incRef(a: Tensor, backend: KernelBackend): void {\n this.trackTensor(a, backend);\n this.backend.incRef(a.dataId);\n }\n\n removeDataId(dataId: DataId, backend: KernelBackend) {\n if (this.state.tensorInfo.has(dataId) &&\n this.state.tensorInfo.get(dataId).backend === backend) {\n this.state.tensorInfo.delete(dataId);\n this.state.numDataBuffers--;\n }\n }\n disposeTensor(a: Tensor): void {\n if (!this.state.tensorInfo.has(a.dataId)) {\n return;\n }\n const info = this.state.tensorInfo.get(a.dataId);\n\n this.state.numTensors--;\n if (a.dtype === 'string') {\n this.state.numStringTensors--;\n this.state.numBytes -= info.bytes;\n }\n // Don't count bytes for complex numbers as they are counted by their\n // components.\n if (a.dtype !== 'complex64' && a.dtype !== 'string') {\n const bytes = a.size * util.bytesPerElement(a.dtype);\n this.state.numBytes -= bytes;\n }\n\n // Remove the reference to dataId if backend dispose the data successfully\n if (info.backend.disposeData(a.dataId)) {\n this.removeDataId(a.dataId, info.backend);\n }\n\n // TODO(nsthorat): Construct an error and save the stack trace for\n // debugging when in debug mode. Creating a stack trace is too expensive\n // to do unconditionally.\n }\n\n disposeVariables(): void {\n for (const varName in this.state.registeredVariables) {\n const v = this.state.registeredVariables[varName];\n this.disposeVariable(v);\n }\n }\n\n disposeVariable(v: Variable): void {\n this.disposeTensor(v);\n if (this.state.registeredVariables[v.name] != null) {\n delete this.state.registeredVariables[v.name];\n }\n }\n\n memory(): MemoryInfo {\n const info = this.backend.memory() as MemoryInfo;\n info.numTensors = this.state.numTensors;\n info.numDataBuffers = this.state.numDataBuffers;\n info.numBytes = this.state.numBytes;\n if (this.state.numStringTensors > 0) {\n info.unreliable = true;\n if (info.reasons == null) {\n info.reasons = [];\n }\n info.reasons.push(\n 'Memory usage by string tensors is approximate ' +\n '(2 bytes per character)');\n }\n return info;\n }\n\n async profile(query: () => (TensorContainer | Promise)):\n Promise {\n this.state.profiling = true;\n\n const startBytes = this.state.numBytes;\n const startNumTensors = this.state.numTensors;\n\n this.state.activeProfile.kernels = [];\n this.state.activeProfile.result = await query();\n\n this.state.profiling = false;\n\n this.state.activeProfile.peakBytes = Math.max(\n ...this.state.activeProfile.kernels.map(d => d.totalBytesSnapshot));\n this.state.activeProfile.newBytes = this.state.numBytes - startBytes;\n this.state.activeProfile.newTensors =\n this.state.numTensors - startNumTensors;\n for (const kernel of this.state.activeProfile.kernels) {\n kernel.kernelTimeMs = await kernel.kernelTimeMs;\n kernel.extraInfo = await kernel.extraInfo;\n }\n return this.state.activeProfile;\n }\n\n isTapeOn(): boolean {\n return this.state.gradientDepth > 0 && this.state.kernelDepth === 0;\n }\n\n private addTapeNode(\n kernelName: string, inputs: NamedTensorMap, outputs: Tensor[],\n gradientsFunc: GradFunc, saved: Tensor[], attrs: NamedAttrMap): void {\n const tapeNode: TapeNode =\n {id: this.state.nextTapeNodeId++, kernelName, inputs, outputs, saved};\n\n const gradConfig = getGradient(kernelName);\n if (gradConfig != null) {\n gradientsFunc = gradConfig.gradFunc;\n }\n if (gradientsFunc != null) {\n tapeNode.gradient = (dys: Tensor[]) => {\n // TODO(smilkov): To optimize back-prop, pass dys that are not used in\n // the backprop graph to the user as null instead of zeros\n dys = dys.map((dy, i) => {\n if (dy == null) {\n const output = outputs[i];\n const vals = util.makeZerosTypedArray(output.size, output.dtype);\n return this.makeTensor(vals, output.shape, output.dtype);\n }\n return dy;\n });\n // Grad functions of ops with single outputs expect a dy, while ops\n // with multiple outputs expect dys (array of dy).\n return gradientsFunc(dys.length > 1 ? dys : dys[0], saved, attrs);\n };\n }\n this.state.activeTape.push(tapeNode);\n }\n\n keep(result: T): T {\n result.kept = true;\n return result;\n }\n\n private startTape() {\n if (this.state.gradientDepth === 0) {\n this.state.activeTape = [];\n }\n this.state.gradientDepth++;\n }\n\n private endTape() {\n this.state.gradientDepth--;\n }\n\n /**\n * Start a scope. Use this with endScope() to achieve the same functionality\n * as scope() without the need for a function closure.\n */\n startScope(name?: string) {\n const scopeInfo: ScopeState = {\n track: [],\n name: 'unnamed scope',\n id: this.state.nextScopeId++\n };\n if (name) {\n scopeInfo.name = name;\n }\n this.state.scopeStack.push(scopeInfo);\n this.state.activeScope = scopeInfo;\n }\n\n /**\n * End a scope. Use this with startScope() to achieve the same functionality\n * as scope() without the need for a function closure.\n */\n endScope(result?: TensorContainer) {\n const tensorsToTrackInParent = getTensorsInContainer(result);\n const tensorsToTrackInParentSet =\n new Set(tensorsToTrackInParent.map(t => t.id));\n\n // Dispose the arrays tracked in this scope.\n for (let i = 0; i < this.state.activeScope.track.length; i++) {\n const tensor = this.state.activeScope.track[i];\n if (!tensor.kept && !tensorsToTrackInParentSet.has(tensor.id)) {\n tensor.dispose();\n }\n }\n\n const oldScope = this.state.scopeStack.pop();\n this.state.activeScope = this.state.scopeStack.length === 0 ?\n null :\n this.state.scopeStack[this.state.scopeStack.length - 1];\n\n // Track the current result in the parent scope.\n tensorsToTrackInParent.forEach(tensor => {\n // Only track the tensor if was allocated in the inner scope and is not\n // globally kept.\n if (!tensor.kept && tensor.scopeId === oldScope.id) {\n this.track(tensor);\n }\n });\n }\n\n /**\n * Returns gradients of `f` with respect to each of the `xs`. The gradients\n * returned are of the same length as `xs`, but some might be null if `f`\n * was not a function of that `x`. It also takes optional dy to multiply the\n * gradient, which defaults to `1`.\n */\n gradients(\n f: () => T, xs: Tensor[], dy?: T,\n allowNoGradients = false): {value: T, grads: Tensor[]} {\n util.assert(\n xs.length > 0, () => 'gradients() received an empty list of xs.');\n if (dy != null && dy.dtype !== 'float32') {\n throw new Error(`dy must have 'float32' dtype, but has '${dy.dtype}'`);\n }\n\n const y = this.scopedRun(\n () => this.startTape(), () => this.endTape(),\n () => this.tidy('forward', f));\n\n util.assert(\n y instanceof Tensor,\n () => 'The result y returned by f() must be a tensor.');\n // Filter out the nodes that don't connect x => y.\n const filteredTape = getFilteredNodesXToY(this.state.activeTape, xs, y);\n if (!allowNoGradients && filteredTape.length === 0 && xs.length > 0) {\n throw new Error(\n 'Cannot compute gradient of y=f(x) with respect to x. Make sure ' +\n 'that the f you passed encloses all operations that lead from x ' +\n 'to y.');\n }\n\n return this.tidy('backward', () => {\n const accumulatedGradientMap: {[tensorId: number]: Tensor} = {};\n accumulatedGradientMap[y.id] = (dy == null) ? ones(y.shape) : dy;\n\n // Backprop gradients through the filtered nodes.\n backpropagateGradients(\n accumulatedGradientMap, filteredTape,\n // Pass the tidy function to avoid circular dep with `tape.ts`.\n f => this.tidy(f as ScopeFn),\n // Pass an add function to avoide a circular dep with `tape.ts`.\n add);\n const grads = xs.map(x => accumulatedGradientMap[x.id]);\n\n if (this.state.gradientDepth === 0) {\n // This means that we are not computing higher-order gradients\n // and can clean up the tape.\n this.state.activeTape.forEach(node => {\n for (const tensor of node.saved) {\n tensor.dispose();\n }\n });\n this.state.activeTape = null;\n }\n return {value: y, grads};\n });\n }\n\n customGrad(f: CustomGradientFunc):\n (...args: Array) => T {\n util.assert(\n util.isFunction(f),\n () => 'The f passed in customGrad(f) must be a function.');\n return (...inputs: Tensor[]): T => {\n util.assert(\n inputs.every(t => t instanceof Tensor),\n () => 'The args passed in customGrad(f)(x1, x2,...) must all be ' +\n 'tensors');\n\n let res: {\n value: T,\n gradFunc: (dy: T, saved: Tensor[]) => Tensor | Tensor[],\n };\n const inputMap: NamedTensorMap = {};\n inputs.forEach((input, i) => {\n inputMap[i] = input;\n });\n\n const forwardFunc: ForwardFunc = (_, save) => {\n res = f(...[...inputs, save]);\n util.assert(\n res.value instanceof Tensor,\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.value` is a tensor');\n util.assert(\n util.isFunction(res.gradFunc),\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.gradFunc` is a function.');\n return res.value;\n };\n\n const backwardsFunc = (dy: T, saved: Tensor[]) => {\n const gradRes = res.gradFunc(dy, saved);\n const grads: Tensor[] = Array.isArray(gradRes) ? gradRes : [gradRes];\n util.assert(\n grads.length === inputs.length,\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.gradFunc` is a function that returns ' +\n 'the same number of tensors as inputs passed to f(...).');\n util.assert(\n grads.every(t => t instanceof Tensor),\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.gradFunc` is a function that returns ' +\n 'a list of only tensors.');\n const gradMap: {[key: string]: () => Tensor} = {};\n grads.forEach((grad, i) => {\n gradMap[i] = () => grad;\n });\n return gradMap;\n };\n\n return this.runKernelFunc({\n forwardFunc,\n backwardsFunc,\n inputs: inputMap,\n });\n };\n }\n\n readSync(dataId: DataId): BackendValues {\n // Route the read to the correct backend.\n const info = this.state.tensorInfo.get(dataId);\n return info.backend.readSync(dataId);\n }\n read(dataId: DataId): Promise {\n // Route the read to the correct backend.\n const info = this.state.tensorInfo.get(dataId);\n return info.backend.read(dataId);\n }\n\n async time(query: () => void): Promise {\n const start = now();\n const timingInfo = await this.backend.time(query) as TimingInfo;\n timingInfo.wallMs = now() - start;\n return timingInfo;\n }\n\n /**\n * Tracks a Tensor in the current scope to be automatically cleaned up\n * when the current scope ends, and returns the value.\n *\n * @param result The Tensor to track in the current scope.\n */\n private track(result: T): T {\n if (this.state.activeScope != null) {\n result.scopeId = this.state.activeScope.id;\n this.state.activeScope.track.push(result);\n }\n\n return result;\n }\n\n get registeredVariables(): NamedVariableMap {\n return this.state.registeredVariables;\n }\n\n /**\n * Resets the engine state. Removes all backends but does not remove\n * registered backend factories.\n */\n reset(): void {\n // Make any pending promise obsolete.\n this.pendingBackendInitId++;\n\n this.state.dispose();\n this.ENV.reset();\n this.state = new EngineState();\n\n for (const backendName in this.registry) {\n this.disposeRegisteredKernels(backendName);\n this.registry[backendName].dispose();\n delete this.registry[backendName];\n }\n this.backendName = null;\n this.backendInstance = null;\n this.pendingBackendInit = null;\n }\n}\n\nfunction ones(shape: number[]): Tensor {\n const values = makeOnesTypedArray(sizeFromShape(shape), 'float32');\n return ENGINE.makeTensor(values, shape, 'float32');\n}\n\nexport function getOrMakeEngine(): Engine {\n const ns = getGlobalNamespace() as {} as {_tfengine: Engine};\n if (ns._tfengine == null) {\n const environment = new Environment(ns);\n ns._tfengine = new Engine(environment);\n }\n setEnvironmentGlobal(ns._tfengine.ENV);\n\n // Tell the current tensor interface that the global engine is responsible\n // for tracking.\n setTensorTracker(() => ns._tfengine);\n return ns._tfengine;\n}\n\nexport const ENGINE = getOrMakeEngine();\n\n/**\n * A implementation of the add op for use within engine and tape.\n *\n * This allows us to avoid a circular dependency between add.ts and engine.\n * It is exported to be available in tape tests.\n */\nexport function add(a: Tensor, b: Tensor): Tensor {\n // We duplicate Add here to avoid a circular dependency with add.ts.\n const inputs = {a, b};\n return ENGINE.runKernel(Add, inputs as {} as NamedTensorMap);\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// tslint:disable-next-line:no-any\nfunction _isNavigatorDefined(): boolean {\n return typeof navigator !== 'undefined' && navigator != null;\n}\n\nexport function isMobile(nav?: Navigator): boolean {\n if (nav || _isNavigatorDefined()) {\n if (!nav) {\n nav = navigator;\n }\n if (nav.product === 'ReactNative') {\n return true;\n }\n\n // tslint:disable-next-line:no-any\n const a = nav.userAgent || nav.vendor || (window as any).opera;\n // tslint:disable-next-line:max-line-length\n 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\n .test(a) ||\n // tslint:disable-next-line:max-line-length\n /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\n .test(a.substr(0, 4));\n }\n return false;\n}\n\nexport function isBrowser(): boolean {\n return (typeof window !== 'undefined' && window.document != null) ||\n //@ts-ignore\n (typeof WorkerGlobalScope !== 'undefined');\n}\n", "/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport './engine';\n\nimport * as device_util from './device_util';\nimport {env} from './environment';\n\nconst ENV = env();\n\n/**\n * This file contains environment-related flag registrations.\n */\n\n/** Whether to enable debug mode. */\nENV.registerFlag('DEBUG', () => false, debugValue => {\n if (debugValue) {\n console.warn(\n 'Debugging mode is ON. The output of every math call will ' +\n 'be downloaded to CPU and checked for NaNs. ' +\n 'This significantly impacts performance.');\n }\n});\n\n/** Whether we are in a browser (as versus, say, node.js) environment. */\nENV.registerFlag('IS_BROWSER', () => device_util.isBrowser());\n\n/** Whether we are in a browser (as versus, say, node.js) environment. */\nENV.registerFlag(\n 'IS_NODE',\n () => (typeof process !== 'undefined') &&\n (typeof process.versions !== 'undefined') &&\n (typeof process.versions.node !== 'undefined'));\n\n/** Whether this browser is Chrome. */\nENV.registerFlag(\n 'IS_CHROME',\n () => typeof navigator !== 'undefined' && navigator != null &&\n navigator.userAgent != null && /Chrome/.test(navigator.userAgent) &&\n /Google Inc/.test(navigator.vendor));\n\n/**\n * True when the environment is \"production\" where we disable safety checks\n * to gain performance.\n */\nENV.registerFlag('PROD', () => false);\n\n/**\n * Whether to do sanity checks when inferring a shape from user-provided\n * values, used when creating a new tensor.\n */\nENV.registerFlag(\n 'TENSORLIKE_CHECK_SHAPE_CONSISTENCY', () => ENV.getBool('DEBUG'));\n\n/** Whether deprecation warnings are enabled. */\nENV.registerFlag('DEPRECATION_WARNINGS_ENABLED', () => true);\n\n/** True if running unit tests. */\nENV.registerFlag('IS_TEST', () => false);\n\n/** Whether to check computation result for errors. */\nENV.registerFlag('CHECK_COMPUTATION_FOR_ERRORS', () => true);\n\n/** Whether the backend needs to wrap input to imageBitmap. */\nENV.registerFlag('WRAP_TO_IMAGEBITMAP', () => false);\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from './engine';\nimport {env} from './environment';\nimport {Tensor} from './tensor';\nimport {DataType, TensorLike} from './types';\nimport {assert, flatten, inferDtype, isTypedArray, toTypedArray} from './util';\n\nexport function inferShape(val: TensorLike, dtype?: DataType): number[] {\n let firstElem: typeof val = val;\n\n if (isTypedArray(val)) {\n return dtype === 'string' ? [] : [val.length];\n }\n if (!Array.isArray(val)) {\n return []; // Scalar.\n }\n const shape: number[] = [];\n\n while (Array.isArray(firstElem) ||\n isTypedArray(firstElem) && dtype !== 'string') {\n shape.push(firstElem.length);\n firstElem = firstElem[0];\n }\n if (Array.isArray(val) &&\n env().getBool('TENSORLIKE_CHECK_SHAPE_CONSISTENCY')) {\n deepAssertShapeConsistency(val, shape, []);\n }\n\n return shape;\n}\n\nfunction deepAssertShapeConsistency(\n val: TensorLike, shape: number[], indices: number[]) {\n indices = indices || [];\n if (!(Array.isArray(val)) && !isTypedArray(val)) {\n assert(\n shape.length === 0,\n () => `Element arr[${indices.join('][')}] is a primitive, ` +\n `but should be an array/TypedArray of ${shape[0]} elements`);\n return;\n }\n assert(\n shape.length > 0,\n () => `Element arr[${indices.join('][')}] should be a primitive, ` +\n `but is an array of ${val.length} elements`);\n assert(\n val.length === shape[0],\n () => `Element arr[${indices.join('][')}] should have ${shape[0]} ` +\n `elements, but has ${val.length} elements`);\n const subShape = shape.slice(1);\n for (let i = 0; i < val.length; ++i) {\n deepAssertShapeConsistency(val[i], subShape, indices.concat(i));\n }\n}\n\nfunction assertDtype(\n expectedDtype: DataType|'numeric'|'string_or_numeric',\n actualDType: DataType, argName: string, functionName: string) {\n if (expectedDtype === 'string_or_numeric') {\n return;\n }\n if (expectedDtype == null) {\n throw new Error(`Expected dtype cannot be null.`);\n }\n if (expectedDtype !== 'numeric' && expectedDtype !== actualDType ||\n expectedDtype === 'numeric' && actualDType === 'string') {\n throw new Error(\n `Argument '${argName}' passed to '${functionName}' must ` +\n `be ${expectedDtype} tensor, but got ${actualDType} tensor`);\n }\n}\n\nexport function convertToTensor(\n x: T|TensorLike, argName: string, functionName: string,\n parseAsDtype: DataType|'numeric'|'string_or_numeric' = 'numeric'): T {\n if (x instanceof Tensor) {\n assertDtype(parseAsDtype, x.dtype, argName, functionName);\n return x;\n }\n let inferredDtype = inferDtype(x);\n // If the user expects a bool/int/float, use that info to update the\n // inferredDtype when it is not a string.\n if (inferredDtype !== 'string' &&\n ['bool', 'int32', 'float32'].indexOf(parseAsDtype) >= 0) {\n inferredDtype = parseAsDtype as DataType;\n }\n assertDtype(parseAsDtype, inferredDtype, argName, functionName);\n\n if ((x == null) ||\n (!isTypedArray(x) && !Array.isArray(x) && typeof x !== 'number' &&\n typeof x !== 'boolean' && typeof x !== 'string')) {\n const type = x == null ? 'null' : (x as {}).constructor.name;\n throw new Error(\n `Argument '${argName}' passed to '${functionName}' must be a ` +\n `Tensor or TensorLike, but got '${type}'`);\n }\n const inferredShape = inferShape(x, inferredDtype);\n if (!isTypedArray(x) && !Array.isArray(x)) {\n x = [x] as number[];\n }\n const skipTypedArray = true;\n const values = inferredDtype !== 'string' ?\n toTypedArray(x, inferredDtype as DataType) :\n flatten(x as string[], [], skipTypedArray) as string[];\n return ENGINE.makeTensor(values, inferredShape, inferredDtype) as T;\n}\n\nexport function convertToTensorArray(\n arg: Array, argName: string, functionName: string,\n parseAsDtype: DataType|'numeric'|'string_or_numeric' = 'numeric'): T[] {\n if (!Array.isArray(arg)) {\n throw new Error(\n `Argument ${argName} passed to ${functionName} must be a ` +\n '`Tensor[]` or `TensorLike[]`');\n }\n const tensors = arg as T[];\n return tensors.map(\n (t, i) =>\n convertToTensor(t, `${argName}[${i}]`, functionName, parseAsDtype));\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {isPromise} from '../util';\n\nexport const OP_SCOPE_SUFFIX = '__op';\n\n/**\n * Used for wrapping functions that perform math operations on\n * Tensors. The function will be wrapped in a named scope that cleans all\n * memory usage after the function is done.\n */\nexport function op(f: {[name: string]: T}): T {\n const keys = Object.keys(f);\n if (keys.length !== 1) {\n throw new Error(\n `Please provide an object with a single key ` +\n `(operation name) mapping to a function. Got an object with ` +\n `${keys.length} keys.`);\n }\n\n let opName = keys[0];\n const fn = f[opName];\n\n // Strip the underscore from the end of the function name.\n if (opName.endsWith('_')) {\n opName = opName.substring(0, opName.length - 1);\n }\n\n // add an __op suffix to distinguish ops from kernels in tf.profile\n opName = opName + OP_SCOPE_SUFFIX;\n\n // tslint:disable-next-line:no-any\n const f2 = (...args: any[]) => {\n ENGINE.startScope(opName);\n try {\n const result = fn(...args);\n if (isPromise(result)) {\n console.error('Cannot return a Promise inside of tidy.');\n }\n ENGINE.endScope(result);\n return result;\n } catch (ex) {\n ENGINE.endScope(null);\n throw ex;\n }\n };\n Object.defineProperty(f2, 'name', {value: opName, configurable: true});\n\n // tslint:disable-next-line:no-any\n return f2 as any as T;\n}\n", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Complex, ComplexInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Converts two real numbers to a complex number.\n *\n * Given a tensor `real` representing the real part of a complex number, and a\n * tensor `imag` representing the imaginary part of a complex number, this\n * operation returns complex numbers elementwise of the form [r0, i0, r1, i1],\n * where r represents the real part and i represents the imag part.\n *\n * The input tensors real and imag must have the same shape.\n *\n * ```js\n * const real = tf.tensor1d([2.25, 3.25]);\n * const imag = tf.tensor1d([4.75, 5.75]);\n * const complex = tf.complex(real, imag);\n *\n * complex.print();\n * ```\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction complex_(real: T|TensorLike, imag: T|TensorLike): T {\n const $real = convertToTensor(real, 'real', 'complex');\n const $imag = convertToTensor(imag, 'imag', 'complex');\n util.assertShapesMatch(\n $real.shape, $imag.shape,\n `real and imag shapes, ${$real.shape} and ${$imag.shape}, ` +\n `must match in call to tf.complex().`);\n\n const inputs: ComplexInputs = {real: $real, imag: $imag};\n return ENGINE.runKernel(Complex, inputs as {} as NamedTensorMap);\n}\n\nexport const complex = op({complex_});\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tensor} from '../tensor';\nimport {TensorLike, TypedArray} from '../types';\nimport {DataType} from '../types';\nimport {assert, assertNonNegativeIntegerDimensions, flatten, inferDtype, isTypedArray, sizeFromShape, toTypedArray} from '../util';\n\n/** This is shared code across all tensor creation methods. */\nexport function makeTensor(\n values: TensorLike, shape: number[], inferredShape: number[],\n dtype?: DataType): Tensor {\n if (dtype == null) {\n dtype = inferDtype(values);\n }\n if (dtype === 'complex64') {\n throw new Error(\n `Cannot construct a complex64 tensor directly. ` +\n `Please use tf.complex(real, imag).`);\n }\n if (!isTypedArray(values) && !Array.isArray(values) &&\n typeof values !== 'number' && typeof values !== 'boolean' &&\n typeof values !== 'string') {\n throw new Error(\n 'values passed to tensor(values) must be a number/boolean/string or ' +\n 'an array of numbers/booleans/strings, or a TypedArray');\n }\n if (shape != null) {\n assertNonNegativeIntegerDimensions(shape);\n\n const providedSize = sizeFromShape(shape);\n const inferredSize = sizeFromShape(inferredShape);\n assert(\n providedSize === inferredSize,\n () =>\n `Based on the provided shape, [${shape}], the tensor should have ` +\n `${providedSize} values but has ${inferredSize}`);\n\n for (let i = 0; i < inferredShape.length; ++i) {\n const inferred = inferredShape[i];\n const flatDimsDontMatch = i === inferredShape.length - 1 ?\n inferred !== sizeFromShape(shape.slice(i)) :\n true;\n assert(\n inferredShape[i] === shape[i] || !flatDimsDontMatch,\n () => `Error creating a new Tensor. Inferred shape ` +\n `(${inferredShape}) does not match the provided ` +\n `shape (${shape}). `);\n }\n }\n\n if (!isTypedArray(values) && !Array.isArray(values)) {\n values = [values] as number[];\n }\n\n shape = shape || inferredShape;\n values = dtype !== 'string' ?\n toTypedArray(values, dtype) :\n flatten(values as string[], [], true) as string[];\n return ENGINE.makeTensor(values as TypedArray, shape, dtype);\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {DataType, Rank, ShapeMap} from '../types';\n\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates a `tf.Tensor` with the provided values, shape and dtype.\n *\n * ```js\n * // Pass an array of values to create a vector.\n * tf.tensor([1, 2, 3, 4]).print();\n * ```\n *\n * ```js\n * // Pass a nested array of values to make a matrix or a higher\n * // dimensional tensor.\n * tf.tensor([[1, 2], [3, 4]]).print();\n * ```\n *\n * ```js\n * // Pass a flat array and specify a shape yourself.\n * tf.tensor([1, 2, 3, 4], [2, 2]).print();\n * ```\n *\n * @param values The values of the tensor. Can be nested array of numbers,\n * or a flat array, or a `TypedArray`. If the values are strings,\n * they will be encoded as utf-8 and kept as `Uint8Array[]`.\n * @param shape The shape of the tensor. Optional. If not provided,\n * it is inferred from `values`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor(\n values: TensorLike, shape?: ShapeMap[R], dtype?: DataType): Tensor {\n const inferredShape = inferShape(values, dtype);\n return makeTensor(values, shape, inferredShape, dtype) as Tensor;\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/* Type definitions for exporting and importing of models. */\n\n/**\n * A map from Tensor dtype to number of bytes per element of the Tensor.\n */\nexport const DTYPE_VALUE_SIZE_MAP: {[dtype: string]: number} = {\n 'float32': 4,\n 'float16': 2,\n 'int32': 4,\n 'uint16': 2,\n 'uint8': 1,\n 'bool': 1,\n 'complex64': 8\n};\n\n/**\n * A weight manifest.\n *\n * The weight manifest consists of an ordered list of weight-manifest groups.\n * Each weight-manifest group (\"group\" for short hereafter) consists of a\n * number of weight values stored in a number of paths.\n * See the documentation of `WeightManifestGroupConfig` below for more details.\n */\nexport declare type WeightsManifestConfig = WeightsManifestGroupConfig[];\n\n/**\n * A weight-manifest group.\n *\n * Consists of an ordered list of weight values encoded in binary format,\n * stored in an ordered list of paths.\n */\nexport declare interface WeightsManifestGroupConfig {\n /**\n * An ordered list of paths.\n *\n * Paths are intentionally abstract in order to be general. For example, they\n * can be relative URL paths or relative paths on the file system.\n */\n paths: string[];\n\n /**\n * Specifications of the weights stored in the paths.\n */\n weights: WeightsManifestEntry[];\n}\n\n/**\n * Group to which the weight belongs.\n *\n * - 'optimizer': Weight from a stateful optimizer.\n */\nexport type WeightGroup = 'model'|'optimizer';\n\n/**\n * An entry in the weight manifest.\n *\n * The entry contains specification of a weight.\n */\nexport declare interface WeightsManifestEntry {\n /**\n * Name of the weight, e.g., 'Dense_1/bias'\n */\n name: string;\n\n /**\n * Shape of the weight.\n */\n shape: number[];\n\n /**\n * Data type of the weight.\n */\n dtype: 'float32'|'int32'|'bool'|'string'|'complex64';\n\n /**\n * Type of the weight.\n *\n * Optional.\n *\n * The value 'optimizer' indicates the weight belongs to an optimizer\n * (i.e., used only during model training and not during inference).\n */\n group?: WeightGroup;\n\n /**\n * Information for dequantization of the weight.\n */\n quantization?: {\n scale?: number, // The scaling constant to multiply by.\n min?: number, // The (possibly nudged) minimum weight to add.\n dtype: 'uint16'|'uint8'|'float16' // The dtype of the quantized weights.\n };\n}\n\n/**\n * Options for saving a model.\n * @innamespace io\n */\nexport interface SaveConfig {\n /**\n * Whether to save only the trainable weights of the model, ignoring the\n * non-trainable ones.\n */\n trainableOnly?: boolean;\n\n /**\n * Whether the optimizer will be saved (if exists).\n *\n * Default: `false`.\n */\n includeOptimizer?: boolean;\n}\n\n/**\n * Result of a saving operation.\n */\nexport interface SaveResult {\n /**\n * Information about the model artifacts saved.\n */\n modelArtifactsInfo: ModelArtifactsInfo;\n\n /**\n * HTTP responses from the server that handled the model-saving request (if\n * any). This is applicable only to server-based saving routes.\n */\n responses?: Response[];\n\n /**\n * Error messages and related data (if any).\n */\n errors?: Array<{}|string>;\n}\n\nexport declare interface ModelArtifactsInfo {\n /**\n * Timestamp for when the model is saved.\n */\n dateSaved: Date;\n\n /**\n * TODO (cais,yassogba) consider removing GraphDef as GraphDefs now\n * come in a JSON format and none of our IOHandlers support a non json\n * format. We could conder replacing this with 'Binary' if we want to\n * allow future handlers to save to non json formats (though they will\n * probably want more information than 'Binary').\n * Type of the model topology\n *\n * Type of the model topology\n *\n * Possible values:\n * - JSON: JSON config (human-readable, e.g., Keras JSON).\n * - GraphDef: TensorFlow\n * [GraphDef](https://www.tensorflow.org/extend/tool_developers/#graphdef)\n * protocol buffer (binary).\n */\n modelTopologyType: 'JSON'|'GraphDef';\n\n /**\n * Size of model topology (Keras JSON or GraphDef), in bytes.\n */\n modelTopologyBytes?: number;\n\n /**\n * Size of weight specification or manifest, in bytes.\n */\n weightSpecsBytes?: number;\n\n /**\n * Size of weight value data, in bytes.\n */\n weightDataBytes?: number;\n}\n\n/** Model training configuration. */\nexport declare interface TrainingConfig {\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n // See\n // tslint:disable-next-line:max-line-length\n // https://github.com/tensorflow/tfjs-layers/blob/master/src/keras_format/training_config.ts\n /** Optimizer used for the model training. */\n optimizer_config: {};\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n /** Loss function(s) for the model's output(s). */\n loss: string|string[]|{[key: string]: string};\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n /** Metric function(s) for the model's output(s). */\n metrics?: string[]|{[key: string]: string};\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n weighted_metrics?: string[];\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n sample_weight_mode?: string;\n\n loss_weights?: number[]|{[key: string]: number};\n}\n\n/**\n * The serialized artifacts of a model, including topology and weights.\n *\n * The `modelTopology`, `trainingConfig`, `weightSpecs` and `weightData` fields\n * of this interface are optional, in order to support topology- or weights-only\n * saving and loading.\n *\n * Note this interface is used internally in IOHandlers. For the file format\n * written to disk as `model.json`, see `ModelJSON`.\n */\nexport declare interface ModelArtifacts {\n /**\n * Model topology.\n *\n * For Keras-style `tf.Model`s, this is a JSON object.\n * For TensorFlow-style models (e.g., `SavedModel`), this is the JSON\n * encoding of the `GraphDef` protocol buffer.\n */\n modelTopology?: {}|ArrayBuffer;\n\n /**\n * Serialized configuration for the model's training.\n */\n trainingConfig?: TrainingConfig;\n\n /**\n * Weight specifications.\n *\n * This corresponds to the weightsData below.\n */\n weightSpecs?: WeightsManifestEntry[];\n\n /**\n * Binary buffer for all weight values concatenated in the order specified\n * by `weightSpecs`.\n */\n weightData?: ArrayBuffer;\n\n /**\n * Hard-coded format name for models saved from TensorFlow.js or converted\n * by TensorFlow.js Converter.\n */\n format?: string;\n\n /**\n * What library is responsible for originally generating this artifact.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js v1.0.0'.\n */\n generatedBy?: string;\n\n /**\n * What library or tool is responsible for converting the original model\n * to this format, applicable only if the model is output by a converter.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js Converter v1.0.0'.\n *\n * A value of `null` means the model artifacts are generated without any\n * conversion process (e.g., saved directly from a TensorFlow.js\n * `tf.LayersModel` instance.)\n */\n convertedBy?: string|null;\n\n /**\n * Inputs and outputs signature for saved model.\n */\n signature?: {};\n\n /**\n * User-defined metadata about the model.\n */\n userDefinedMetadata?: {[key: string]: {}};\n\n /**\n * Initializer for the model.\n */\n modelInitializer?: {};\n}\n\n/**\n * The on-disk format of the `model.json` file.\n *\n * TF.js 1.0 always populates the optional fields when writing model.json.\n * Prior versions did not provide those fields.\n */\nexport declare interface ModelJSON {\n /**\n * Model topology.\n *\n * For Keras-style `tf.Model`s, this is a JSON object.\n * For TensorFlow-style models (e.g., `SavedModel`), this is the JSON\n * encoding of the `GraphDef` protocol buffer.\n */\n modelTopology: {};\n\n /** Model training configuration. */\n trainingConfig?: TrainingConfig;\n\n /**\n * Weights manifest.\n *\n * The weights manifest consists of an ordered list of weight-manifest\n * groups. Each weight-manifest group consists of a number of weight values\n * stored in a number of paths. See the documentation of\n * `WeightsManifestConfig` for more details.\n */\n weightsManifest: WeightsManifestConfig;\n\n /**\n * Hard-coded format name for models saved from TensorFlow.js or converted\n * by TensorFlow.js Converter.\n */\n format?: string;\n\n /**\n * What library is responsible for originally generating this artifact.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js v1.0.0'.\n */\n generatedBy?: string;\n\n /**\n * What library or tool is responsible for converting the original model\n * to this format, applicable only if the model is output by a converter.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js Converter v1.0.0'.\n *\n * A value of `null` means the model artifacts are generated without any\n * conversion process (e.g., saved directly from a TensorFlow.js\n * `tf.LayersModel` instance.)\n */\n convertedBy?: string|null;\n\n /**\n * Inputs and outputs signature for saved model.\n */\n signature?: {};\n\n /**\n * User-defined metadata about the model.\n */\n userDefinedMetadata?: {[key: string]: {}};\n\n /**\n * Initializer for the model.\n */\n modelInitializer?: {};\n}\n\n/**\n * Type definition for handlers of loading operations.\n */\nexport type LoadHandler = () => Promise;\n\n/**\n * Type definition for handlers of saving operations.\n */\nexport type SaveHandler = (modelArtifact: ModelArtifacts) =>\n Promise;\n\n/**\n * Interface for a model import/export handler.\n *\n * The `save` and `load` handlers are both optional, in order to allow handlers\n * that support only saving or loading.\n */\n// tslint:disable-next-line:interface-name\nexport interface IOHandler {\n save?: SaveHandler;\n load?: LoadHandler;\n}\n\n/**\n * An interface for the manager of a model store.\n *\n * A model store is defined as a storage medium on which multiple models can\n * be stored. Each stored model has a unique `path` as its identifier.\n * A `ModelStoreManager` for the store allows actions including\n *\n * - Listing the models stored in the store.\n * - Deleting a model from the store.\n */\nexport interface ModelStoreManager {\n /**\n * List all models in the model store.\n *\n * @returns A dictionary mapping paths of existing models to their\n * model artifacts info. Model artifacts info include type of the model's\n * topology, byte sizes of the topology, weights, etc.\n */\n listModels(): Promise<{[path: string]: ModelArtifactsInfo}>;\n\n /**\n * Remove a model specified by `path`.\n *\n * @param path\n * @returns ModelArtifactsInfo of the deleted model (if and only if deletion\n * is successful).\n * @throws Error if deletion fails, e.g., if no model exists at `path`.\n */\n removeModel(path: string): Promise;\n}\n\n/**\n * Callback for the progress of a long-running action such as an HTTP\n * request for a large binary object.\n *\n * `fraction` should be a number in the [0, 1] interval, indicating how\n * much of the action has completed.\n */\nexport type OnProgressCallback = (fraction: number) => void;\n\n/** @innamespace io */\nexport interface LoadOptions {\n /**\n * RequestInit (options) for HTTP requests.\n *\n * For detailed information on the supported fields, see\n * [https://developer.mozilla.org/en-US/docs/Web/API/Request/Request](\n * https://developer.mozilla.org/en-US/docs/Web/API/Request/Request)\n */\n requestInit?: RequestInit;\n\n /**\n * Progress callback.\n */\n onProgress?: OnProgressCallback;\n\n /**\n * A function used to override the `window.fetch` function.\n */\n fetchFunc?: Function;\n\n /**\n * Strict loading model: whether extraneous weights or missing\n * weights should trigger an `Error`.\n *\n * If `true`, require that the provided weights exactly match those\n * required by the layers. `false` means that both extra weights\n * and missing weights will be silently ignored.\n *\n * Default: `true`.\n */\n strict?: boolean;\n\n /**\n * Path prefix for weight files, by default this is calculated from the\n * path of the model JSON file.\n *\n * For instance, if the path to the model JSON file is\n * `http://localhost/foo/model.json`, then the default path prefix will be\n * `http://localhost/foo/`. If a weight file has the path value\n * `group1-shard1of2` in the weight manifest, then the weight file will be\n * loaded from `http://localhost/foo/group1-shard1of2` by default. However,\n * if you provide a `weightPathPrefix` value of\n * `http://localhost/foo/alt-weights`, then the weight file will be loaded\n * from the path `http://localhost/foo/alt-weights/group1-shard1of2` instead.\n */\n weightPathPrefix?: string;\n\n /**\n * Whether the module or model is to be loaded from TF Hub.\n *\n * Setting this to `true` allows passing a TF-Hub module URL, omitting the\n * standard model file name and the query parameters.\n *\n * Default: `false`.\n */\n fromTFHub?: boolean;\n\n /**\n * An async function to convert weight file name to URL. The weight file\n * names are stored in model.json's weightsManifest.paths field. By default we\n * consider weight files are colocated with the model.json file. For example:\n * model.json URL: https://www.google.com/models/1/model.json\n * group1-shard1of1.bin url:\n * https://www.google.com/models/1/group1-shard1of1.bin\n *\n * With this func you can convert the weight file name to any URL.\n */\n weightUrlConverter?: (weightFileName: string) => Promise;\n}\n\n/**\n * Additional options for Platform.fetch\n */\nexport interface RequestDetails {\n /**\n * Is this request for a binary file (as opposed to a json file)\n */\n isBinary?: boolean;\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {complex} from '../ops/complex';\n\nimport {tensor} from '../ops/tensor';\nimport {NamedTensor, NamedTensorMap} from '../tensor_types';\nimport {TypedArray} from '../types';\nimport {sizeFromShape} from '../util';\n\nimport {DTYPE_VALUE_SIZE_MAP, ModelArtifacts, ModelArtifactsInfo, WeightGroup, WeightsManifestEntry} from './types';\n\n/** Number of bytes reserved for the length of the string. (32bit integer). */\nconst NUM_BYTES_STRING_LENGTH = 4;\n\n/**\n * Encode a map from names to weight values as an ArrayBuffer, along with an\n * `Array` of `WeightsManifestEntry` as specification of the encoded weights.\n *\n * This function does not perform sharding.\n *\n * This function is the reverse of `decodeWeights`.\n *\n * @param tensors A map (\"dict\") from names to tensors.\n * @param group Group to which the weights belong (optional).\n * @returns A `Promise` of\n * - A flat `ArrayBuffer` with all the binary values of the `Tensor`s\n * concatenated.\n * - An `Array` of `WeightManifestEntry`s, carrying information including\n * tensor names, `dtype`s and shapes.\n * @throws Error: on unsupported tensor `dtype`.\n */\nexport async function encodeWeights(\n tensors: NamedTensorMap|NamedTensor[], group?: WeightGroup):\n Promise<{data: ArrayBuffer, specs: WeightsManifestEntry[]}> {\n // TODO(adarob, cais): Support quantization.\n const specs: WeightsManifestEntry[] = [];\n const dataPromises: Array> = [];\n\n const names: string[] = Array.isArray(tensors) ?\n tensors.map(tensor => tensor.name) :\n Object.keys(tensors);\n\n for (let i = 0; i < names.length; ++i) {\n const name = names[i];\n const t = Array.isArray(tensors) ? tensors[i].tensor : tensors[name];\n if (t.dtype !== 'float32' && t.dtype !== 'int32' && t.dtype !== 'bool' &&\n t.dtype !== 'string' && t.dtype !== 'complex64') {\n throw new Error(`Unsupported dtype in weight '${name}': ${t.dtype}`);\n }\n const spec: WeightsManifestEntry = {name, shape: t.shape, dtype: t.dtype};\n if (t.dtype === 'string') {\n const utf8bytes = new Promise(async resolve => {\n const vals = await t.bytes() as Uint8Array[];\n const totalNumBytes = vals.reduce((p, c) => p + c.length, 0) +\n NUM_BYTES_STRING_LENGTH * vals.length;\n const bytes = new Uint8Array(totalNumBytes);\n let offset = 0;\n for (let i = 0; i < vals.length; i++) {\n const val = vals[i];\n const bytesOfLength =\n new Uint8Array(new Uint32Array([val.length]).buffer);\n bytes.set(bytesOfLength, offset);\n offset += NUM_BYTES_STRING_LENGTH;\n bytes.set(val, offset);\n offset += val.length;\n }\n resolve(bytes);\n });\n dataPromises.push(utf8bytes);\n } else {\n dataPromises.push(t.data());\n }\n if (group != null) {\n spec.group = group;\n }\n specs.push(spec);\n }\n\n const tensorValues = await Promise.all(dataPromises);\n return {data: concatenateTypedArrays(tensorValues), specs};\n}\n\n/**\n * Decode flat ArrayBuffer as weights.\n *\n * This function does not handle sharding.\n *\n * This function is the reverse of `encodeWeights`.\n *\n * @param buffer A flat ArrayBuffer carrying the binary values of the tensors\n * concatenated in the order specified in `specs`.\n * @param specs Specifications of the names, dtypes and shapes of the tensors\n * whose value are encoded by `buffer`.\n * @return A map from tensor name to tensor value, with the names corresponding\n * to names in `specs`.\n * @throws Error, if any of the tensors has unsupported dtype.\n */\nexport function decodeWeights(\n buffer: ArrayBuffer, specs: WeightsManifestEntry[]): NamedTensorMap {\n // TODO(adarob, cais): Support quantization.\n const out: NamedTensorMap = {};\n let float16Decode: (buffer: Uint16Array) => Float32Array | undefined;\n let offset = 0;\n for (const spec of specs) {\n const name = spec.name;\n const dtype = spec.dtype;\n const shape = spec.shape;\n const size = sizeFromShape(shape);\n let values: TypedArray|string[]|Uint8Array[];\n\n if ('quantization' in spec) {\n const quantization = spec.quantization;\n if (quantization.dtype === 'uint8' || quantization.dtype === 'uint16') {\n if (!('min' in quantization && 'scale' in quantization)) {\n throw new Error(\n `Weight ${spec.name} with quantization ${quantization.dtype} ` +\n `doesn't have corresponding metadata min and scale.`);\n }\n } else if (quantization.dtype === 'float16') {\n if (dtype !== 'float32') {\n throw new Error(\n `Weight ${spec.name} is quantized with ${quantization.dtype} ` +\n `which only supports weights of type float32 not ${dtype}.`);\n }\n } else {\n throw new Error(\n `Weight ${spec.name} has unknown ` +\n `quantization dtype ${quantization.dtype}. ` +\n `Supported quantization dtypes are: ` +\n `'uint8', 'uint16', and 'float16'.`);\n }\n const quantizationSizeFactor = DTYPE_VALUE_SIZE_MAP[quantization.dtype];\n const byteBuffer =\n buffer.slice(offset, offset + size * quantizationSizeFactor);\n const quantizedArray = (quantization.dtype === 'uint8') ?\n new Uint8Array(byteBuffer) :\n new Uint16Array(byteBuffer);\n if (dtype === 'float32') {\n if (quantization.dtype === 'uint8' || quantization.dtype === 'uint16') {\n values = new Float32Array(quantizedArray.length);\n for (let i = 0; i < quantizedArray.length; i++) {\n const v = quantizedArray[i];\n values[i] = v * quantization.scale + quantization.min;\n }\n } else if (quantization.dtype === 'float16') {\n if (float16Decode === undefined) {\n float16Decode = getFloat16Decoder();\n }\n values = float16Decode(quantizedArray as Uint16Array);\n } else {\n throw new Error(\n `Unsupported quantization type ${quantization.dtype} ` +\n `for weight type float32.`);\n }\n } else if (dtype === 'int32') {\n if (quantization.dtype !== 'uint8' && quantization.dtype !== 'uint16') {\n throw new Error(\n `Unsupported quantization type ${quantization.dtype} ` +\n `for weight type int32.`);\n }\n values = new Int32Array(quantizedArray.length);\n for (let i = 0; i < quantizedArray.length; i++) {\n const v = quantizedArray[i];\n values[i] = Math.round(v * quantization.scale + quantization.min);\n }\n } else {\n throw new Error(`Unsupported dtype in weight '${name}': ${dtype}`);\n }\n offset += size * quantizationSizeFactor;\n } else if (dtype === 'string') {\n const size = sizeFromShape(spec.shape);\n values = [];\n for (let i = 0; i < size; i++) {\n const byteLength = new Uint32Array(\n buffer.slice(offset, offset + NUM_BYTES_STRING_LENGTH))[0];\n offset += NUM_BYTES_STRING_LENGTH;\n const bytes = new Uint8Array(buffer.slice(offset, offset + byteLength));\n (values as Uint8Array[]).push(bytes);\n offset += byteLength;\n }\n } else {\n const dtypeFactor = DTYPE_VALUE_SIZE_MAP[dtype];\n const byteBuffer = buffer.slice(offset, offset + size * dtypeFactor);\n\n if (dtype === 'float32') {\n values = new Float32Array(byteBuffer);\n } else if (dtype === 'int32') {\n values = new Int32Array(byteBuffer);\n } else if (dtype === 'bool') {\n values = new Uint8Array(byteBuffer);\n } else if (dtype === 'complex64') {\n values = new Float32Array(byteBuffer);\n const real = new Float32Array(values.length / 2);\n const image = new Float32Array(values.length / 2);\n for (let i = 0; i < real.length; i++) {\n real[i] = values[i * 2];\n image[i] = values[i * 2 + 1];\n }\n const realTensor = tensor(real, shape, 'float32');\n const imageTensor = tensor(image, shape, 'float32');\n out[name] = complex(realTensor, imageTensor);\n realTensor.dispose();\n imageTensor.dispose();\n } else {\n throw new Error(`Unsupported dtype in weight '${name}': ${dtype}`);\n }\n offset += size * dtypeFactor;\n }\n if (dtype !== 'complex64') {\n out[name] = tensor(values, shape, dtype);\n }\n }\n return out;\n}\n\n/**\n * Concatenate TypedArrays into an ArrayBuffer.\n */\nexport function concatenateTypedArrays(xs: TypedArray[]): ArrayBuffer {\n // TODO(adarob, cais): Support quantization.\n if (xs === null) {\n throw new Error(`Invalid input value: ${JSON.stringify(xs)}`);\n }\n\n let totalByteLength = 0;\n\n // `normalizedXs` is here for this reason: a `TypedArray`'s `buffer'\n // can have a different byte length from that of the `TypedArray` itself,\n // for example, when the `TypedArray` is created from an offset in an\n // `ArrayBuffer`. `normliazedXs` holds `TypedArray`s whose `buffer`s match\n // the `TypedArray` in byte length. If an element of `xs` does not show\n // this property, a new `TypedArray` that satisfy this property will be\n // constructed and pushed into `normalizedXs`.\n const normalizedXs: TypedArray[] = [];\n xs.forEach((x: TypedArray) => {\n totalByteLength += x.byteLength;\n // tslint:disable:no-any\n normalizedXs.push(\n x.byteLength === x.buffer.byteLength ? x :\n new (x.constructor as any)(x));\n if (!(x as any instanceof Float32Array || x as any instanceof Int32Array ||\n x as any instanceof Uint8Array)) {\n throw new Error(`Unsupported TypedArray subtype: ${x.constructor.name}`);\n }\n // tslint:enable:no-any\n });\n\n const y = new Uint8Array(totalByteLength);\n let offset = 0;\n normalizedXs.forEach((x: TypedArray) => {\n y.set(new Uint8Array(x.buffer), offset);\n offset += x.byteLength;\n });\n\n return y.buffer;\n}\n\n// Use Buffer on Node.js instead of Blob/atob/btoa\nconst useNodeBuffer = typeof Buffer !== 'undefined' &&\n (typeof Blob === 'undefined' || typeof atob === 'undefined' ||\n typeof btoa === 'undefined');\n\n/**\n * Calculate the byte length of a JavaScript string.\n *\n * Note that a JavaScript string can contain wide characters, therefore the\n * length of the string is not necessarily equal to the byte length.\n *\n * @param str Input string.\n * @returns Byte length.\n */\nexport function stringByteLength(str: string): number {\n if (useNodeBuffer) {\n return Buffer.byteLength(str);\n }\n return new Blob([str]).size;\n}\n\n/**\n * Encode an ArrayBuffer as a base64 encoded string.\n *\n * @param buffer `ArrayBuffer` to be converted.\n * @returns A string that base64-encodes `buffer`.\n */\nexport function arrayBufferToBase64String(buffer: ArrayBuffer): string {\n if (useNodeBuffer) {\n return Buffer.from(buffer).toString('base64');\n }\n const buf = new Uint8Array(buffer);\n let s = '';\n for (let i = 0, l = buf.length; i < l; i++) {\n s += String.fromCharCode(buf[i]);\n }\n return btoa(s);\n}\n\n/**\n * Decode a base64 string as an ArrayBuffer.\n *\n * @param str Base64 string.\n * @returns Decoded `ArrayBuffer`.\n */\nexport function base64StringToArrayBuffer(str: string): ArrayBuffer {\n if (useNodeBuffer) {\n const buf = Buffer.from(str, 'base64');\n return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n }\n const s = atob(str);\n const buffer = new Uint8Array(s.length);\n for (let i = 0; i < s.length; ++i) {\n buffer.set([s.charCodeAt(i)], i);\n }\n return buffer.buffer;\n}\n\n/**\n * Concatenate a number of ArrayBuffers into one.\n *\n * @param buffers A number of array buffers to concatenate.\n * @returns Result of concatenating `buffers` in order.\n */\nexport function concatenateArrayBuffers(buffers: ArrayBuffer[]): ArrayBuffer {\n if (buffers.length === 1) {\n return buffers[0];\n }\n\n let totalByteLength = 0;\n buffers.forEach((buffer: ArrayBuffer) => {\n totalByteLength += buffer.byteLength;\n });\n\n const temp = new Uint8Array(totalByteLength);\n let offset = 0;\n buffers.forEach((buffer: ArrayBuffer) => {\n temp.set(new Uint8Array(buffer), offset);\n offset += buffer.byteLength;\n });\n return temp.buffer;\n}\n\n/**\n * Get the basename of a path.\n *\n * Behaves in a way analogous to Linux's basename command.\n *\n * @param path\n */\nexport function basename(path: string): string {\n const SEPARATOR = '/';\n path = path.trim();\n while (path.endsWith(SEPARATOR)) {\n path = path.slice(0, path.length - 1);\n }\n const items = path.split(SEPARATOR);\n return items[items.length - 1];\n}\n\n/**\n * Populate ModelArtifactsInfo fields for a model with JSON topology.\n * @param modelArtifacts\n * @returns A ModelArtifactsInfo object.\n */\nexport function getModelArtifactsInfoForJSON(modelArtifacts: ModelArtifacts):\n ModelArtifactsInfo {\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error('Expected JSON model topology, received ArrayBuffer.');\n }\n\n return {\n dateSaved: new Date(),\n modelTopologyType: 'JSON',\n modelTopologyBytes: modelArtifacts.modelTopology == null ?\n 0 :\n stringByteLength(JSON.stringify(modelArtifacts.modelTopology)),\n weightSpecsBytes: modelArtifacts.weightSpecs == null ?\n 0 :\n stringByteLength(JSON.stringify(modelArtifacts.weightSpecs)),\n weightDataBytes: modelArtifacts.weightData == null ?\n 0 :\n modelArtifacts.weightData.byteLength,\n };\n}\n\n/**\n * Computes mantisa table for casting Float16 to Float32\n * See http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n *\n * @returns Uint32Array, 2048 mantissa lookup values.\n */\nfunction computeFloat16MantisaTable(): Uint32Array {\n const convertMantissa = (i: number): number => {\n let m = i << 13;\n let e = 0;\n\n while ((m & 0x00800000) === 0) {\n e -= 0x00800000;\n m <<= 1;\n }\n m &= ~0x00800000;\n e += 0x38800000;\n\n return m | e;\n };\n\n const mantisaTable = new Uint32Array(2048);\n\n mantisaTable[0] = 0;\n for (let i = 1; i < 1024; i++) {\n mantisaTable[i] = convertMantissa(i);\n }\n for (let i = 1024; i < 2048; i++) {\n mantisaTable[i] = 0x38000000 + ((i - 1024) << 13);\n }\n\n return mantisaTable;\n}\n\n/**\n * Computes exponent table for casting Float16 to Float32\n * See http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n *\n * @returns Uint32Array, 64 exponent lookup values.\n */\nfunction computeFloat16ExponentTable(): Uint32Array {\n const exponentTable = new Uint32Array(64);\n\n exponentTable[0] = 0;\n exponentTable[31] = 0x47800000;\n exponentTable[32] = 0x80000000;\n exponentTable[63] = 0xc7800000;\n for (let i = 1; i < 31; i++) {\n exponentTable[i] = i << 23;\n }\n for (let i = 33; i < 63; i++) {\n exponentTable[i] = 0x80000000 + ((i - 32) << 23);\n }\n\n return exponentTable;\n}\n\n/**\n * Computes offset table for casting Float16 to Float32\n * See http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n *\n * @returns Uint32Array, 6d offset values.\n */\nfunction computeFloat16OffsetTable(): Uint32Array {\n const offsetTable = new Uint32Array(64);\n\n for (let i = 0; i < 64; i++) {\n offsetTable[i] = 1024;\n }\n offsetTable[0] = offsetTable[32] = 0;\n\n return offsetTable;\n}\n\n/**\n * Retrieve a Float16 decoder which will decode a ByteArray of Float16 values\n * to a Float32Array.\n *\n * @returns Function (buffer: Uint16Array) => Float32Array which decodes\n * the Uint16Array of Float16 bytes to a Float32Array.\n */\nexport function getFloat16Decoder(): (buffer: Uint16Array) => Float32Array {\n // Algorithm is based off of\n // http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n\n // Cache lookup tables\n const mantisaTable = computeFloat16MantisaTable();\n const exponentTable = computeFloat16ExponentTable();\n const offsetTable = computeFloat16OffsetTable();\n\n return (quantizedArray: Uint16Array) => {\n const buffer = new ArrayBuffer(4 * quantizedArray.length);\n const bufferUint32View = new Uint32Array(buffer);\n for (let index = 0; index < quantizedArray.length; index++) {\n const float16Bits = quantizedArray[index];\n const float32Bits =\n mantisaTable[offsetTable[float16Bits >> 10] + (float16Bits & 0x3ff)] +\n exponentTable[float16Bits >> 10];\n bufferUint32View[index] = float32Bits;\n }\n return new Float32Array(buffer);\n };\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IOHandler, LoadOptions} from './types';\n\nexport type IORouter = (url: string|string[], loadOptions?: LoadOptions) =>\n IOHandler;\n\nexport class IORouterRegistry {\n // Singleton instance.\n private static instance: IORouterRegistry;\n\n private saveRouters: IORouter[];\n private loadRouters: IORouter[];\n\n private constructor() {\n this.saveRouters = [];\n this.loadRouters = [];\n }\n\n private static getInstance(): IORouterRegistry {\n if (IORouterRegistry.instance == null) {\n IORouterRegistry.instance = new IORouterRegistry();\n }\n return IORouterRegistry.instance;\n }\n\n /**\n * Register a save-handler router.\n *\n * @param saveRouter A function that maps a URL-like string onto an instance\n * of `IOHandler` with the `save` method defined or `null`.\n */\n static registerSaveRouter(saveRouter: IORouter) {\n IORouterRegistry.getInstance().saveRouters.push(saveRouter);\n }\n\n /**\n * Register a load-handler router.\n *\n * @param loadRouter A function that maps a URL-like string onto an instance\n * of `IOHandler` with the `load` method defined or `null`.\n */\n static registerLoadRouter(loadRouter: IORouter) {\n IORouterRegistry.getInstance().loadRouters.push(loadRouter);\n }\n\n /**\n * Look up IOHandler for saving, given a URL-like string.\n *\n * @param url\n * @returns If only one match is found, an instance of IOHandler with the\n * `save` method defined. If no match is found, `null`.\n * @throws Error, if more than one match is found.\n */\n static getSaveHandlers(url: string|string[]): IOHandler[] {\n return IORouterRegistry.getHandlers(url, 'save');\n }\n\n /**\n * Look up IOHandler for loading, given a URL-like string.\n *\n * @param url\n * @param loadOptions Optional, custom load options.\n * @returns All valid handlers for `url`, given the currently registered\n * handler routers.\n */\n static getLoadHandlers(url: string|string[], loadOptions?: LoadOptions):\n IOHandler[] {\n return IORouterRegistry.getHandlers(url, 'load', loadOptions);\n }\n\n private static getHandlers(\n url: string|string[], handlerType: 'save'|'load',\n loadOptions?: LoadOptions): IOHandler[] {\n const validHandlers: IOHandler[] = [];\n const routers = handlerType === 'load' ?\n IORouterRegistry.getInstance().loadRouters :\n IORouterRegistry.getInstance().saveRouters;\n routers.forEach(router => {\n const handler = router(url, loadOptions);\n if (handler !== null) {\n validHandlers.push(handler);\n }\n });\n return validHandlers;\n }\n}\n\nexport const registerSaveRouter = (loudRouter: IORouter) =>\n IORouterRegistry.registerSaveRouter(loudRouter);\nexport const registerLoadRouter = (loudRouter: IORouter) =>\n IORouterRegistry.registerLoadRouter(loudRouter);\nexport const getSaveHandlers = (url: string|string[]) =>\n IORouterRegistry.getSaveHandlers(url);\nexport const getLoadHandlers =\n (url: string|string[], loadOptions?: LoadOptions) =>\n IORouterRegistry.getLoadHandlers(url, loadOptions);\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport '../flags';\n\nimport {env} from '../environment';\n\nimport {getModelArtifactsInfoForJSON} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, ModelArtifacts, ModelArtifactsInfo, ModelStoreManager, SaveResult} from './types';\n\nconst DATABASE_NAME = 'tensorflowjs';\nconst DATABASE_VERSION = 1;\n\n// Model data and ModelArtifactsInfo (metadata) are stored in two separate\n// stores for efficient access of the list of stored models and their metadata.\n// 1. The object store for model data: topology, weights and weight manifests.\nconst MODEL_STORE_NAME = 'models_store';\n// 2. The object store for ModelArtifactsInfo, including meta-information such\n// as the type of topology (JSON vs binary), byte size of the topology, byte\n// size of the weights, etc.\nconst INFO_STORE_NAME = 'model_info_store';\n\n/**\n * Delete the entire database for tensorflow.js, including the models store.\n */\nexport async function deleteDatabase(): Promise {\n const idbFactory = getIndexedDBFactory();\n\n return new Promise((resolve, reject) => {\n const deleteRequest = idbFactory.deleteDatabase(DATABASE_NAME);\n deleteRequest.onsuccess = () => resolve();\n deleteRequest.onerror = error => reject(error);\n });\n}\n\nfunction getIndexedDBFactory(): IDBFactory {\n if (!env().getBool('IS_BROWSER')) {\n // TODO(cais): Add more info about what IOHandler subtypes are available.\n // Maybe point to a doc page on the web and/or automatically determine\n // the available IOHandlers and print them in the error message.\n throw new Error(\n 'Failed to obtain IndexedDB factory because the current environment' +\n 'is not a web browser.');\n }\n // tslint:disable-next-line:no-any\n const theWindow: any = typeof window === 'undefined' ? self : window;\n const factory = theWindow.indexedDB || theWindow.mozIndexedDB ||\n theWindow.webkitIndexedDB || theWindow.msIndexedDB ||\n theWindow.shimIndexedDB;\n if (factory == null) {\n throw new Error(\n 'The current browser does not appear to support IndexedDB.');\n }\n return factory;\n}\n\nfunction setUpDatabase(openRequest: IDBRequest) {\n const db = openRequest.result as IDBDatabase;\n db.createObjectStore(MODEL_STORE_NAME, {keyPath: 'modelPath'});\n db.createObjectStore(INFO_STORE_NAME, {keyPath: 'modelPath'});\n}\n\n/**\n * IOHandler subclass: Browser IndexedDB.\n *\n * See the doc string of `browserIndexedDB` for more details.\n */\nexport class BrowserIndexedDB implements IOHandler {\n protected readonly indexedDB: IDBFactory;\n protected readonly modelPath: string;\n\n static readonly URL_SCHEME = 'indexeddb://';\n\n constructor(modelPath: string) {\n this.indexedDB = getIndexedDBFactory();\n\n if (modelPath == null || !modelPath) {\n throw new Error(\n 'For IndexedDB, modelPath must not be null, undefined or empty.');\n }\n this.modelPath = modelPath;\n }\n\n async save(modelArtifacts: ModelArtifacts): Promise {\n // TODO(cais): Support saving GraphDef models.\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserLocalStorage.save() does not support saving model topology ' +\n 'in binary formats yet.');\n }\n\n return this.databaseAction(this.modelPath, modelArtifacts) as\n Promise;\n }\n\n async load(): Promise {\n return this.databaseAction(this.modelPath) as Promise;\n }\n\n /**\n * Perform database action to put model artifacts into or read model artifacts\n * from IndexedDB object store.\n *\n * Whether the action is put or get depends on whether `modelArtifacts` is\n * specified. If it is specified, the action will be put; otherwise the action\n * will be get.\n *\n * @param modelPath A unique string path for the model.\n * @param modelArtifacts If specified, it will be the model artifacts to be\n * stored in IndexedDB.\n * @returns A `Promise` of `SaveResult`, if the action is put, or a `Promise`\n * of `ModelArtifacts`, if the action is get.\n */\n private databaseAction(modelPath: string, modelArtifacts?: ModelArtifacts):\n Promise {\n return new Promise((resolve, reject) => {\n const openRequest = this.indexedDB.open(DATABASE_NAME, DATABASE_VERSION);\n openRequest.onupgradeneeded = () => setUpDatabase(openRequest);\n\n openRequest.onsuccess = () => {\n const db = openRequest.result;\n\n if (modelArtifacts == null) {\n // Read model out from object store.\n const modelTx = db.transaction(MODEL_STORE_NAME, 'readonly');\n const modelStore = modelTx.objectStore(MODEL_STORE_NAME);\n const getRequest = modelStore.get(this.modelPath);\n getRequest.onsuccess = () => {\n if (getRequest.result == null) {\n db.close();\n return reject(new Error(\n `Cannot find model with path '${this.modelPath}' ` +\n `in IndexedDB.`));\n } else {\n resolve(getRequest.result.modelArtifacts);\n }\n };\n getRequest.onerror = error => {\n db.close();\n return reject(getRequest.error);\n };\n modelTx.oncomplete = () => db.close();\n } else {\n // Put model into object store.\n const modelArtifactsInfo: ModelArtifactsInfo =\n getModelArtifactsInfoForJSON(modelArtifacts);\n // First, put ModelArtifactsInfo into info store.\n const infoTx = db.transaction(INFO_STORE_NAME, 'readwrite');\n let infoStore = infoTx.objectStore(INFO_STORE_NAME);\n const putInfoRequest =\n infoStore.put({modelPath: this.modelPath, modelArtifactsInfo});\n let modelTx: IDBTransaction;\n putInfoRequest.onsuccess = () => {\n // Second, put model data into model store.\n modelTx = db.transaction(MODEL_STORE_NAME, 'readwrite');\n const modelStore = modelTx.objectStore(MODEL_STORE_NAME);\n const putModelRequest = modelStore.put({\n modelPath: this.modelPath,\n modelArtifacts,\n modelArtifactsInfo\n });\n putModelRequest.onsuccess = () => resolve({modelArtifactsInfo});\n putModelRequest.onerror = error => {\n // If the put-model request fails, roll back the info entry as\n // well.\n infoStore = infoTx.objectStore(INFO_STORE_NAME);\n const deleteInfoRequest = infoStore.delete(this.modelPath);\n deleteInfoRequest.onsuccess = () => {\n db.close();\n return reject(putModelRequest.error);\n };\n deleteInfoRequest.onerror = error => {\n db.close();\n return reject(putModelRequest.error);\n };\n };\n };\n putInfoRequest.onerror = error => {\n db.close();\n return reject(putInfoRequest.error);\n };\n infoTx.oncomplete = () => {\n if (modelTx == null) {\n db.close();\n } else {\n modelTx.oncomplete = () => db.close();\n }\n };\n }\n };\n openRequest.onerror = error => reject(openRequest.error);\n });\n }\n}\n\nexport const indexedDBRouter: IORouter = (url: string|string[]) => {\n if (!env().getBool('IS_BROWSER')) {\n return null;\n } else {\n if (!Array.isArray(url) && url.startsWith(BrowserIndexedDB.URL_SCHEME)) {\n return browserIndexedDB(url.slice(BrowserIndexedDB.URL_SCHEME.length));\n } else {\n return null;\n }\n }\n};\nIORouterRegistry.registerSaveRouter(indexedDBRouter);\nIORouterRegistry.registerLoadRouter(indexedDBRouter);\n\n/**\n * Creates a browser IndexedDB IOHandler for saving and loading models.\n *\n * ```js\n * const model = tf.sequential();\n * model.add(\n * tf.layers.dense({units: 1, inputShape: [100], activation: 'sigmoid'}));\n *\n * const saveResult = await model.save('indexeddb://MyModel'));\n * console.log(saveResult);\n * ```\n *\n * @param modelPath A unique identifier for the model to be saved. Must be a\n * non-empty string.\n * @returns An instance of `BrowserIndexedDB` (sublcass of `IOHandler`),\n * which can be used with, e.g., `tf.Model.save`.\n */\nexport function browserIndexedDB(modelPath: string): IOHandler {\n return new BrowserIndexedDB(modelPath);\n}\n\nfunction maybeStripScheme(key: string) {\n return key.startsWith(BrowserIndexedDB.URL_SCHEME) ?\n key.slice(BrowserIndexedDB.URL_SCHEME.length) :\n key;\n}\n\nexport class BrowserIndexedDBManager implements ModelStoreManager {\n private indexedDB: IDBFactory;\n\n constructor() {\n this.indexedDB = getIndexedDBFactory();\n }\n\n async listModels(): Promise<{[path: string]: ModelArtifactsInfo}> {\n return new Promise<{[path: string]: ModelArtifactsInfo}>(\n (resolve, reject) => {\n const openRequest =\n this.indexedDB.open(DATABASE_NAME, DATABASE_VERSION);\n openRequest.onupgradeneeded = () => setUpDatabase(openRequest);\n\n openRequest.onsuccess = () => {\n const db = openRequest.result;\n const tx = db.transaction(INFO_STORE_NAME, 'readonly');\n const store = tx.objectStore(INFO_STORE_NAME);\n // tslint:disable:max-line-length\n // Need to cast `store` as `any` here because TypeScript's DOM\n // library does not have the `getAll()` method even though the\n // method is supported in the latest version of most mainstream\n // browsers:\n // https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/getAll\n // tslint:enable:max-line-length\n // tslint:disable-next-line:no-any\n const getAllInfoRequest = (store as any).getAll() as IDBRequest;\n getAllInfoRequest.onsuccess = () => {\n const out: {[path: string]: ModelArtifactsInfo} = {};\n for (const item of getAllInfoRequest.result) {\n out[item.modelPath] = item.modelArtifactsInfo;\n }\n resolve(out);\n };\n getAllInfoRequest.onerror = error => {\n db.close();\n return reject(getAllInfoRequest.error);\n };\n tx.oncomplete = () => db.close();\n };\n openRequest.onerror = error => reject(openRequest.error);\n });\n }\n\n async removeModel(path: string): Promise {\n path = maybeStripScheme(path);\n return new Promise((resolve, reject) => {\n const openRequest = this.indexedDB.open(DATABASE_NAME, DATABASE_VERSION);\n openRequest.onupgradeneeded = () => setUpDatabase(openRequest);\n\n openRequest.onsuccess = () => {\n const db = openRequest.result;\n const infoTx = db.transaction(INFO_STORE_NAME, 'readwrite');\n const infoStore = infoTx.objectStore(INFO_STORE_NAME);\n\n const getInfoRequest = infoStore.get(path);\n let modelTx: IDBTransaction;\n getInfoRequest.onsuccess = () => {\n if (getInfoRequest.result == null) {\n db.close();\n return reject(new Error(\n `Cannot find model with path '${path}' ` +\n `in IndexedDB.`));\n } else {\n // First, delete the entry in the info store.\n const deleteInfoRequest = infoStore.delete(path);\n const deleteModelData = () => {\n // Second, delete the entry in the model store.\n modelTx = db.transaction(MODEL_STORE_NAME, 'readwrite');\n const modelStore = modelTx.objectStore(MODEL_STORE_NAME);\n const deleteModelRequest = modelStore.delete(path);\n deleteModelRequest.onsuccess = () =>\n resolve(getInfoRequest.result.modelArtifactsInfo);\n deleteModelRequest.onerror = error =>\n reject(getInfoRequest.error);\n };\n // Proceed with deleting model data regardless of whether deletion\n // of info data succeeds or not.\n deleteInfoRequest.onsuccess = deleteModelData;\n deleteInfoRequest.onerror = error => {\n deleteModelData();\n db.close();\n return reject(getInfoRequest.error);\n };\n }\n };\n getInfoRequest.onerror = error => {\n db.close();\n return reject(getInfoRequest.error);\n };\n\n infoTx.oncomplete = () => {\n if (modelTx == null) {\n db.close();\n } else {\n modelTx.oncomplete = () => db.close();\n }\n };\n };\n openRequest.onerror = error => reject(openRequest.error);\n });\n }\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport '../flags';\nimport {env} from '../environment';\n\nimport {assert} from '../util';\nimport {arrayBufferToBase64String, base64StringToArrayBuffer, getModelArtifactsInfoForJSON} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, ModelArtifacts, ModelArtifactsInfo, ModelStoreManager, SaveResult} from './types';\n\nconst PATH_SEPARATOR = '/';\nconst PATH_PREFIX = 'tensorflowjs_models';\nconst INFO_SUFFIX = 'info';\nconst MODEL_TOPOLOGY_SUFFIX = 'model_topology';\nconst WEIGHT_SPECS_SUFFIX = 'weight_specs';\nconst WEIGHT_DATA_SUFFIX = 'weight_data';\nconst MODEL_METADATA_SUFFIX = 'model_metadata';\n\n/**\n * Purge all tensorflow.js-saved model artifacts from local storage.\n *\n * @returns Paths of the models purged.\n */\nexport function purgeLocalStorageArtifacts(): string[] {\n if (!env().getBool('IS_BROWSER') || typeof window === 'undefined' ||\n typeof window.localStorage === 'undefined') {\n throw new Error(\n 'purgeLocalStorageModels() cannot proceed because local storage is ' +\n 'unavailable in the current environment.');\n }\n const LS = window.localStorage;\n const purgedModelPaths: string[] = [];\n for (let i = 0; i < LS.length; ++i) {\n const key = LS.key(i);\n const prefix = PATH_PREFIX + PATH_SEPARATOR;\n if (key.startsWith(prefix) && key.length > prefix.length) {\n LS.removeItem(key);\n const modelName = getModelPathFromKey(key);\n if (purgedModelPaths.indexOf(modelName) === -1) {\n purgedModelPaths.push(modelName);\n }\n }\n }\n return purgedModelPaths;\n}\n\nfunction getModelKeys(path: string): {\n info: string,\n topology: string,\n weightSpecs: string,\n weightData: string,\n modelMetadata: string\n} {\n return {\n info: [PATH_PREFIX, path, INFO_SUFFIX].join(PATH_SEPARATOR),\n topology: [PATH_PREFIX, path, MODEL_TOPOLOGY_SUFFIX].join(PATH_SEPARATOR),\n weightSpecs: [PATH_PREFIX, path, WEIGHT_SPECS_SUFFIX].join(PATH_SEPARATOR),\n weightData: [PATH_PREFIX, path, WEIGHT_DATA_SUFFIX].join(PATH_SEPARATOR),\n modelMetadata:\n [PATH_PREFIX, path, MODEL_METADATA_SUFFIX].join(PATH_SEPARATOR)\n };\n}\n\n/**\n * Get model path from a local-storage key.\n *\n * E.g., 'tensorflowjs_models/my/model/1/info' --> 'my/model/1'\n *\n * @param key\n */\nfunction getModelPathFromKey(key: string) {\n const items = key.split(PATH_SEPARATOR);\n if (items.length < 3) {\n throw new Error(`Invalid key format: ${key}`);\n }\n return items.slice(1, items.length - 1).join(PATH_SEPARATOR);\n}\n\nfunction maybeStripScheme(key: string) {\n return key.startsWith(BrowserLocalStorage.URL_SCHEME) ?\n key.slice(BrowserLocalStorage.URL_SCHEME.length) :\n key;\n}\n\ndeclare type LocalStorageKeys = {\n info: string,\n topology: string,\n weightSpecs: string,\n weightData: string,\n modelMetadata: string\n};\n\n/**\n * IOHandler subclass: Browser Local Storage.\n *\n * See the doc string to `browserLocalStorage` for more details.\n */\nexport class BrowserLocalStorage implements IOHandler {\n protected readonly LS: Storage;\n protected readonly modelPath: string;\n protected readonly keys: LocalStorageKeys;\n\n static readonly URL_SCHEME = 'localstorage://';\n\n constructor(modelPath: string) {\n if (!env().getBool('IS_BROWSER') || typeof window === 'undefined' ||\n typeof window.localStorage === 'undefined') {\n // TODO(cais): Add more info about what IOHandler subtypes are\n // available.\n // Maybe point to a doc page on the web and/or automatically determine\n // the available IOHandlers and print them in the error message.\n throw new Error(\n 'The current environment does not support local storage.');\n }\n this.LS = window.localStorage;\n\n if (modelPath == null || !modelPath) {\n throw new Error(\n 'For local storage, modelPath must not be null, undefined or empty.');\n }\n this.modelPath = modelPath;\n this.keys = getModelKeys(this.modelPath);\n }\n\n /**\n * Save model artifacts to browser local storage.\n *\n * See the documentation to `browserLocalStorage` for details on the saved\n * artifacts.\n *\n * @param modelArtifacts The model artifacts to be stored.\n * @returns An instance of SaveResult.\n */\n async save(modelArtifacts: ModelArtifacts): Promise {\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserLocalStorage.save() does not support saving model topology ' +\n 'in binary formats yet.');\n } else {\n const topology = JSON.stringify(modelArtifacts.modelTopology);\n const weightSpecs = JSON.stringify(modelArtifacts.weightSpecs);\n\n const modelArtifactsInfo: ModelArtifactsInfo =\n getModelArtifactsInfoForJSON(modelArtifacts);\n\n try {\n this.LS.setItem(this.keys.info, JSON.stringify(modelArtifactsInfo));\n this.LS.setItem(this.keys.topology, topology);\n this.LS.setItem(this.keys.weightSpecs, weightSpecs);\n this.LS.setItem(\n this.keys.weightData,\n arrayBufferToBase64String(modelArtifacts.weightData));\n const result: ModelArtifacts = {\n format: modelArtifacts.format,\n generatedBy: modelArtifacts.generatedBy,\n convertedBy: modelArtifacts.convertedBy\n };\n if (modelArtifacts.signature != null) {\n result.signature = modelArtifacts.signature;\n }\n if (modelArtifacts.userDefinedMetadata != null) {\n result.userDefinedMetadata = modelArtifacts.userDefinedMetadata;\n }\n if (modelArtifacts.modelInitializer != null) {\n result.modelInitializer = modelArtifacts.modelInitializer;\n }\n this.LS.setItem(this.keys.modelMetadata, JSON.stringify(result));\n\n return {modelArtifactsInfo};\n } catch (err) {\n // If saving failed, clean up all items saved so far.\n this.LS.removeItem(this.keys.info);\n this.LS.removeItem(this.keys.topology);\n this.LS.removeItem(this.keys.weightSpecs);\n this.LS.removeItem(this.keys.weightData);\n this.LS.removeItem(this.keys.modelMetadata);\n\n throw new Error(\n `Failed to save model '${this.modelPath}' to local storage: ` +\n `size quota being exceeded is a possible cause of this failure: ` +\n `modelTopologyBytes=${modelArtifactsInfo.modelTopologyBytes}, ` +\n `weightSpecsBytes=${modelArtifactsInfo.weightSpecsBytes}, ` +\n `weightDataBytes=${modelArtifactsInfo.weightDataBytes}.`);\n }\n }\n }\n\n /**\n * Load a model from local storage.\n *\n * See the documentation to `browserLocalStorage` for details on the saved\n * artifacts.\n *\n * @returns The loaded model (if loading succeeds).\n */\n async load(): Promise {\n const info =\n JSON.parse(this.LS.getItem(this.keys.info)) as ModelArtifactsInfo;\n if (info == null) {\n throw new Error(\n `In local storage, there is no model with name '${this.modelPath}'`);\n }\n\n if (info.modelTopologyType !== 'JSON') {\n throw new Error(\n 'BrowserLocalStorage does not support loading non-JSON model ' +\n 'topology yet.');\n }\n\n const out: ModelArtifacts = {};\n\n // Load topology.\n const topology = JSON.parse(this.LS.getItem(this.keys.topology));\n if (topology == null) {\n throw new Error(\n `In local storage, the topology of model '${this.modelPath}' ` +\n `is missing.`);\n }\n out.modelTopology = topology;\n\n // Load weight specs.\n const weightSpecs = JSON.parse(this.LS.getItem(this.keys.weightSpecs));\n if (weightSpecs == null) {\n throw new Error(\n `In local storage, the weight specs of model '${this.modelPath}' ` +\n `are missing.`);\n }\n out.weightSpecs = weightSpecs;\n\n // Load meta-data fields.\n const metadataString = this.LS.getItem(this.keys.modelMetadata);\n if (metadataString != null) {\n const metadata = JSON.parse(metadataString) as ModelArtifacts;\n out.format = metadata['format'];\n out.generatedBy = metadata['generatedBy'];\n out.convertedBy = metadata['convertedBy'];\n if (metadata['signature'] != null) {\n out.signature = metadata['signature'];\n }\n if (metadata['userDefinedMetadata'] != null) {\n out.userDefinedMetadata = metadata['userDefinedMetadata'];\n }\n if (metadata['modelInitializer'] != null) {\n out.modelInitializer = metadata['modelInitializer'];\n }\n }\n\n // Load weight data.\n const weightDataBase64 = this.LS.getItem(this.keys.weightData);\n if (weightDataBase64 == null) {\n throw new Error(\n `In local storage, the binary weight values of model ` +\n `'${this.modelPath}' are missing.`);\n }\n out.weightData = base64StringToArrayBuffer(weightDataBase64);\n\n return out;\n }\n}\n\nexport const localStorageRouter: IORouter = (url: string|string[]) => {\n if (!env().getBool('IS_BROWSER')) {\n return null;\n } else {\n if (!Array.isArray(url) && url.startsWith(BrowserLocalStorage.URL_SCHEME)) {\n return browserLocalStorage(\n url.slice(BrowserLocalStorage.URL_SCHEME.length));\n } else {\n return null;\n }\n }\n};\nIORouterRegistry.registerSaveRouter(localStorageRouter);\nIORouterRegistry.registerLoadRouter(localStorageRouter);\n\n/**\n * Factory function for local storage IOHandler.\n *\n * This `IOHandler` supports both `save` and `load`.\n *\n * For each model's saved artifacts, four items are saved to local storage.\n * - `${PATH_SEPARATOR}/${modelPath}/info`: Contains meta-info about the\n * model, such as date saved, type of the topology, size in bytes, etc.\n * - `${PATH_SEPARATOR}/${modelPath}/topology`: Model topology. For Keras-\n * style models, this is a stringized JSON.\n * - `${PATH_SEPARATOR}/${modelPath}/weight_specs`: Weight specs of the\n * model, can be used to decode the saved binary weight values (see\n * item below).\n * - `${PATH_SEPARATOR}/${modelPath}/weight_data`: Concatenated binary\n * weight values, stored as a base64-encoded string.\n *\n * Saving may throw an `Error` if the total size of the artifacts exceed the\n * browser-specific quota.\n *\n * @param modelPath A unique identifier for the model to be saved. Must be a\n * non-empty string.\n * @returns An instance of `IOHandler`, which can be used with, e.g.,\n * `tf.Model.save`.\n */\nexport function browserLocalStorage(modelPath: string): IOHandler {\n return new BrowserLocalStorage(modelPath);\n}\n\nexport class BrowserLocalStorageManager implements ModelStoreManager {\n private readonly LS: Storage;\n\n constructor() {\n assert(\n env().getBool('IS_BROWSER'),\n () => 'Current environment is not a web browser');\n assert(\n typeof window === 'undefined' ||\n typeof window.localStorage !== 'undefined',\n () => 'Current browser does not appear to support localStorage');\n this.LS = window.localStorage;\n }\n\n async listModels(): Promise<{[path: string]: ModelArtifactsInfo}> {\n const out: {[path: string]: ModelArtifactsInfo} = {};\n const prefix = PATH_PREFIX + PATH_SEPARATOR;\n const suffix = PATH_SEPARATOR + INFO_SUFFIX;\n for (let i = 0; i < this.LS.length; ++i) {\n const key = this.LS.key(i);\n if (key.startsWith(prefix) && key.endsWith(suffix)) {\n const modelPath = getModelPathFromKey(key);\n out[modelPath] = JSON.parse(this.LS.getItem(key)) as ModelArtifactsInfo;\n }\n }\n return out;\n }\n\n async removeModel(path: string): Promise {\n path = maybeStripScheme(path);\n const keys = getModelKeys(path);\n if (this.LS.getItem(keys.info) == null) {\n throw new Error(`Cannot find model at path '${path}'`);\n }\n const info = JSON.parse(this.LS.getItem(keys.info)) as ModelArtifactsInfo;\n\n this.LS.removeItem(keys.info);\n this.LS.removeItem(keys.topology);\n this.LS.removeItem(keys.weightSpecs);\n this.LS.removeItem(keys.weightData);\n return info;\n }\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Classes and functions for model management across multiple storage mediums.\n *\n * Supported client actions:\n * - Listing models on all registered storage mediums.\n * - Remove model by URL from any registered storage mediums, by using URL\n * string.\n * - Moving or copying model from one path to another in the same medium or from\n * one medium to another, by using URL strings.\n */\n\nimport {assert} from '../util';\n\nimport {IORouterRegistry} from './router_registry';\nimport {ModelArtifactsInfo, ModelStoreManager} from './types';\n\nconst URL_SCHEME_SUFFIX = '://';\n\nexport class ModelStoreManagerRegistry {\n // Singleton instance.\n private static instance: ModelStoreManagerRegistry;\n\n private managers: {[scheme: string]: ModelStoreManager};\n\n private constructor() {\n this.managers = {};\n }\n\n private static getInstance(): ModelStoreManagerRegistry {\n if (ModelStoreManagerRegistry.instance == null) {\n ModelStoreManagerRegistry.instance = new ModelStoreManagerRegistry();\n }\n return ModelStoreManagerRegistry.instance;\n }\n\n /**\n * Register a save-handler router.\n *\n * @param saveRouter A function that maps a URL-like string onto an instance\n * of `IOHandler` with the `save` method defined or `null`.\n */\n static registerManager(scheme: string, manager: ModelStoreManager) {\n assert(scheme != null, () => 'scheme must not be undefined or null.');\n if (scheme.endsWith(URL_SCHEME_SUFFIX)) {\n scheme = scheme.slice(0, scheme.indexOf(URL_SCHEME_SUFFIX));\n }\n assert(scheme.length > 0, () => 'scheme must not be an empty string.');\n const registry = ModelStoreManagerRegistry.getInstance();\n assert(\n registry.managers[scheme] == null,\n () => `A model store manager is already registered for scheme '${\n scheme}'.`);\n registry.managers[scheme] = manager;\n }\n\n static getManager(scheme: string): ModelStoreManager {\n const manager = this.getInstance().managers[scheme];\n if (manager == null) {\n throw new Error(`Cannot find model manager for scheme '${scheme}'`);\n }\n return manager;\n }\n\n static getSchemes(): string[] {\n return Object.keys(this.getInstance().managers);\n }\n}\n\n/**\n * Helper method for parsing a URL string into a scheme and a path.\n *\n * @param url E.g., 'localstorage://my-model'\n * @returns A dictionary with two fields: scheme and path.\n * Scheme: e.g., 'localstorage' in the example above.\n * Path: e.g., 'my-model' in the example above.\n */\nfunction parseURL(url: string): {scheme: string, path: string} {\n if (url.indexOf(URL_SCHEME_SUFFIX) === -1) {\n throw new Error(\n `The url string provided does not contain a scheme. ` +\n `Supported schemes are: ` +\n `${ModelStoreManagerRegistry.getSchemes().join(',')}`);\n }\n return {\n scheme: url.split(URL_SCHEME_SUFFIX)[0],\n path: url.split(URL_SCHEME_SUFFIX)[1],\n };\n}\n\nasync function cloneModelInternal(\n sourceURL: string, destURL: string,\n deleteSource = false): Promise {\n assert(\n sourceURL !== destURL,\n () => `Old path and new path are the same: '${sourceURL}'`);\n\n const loadHandlers = IORouterRegistry.getLoadHandlers(sourceURL);\n assert(\n loadHandlers.length > 0,\n () => `Copying failed because no load handler is found for source URL ${\n sourceURL}.`);\n assert(\n loadHandlers.length < 2,\n () => `Copying failed because more than one (${loadHandlers.length}) ` +\n `load handlers for source URL ${sourceURL}.`);\n const loadHandler = loadHandlers[0];\n\n const saveHandlers = IORouterRegistry.getSaveHandlers(destURL);\n assert(\n saveHandlers.length > 0,\n () => `Copying failed because no save handler is found for destination ` +\n `URL ${destURL}.`);\n assert(\n saveHandlers.length < 2,\n () => `Copying failed because more than one (${loadHandlers.length}) ` +\n `save handlers for destination URL ${destURL}.`);\n const saveHandler = saveHandlers[0];\n\n const sourceScheme = parseURL(sourceURL).scheme;\n const sourcePath = parseURL(sourceURL).path;\n const sameMedium = sourceScheme === parseURL(sourceURL).scheme;\n\n const modelArtifacts = await loadHandler.load();\n\n // If moving within the same storage medium, remove the old model as soon as\n // the loading is done. Without doing this, it is possible that the combined\n // size of the two models will cause the cloning to fail.\n if (deleteSource && sameMedium) {\n await ModelStoreManagerRegistry.getManager(sourceScheme)\n .removeModel(sourcePath);\n }\n\n const saveResult = await saveHandler.save(modelArtifacts);\n\n // If moving between mediums, the deletion is done after the save succeeds.\n // This guards against the case in which saving to the destination medium\n // fails.\n if (deleteSource && !sameMedium) {\n await ModelStoreManagerRegistry.getManager(sourceScheme)\n .removeModel(sourcePath);\n }\n\n return saveResult.modelArtifactsInfo;\n}\n\n/**\n * List all models stored in registered storage mediums.\n *\n * For a web browser environment, the registered mediums are Local Storage and\n * IndexedDB.\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Delete the model.\n * await tf.io.removeModel('localstorage://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n * ```\n *\n * @returns A `Promise` of a dictionary mapping URLs of existing models to\n * their model artifacts info. URLs include medium-specific schemes, e.g.,\n * 'indexeddb://my/model/1'. Model artifacts info include type of the\n * model's topology, byte sizes of the topology, weights, etc.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function listModels(): Promise<{[url: string]: ModelArtifactsInfo}> {\n const schemes = ModelStoreManagerRegistry.getSchemes();\n const out: {[url: string]: ModelArtifactsInfo} = {};\n for (const scheme of schemes) {\n const schemeOut =\n await ModelStoreManagerRegistry.getManager(scheme).listModels();\n for (const path in schemeOut) {\n const url = scheme + URL_SCHEME_SUFFIX + path;\n out[url] = schemeOut[path];\n }\n }\n return out;\n}\n\n/**\n * Remove a model specified by URL from a reigstered storage medium.\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Delete the model.\n * await tf.io.removeModel('localstorage://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n * ```\n *\n * @param url A URL to a stored model, with a scheme prefix, e.g.,\n * 'localstorage://my-model-1', 'indexeddb://my/model/2'.\n * @returns ModelArtifactsInfo of the deleted model (if and only if deletion\n * is successful).\n * @throws Error if deletion fails, e.g., if no model exists at `path`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function removeModel(url: string): Promise {\n const schemeAndPath = parseURL(url);\n const manager = ModelStoreManagerRegistry.getManager(schemeAndPath.scheme);\n return manager.removeModel(schemeAndPath.path);\n}\n\n/**\n * Copy a model from one URL to another.\n *\n * This function supports:\n *\n * 1. Copying within a storage medium, e.g.,\n * `tf.io.copyModel('localstorage://model-1', 'localstorage://model-2')`\n * 2. Copying between two storage mediums, e.g.,\n * `tf.io.copyModel('localstorage://model-1', 'indexeddb://model-1')`\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Copy the model, from Local Storage to IndexedDB.\n * await tf.io.copyModel(\n * 'localstorage://demo/management/model1',\n * 'indexeddb://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Remove both models.\n * await tf.io.removeModel('localstorage://demo/management/model1');\n * await tf.io.removeModel('indexeddb://demo/management/model1');\n * ```\n *\n * @param sourceURL Source URL of copying.\n * @param destURL Destination URL of copying.\n * @returns ModelArtifactsInfo of the copied model (if and only if copying\n * is successful).\n * @throws Error if copying fails, e.g., if no model exists at `sourceURL`, or\n * if `oldPath` and `newPath` are identical.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function copyModel(\n sourceURL: string, destURL: string): Promise {\n const deleteSource = false;\n return cloneModelInternal(sourceURL, destURL, deleteSource);\n}\n\n/**\n * Move a model from one URL to another.\n *\n * This function supports:\n *\n * 1. Moving within a storage medium, e.g.,\n * `tf.io.moveModel('localstorage://model-1', 'localstorage://model-2')`\n * 2. Moving between two storage mediums, e.g.,\n * `tf.io.moveModel('localstorage://model-1', 'indexeddb://model-1')`\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Move the model, from Local Storage to IndexedDB.\n * await tf.io.moveModel(\n * 'localstorage://demo/management/model1',\n * 'indexeddb://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Remove the moved model.\n * await tf.io.removeModel('indexeddb://demo/management/model1');\n * ```\n *\n * @param sourceURL Source URL of moving.\n * @param destURL Destination URL of moving.\n * @returns ModelArtifactsInfo of the copied model (if and only if copying\n * is successful).\n * @throws Error if moving fails, e.g., if no model exists at `sourceURL`, or\n * if `oldPath` and `newPath` are identical.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function moveModel(\n sourceURL: string, destURL: string): Promise {\n const deleteSource = true;\n return cloneModelInternal(sourceURL, destURL, deleteSource);\n}\n\nexport {moveModel, copyModel, removeModel, listModels};\n", "/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport '../flags';\n\nimport {env} from '../environment';\nimport {BrowserIndexedDB, BrowserIndexedDBManager} from '../io/indexed_db';\nimport {BrowserLocalStorage, BrowserLocalStorageManager} from '../io/local_storage';\nimport {ModelStoreManagerRegistry} from '../io/model_management';\n\nimport {Platform} from './platform';\n\nexport class PlatformBrowser implements Platform {\n // According to the spec, the built-in encoder can do only UTF-8 encoding.\n // https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/TextEncoder\n private textEncoder: TextEncoder;\n\n fetch(path: string, init?: RequestInit): Promise {\n return fetch(path, init);\n }\n\n now(): number {\n return performance.now();\n }\n\n encode(text: string, encoding: string): Uint8Array {\n if (encoding !== 'utf-8' && encoding !== 'utf8') {\n throw new Error(\n `Browser's encoder only supports utf-8, but got ${encoding}`);\n }\n if (this.textEncoder == null) {\n this.textEncoder = new TextEncoder();\n }\n return this.textEncoder.encode(text);\n }\n decode(bytes: Uint8Array, encoding: string): string {\n return new TextDecoder(encoding).decode(bytes);\n }\n}\n\nif (env().get('IS_BROWSER')) {\n env().setPlatform('browser', new PlatformBrowser());\n\n // Register LocalStorage IOHandler\n try {\n ModelStoreManagerRegistry.registerManager(\n BrowserLocalStorage.URL_SCHEME, new BrowserLocalStorageManager());\n } catch (err) {\n }\n\n // Register IndexedDB IOHandler\n try {\n ModelStoreManagerRegistry.registerManager(\n BrowserIndexedDB.URL_SCHEME, new BrowserIndexedDBManager());\n } catch (err) {\n }\n}\n", "/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {env} from '../environment';\n\nimport {Platform} from './platform';\n\n// We are wrapping this within an object so it can be stubbed by Jasmine.\nexport const getNodeFetch = {\n // tslint:disable-next-line:no-require-imports\n importFetch: () => require('node-fetch')\n};\n\ntype FetchFn = (url: string, init?: RequestInit) => Promise;\nlet systemFetch: FetchFn;\n// These getters and setters are for testing so we don't export a mutable\n// variable.\nexport function resetSystemFetch() {\n systemFetch = null;\n}\nexport function setSystemFetch(fetchFn: FetchFn) {\n systemFetch = fetchFn;\n}\nexport function getSystemFetch(): FetchFn {\n return systemFetch;\n}\n\nexport class PlatformNode implements Platform {\n private textEncoder: TextEncoder;\n // tslint:disable-next-line:no-any\n util: any;\n\n constructor() {\n // tslint:disable-next-line:no-require-imports\n this.util = require('util');\n // According to the spec, the built-in encoder can do only UTF-8 encoding.\n // https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/TextEncoder\n this.textEncoder = new this.util.TextEncoder();\n }\n\n fetch(path: string, requestInits?: RequestInit): Promise {\n if (env().global.fetch != null) {\n return env().global.fetch(path, requestInits);\n }\n\n if (systemFetch == null) {\n systemFetch = getNodeFetch.importFetch();\n }\n return systemFetch(path, requestInits);\n }\n\n now(): number {\n const time = process.hrtime();\n return time[0] * 1000 + time[1] / 1000000;\n }\n\n encode(text: string, encoding: string): Uint8Array {\n if (encoding !== 'utf-8' && encoding !== 'utf8') {\n throw new Error(\n `Node built-in encoder only supports utf-8, but got ${encoding}`);\n }\n return this.textEncoder.encode(text);\n }\n decode(bytes: Uint8Array, encoding: string): string {\n if (bytes.length === 0) {\n return '';\n }\n return new this.util.TextDecoder(encoding).decode(bytes);\n }\n}\n\nif (env().get('IS_NODE')) {\n env().setPlatform('node', new PlatformNode());\n}\n", "/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorBuffer} from '../tensor';\nimport {DataType, DataTypeMap, Rank, ShapeMap} from '../types';\nimport * as util from '../util';\n\n/**\n * Creates an empty `tf.TensorBuffer` with the specified `shape` and `dtype`.\n *\n * The values are stored in CPU as `TypedArray`. Fill the buffer using\n * `buffer.set()`, or by modifying directly `buffer.values`.\n *\n * When done, call `buffer.toTensor()` to get an immutable `tf.Tensor` with\n * those values.\n *\n * ```js\n * // Create a buffer and set values at particular indices.\n * const buffer = tf.buffer([2, 2]);\n * buffer.set(3, 0, 0);\n * buffer.set(5, 1, 0);\n *\n * // Convert the buffer back to a tensor.\n * buffer.toTensor().print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param dtype The dtype of the buffer. Defaults to 'float32'.\n * @param values The values of the buffer as `TypedArray`. Defaults to\n * zeros.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function buffer(\n shape: ShapeMap[R], dtype: D = 'float32' as D,\n values?: DataTypeMap[D]): TensorBuffer {\n dtype = dtype || 'float32' as D;\n util.assertNonNegativeIntegerDimensions(shape);\n return new TensorBuffer(shape, dtype, values);\n}\n", "/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Cast, CastAttrs, CastInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {DataType, TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Casts a `tf.Tensor` to a new dtype.\n *\n * ```js\n * const x = tf.tensor1d([1.5, 2.5, 3]);\n * tf.cast(x, 'int32').print();\n * ```\n * @param x The input tensor to be casted.\n * @param dtype The dtype to cast the input tensor to.\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction cast_(x: T|TensorLike, dtype: DataType): T {\n const $x = convertToTensor(x, 'x', 'cast');\n\n // Sanity checks.\n if (!util.isValidDtype(dtype)) {\n throw new Error(`Failed to cast to unknown dtype ${dtype}`);\n }\n if (dtype === 'string' && $x.dtype !== 'string' ||\n dtype !== 'string' && $x.dtype === 'string') {\n throw new Error('Only strings can be casted to strings');\n }\n\n const inputs: CastInputs = {x: $x};\n const attrs: CastAttrs = {dtype};\n\n return ENGINE.runKernel(\n Cast, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const cast = op({cast_});\n", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Identity, IdentityInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Creates a new tensor with the same values and shape as the specified\n * tensor.\n *\n * ```js\n * const x = tf.tensor([1, 2]);\n *\n * x.clone().print();\n * ```\n *\n * @param x The tensor to clone.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction clone_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'clone', 'string_or_numeric');\n const inputs: IdentityInputs = {x: $x};\n\n // Note this op is called tf.identity in python. Hence the kernel name used\n // here.\n return ENGINE.runKernel(Identity, inputs as {} as NamedTensorMap);\n}\n\nexport const clone = op({clone_});\n", "/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\n\n/**\n * Prints information about the `tf.Tensor` including its data.\n *\n * ```js\n * const verbose = true;\n * tf.tensor2d([1, 2, 3, 4], [2, 2]).print(verbose);\n * ```\n * @param x The tensor to be printed.\n * @param verbose Whether to print verbose information about the ` Tensor`,\n * including dtype and size.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function print(x: T, verbose = false): void {\n console.log(x.toString(verbose));\n}\n", "/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Required side effectful code for tfjs-core\n\n// Set up Engine and ENV\nimport {getOrMakeEngine} from './engine';\ngetOrMakeEngine();\n\n// Register backend-agnostic flags.\nimport './flags';\n// Register platforms\nimport './platforms/platform_browser';\nimport './platforms/platform_node';\n\n// Set up OpHandler\nimport {buffer} from './ops/buffer';\nimport {cast} from './ops/cast';\nimport {clone} from './ops/clone';\nimport {print} from './ops/print';\nimport {OpHandler, setOpHandler} from './tensor';\nconst opHandler: OpHandler = {\n buffer,\n cast,\n clone,\n print\n};\nsetOpHandler(opHandler);\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Importing local_storage and indexed_db is necessary for the routers to be\n// registered.\nimport './indexed_db';\nimport './local_storage';\n\nimport {browserFiles} from './browser_files';\nimport {browserHTTPRequest, http, isHTTPScheme} from './http';\nimport {concatenateArrayBuffers, decodeWeights, encodeWeights, getModelArtifactsInfoForJSON} from './io_utils';\nimport {fromMemory, withSaveHandler} from './passthrough';\nimport {getLoadHandlers, getSaveHandlers, registerLoadRouter, registerSaveRouter} from './router_registry';\nimport {IOHandler, LoadHandler, LoadOptions, ModelArtifacts, ModelArtifactsInfo, ModelJSON, ModelStoreManager, OnProgressCallback, RequestDetails, SaveConfig, SaveHandler, SaveResult, WeightGroup, WeightsManifestConfig, WeightsManifestEntry} from './types';\nimport {loadWeights, weightsLoaderFactory} from './weights_loader';\n\nexport {copyModel, listModels, moveModel, removeModel} from './model_management';\nexport {\n browserFiles,\n browserHTTPRequest,\n concatenateArrayBuffers,\n decodeWeights,\n encodeWeights,\n fromMemory,\n getLoadHandlers,\n getModelArtifactsInfoForJSON,\n getSaveHandlers,\n http,\n IOHandler,\n isHTTPScheme,\n LoadHandler,\n LoadOptions,\n loadWeights,\n ModelArtifacts,\n ModelArtifactsInfo,\n ModelJSON,\n ModelStoreManager,\n OnProgressCallback,\n registerLoadRouter,\n registerSaveRouter,\n RequestDetails,\n SaveConfig,\n SaveHandler,\n SaveResult,\n WeightGroup,\n weightsLoaderFactory,\n WeightsManifestConfig,\n WeightsManifestEntry,\n withSaveHandler\n};\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * IOHandlers related to files, such as browser-triggered file downloads,\n * user-selected files in browser.\n */\n\nimport '../flags';\nimport {env} from '../environment';\n\nimport {basename, concatenateArrayBuffers, getModelArtifactsInfoForJSON} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, ModelArtifacts, ModelJSON, SaveResult, WeightsManifestConfig, WeightsManifestEntry} from './types';\n\nconst DEFAULT_FILE_NAME_PREFIX = 'model';\nconst DEFAULT_JSON_EXTENSION_NAME = '.json';\nconst DEFAULT_WEIGHT_DATA_EXTENSION_NAME = '.weights.bin';\n\nfunction defer(f: () => T): Promise {\n return new Promise(resolve => setTimeout(resolve)).then(f);\n}\n\nexport class BrowserDownloads implements IOHandler {\n private readonly modelTopologyFileName: string;\n private readonly weightDataFileName: string;\n private readonly jsonAnchor: HTMLAnchorElement;\n private readonly weightDataAnchor: HTMLAnchorElement;\n\n static readonly URL_SCHEME = 'downloads://';\n\n constructor(fileNamePrefix?: string) {\n if (!env().getBool('IS_BROWSER')) {\n // TODO(cais): Provide info on what IOHandlers are available under the\n // current environment.\n throw new Error(\n 'browserDownloads() cannot proceed because the current environment ' +\n 'is not a browser.');\n }\n\n if (fileNamePrefix.startsWith(BrowserDownloads.URL_SCHEME)) {\n fileNamePrefix = fileNamePrefix.slice(BrowserDownloads.URL_SCHEME.length);\n }\n if (fileNamePrefix == null || fileNamePrefix.length === 0) {\n fileNamePrefix = DEFAULT_FILE_NAME_PREFIX;\n }\n\n this.modelTopologyFileName = fileNamePrefix + DEFAULT_JSON_EXTENSION_NAME;\n this.weightDataFileName =\n fileNamePrefix + DEFAULT_WEIGHT_DATA_EXTENSION_NAME;\n }\n\n async save(modelArtifacts: ModelArtifacts): Promise {\n if (typeof (document) === 'undefined') {\n throw new Error(\n 'Browser downloads are not supported in ' +\n 'this environment since `document` is not present');\n }\n const weightsURL = window.URL.createObjectURL(new Blob(\n [modelArtifacts.weightData], {type: 'application/octet-stream'}));\n\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserDownloads.save() does not support saving model topology ' +\n 'in binary formats yet.');\n } else {\n const weightsManifest: WeightsManifestConfig = [{\n paths: ['./' + this.weightDataFileName],\n weights: modelArtifacts.weightSpecs\n }];\n const modelTopologyAndWeightManifest: ModelJSON = {\n modelTopology: modelArtifacts.modelTopology,\n format: modelArtifacts.format,\n generatedBy: modelArtifacts.generatedBy,\n convertedBy: modelArtifacts.convertedBy,\n weightsManifest\n };\n if (modelArtifacts.signature != null) {\n modelTopologyAndWeightManifest.signature = modelArtifacts.signature;\n }\n if (modelArtifacts.userDefinedMetadata != null) {\n modelTopologyAndWeightManifest.userDefinedMetadata =\n modelArtifacts.userDefinedMetadata;\n }\n if (modelArtifacts.modelInitializer != null) {\n modelTopologyAndWeightManifest.modelInitializer =\n modelArtifacts.modelInitializer;\n }\n const modelTopologyAndWeightManifestURL =\n window.URL.createObjectURL(new Blob(\n [JSON.stringify(modelTopologyAndWeightManifest)],\n {type: 'application/json'}));\n\n // If anchor elements are not provided, create them without attaching them\n // to parents, so that the downloaded file names can be controlled.\n const jsonAnchor = this.jsonAnchor == null ? document.createElement('a') :\n this.jsonAnchor;\n jsonAnchor.download = this.modelTopologyFileName;\n jsonAnchor.href = modelTopologyAndWeightManifestURL;\n // Trigger downloads by evoking a click event on the download anchors.\n // When multiple downloads are started synchronously, Firefox will only\n // save the last one.\n await defer(() => jsonAnchor.dispatchEvent(new MouseEvent('click')));\n\n if (modelArtifacts.weightData != null) {\n const weightDataAnchor = this.weightDataAnchor == null ?\n document.createElement('a') :\n this.weightDataAnchor;\n weightDataAnchor.download = this.weightDataFileName;\n weightDataAnchor.href = weightsURL;\n await defer(\n () => weightDataAnchor.dispatchEvent(new MouseEvent('click')));\n }\n\n return {modelArtifactsInfo: getModelArtifactsInfoForJSON(modelArtifacts)};\n }\n }\n}\n\nclass BrowserFiles implements IOHandler {\n private readonly files: File[];\n\n constructor(files: File[]) {\n if (files == null || files.length < 1) {\n throw new Error(\n `When calling browserFiles, at least 1 file is required, ` +\n `but received ${files}`);\n }\n this.files = files;\n }\n\n async load(): Promise {\n const jsonFile = this.files[0];\n const weightFiles = this.files.slice(1);\n\n return new Promise((resolve, reject) => {\n const jsonReader = new FileReader();\n jsonReader.onload = (event: Event) => {\n // tslint:disable-next-line:no-any\n const modelJSON = JSON.parse((event.target as any).result) as ModelJSON;\n const modelTopology = modelJSON.modelTopology;\n if (modelTopology == null) {\n reject(new Error(\n `modelTopology field is missing from file ${jsonFile.name}`));\n return;\n }\n\n if (weightFiles.length === 0) {\n resolve({modelTopology});\n }\n\n const weightsManifest = modelJSON.weightsManifest;\n if (weightsManifest == null) {\n reject(new Error(\n `weightManifest field is missing from file ${jsonFile.name}`));\n return;\n }\n\n let pathToFile: {[path: string]: File};\n try {\n pathToFile =\n this.checkManifestAndWeightFiles(weightsManifest, weightFiles);\n } catch (err) {\n reject(err);\n return;\n }\n\n const weightSpecs: WeightsManifestEntry[] = [];\n const paths: string[] = [];\n const perFileBuffers: ArrayBuffer[] = [];\n weightsManifest.forEach(weightsGroup => {\n weightsGroup.paths.forEach(path => {\n paths.push(path);\n perFileBuffers.push(null);\n });\n weightSpecs.push(...weightsGroup.weights);\n });\n\n weightsManifest.forEach(weightsGroup => {\n weightsGroup.paths.forEach(path => {\n const weightFileReader = new FileReader();\n weightFileReader.onload = (event: Event) => {\n // tslint:disable-next-line:no-any\n const weightData = (event.target as any).result as ArrayBuffer;\n const index = paths.indexOf(path);\n perFileBuffers[index] = weightData;\n if (perFileBuffers.indexOf(null) === -1) {\n const result: ModelArtifacts = {\n modelTopology,\n weightSpecs,\n weightData: concatenateArrayBuffers(perFileBuffers),\n format: modelJSON.format,\n generatedBy: modelJSON.generatedBy,\n convertedBy: modelJSON.convertedBy\n };\n if (modelJSON.signature != null) {\n result.signature = modelJSON.signature;\n }\n if (modelJSON.userDefinedMetadata != null) {\n result.userDefinedMetadata = modelJSON.userDefinedMetadata;\n }\n if (modelJSON.modelInitializer != null) {\n result.modelInitializer = modelJSON.modelInitializer;\n }\n resolve(result);\n }\n };\n weightFileReader.onerror = error =>\n reject(`Failed to weights data from file of path '${path}'.`);\n weightFileReader.readAsArrayBuffer(pathToFile[path]);\n });\n });\n };\n jsonReader.onerror = error => reject(\n `Failed to read model topology and weights manifest JSON ` +\n `from file '${jsonFile.name}'. BrowserFiles supports loading ` +\n `Keras-style tf.Model artifacts only.`);\n jsonReader.readAsText(jsonFile);\n });\n }\n\n /**\n * Check the compatibility between weights manifest and weight files.\n */\n private checkManifestAndWeightFiles(\n manifest: WeightsManifestConfig, files: File[]): {[path: string]: File} {\n const basenames: string[] = [];\n const fileNames = files.map(file => basename(file.name));\n const pathToFile: {[path: string]: File} = {};\n for (const group of manifest) {\n group.paths.forEach(path => {\n const pathBasename = basename(path);\n if (basenames.indexOf(pathBasename) !== -1) {\n throw new Error(\n `Duplicate file basename found in weights manifest: ` +\n `'${pathBasename}'`);\n }\n basenames.push(pathBasename);\n if (fileNames.indexOf(pathBasename) === -1) {\n throw new Error(\n `Weight file with basename '${pathBasename}' is not provided.`);\n } else {\n pathToFile[path] = files[fileNames.indexOf(pathBasename)];\n }\n });\n }\n\n if (basenames.length !== files.length) {\n throw new Error(\n `Mismatch in the number of files in weights manifest ` +\n `(${basenames.length}) and the number of weight files provided ` +\n `(${files.length}).`);\n }\n return pathToFile;\n }\n}\n\nexport const browserDownloadsRouter: IORouter = (url: string|string[]) => {\n if (!env().getBool('IS_BROWSER')) {\n return null;\n } else {\n if (!Array.isArray(url) && url.startsWith(BrowserDownloads.URL_SCHEME)) {\n return browserDownloads(url.slice(BrowserDownloads.URL_SCHEME.length));\n } else {\n return null;\n }\n }\n};\nIORouterRegistry.registerSaveRouter(browserDownloadsRouter);\n\n/**\n * Creates an IOHandler that triggers file downloads from the browser.\n *\n * The returned `IOHandler` instance can be used as model exporting methods such\n * as `tf.Model.save` and supports only saving.\n *\n * ```js\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * const saveResult = await model.save('downloads://mymodel');\n * // This will trigger downloading of two files:\n * // 'mymodel.json' and 'mymodel.weights.bin'.\n * console.log(saveResult);\n * ```\n *\n * @param fileNamePrefix Prefix name of the files to be downloaded. For use with\n * `tf.Model`, `fileNamePrefix` should follow either of the following two\n * formats:\n * 1. `null` or `undefined`, in which case the default file\n * names will be used:\n * - 'model.json' for the JSON file containing the model topology and\n * weights manifest.\n * - 'model.weights.bin' for the binary file containing the binary weight\n * values.\n * 2. A single string or an Array of a single string, as the file name prefix.\n * For example, if `'foo'` is provided, the downloaded JSON\n * file and binary weights file will be named 'foo.json' and\n * 'foo.weights.bin', respectively.\n * @param config Additional configuration for triggering downloads.\n * @returns An instance of `BrowserDownloads` `IOHandler`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Loading',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nexport function browserDownloads(fileNamePrefix = 'model'): IOHandler {\n return new BrowserDownloads(fileNamePrefix);\n}\n\n/**\n * Creates an IOHandler that loads model artifacts from user-selected files.\n *\n * This method can be used for loading from files such as user-selected files\n * in the browser.\n * When used in conjunction with `tf.loadLayersModel`, an instance of\n * `tf.LayersModel` (Keras-style) can be constructed from the loaded artifacts.\n *\n * ```js\n * // Note: This code snippet won't run properly without the actual file input\n * // elements in the HTML DOM.\n *\n * // Suppose there are two HTML file input (``)\n * // elements.\n * const uploadJSONInput = document.getElementById('upload-json');\n * const uploadWeightsInput = document.getElementById('upload-weights');\n * const model = await tf.loadLayersModel(tf.io.browserFiles(\n * [uploadJSONInput.files[0], uploadWeightsInput.files[0]]));\n * ```\n *\n * @param files `File`s to load from. Currently, this function supports only\n * loading from files that contain Keras-style models (i.e., `tf.Model`s), for\n * which an `Array` of `File`s is expected (in that order):\n * - A JSON file containing the model topology and weight manifest.\n * - Optionally, One or more binary files containing the binary weights.\n * These files must have names that match the paths in the `weightsManifest`\n * contained by the aforementioned JSON file, or errors will be thrown\n * during loading. These weights files have the same format as the ones\n * generated by `tensorflowjs_converter` that comes with the `tensorflowjs`\n * Python PIP package. If no weights files are provided, only the model\n * topology will be loaded from the JSON file above.\n * @returns An instance of `Files` `IOHandler`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Loading',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nexport function browserFiles(files: File[]): IOHandler {\n return new BrowserFiles(files);\n}\n", "/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {assert} from '../util';\n\nimport {OnProgressCallback} from './types';\n\n/**\n * Monitor Promise.all progress, fire onProgress callback function.\n *\n * @param promises Promise list going to be monitored\n * @param onProgress Callback function. Fired when a promise resolved.\n * @param startFraction Optional fraction start. Default to 0.\n * @param endFraction Optional fraction end. Default to 1.\n */\nexport function monitorPromisesProgress(\n promises: Array>, onProgress: OnProgressCallback,\n startFraction?: number, endFraction?: number) {\n checkPromises(promises);\n startFraction = startFraction == null ? 0 : startFraction;\n endFraction = endFraction == null ? 1 : endFraction;\n checkFraction(startFraction, endFraction);\n let resolvedPromise = 0;\n\n const registerMonitor = (promise: Promise<{}>) => {\n promise.then(value => {\n const fraction = startFraction +\n ++resolvedPromise / promises.length * (endFraction - startFraction);\n // pass fraction as parameter to callback function.\n onProgress(fraction);\n return value;\n });\n return promise;\n };\n\n function checkPromises(promises: Array>): void {\n assert(\n promises != null && Array.isArray(promises) && promises.length > 0,\n () => 'promises must be a none empty array');\n }\n\n function checkFraction(startFraction: number, endFraction: number): void {\n assert(\n startFraction >= 0 && startFraction <= 1,\n () => `Progress fraction must be in range [0, 1], but ` +\n `got startFraction ${startFraction}`);\n assert(\n endFraction >= 0 && endFraction <= 1,\n () => `Progress fraction must be in range [0, 1], but ` +\n `got endFraction ${endFraction}`);\n assert(\n endFraction >= startFraction,\n () => `startFraction must be no more than endFraction, but ` +\n `got startFraction ${startFraction} and endFraction ` +\n `${endFraction}`);\n }\n\n return Promise.all(promises.map(registerMonitor));\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '../environment';\n\nimport {NamedTensorMap} from '../tensor_types';\nimport * as util from '../util';\nimport {decodeWeights} from './io_utils';\nimport {monitorPromisesProgress} from './progress';\nimport {DTYPE_VALUE_SIZE_MAP, LoadOptions, WeightsManifestConfig, WeightsManifestEntry} from './types';\n\n/**\n * Reads binary weights data from a number of URLs.\n *\n * @param fetchURLs URLs to send the HTTP requests at, using `fetch` calls.\n * @param requestOptions RequestInit (options) for the HTTP requests.\n * @param fetchFunc Optional overriding value for the `window.fetch` function.\n * @param onProgress Optional, progress callback function, fired periodically\n * before the load is completed.\n * @returns A `Promise` of an Array of `ArrayBuffer`. The Array has the same\n * length as `fetchURLs`.\n */\nexport async function loadWeightsAsArrayBuffer(\n fetchURLs: string[], loadOptions?: LoadOptions): Promise {\n if (loadOptions == null) {\n loadOptions = {};\n }\n\n const fetchFunc = loadOptions.fetchFunc == null ? env().platform.fetch :\n loadOptions.fetchFunc;\n\n // Create the requests for all of the weights in parallel.\n const requests = fetchURLs.map(\n fetchURL =>\n fetchFunc(fetchURL, loadOptions.requestInit, {isBinary: true}));\n\n const fetchStartFraction = 0;\n const fetchEndFraction = 0.5;\n\n const responses = loadOptions.onProgress == null ?\n await Promise.all(requests) :\n await monitorPromisesProgress(\n requests, loadOptions.onProgress, fetchStartFraction,\n fetchEndFraction);\n\n const bufferPromises = responses.map(response => response.arrayBuffer());\n\n const bufferStartFraction = 0.5;\n const bufferEndFraction = 1;\n\n const buffers = loadOptions.onProgress == null ?\n await Promise.all(bufferPromises) :\n await monitorPromisesProgress(\n bufferPromises, loadOptions.onProgress, bufferStartFraction,\n bufferEndFraction);\n return buffers;\n}\n\n/**\n * Reads a weights manifest JSON configuration, fetches the weights and\n * returns them as `Tensor`s.\n *\n * @param manifest The weights manifest JSON.\n * @param filePathPrefix The path prefix for filenames given in the manifest.\n * Defaults to the empty string.\n * @param weightNames The names of the weights to be fetched.\n */\nexport async function loadWeights(\n manifest: WeightsManifestConfig, filePathPrefix = '',\n weightNames?: string[],\n requestInit?: RequestInit): Promise {\n // TODO(nsthorat): Groups are currently fetched atomically. If you need a\n // single weight from a group, the whole group will be fetched. At a future\n // date, we should support fetching only the individual shards within a\n // group that are needed to reconstruct the requested weight.\n // TODO(cais): Use `decodeWeights` for implementation.\n\n const fetchWeights = (fetchUrls: string[]) =>\n loadWeightsAsArrayBuffer(fetchUrls, {requestInit});\n const loadWeights = weightsLoaderFactory(fetchWeights);\n\n return loadWeights(manifest, filePathPrefix, weightNames);\n}\n\n/**\n * Creates a function, which reads a weights manifest JSON configuration,\n * fetches the weight files using the specified function and returns them as\n * `Tensor`s.\n *\n * ```js\n * // example for creating a nodejs weight loader, which reads the weight files\n * // from disk using fs.readFileSync\n *\n * import * as fs from 'fs'\n *\n * const fetchWeightsFromDisk = (filePaths: string[]) =>\n * filePaths.map(filePath => fs.readFileSync(filePath).buffer)\n *\n * const loadWeights = tf.io.weightsLoaderFactory(fetchWeightsFromDisk)\n *\n * const manifest = JSON.parse(\n * fs.readFileSync('./my_model-weights_manifest').toString()\n * )\n * const weightMap = await loadWeights(manifest, './')\n * ```\n * @param fetchWeightsFunction The function used for fetching the weight files.\n * @returns Weight loading function.\n */\nexport function weightsLoaderFactory(\n fetchWeightsFunction: (fetchUrls: string[]) => Promise):\n (manifest: WeightsManifestConfig, filePathPrefix?: string,\n weightNames?: string[]) => Promise {\n return async(\n manifest: WeightsManifestConfig, filePathPrefix = '',\n weightNames?: string[]): Promise => {\n // Collect all the groups, weights, and their relative offsets to be\n // fetched.\n const groupIndicesToFetchMap = manifest.map(() => false);\n const groupWeightsToFetch: {\n [group: number]: Array<{\n manifestEntry: WeightsManifestEntry; groupOffset: number;\n sizeBytes: number;\n }>\n } = {};\n const weightsFound =\n weightNames != null ? weightNames.map(() => false) : [];\n const allManifestWeightNames: string[] = [];\n manifest.forEach((manifestGroupConfig, groupIndex) => {\n let groupOffset = 0;\n manifestGroupConfig.weights.forEach(weightsEntry => {\n const rawDtype = ('quantization' in weightsEntry) ?\n weightsEntry.quantization.dtype :\n weightsEntry.dtype;\n\n const weightsBytes = DTYPE_VALUE_SIZE_MAP[rawDtype] *\n util.sizeFromShape(weightsEntry.shape);\n\n const enqueueWeightsForFetchingFn = () => {\n groupIndicesToFetchMap[groupIndex] = true;\n if (groupWeightsToFetch[groupIndex] == null) {\n groupWeightsToFetch[groupIndex] = [];\n }\n\n groupWeightsToFetch[groupIndex].push({\n manifestEntry: weightsEntry,\n groupOffset,\n sizeBytes: weightsBytes\n });\n };\n\n if (weightNames != null) {\n weightNames.forEach((weightName, weightIndex) => {\n if (weightName === weightsEntry.name) {\n enqueueWeightsForFetchingFn();\n weightsFound[weightIndex] = true;\n }\n });\n } else {\n enqueueWeightsForFetchingFn();\n }\n\n allManifestWeightNames.push(weightsEntry.name);\n groupOffset += weightsBytes;\n });\n });\n\n if (!weightsFound.every(found => found)) {\n const weightsNotFound = weightNames.filter((_, i) => !weightsFound[i]);\n throw new Error(\n `Could not find weights in manifest with names: ` +\n `${weightsNotFound.join(', ')}. \\n` +\n `Manifest JSON has weights with names: ` +\n `${allManifestWeightNames.join(', ')}.`);\n }\n\n // Convert the one-hot boolean groupId => shouldFetch map to a list of group\n // IDs.\n const groupIndicesToFetch =\n groupIndicesToFetchMap.reduce((accumulator, shouldFetch, i) => {\n if (shouldFetch) {\n accumulator.push(i);\n }\n return accumulator;\n }, []);\n\n const fetchUrls: string[] = [];\n groupIndicesToFetch.forEach(i => {\n manifest[i].paths.forEach(filepath => {\n const fetchUrl = filePathPrefix +\n (!filePathPrefix.endsWith('/') ? '/' : '') + filepath;\n fetchUrls.push(fetchUrl);\n });\n });\n const buffers = await fetchWeightsFunction(fetchUrls);\n\n const weightsTensorMap: NamedTensorMap = {};\n let bufferIndexOffset = 0;\n groupIndicesToFetch.forEach(i => {\n const numBuffers = manifest[i].paths.length;\n\n let groupBytes = 0;\n for (let i = 0; i < numBuffers; i++) {\n groupBytes += buffers[bufferIndexOffset + i].byteLength;\n }\n\n // Create a buffer for the whole group.\n const groupBuffer = new ArrayBuffer(groupBytes);\n const groupByteBuffer = new Uint8Array(groupBuffer);\n let groupBufferOffset = 0;\n for (let i = 0; i < numBuffers; i++) {\n const buffer = new Uint8Array(buffers[bufferIndexOffset + i]);\n groupByteBuffer.set(buffer, groupBufferOffset);\n groupBufferOffset += buffer.byteLength;\n }\n\n const weightsEntries = groupWeightsToFetch[i];\n weightsEntries.forEach(weightsEntry => {\n const byteBuffer = groupBuffer.slice(\n weightsEntry.groupOffset,\n weightsEntry.groupOffset + weightsEntry.sizeBytes);\n const nameToTensorMap =\n decodeWeights(byteBuffer, [weightsEntry.manifestEntry]);\n for (const name in nameToTensorMap) {\n weightsTensorMap[name] = nameToTensorMap[name];\n }\n });\n\n bufferIndexOffset += numBuffers;\n });\n\n return weightsTensorMap;\n };\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * IOHandler implementations based on HTTP requests in the web browser.\n *\n * Uses [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n */\n\nimport {env} from '../environment';\n\nimport {assert} from '../util';\nimport {concatenateArrayBuffers, getModelArtifactsInfoForJSON} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, LoadOptions, ModelArtifacts, ModelJSON, OnProgressCallback, SaveResult, WeightsManifestConfig, WeightsManifestEntry} from './types';\nimport {loadWeightsAsArrayBuffer} from './weights_loader';\n\nconst OCTET_STREAM_MIME_TYPE = 'application/octet-stream';\nconst JSON_TYPE = 'application/json';\nexport class HTTPRequest implements IOHandler {\n protected readonly path: string;\n protected readonly requestInit: RequestInit;\n\n private readonly fetch: Function;\n private readonly weightUrlConverter: (weightName: string) => Promise;\n\n readonly DEFAULT_METHOD = 'POST';\n\n static readonly URL_SCHEME_REGEX = /^https?:\\/\\//;\n\n private readonly weightPathPrefix: string;\n private readonly onProgress: OnProgressCallback;\n\n constructor(path: string, loadOptions?: LoadOptions) {\n if (loadOptions == null) {\n loadOptions = {};\n }\n this.weightPathPrefix = loadOptions.weightPathPrefix;\n this.onProgress = loadOptions.onProgress;\n this.weightUrlConverter = loadOptions.weightUrlConverter;\n\n if (loadOptions.fetchFunc != null) {\n assert(\n typeof loadOptions.fetchFunc === 'function',\n () => 'Must pass a function that matches the signature of ' +\n '`fetch` (see ' +\n 'https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)');\n this.fetch = loadOptions.fetchFunc;\n } else {\n this.fetch = env().platform.fetch;\n }\n\n assert(\n path != null && path.length > 0,\n () => 'URL path for http must not be null, undefined or ' +\n 'empty.');\n\n if (Array.isArray(path)) {\n assert(\n path.length === 2,\n () => 'URL paths for http must have a length of 2, ' +\n `(actual length is ${path.length}).`);\n }\n this.path = path;\n\n if (loadOptions.requestInit != null &&\n loadOptions.requestInit.body != null) {\n throw new Error(\n 'requestInit is expected to have no pre-existing body, but has one.');\n }\n this.requestInit = loadOptions.requestInit || {};\n }\n\n async save(modelArtifacts: ModelArtifacts): Promise {\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserHTTPRequest.save() does not support saving model topology ' +\n 'in binary formats yet.');\n }\n\n const init = Object.assign({method: this.DEFAULT_METHOD}, this.requestInit);\n init.body = new FormData();\n\n const weightsManifest: WeightsManifestConfig = [{\n paths: ['./model.weights.bin'],\n weights: modelArtifacts.weightSpecs,\n }];\n const modelTopologyAndWeightManifest: ModelJSON = {\n modelTopology: modelArtifacts.modelTopology,\n format: modelArtifacts.format,\n generatedBy: modelArtifacts.generatedBy,\n convertedBy: modelArtifacts.convertedBy,\n weightsManifest\n };\n if (modelArtifacts.signature != null) {\n modelTopologyAndWeightManifest.signature = modelArtifacts.signature;\n }\n if (modelArtifacts.userDefinedMetadata != null) {\n modelTopologyAndWeightManifest.userDefinedMetadata =\n modelArtifacts.userDefinedMetadata;\n }\n if (modelArtifacts.modelInitializer != null) {\n modelTopologyAndWeightManifest.modelInitializer =\n modelArtifacts.modelInitializer;\n }\n\n init.body.append(\n 'model.json',\n new Blob(\n [JSON.stringify(modelTopologyAndWeightManifest)],\n {type: JSON_TYPE}),\n 'model.json');\n\n if (modelArtifacts.weightData != null) {\n init.body.append(\n 'model.weights.bin',\n new Blob([modelArtifacts.weightData], {type: OCTET_STREAM_MIME_TYPE}),\n 'model.weights.bin');\n }\n\n const response = await this.fetch(this.path, init);\n\n if (response.ok) {\n return {\n modelArtifactsInfo: getModelArtifactsInfoForJSON(modelArtifacts),\n responses: [response],\n };\n } else {\n throw new Error(\n `BrowserHTTPRequest.save() failed due to HTTP response status ` +\n `${response.status}.`);\n }\n }\n\n /**\n * Load model artifacts via HTTP request(s).\n *\n * See the documentation to `tf.io.http` for details on the saved\n * artifacts.\n *\n * @returns The loaded model artifacts (if loading succeeds).\n */\n async load(): Promise {\n const modelConfigRequest = await this.fetch(this.path, this.requestInit);\n\n if (!modelConfigRequest.ok) {\n throw new Error(\n `Request to ${this.path} failed with status code ` +\n `${modelConfigRequest.status}. Please verify this URL points to ` +\n `the model JSON of the model to load.`);\n }\n let modelConfig: ModelJSON;\n try {\n modelConfig = await modelConfigRequest.json();\n } catch (e) {\n let message = `Failed to parse model JSON of response from ${this.path}.`;\n // TODO(nsthorat): Remove this after some time when we're comfortable that\n // .pb files are mostly gone.\n if (this.path.endsWith('.pb')) {\n message += ' Your path contains a .pb file extension. ' +\n 'Support for .pb models have been removed in TensorFlow.js 1.0 ' +\n 'in favor of .json models. You can re-convert your Python ' +\n 'TensorFlow model using the TensorFlow.js 1.0 conversion scripts ' +\n 'or you can convert your.pb models with the \\'pb2json\\'' +\n 'NPM script in the tensorflow/tfjs-converter repository.';\n } else {\n message += ' Please make sure the server is serving valid ' +\n 'JSON for this request.';\n }\n throw new Error(message);\n }\n const modelTopology = modelConfig.modelTopology;\n const weightsManifest = modelConfig.weightsManifest;\n const generatedBy = modelConfig.generatedBy;\n const convertedBy = modelConfig.convertedBy;\n const format = modelConfig.format;\n const signature = modelConfig.signature;\n const userDefinedMetadata = modelConfig.userDefinedMetadata;\n\n // We do not allow both modelTopology and weightsManifest to be missing.\n if (modelTopology == null && weightsManifest == null) {\n throw new Error(\n `The JSON from HTTP path ${this.path} contains neither model ` +\n `topology or manifest for weights.`);\n }\n\n let weightSpecs: WeightsManifestEntry[];\n let weightData: ArrayBuffer;\n if (weightsManifest != null) {\n const results = await this.loadWeights(weightsManifest);\n [weightSpecs, weightData] = results;\n }\n\n const artifacts: ModelArtifacts = {\n modelTopology,\n weightSpecs,\n weightData,\n generatedBy,\n convertedBy,\n format\n };\n\n if (signature != null) {\n artifacts.signature = signature;\n }\n if (userDefinedMetadata != null) {\n artifacts.userDefinedMetadata = userDefinedMetadata;\n }\n\n const initializer = modelConfig.modelInitializer;\n if (initializer) {\n artifacts.modelInitializer = initializer;\n }\n\n return artifacts;\n }\n\n private async loadWeights(weightsManifest: WeightsManifestConfig):\n Promise<[WeightsManifestEntry[], ArrayBuffer]> {\n const weightPath = Array.isArray(this.path) ? this.path[1] : this.path;\n const [prefix, suffix] = parseUrl(weightPath);\n const pathPrefix = this.weightPathPrefix || prefix;\n\n const weightSpecs = [];\n for (const entry of weightsManifest) {\n weightSpecs.push(...entry.weights);\n }\n\n const fetchURLs: string[] = [];\n const urlPromises: Array> = [];\n for (const weightsGroup of weightsManifest) {\n for (const path of weightsGroup.paths) {\n if (this.weightUrlConverter != null) {\n urlPromises.push(this.weightUrlConverter(path));\n } else {\n fetchURLs.push(pathPrefix + path + suffix);\n }\n }\n }\n\n if (this.weightUrlConverter) {\n fetchURLs.push(...await Promise.all(urlPromises));\n }\n\n const buffers = await loadWeightsAsArrayBuffer(fetchURLs, {\n requestInit: this.requestInit,\n fetchFunc: this.fetch,\n onProgress: this.onProgress\n });\n return [weightSpecs, concatenateArrayBuffers(buffers)];\n }\n}\n\n/**\n * Extract the prefix and suffix of the url, where the prefix is the path before\n * the last file, and suffix is the search params after the last file.\n * ```\n * const url = 'http://tfhub.dev/model/1/tensorflowjs_model.pb?tfjs-format=file'\n * [prefix, suffix] = parseUrl(url)\n * // prefix = 'http://tfhub.dev/model/1/'\n * // suffix = '?tfjs-format=file'\n * ```\n * @param url the model url to be parsed.\n */\nexport function parseUrl(url: string): [string, string] {\n const lastSlash = url.lastIndexOf('/');\n const lastSearchParam = url.lastIndexOf('?');\n const prefix = url.substring(0, lastSlash);\n const suffix =\n lastSearchParam > lastSlash ? url.substring(lastSearchParam) : '';\n return [prefix + '/', suffix];\n}\n\nexport function isHTTPScheme(url: string): boolean {\n return url.match(HTTPRequest.URL_SCHEME_REGEX) != null;\n}\n\nexport const httpRouter: IORouter =\n (url: string, loadOptions?: LoadOptions) => {\n if (typeof fetch === 'undefined' &&\n (loadOptions == null || loadOptions.fetchFunc == null)) {\n // `http` uses `fetch` or `node-fetch`, if one wants to use it in\n // an environment that is not the browser or node they have to setup a\n // global fetch polyfill.\n return null;\n } else {\n let isHTTP = true;\n if (Array.isArray(url)) {\n isHTTP = url.every(urlItem => isHTTPScheme(urlItem));\n } else {\n isHTTP = isHTTPScheme(url);\n }\n if (isHTTP) {\n return http(url, loadOptions);\n }\n }\n return null;\n };\nIORouterRegistry.registerSaveRouter(httpRouter);\nIORouterRegistry.registerLoadRouter(httpRouter);\n\n/**\n * Creates an IOHandler subtype that sends model artifacts to HTTP server.\n *\n * An HTTP request of the `multipart/form-data` mime type will be sent to the\n * `path` URL. The form data includes artifacts that represent the topology\n * and/or weights of the model. In the case of Keras-style `tf.Model`, two\n * blobs (files) exist in form-data:\n * - A JSON file consisting of `modelTopology` and `weightsManifest`.\n * - A binary weights file consisting of the concatenated weight values.\n * These files are in the same format as the one generated by\n * [tfjs_converter](https://js.tensorflow.org/tutorials/import-keras.html).\n *\n * The following code snippet exemplifies the client-side code that uses this\n * function:\n *\n * ```js\n * const model = tf.sequential();\n * model.add(\n * tf.layers.dense({units: 1, inputShape: [100], activation: 'sigmoid'}));\n *\n * const saveResult = await model.save(tf.io.http(\n * 'http://model-server:5000/upload', {requestInit: {method: 'PUT'}}));\n * console.log(saveResult);\n * ```\n *\n * If the default `POST` method is to be used, without any custom parameters\n * such as headers, you can simply pass an HTTP or HTTPS URL to `model.save`:\n *\n * ```js\n * const saveResult = await model.save('http://model-server:5000/upload');\n * ```\n *\n * The following GitHub Gist\n * https://gist.github.com/dsmilkov/1b6046fd6132d7408d5257b0976f7864\n * implements a server based on [flask](https://github.com/pallets/flask) that\n * can receive the request. Upon receiving the model artifacts via the requst,\n * this particular server reconsistutes instances of [Keras\n * Models](https://keras.io/models/model/) in memory.\n *\n *\n * @param path A URL path to the model.\n * Can be an absolute HTTP path (e.g.,\n * 'http://localhost:8000/model-upload)') or a relative path (e.g.,\n * './model-upload').\n * @param requestInit Request configurations to be used when sending\n * HTTP request to server using `fetch`. It can contain fields such as\n * `method`, `credentials`, `headers`, `mode`, etc. See\n * https://developer.mozilla.org/en-US/docs/Web/API/Request/Request\n * for more information. `requestInit` must not have a body, because the\n * body will be set by TensorFlow.js. File blobs representing the model\n * topology (filename: 'model.json') and the weights of the model (filename:\n * 'model.weights.bin') will be appended to the body. If `requestInit` has a\n * `body`, an Error will be thrown.\n * @param loadOptions Optional configuration for the loading. It includes the\n * following fields:\n * - weightPathPrefix Optional, this specifies the path prefix for weight\n * files, by default this is calculated from the path param.\n * - fetchFunc Optional, custom `fetch` function. E.g., in Node.js,\n * the `fetch` from node-fetch can be used here.\n * - onProgress Optional, progress callback function, fired periodically\n * before the load is completed.\n * @returns An instance of `IOHandler`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Loading',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nexport function http(path: string, loadOptions?: LoadOptions): IOHandler {\n return new HTTPRequest(path, loadOptions);\n}\n\n/**\n * Deprecated. Use `tf.io.http`.\n * @param path\n * @param loadOptions\n */\nexport function browserHTTPRequest(\n path: string, loadOptions?: LoadOptions): IOHandler {\n return http(path, loadOptions);\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * IOHandlers that pass through the in-memory ModelArtifacts format.\n */\n\nimport {IOHandler, ModelArtifacts, SaveResult, TrainingConfig, WeightsManifestEntry} from './types';\n\nclass PassthroughLoader implements IOHandler {\n constructor(private readonly modelArtifacts?: ModelArtifacts) {}\n\n async load(): Promise {\n return this.modelArtifacts;\n }\n}\n\nclass PassthroughSaver implements IOHandler {\n constructor(\n private readonly saveHandler:\n (artifacts: ModelArtifacts) => Promise) {}\n\n async save(modelArtifacts: ModelArtifacts) {\n return this.saveHandler(modelArtifacts);\n }\n}\n\n/**\n * Creates an IOHandler that loads model artifacts from memory.\n *\n * When used in conjunction with `tf.loadLayersModel`, an instance of\n * `tf.LayersModel` (Keras-style) can be constructed from the loaded artifacts.\n *\n * ```js\n * const model = await tf.loadLayersModel(tf.io.fromMemory(\n * modelTopology, weightSpecs, weightData));\n * ```\n *\n * @param modelArtifacts a object containing model topology (i.e., parsed from\n * the JSON format).\n * @param weightSpecs An array of `WeightsManifestEntry` objects describing the\n * names, shapes, types, and quantization of the weight data.\n * @param weightData A single `ArrayBuffer` containing the weight data,\n * concatenated in the order described by the weightSpecs.\n * @param trainingConfig Model training configuration. Optional.\n *\n * @returns A passthrough `IOHandler` that simply loads the provided data.\n */\nexport function fromMemory(\n modelArtifacts: {}|ModelArtifacts, weightSpecs?: WeightsManifestEntry[],\n weightData?: ArrayBuffer, trainingConfig?: TrainingConfig): IOHandler {\n if (arguments.length === 1) {\n const isModelArtifacts =\n (modelArtifacts as ModelArtifacts).modelTopology != null ||\n (modelArtifacts as ModelArtifacts).weightSpecs != null;\n if (isModelArtifacts) {\n return new PassthroughLoader(modelArtifacts as ModelArtifacts);\n } else {\n // Legacy support: with only modelTopology.\n // TODO(cais): Remove this deprecated API.\n console.warn(\n 'Please call tf.io.fromMemory() with only one argument. ' +\n 'The argument should be of type ModelArtifacts. ' +\n 'The multi-argument signature of tf.io.fromMemory() has been ' +\n 'deprecated and will be removed in a future release.');\n return new PassthroughLoader({modelTopology: modelArtifacts as {}});\n }\n } else {\n // Legacy support.\n // TODO(cais): Remove this deprecated API.\n console.warn(\n 'Please call tf.io.fromMemory() with only one argument. ' +\n 'The argument should be of type ModelArtifacts. ' +\n 'The multi-argument signature of tf.io.fromMemory() has been ' +\n 'deprecated and will be removed in a future release.');\n return new PassthroughLoader({\n modelTopology: modelArtifacts as {},\n weightSpecs,\n weightData,\n trainingConfig\n });\n }\n}\n\n/**\n * Creates an IOHandler that passes saved model artifacts to a callback.\n *\n * ```js\n * function handleSave(artifacts) {\n * // ... do something with the artifacts ...\n * return {modelArtifactsInfo: {...}, ...};\n * }\n *\n * const saveResult = model.save(tf.io.withSaveHandler(handleSave));\n * ```\n *\n * @param saveHandler A function that accepts a `ModelArtifacts` and returns a\n * `SaveResult`.\n */\nexport function withSaveHandler(\n saveHandler: (artifacts: ModelArtifacts) =>\n Promise): IOHandler {\n return new PassthroughSaver(saveHandler);\n}\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Exports under the tf.math.* namespace.\n */\n\nimport {confusionMatrix} from './ops/confusion_matrix';\n\nexport {confusionMatrix};\n", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {BatchMatMul, BatchMatMulAttrs, BatchMatMulInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the dot product of two matrices, A * B. These must be matrices.\n *\n * ```js\n * const a = tf.tensor2d([1, 2], [1, 2]);\n * const b = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * a.matMul(b).print(); // or tf.matMul(a, b)\n * ```\n * @param a First matrix in dot product operation.\n * @param b Second matrix in dot product operation.\n * @param transposeA If true, `a` is transposed before multiplication.\n * @param transposeB If true, `b` is transposed before multiplication.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction matMul_(\n a: Tensor|TensorLike, b: Tensor|TensorLike, transposeA = false,\n transposeB = false): T {\n let $a = convertToTensor(a, 'a', 'matMul');\n let $b = convertToTensor(b, 'b', 'matMul');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: BatchMatMulInputs = {a: $a, b: $b};\n const attrs: BatchMatMulAttrs = {transposeA, transposeB};\n\n return ENGINE.runKernel(\n BatchMatMul, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const matMul = op({matMul_});\n", "/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {OneHot, OneHotAttrs, OneHotInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Creates a one-hot `tf.Tensor`. The locations represented by `indices` take\n * value `onValue` (defaults to 1), while all other locations take value\n * `offValue` (defaults to 0). If `indices` is rank `R`, the output has rank\n * `R+1` with the last axis of size `depth`.\n *\n * ```js\n * tf.oneHot(tf.tensor1d([0, 1], 'int32'), 3).print();\n * ```\n *\n * @param indices `tf.Tensor` of indices with dtype `int32`.\n * @param depth The depth of the one hot dimension.\n * @param onValue A number used to fill in the output when the index matches\n * the location.\n * @param offValue A number used to fill in the output when the index does\n * not match the location.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction oneHot_(\n indices: Tensor|TensorLike, depth: number, onValue = 1,\n offValue = 0): Tensor {\n if (depth < 2) {\n throw new Error(`Error in oneHot: depth must be >=2, but it is ${depth}`);\n }\n const $indices = convertToTensor(indices, 'indices', 'oneHot', 'int32');\n\n const inputs: OneHotInputs = {indices: $indices};\n const attrs: OneHotAttrs = {depth, onValue, offValue};\n\n return ENGINE.runKernel(\n OneHot, inputs as unknown as NamedTensorMap,\n attrs as unknown as NamedAttrMap);\n}\n\nexport const oneHot = op({oneHot_});\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Transpose, TransposeAttrs, TransposeInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Transposes the `tf.Tensor`. Permutes the dimensions according to `perm`.\n *\n * The returned `tf.Tensor`'s dimension `i` will correspond to the input\n * dimension `perm[i]`. If `perm` is not given, it is set to `[n-1...0]`,\n * where `n` is the rank of the input `tf.Tensor`. Hence by default, this\n * operation performs a regular matrix transpose on 2-D input `tf.Tensor`s.\n *\n * ```js\n * const a = tf.tensor2d([1, 2, 3, 4, 5, 6], [2, 3]);\n *\n * a.transpose().print(); // or tf.transpose(a)\n * ```\n *\n * @param x The tensor to transpose.\n * @param perm The permutation of the dimensions of a.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction transpose_(x: T|TensorLike, perm?: number[]): T {\n const $x = convertToTensor(x, 'x', 'transpose');\n\n if (perm == null) {\n perm = $x.shape.map((s, i) => i).reverse();\n }\n util.assert(\n $x.rank === perm.length,\n () => `Error in transpose: rank of input ${$x.rank} ` +\n `must match length of perm ${perm}.`);\n perm.forEach(axis => {\n util.assert(\n axis >= 0 && axis < $x.rank,\n () => `All entries in 'perm' must be between 0 and ${$x.rank - 1}` +\n ` but got ${perm}`);\n });\n\n if ($x.rank <= 1) {\n return $x.clone();\n }\n\n const inputs: TransposeInputs = {x: $x};\n const attrs: TransposeAttrs = {perm};\n\n return ENGINE.runKernel(\n Transpose, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const transpose = op({transpose_});\n", "/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D, Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {cast} from './cast';\nimport {matMul} from './mat_mul';\nimport {oneHot} from './one_hot';\nimport {op} from './operation';\nimport {transpose} from './transpose';\n\n/**\n * Computes the confusion matrix from true labels and predicted labels.\n *\n * ```js\n * const labels = tf.tensor1d([0, 1, 2, 1, 0], 'int32');\n * const predictions = tf.tensor1d([0, 2, 2, 1, 0], 'int32');\n * const numClasses = 3;\n * const out = tf.math.confusionMatrix(labels, predictions, numClasses);\n * out.print();\n * // Expected output matrix:\n * // [[2, 0, 0],\n * // [0, 1, 1],\n * // [0, 0, 1]]\n * ```\n *\n * @param labels The target labels, assumed to be 0-based integers\n * for the classes. The shape is `[numExamples]`, where\n * `numExamples` is the number of examples included.\n * @param predictions The predicted classes, assumed to be\n * 0-based integers for the classes. Must have the same shape as `labels`.\n * @param numClasses Number of all classes, as an integer.\n * Its value must be larger than the largest element in `labels` and\n * `predictions`.\n * @returns The confusion matrix as a int32-type 2D tensor. The value at\n * row `r` and column `c` is the number of times examples of actual class\n * `r` were predicted as class `c`.\n *\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nexport function confusionMatrix_(\n labels: Tensor1D|TensorLike, predictions: Tensor1D|TensorLike,\n numClasses: number): Tensor2D {\n const $labels = convertToTensor(labels, 'labels', 'confusionMatrix');\n const $predictions =\n convertToTensor(predictions, 'predictions', 'confusionMatrix');\n\n util.assert(\n numClasses == null || numClasses > 0 && Number.isInteger(numClasses),\n () => `If provided, numClasses must be a positive integer, ` +\n `but got ${numClasses}`);\n util.assert(\n $labels.rank === 1,\n () => `Expected the rank of labels to be 1, but got ${$labels.rank}`);\n util.assert(\n $predictions.rank === 1,\n () => `Expected the rank of predictions to be 1, ` +\n `but got ${$predictions.rank}`);\n util.assert(\n $labels.shape[0] === $predictions.shape[0],\n () => `Mismatch in the number of examples: ` +\n `${$labels.shape[0]} vs. ${$predictions.shape[0]}. ` +\n `Labels and predictions should have the same number of elements.`);\n util.assert(\n numClasses > 0 && Number.isInteger(numClasses),\n () => `numClasses is required to be a positive integer, but got ` +\n `${numClasses}`);\n // TODO(cais): In the future, if oneHot supports tensors inputs for\n // `numClasses`, `confusionMatrix` can make `numClasses` optional.\n\n const oneHotLabels = oneHot(cast($labels, 'int32'), numClasses) as Tensor2D;\n const oneHotPredictions =\n oneHot(cast($predictions, 'int32'), numClasses) as Tensor2D;\n const oneHotLabelsT: Tensor2D = transpose(oneHotLabels);\n const product: Tensor2D = matMul(oneHotLabelsT, oneHotPredictions);\n return cast(product, 'int32');\n}\n\nexport const confusionMatrix = op({confusionMatrix_});\n", "/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {env} from '../environment';\nimport {FromPixels, FromPixelsAttrs, FromPixelsInputs} from '../kernel_names';\nimport {getKernel, NamedAttrMap} from '../kernel_registry';\nimport {Tensor, Tensor2D, Tensor3D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {PixelData, TensorLike} from '../types';\n\nimport {cast} from './cast';\nimport {op} from './operation';\nimport {tensor3d} from './tensor3d';\n\nlet fromPixels2DContext: CanvasRenderingContext2D;\n\n/**\n * Creates a `tf.Tensor` from an image.\n *\n * ```js\n * const image = new ImageData(1, 1);\n * image.data[0] = 100;\n * image.data[1] = 150;\n * image.data[2] = 200;\n * image.data[3] = 255;\n *\n * tf.browser.fromPixels(image).print();\n * ```\n *\n * @param pixels The input image to construct the tensor from. The\n * supported image types are all 4-channel. You can also pass in an image\n * object with following attributes:\n * `{data: Uint8Array; width: number; height: number}`\n * @param numChannels The number of channels of the output tensor. A\n * numChannels value less than 4 allows you to ignore channels. Defaults to\n * 3 (ignores alpha channel of input image).\n *\n * @returns A Tensor3D with the shape `[height, width, numChannels]`.\n *\n * @doc {heading: 'Browser', namespace: 'browser', ignoreCI: true}\n */\nfunction fromPixels_(\n pixels: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap,\n numChannels = 3): Tensor3D {\n // Sanity checks.\n if (numChannels > 4) {\n throw new Error(\n 'Cannot construct Tensor with more than 4 channels from pixels.');\n }\n if (pixels == null) {\n throw new Error('pixels passed to tf.browser.fromPixels() can not be null');\n }\n let isPixelData = false;\n let isImageData = false;\n let isVideo = false;\n let isImage = false;\n let isCanvasLike = false;\n let isImageBitmap = false;\n if ((pixels as PixelData).data instanceof Uint8Array) {\n isPixelData = true;\n } else if (\n typeof (ImageData) !== 'undefined' && pixels instanceof ImageData) {\n isImageData = true;\n } else if (\n typeof (HTMLVideoElement) !== 'undefined' &&\n pixels instanceof HTMLVideoElement) {\n isVideo = true;\n } else if (\n typeof (HTMLImageElement) !== 'undefined' &&\n pixels instanceof HTMLImageElement) {\n isImage = true;\n // tslint:disable-next-line: no-any\n } else if ((pixels as any).getContext != null) {\n isCanvasLike = true;\n } else if (\n typeof (ImageBitmap) !== 'undefined' && pixels instanceof ImageBitmap) {\n isImageBitmap = true;\n } else {\n throw new Error(\n 'pixels passed to tf.browser.fromPixels() must be either an ' +\n `HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData ` +\n `in browser, or OffscreenCanvas, ImageData in webworker` +\n ` or {data: Uint32Array, width: number, height: number}, ` +\n `but was ${(pixels as {}).constructor.name}`);\n }\n if (isVideo) {\n const HAVE_CURRENT_DATA_READY_STATE = 2;\n if (isVideo &&\n (pixels as HTMLVideoElement).readyState <\n HAVE_CURRENT_DATA_READY_STATE) {\n throw new Error(\n 'The video element has not loaded data yet. Please wait for ' +\n '`loadeddata` event on the